diff options
43 files changed, 984 insertions, 518 deletions
diff --git a/Documentation/devicetree/bindings/misc/at25.txt b/Documentation/devicetree/bindings/misc/at25.txt index ab3c327929dd..1d3447165c37 100644 --- a/Documentation/devicetree/bindings/misc/at25.txt +++ b/Documentation/devicetree/bindings/misc/at25.txt | |||
| @@ -1,21 +1,35 @@ | |||
| 1 | Atmel AT25 eeprom | 1 | EEPROMs (SPI) compatible with Atmel at25. |
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible : "atmel,at25". | 4 | - compatible : "atmel,at25". |
| 5 | - reg : chip select number | 5 | - reg : chip select number |
| 6 | - spi-max-frequency : max spi frequency to use | 6 | - spi-max-frequency : max spi frequency to use |
| 7 | - pagesize : size of the eeprom page | ||
| 8 | - size : total eeprom size in bytes | ||
| 9 | - address-width : number of address bits (one of 8, 16, or 24) | ||
| 7 | 10 | ||
| 11 | Optional properties: | ||
| 12 | - spi-cpha : SPI shifted clock phase, as per spi-bus bindings. | ||
| 13 | - spi-cpol : SPI inverse clock polarity, as per spi-bus bindings. | ||
| 14 | - read-only : this parameter-less property disables writes to the eeprom | ||
| 15 | |||
| 16 | Obsolete legacy properties are can be used in place of "size", "pagesize", | ||
| 17 | "address-width", and "read-only": | ||
| 8 | - at25,byte-len : total eeprom size in bytes | 18 | - at25,byte-len : total eeprom size in bytes |
| 9 | - at25,addr-mode : addr-mode flags, as defined in include/linux/spi/eeprom.h | 19 | - at25,addr-mode : addr-mode flags, as defined in include/linux/spi/eeprom.h |
| 10 | - at25,page-size : size of the eeprom page | 20 | - at25,page-size : size of the eeprom page |
| 11 | 21 | ||
| 12 | Examples: | 22 | Additional compatible properties are also allowed. |
| 13 | at25@0 { | 23 | |
| 14 | compatible = "atmel,at25"; | 24 | Example: |
| 15 | reg = <0> | 25 | at25@0 { |
| 16 | spi-max-frequency = <5000000>; | 26 | compatible = "atmel,at25", "st,m95256"; |
| 27 | reg = <0> | ||
| 28 | spi-max-frequency = <5000000>; | ||
| 29 | spi-cpha; | ||
| 30 | spi-cpol; | ||
| 17 | 31 | ||
| 18 | at25,byte-len = <0x8000>; | 32 | pagesize = <64>; |
| 19 | at25,addr-mode = <2>; | 33 | size = <32768>; |
| 20 | at25,page-size = <64>; | 34 | address-width = <16>; |
| 21 | }; | 35 | }; |
diff --git a/Documentation/devicetree/bindings/misc/lis302.txt b/Documentation/devicetree/bindings/misc/lis302.txt new file mode 100644 index 000000000000..6def86f6b053 --- /dev/null +++ b/Documentation/devicetree/bindings/misc/lis302.txt | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | LIS302 accelerometer devicetree bindings | ||
| 2 | |||
| 3 | This device is matched via its bus drivers, and has a number of properties | ||
| 4 | that apply in on the generic device (independent from the bus). | ||
| 5 | |||
| 6 | |||
| 7 | Required properties for the SPI bindings: | ||
| 8 | - compatible: should be set to "st,lis3lv02d_spi" | ||
| 9 | - reg: the chipselect index | ||
| 10 | - spi-max-frequency: maximal bus speed, should be set to 1000000 unless | ||
| 11 | constrained by external circuitry | ||
| 12 | - interrupts: the interrupt generated by the device | ||
| 13 | |||
| 14 | Required properties for the I2C bindings: | ||
| 15 | - compatible: should be set to "st,lis3lv02d" | ||
| 16 | - reg: i2c slave address | ||
| 17 | - Vdd-supply: The input supply for Vdd | ||
| 18 | - Vdd_IO-supply: The input supply for Vdd_IO | ||
| 19 | |||
| 20 | |||
| 21 | Optional properties for all bus drivers: | ||
| 22 | |||
| 23 | - st,click-single-{x,y,z}: if present, tells the device to issue an | ||
| 24 | interrupt on single click events on the | ||
| 25 | x/y/z axis. | ||
| 26 | - st,click-double-{x,y,z}: if present, tells the device to issue an | ||
| 27 | interrupt on double click events on the | ||
| 28 | x/y/z axis. | ||
| 29 | - st,click-thresh-{x,y,z}: set the x/y/z axis threshold | ||
| 30 | - st,click-click-time-limit: click time limit, from 0 to 127.5msec | ||
| 31 | with step of 0.5 msec | ||
| 32 | - st,click-latency: click latency, from 0 to 255 msec with | ||
| 33 | step of 1 msec. | ||
| 34 | - st,click-window: click window, from 0 to 255 msec with | ||
| 35 | step of 1 msec. | ||
| 36 | - st,irq{1,2}-disable: disable IRQ 1/2 | ||
| 37 | - st,irq{1,2}-ff-wu-1: raise IRQ 1/2 on FF_WU_1 condition | ||
| 38 | - st,irq{1,2}-ff-wu-2: raise IRQ 1/2 on FF_WU_2 condition | ||
| 39 | - st,irq{1,2}-data-ready: raise IRQ 1/2 on data ready contition | ||
| 40 | - st,irq{1,2}-click: raise IRQ 1/2 on click condition | ||
| 41 | - st,irq-open-drain: consider IRQ lines open-drain | ||
| 42 | - st,irq-active-low: make IRQ lines active low | ||
| 43 | - st,wu-duration-1: duration register for Free-Fall/Wake-Up | ||
| 44 | interrupt 1 | ||
| 45 | - st,wu-duration-2: duration register for Free-Fall/Wake-Up | ||
| 46 | interrupt 2 | ||
| 47 | - st,wakeup-{x,y,z}-{lo,hi}: set wakeup condition on x/y/z axis for | ||
| 48 | upper/lower limit | ||
| 49 | - st,highpass-cutoff-hz=: 1, 2, 4 or 8 for 1Hz, 2Hz, 4Hz or 8Hz of | ||
| 50 | highpass cut-off frequency | ||
| 51 | - st,hipass{1,2}-disable: disable highpass 1/2. | ||
| 52 | - st,default-rate=: set the default rate | ||
| 53 | - st,axis-{x,y,z}=: set the axis to map to the three coordinates | ||
| 54 | - st,{min,max}-limit-{x,y,z} set the min/max limits for x/y/z axis | ||
| 55 | (used by self-test) | ||
| 56 | |||
| 57 | |||
| 58 | Example for a SPI device node: | ||
| 59 | |||
| 60 | lis302@0 { | ||
| 61 | compatible = "st,lis302dl-spi"; | ||
| 62 | reg = <0>; | ||
| 63 | spi-max-frequency = <1000000>; | ||
| 64 | interrupt-parent = <&gpio>; | ||
| 65 | interrupts = <104 0>; | ||
| 66 | |||
| 67 | st,click-single-x; | ||
| 68 | st,click-single-y; | ||
| 69 | st,click-single-z; | ||
| 70 | st,click-thresh-x = <10>; | ||
| 71 | st,click-thresh-y = <10>; | ||
| 72 | st,click-thresh-z = <10>; | ||
| 73 | st,irq1-click; | ||
| 74 | st,irq2-click; | ||
| 75 | st,wakeup-x-lo; | ||
| 76 | st,wakeup-x-hi; | ||
| 77 | st,wakeup-y-lo; | ||
| 78 | st,wakeup-y-hi; | ||
| 79 | st,wakeup-z-lo; | ||
| 80 | st,wakeup-z-hi; | ||
| 81 | }; | ||
| 82 | |||
| 83 | Example for a I2C device node: | ||
| 84 | |||
| 85 | lis331dlh: lis331dlh@18 { | ||
| 86 | compatible = "st,lis331dlh", "st,lis3lv02d"; | ||
| 87 | reg = <0x18>; | ||
| 88 | Vdd-supply = <&lis3_reg>; | ||
| 89 | Vdd_IO-supply = <&lis3_reg>; | ||
| 90 | |||
| 91 | st,click-single-x; | ||
| 92 | st,click-single-y; | ||
| 93 | st,click-single-z; | ||
| 94 | st,click-thresh-x = <10>; | ||
| 95 | st,click-thresh-y = <10>; | ||
| 96 | st,click-thresh-z = <10>; | ||
| 97 | st,irq1-click; | ||
| 98 | st,irq2-click; | ||
| 99 | st,wakeup-x-lo; | ||
| 100 | st,wakeup-x-hi; | ||
| 101 | st,wakeup-y-lo; | ||
| 102 | st,wakeup-y-hi; | ||
| 103 | st,wakeup-z-lo; | ||
| 104 | st,wakeup-z-hi; | ||
| 105 | st,min-limit-x = <120>; | ||
| 106 | st,min-limit-y = <120>; | ||
| 107 | st,min-limit-z = <140>; | ||
| 108 | st,max-limit-x = <550>; | ||
| 109 | st,max-limit-y = <550>; | ||
| 110 | st,max-limit-z = <750>; | ||
| 111 | }; | ||
| 112 | |||
diff --git a/Documentation/devicetree/bindings/w1/w1-gpio.txt b/Documentation/devicetree/bindings/w1/w1-gpio.txt new file mode 100644 index 000000000000..6e09c35d9f1a --- /dev/null +++ b/Documentation/devicetree/bindings/w1/w1-gpio.txt | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | w1-gpio devicetree bindings | ||
| 2 | |||
| 3 | Required properties: | ||
| 4 | |||
| 5 | - compatible: "w1-gpio" | ||
| 6 | - gpios: one or two GPIO specs: | ||
| 7 | - the first one is used as data I/O pin | ||
| 8 | - the second one is optional. If specified, it is used as | ||
| 9 | enable pin for an external pin pullup. | ||
| 10 | |||
| 11 | Optional properties: | ||
| 12 | |||
| 13 | - linux,open-drain: if specified, the data pin is considered in | ||
| 14 | open-drain mode. | ||
| 15 | |||
| 16 | Examples: | ||
| 17 | |||
| 18 | onewire@0 { | ||
| 19 | compatible = "w1-gpio"; | ||
| 20 | gpios = <&gpio 126 0>, <&gpio 105 0>; | ||
| 21 | }; | ||
| 22 | |||
diff --git a/Documentation/misc-devices/lis3lv02d b/Documentation/misc-devices/lis3lv02d index f1a4ec840f86..af815b9ba413 100644 --- a/Documentation/misc-devices/lis3lv02d +++ b/Documentation/misc-devices/lis3lv02d | |||
| @@ -4,7 +4,8 @@ Kernel driver lis3lv02d | |||
| 4 | Supported chips: | 4 | Supported chips: |
| 5 | 5 | ||
| 6 | * STMicroelectronics LIS3LV02DL, LIS3LV02DQ (12 bits precision) | 6 | * STMicroelectronics LIS3LV02DL, LIS3LV02DQ (12 bits precision) |
| 7 | * STMicroelectronics LIS302DL, LIS3L02DQ, LIS331DL (8 bits) | 7 | * STMicroelectronics LIS302DL, LIS3L02DQ, LIS331DL (8 bits) and |
| 8 | LIS331DLH (16 bits) | ||
| 8 | 9 | ||
| 9 | Authors: | 10 | Authors: |
| 10 | Yan Burman <burman.yan@gmail.com> | 11 | Yan Burman <burman.yan@gmail.com> |
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index ea6f6325f9ba..72bedad6bf8c 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
| @@ -418,8 +418,8 @@ config APPLICOM | |||
| 418 | If unsure, say N. | 418 | If unsure, say N. |
| 419 | 419 | ||
| 420 | config SONYPI | 420 | config SONYPI |
| 421 | tristate "Sony Vaio Programmable I/O Control Device support (EXPERIMENTAL)" | 421 | tristate "Sony Vaio Programmable I/O Control Device support" |
| 422 | depends on EXPERIMENTAL && X86 && PCI && INPUT && !64BIT | 422 | depends on X86 && PCI && INPUT && !64BIT |
| 423 | ---help--- | 423 | ---help--- |
| 424 | This driver enables access to the Sony Programmable I/O Control | 424 | This driver enables access to the Sony Programmable I/O Control |
| 425 | Device which can be found in many (all ?) Sony Vaio laptops. | 425 | Device which can be found in many (all ?) Sony Vaio laptops. |
| @@ -566,7 +566,7 @@ source "drivers/char/tpm/Kconfig" | |||
| 566 | 566 | ||
| 567 | config TELCLOCK | 567 | config TELCLOCK |
| 568 | tristate "Telecom clock driver for ATCA SBC" | 568 | tristate "Telecom clock driver for ATCA SBC" |
| 569 | depends on EXPERIMENTAL && X86 | 569 | depends on X86 |
| 570 | default n | 570 | default n |
| 571 | help | 571 | help |
| 572 | The telecom clock device is specific to the MPCBL0010 and MPCBL0050 | 572 | The telecom clock device is specific to the MPCBL0010 and MPCBL0050 |
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index 33dc2298af73..3d6c0671e996 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
| @@ -826,7 +826,7 @@ static int __init mmtimer_init(void) | |||
| 826 | 826 | ||
| 827 | /* Allocate list of node ptrs to mmtimer_t's */ | 827 | /* Allocate list of node ptrs to mmtimer_t's */ |
| 828 | timers = kzalloc(sizeof(struct mmtimer_node)*maxn, GFP_KERNEL); | 828 | timers = kzalloc(sizeof(struct mmtimer_node)*maxn, GFP_KERNEL); |
| 829 | if (timers == NULL) { | 829 | if (!timers) { |
| 830 | printk(KERN_ERR "%s: failed to allocate memory for device\n", | 830 | printk(KERN_ERR "%s: failed to allocate memory for device\n", |
| 831 | MMTIMER_NAME); | 831 | MMTIMER_NAME); |
| 832 | goto out3; | 832 | goto out3; |
| @@ -848,7 +848,6 @@ static int __init mmtimer_init(void) | |||
| 848 | return 0; | 848 | return 0; |
| 849 | 849 | ||
| 850 | out3: | 850 | out3: |
| 851 | kfree(timers); | ||
| 852 | misc_deregister(&mmtimer_miscdev); | 851 | misc_deregister(&mmtimer_miscdev); |
| 853 | out2: | 852 | out2: |
| 854 | free_irq(SGI_MMTIMER_VECTOR, NULL); | 853 | free_irq(SGI_MMTIMER_VECTOR, NULL); |
diff --git a/drivers/char/nwbutton.c b/drivers/char/nwbutton.c index 04a480f86c6c..cfdfe493c6af 100644 --- a/drivers/char/nwbutton.c +++ b/drivers/char/nwbutton.c | |||
| @@ -93,9 +93,9 @@ int button_del_callback (void (*callback) (void)) | |||
| 93 | button_callback_list [lp].count = 0; | 93 | button_callback_list [lp].count = 0; |
| 94 | callback_count--; | 94 | callback_count--; |
| 95 | return 0; | 95 | return 0; |
| 96 | }; | 96 | } |
| 97 | lp--; | 97 | lp--; |
| 98 | }; | 98 | } |
| 99 | return -EINVAL; | 99 | return -EINVAL; |
| 100 | } | 100 | } |
| 101 | 101 | ||
diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index 0a484b4a1b02..a6b8ddea2227 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c | |||
| @@ -891,6 +891,14 @@ static void rx_ready_async(MGSLPC_INFO *info, int tcd, struct tty_struct *tty) | |||
| 891 | int work = 0; | 891 | int work = 0; |
| 892 | struct mgsl_icount *icount = &info->icount; | 892 | struct mgsl_icount *icount = &info->icount; |
| 893 | 893 | ||
| 894 | if (!tty) { | ||
| 895 | /* tty is not available anymore */ | ||
| 896 | issue_command(info, CHA, CMD_RXRESET); | ||
| 897 | if (debug_level >= DEBUG_LEVEL_ISR) | ||
| 898 | printk("%s(%d):rx_ready_async(tty=NULL)\n",__FILE__,__LINE__); | ||
| 899 | return; | ||
| 900 | } | ||
| 901 | |||
| 894 | if (tcd) { | 902 | if (tcd) { |
| 895 | /* early termination, get FIFO count from RBCL register */ | 903 | /* early termination, get FIFO count from RBCL register */ |
| 896 | fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f); | 904 | fifo_count = (unsigned char)(read_reg(info, CHA+RBCL) & 0x1f); |
| @@ -980,7 +988,7 @@ static void tx_done(MGSLPC_INFO *info, struct tty_struct *tty) | |||
| 980 | else | 988 | else |
| 981 | #endif | 989 | #endif |
| 982 | { | 990 | { |
| 983 | if (tty->stopped || tty->hw_stopped) { | 991 | if (tty && (tty->stopped || tty->hw_stopped)) { |
| 984 | tx_stop(info); | 992 | tx_stop(info); |
| 985 | return; | 993 | return; |
| 986 | } | 994 | } |
| @@ -1000,7 +1008,7 @@ static void tx_ready(MGSLPC_INFO *info, struct tty_struct *tty) | |||
| 1000 | if (!info->tx_active) | 1008 | if (!info->tx_active) |
| 1001 | return; | 1009 | return; |
| 1002 | } else { | 1010 | } else { |
| 1003 | if (tty->stopped || tty->hw_stopped) { | 1011 | if (tty && (tty->stopped || tty->hw_stopped)) { |
| 1004 | tx_stop(info); | 1012 | tx_stop(info); |
| 1005 | return; | 1013 | return; |
| 1006 | } | 1014 | } |
| @@ -1050,13 +1058,12 @@ static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty) | |||
| 1050 | wake_up_interruptible(&info->status_event_wait_q); | 1058 | wake_up_interruptible(&info->status_event_wait_q); |
| 1051 | wake_up_interruptible(&info->event_wait_q); | 1059 | wake_up_interruptible(&info->event_wait_q); |
| 1052 | 1060 | ||
| 1053 | if (info->port.flags & ASYNC_CTS_FLOW) { | 1061 | if (tty && (info->port.flags & ASYNC_CTS_FLOW)) { |
| 1054 | if (tty->hw_stopped) { | 1062 | if (tty->hw_stopped) { |
| 1055 | if (info->serial_signals & SerialSignal_CTS) { | 1063 | if (info->serial_signals & SerialSignal_CTS) { |
| 1056 | if (debug_level >= DEBUG_LEVEL_ISR) | 1064 | if (debug_level >= DEBUG_LEVEL_ISR) |
| 1057 | printk("CTS tx start..."); | 1065 | printk("CTS tx start..."); |
| 1058 | if (tty) | 1066 | tty->hw_stopped = 0; |
| 1059 | tty->hw_stopped = 0; | ||
| 1060 | tx_start(info, tty); | 1067 | tx_start(info, tty); |
| 1061 | info->pending_bh |= BH_TRANSMIT; | 1068 | info->pending_bh |= BH_TRANSMIT; |
| 1062 | return; | 1069 | return; |
| @@ -1065,8 +1072,7 @@ static void cts_change(MGSLPC_INFO *info, struct tty_struct *tty) | |||
| 1065 | if (!(info->serial_signals & SerialSignal_CTS)) { | 1072 | if (!(info->serial_signals & SerialSignal_CTS)) { |
| 1066 | if (debug_level >= DEBUG_LEVEL_ISR) | 1073 | if (debug_level >= DEBUG_LEVEL_ISR) |
| 1067 | printk("CTS tx stop..."); | 1074 | printk("CTS tx stop..."); |
| 1068 | if (tty) | 1075 | tty->hw_stopped = 1; |
| 1069 | tty->hw_stopped = 1; | ||
| 1070 | tx_stop(info); | 1076 | tx_stop(info); |
| 1071 | } | 1077 | } |
| 1072 | } | 1078 | } |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 3fcf80ff12f2..d0d824ebf2c1 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
| @@ -783,7 +783,8 @@ static int __init ppdev_init (void) | |||
| 783 | err = PTR_ERR(ppdev_class); | 783 | err = PTR_ERR(ppdev_class); |
| 784 | goto out_chrdev; | 784 | goto out_chrdev; |
| 785 | } | 785 | } |
| 786 | if (parport_register_driver(&pp_driver)) { | 786 | err = parport_register_driver(&pp_driver); |
| 787 | if (err < 0) { | ||
| 787 | printk (KERN_WARNING CHRDEV ": unable to register with parport\n"); | 788 | printk (KERN_WARNING CHRDEV ": unable to register with parport\n"); |
| 788 | goto out_class; | 789 | goto out_class; |
| 789 | } | 790 | } |
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c index af9437488b6c..91470fdbab2a 100644 --- a/drivers/char/rtc.c +++ b/drivers/char/rtc.c | |||
| @@ -411,7 +411,7 @@ static int rtc_do_ioctl(unsigned int cmd, unsigned long arg, int kernel) | |||
| 411 | case RTC_IRQP_READ: | 411 | case RTC_IRQP_READ: |
| 412 | case RTC_IRQP_SET: | 412 | case RTC_IRQP_SET: |
| 413 | return -EINVAL; | 413 | return -EINVAL; |
| 414 | }; | 414 | } |
| 415 | } | 415 | } |
| 416 | #endif | 416 | #endif |
| 417 | 417 | ||
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index ce29e7cce528..e95e0ab0bd87 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
| @@ -784,8 +784,10 @@ static int __init tlclk_init(void) | |||
| 784 | } | 784 | } |
| 785 | tlclk_major = ret; | 785 | tlclk_major = ret; |
| 786 | alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL); | 786 | alarm_events = kzalloc( sizeof(struct tlclk_alarms), GFP_KERNEL); |
| 787 | if (!alarm_events) | 787 | if (!alarm_events) { |
| 788 | ret = -ENOMEM; | ||
| 788 | goto out1; | 789 | goto out1; |
| 790 | } | ||
| 789 | 791 | ||
| 790 | /* Read telecom clock IRQ number (Set by BIOS) */ | 792 | /* Read telecom clock IRQ number (Set by BIOS) */ |
| 791 | if (!request_region(TLCLK_BASE, 8, "telco_clock")) { | 793 | if (!request_region(TLCLK_BASE, 8, "telco_clock")) { |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index cdf2f5451c76..060a672ebb7b 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
| @@ -1941,7 +1941,17 @@ static int __init init(void) | |||
| 1941 | INIT_LIST_HEAD(&pdrvdata.consoles); | 1941 | INIT_LIST_HEAD(&pdrvdata.consoles); |
| 1942 | INIT_LIST_HEAD(&pdrvdata.portdevs); | 1942 | INIT_LIST_HEAD(&pdrvdata.portdevs); |
| 1943 | 1943 | ||
| 1944 | return register_virtio_driver(&virtio_console); | 1944 | err = register_virtio_driver(&virtio_console); |
| 1945 | if (err < 0) { | ||
| 1946 | pr_err("Error %d registering virtio driver\n", err); | ||
| 1947 | goto free; | ||
| 1948 | } | ||
| 1949 | return 0; | ||
| 1950 | free: | ||
| 1951 | if (pdrvdata.debugfs_dir) | ||
| 1952 | debugfs_remove_recursive(pdrvdata.debugfs_dir); | ||
| 1953 | class_destroy(pdrvdata.class); | ||
| 1954 | return err; | ||
| 1945 | } | 1955 | } |
| 1946 | 1956 | ||
| 1947 | static void __exit fini(void) | 1957 | static void __exit fini(void) |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 98a442da892a..99c73352c430 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
| @@ -105,7 +105,7 @@ config ATMEL_TCB_CLKSRC_BLOCK | |||
| 105 | 105 | ||
| 106 | config IBM_ASM | 106 | config IBM_ASM |
| 107 | tristate "Device driver for IBM RSA service processor" | 107 | tristate "Device driver for IBM RSA service processor" |
| 108 | depends on X86 && PCI && INPUT && EXPERIMENTAL | 108 | depends on X86 && PCI && INPUT |
| 109 | ---help--- | 109 | ---help--- |
| 110 | This option enables device driver support for in-band access to the | 110 | This option enables device driver support for in-band access to the |
| 111 | IBM RSA (Condor) service processor in eServer xSeries systems. | 111 | IBM RSA (Condor) service processor in eServer xSeries systems. |
| @@ -162,8 +162,8 @@ config SGI_IOC4 | |||
| 162 | Otherwise say N. | 162 | Otherwise say N. |
| 163 | 163 | ||
| 164 | config TIFM_CORE | 164 | config TIFM_CORE |
| 165 | tristate "TI Flash Media interface support (EXPERIMENTAL)" | 165 | tristate "TI Flash Media interface support" |
| 166 | depends on EXPERIMENTAL && PCI | 166 | depends on PCI |
| 167 | help | 167 | help |
| 168 | If you want support for Texas Instruments(R) Flash Media adapters | 168 | If you want support for Texas Instruments(R) Flash Media adapters |
| 169 | you should select this option and then also choose an appropriate | 169 | you should select this option and then also choose an appropriate |
| @@ -178,8 +178,8 @@ config TIFM_CORE | |||
| 178 | be called tifm_core. | 178 | be called tifm_core. |
| 179 | 179 | ||
| 180 | config TIFM_7XX1 | 180 | config TIFM_7XX1 |
| 181 | tristate "TI Flash Media PCI74xx/PCI76xx host adapter support (EXPERIMENTAL)" | 181 | tristate "TI Flash Media PCI74xx/PCI76xx host adapter support" |
| 182 | depends on PCI && TIFM_CORE && EXPERIMENTAL | 182 | depends on PCI && TIFM_CORE |
| 183 | default TIFM_CORE | 183 | default TIFM_CORE |
| 184 | help | 184 | help |
| 185 | This option enables support for Texas Instruments(R) PCI74xx and | 185 | This option enables support for Texas Instruments(R) PCI74xx and |
| @@ -192,7 +192,7 @@ config TIFM_7XX1 | |||
| 192 | 192 | ||
| 193 | config ICS932S401 | 193 | config ICS932S401 |
| 194 | tristate "Integrated Circuits ICS932S401" | 194 | tristate "Integrated Circuits ICS932S401" |
| 195 | depends on I2C && EXPERIMENTAL | 195 | depends on I2C |
| 196 | help | 196 | help |
| 197 | If you say yes here you get support for the Integrated Circuits | 197 | If you say yes here you get support for the Integrated Circuits |
| 198 | ICS932S401 clock control chips. | 198 | ICS932S401 clock control chips. |
| @@ -398,7 +398,7 @@ config EP93XX_PWM | |||
| 398 | 398 | ||
| 399 | config DS1682 | 399 | config DS1682 |
| 400 | tristate "Dallas DS1682 Total Elapsed Time Recorder with Alarm" | 400 | tristate "Dallas DS1682 Total Elapsed Time Recorder with Alarm" |
| 401 | depends on I2C && EXPERIMENTAL | 401 | depends on I2C |
| 402 | help | 402 | help |
| 403 | If you say yes here you get support for Dallas Semiconductor | 403 | If you say yes here you get support for Dallas Semiconductor |
| 404 | DS1682 Total Elapsed Time Recorder. | 404 | DS1682 Total Elapsed Time Recorder. |
diff --git a/drivers/misc/bmp085-i2c.c b/drivers/misc/bmp085-i2c.c index 9943971c13e3..a4f33c995ea1 100644 --- a/drivers/misc/bmp085-i2c.c +++ b/drivers/misc/bmp085-i2c.c | |||
| @@ -57,12 +57,6 @@ static int bmp085_i2c_remove(struct i2c_client *client) | |||
| 57 | return bmp085_remove(&client->dev); | 57 | return bmp085_remove(&client->dev); |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | static const struct of_device_id bmp085_of_match[] = { | ||
| 61 | { .compatible = "bosch,bmp085", }, | ||
| 62 | { }, | ||
| 63 | }; | ||
| 64 | MODULE_DEVICE_TABLE(of, bmp085_of_match); | ||
| 65 | |||
| 66 | static const struct i2c_device_id bmp085_id[] = { | 60 | static const struct i2c_device_id bmp085_id[] = { |
| 67 | { BMP085_NAME, 0 }, | 61 | { BMP085_NAME, 0 }, |
| 68 | { "bmp180", 0 }, | 62 | { "bmp180", 0 }, |
| @@ -74,7 +68,6 @@ static struct i2c_driver bmp085_i2c_driver = { | |||
| 74 | .driver = { | 68 | .driver = { |
| 75 | .owner = THIS_MODULE, | 69 | .owner = THIS_MODULE, |
| 76 | .name = BMP085_NAME, | 70 | .name = BMP085_NAME, |
| 77 | .of_match_table = bmp085_of_match | ||
| 78 | }, | 71 | }, |
| 79 | .id_table = bmp085_id, | 72 | .id_table = bmp085_id, |
| 80 | .probe = bmp085_i2c_probe, | 73 | .probe = bmp085_i2c_probe, |
diff --git a/drivers/misc/bmp085-spi.c b/drivers/misc/bmp085-spi.c index 78aaff9b5231..5e982af99730 100644 --- a/drivers/misc/bmp085-spi.c +++ b/drivers/misc/bmp085-spi.c | |||
| @@ -73,19 +73,8 @@ static struct spi_driver bmp085_spi_driver = { | |||
| 73 | .remove = __devexit_p(bmp085_spi_remove) | 73 | .remove = __devexit_p(bmp085_spi_remove) |
| 74 | }; | 74 | }; |
| 75 | 75 | ||
| 76 | static int __init bmp085_spi_init(void) | 76 | module_spi_driver(bmp085_spi_driver); |
| 77 | { | ||
| 78 | return spi_register_driver(&bmp085_spi_driver); | ||
| 79 | } | ||
| 80 | |||
| 81 | static void __exit bmp085_spi_exit(void) | ||
| 82 | { | ||
| 83 | spi_unregister_driver(&bmp085_spi_driver); | ||
| 84 | } | ||
| 85 | 77 | ||
| 86 | MODULE_AUTHOR("Eric Andersson <eric.andersson@unixphere.com>"); | 78 | MODULE_AUTHOR("Eric Andersson <eric.andersson@unixphere.com>"); |
| 87 | MODULE_DESCRIPTION("BMP085 SPI bus driver"); | 79 | MODULE_DESCRIPTION("BMP085 SPI bus driver"); |
| 88 | MODULE_LICENSE("GPL"); | 80 | MODULE_LICENSE("GPL"); |
| 89 | |||
| 90 | module_init(bmp085_spi_init); | ||
| 91 | module_exit(bmp085_spi_exit); | ||
diff --git a/drivers/misc/c2port/Kconfig b/drivers/misc/c2port/Kconfig index 33ee834e1b83..0dd690e61d3c 100644 --- a/drivers/misc/c2port/Kconfig +++ b/drivers/misc/c2port/Kconfig | |||
| @@ -3,8 +3,7 @@ | |||
| 3 | # | 3 | # |
| 4 | 4 | ||
| 5 | menuconfig C2PORT | 5 | menuconfig C2PORT |
| 6 | tristate "Silicon Labs C2 port support (EXPERIMENTAL)" | 6 | tristate "Silicon Labs C2 port support" |
| 7 | depends on EXPERIMENTAL | ||
| 8 | default n | 7 | default n |
| 9 | help | 8 | help |
| 10 | This option enables support for Silicon Labs C2 port used to | 9 | This option enables support for Silicon Labs C2 port used to |
| @@ -22,7 +21,7 @@ menuconfig C2PORT | |||
| 22 | if C2PORT | 21 | if C2PORT |
| 23 | 22 | ||
| 24 | config C2PORT_DURAMAR_2150 | 23 | config C2PORT_DURAMAR_2150 |
| 25 | tristate "C2 port support for Eurotech's Duramar 2150 (EXPERIMENTAL)" | 24 | tristate "C2 port support for Eurotech's Duramar 2150" |
| 26 | depends on X86 | 25 | depends on X86 |
| 27 | default n | 26 | default n |
| 28 | help | 27 | help |
diff --git a/drivers/misc/carma/carma-fpga-program.c b/drivers/misc/carma/carma-fpga-program.c index a2d25e4857e3..eaddfe9db149 100644 --- a/drivers/misc/carma/carma-fpga-program.c +++ b/drivers/misc/carma/carma-fpga-program.c | |||
| @@ -978,7 +978,6 @@ static int fpga_of_probe(struct platform_device *op) | |||
| 978 | dev_set_drvdata(priv->dev, priv); | 978 | dev_set_drvdata(priv->dev, priv); |
| 979 | dma_cap_zero(mask); | 979 | dma_cap_zero(mask); |
| 980 | dma_cap_set(DMA_MEMCPY, mask); | 980 | dma_cap_set(DMA_MEMCPY, mask); |
| 981 | dma_cap_set(DMA_INTERRUPT, mask); | ||
| 982 | dma_cap_set(DMA_SLAVE, mask); | 981 | dma_cap_set(DMA_SLAVE, mask); |
| 983 | dma_cap_set(DMA_SG, mask); | 982 | dma_cap_set(DMA_SG, mask); |
| 984 | 983 | ||
diff --git a/drivers/misc/carma/carma-fpga.c b/drivers/misc/carma/carma-fpga.c index 8c279da07410..0c43297ed9ac 100644 --- a/drivers/misc/carma/carma-fpga.c +++ b/drivers/misc/carma/carma-fpga.c | |||
| @@ -666,7 +666,7 @@ static int data_submit_dma(struct fpga_device *priv, struct data_buf *buf) | |||
| 666 | src = SYS_FPGA_BLOCK; | 666 | src = SYS_FPGA_BLOCK; |
| 667 | tx = chan->device->device_prep_dma_memcpy(chan, dst, src, | 667 | tx = chan->device->device_prep_dma_memcpy(chan, dst, src, |
| 668 | REG_BLOCK_SIZE, | 668 | REG_BLOCK_SIZE, |
| 669 | DMA_PREP_INTERRUPT); | 669 | 0); |
| 670 | if (!tx) { | 670 | if (!tx) { |
| 671 | dev_err(priv->dev, "unable to prep SYS-FPGA DMA\n"); | 671 | dev_err(priv->dev, "unable to prep SYS-FPGA DMA\n"); |
| 672 | return -ENOMEM; | 672 | return -ENOMEM; |
diff --git a/drivers/misc/eeprom/Kconfig b/drivers/misc/eeprom/Kconfig index 701edf658970..c9e695ea7c9a 100644 --- a/drivers/misc/eeprom/Kconfig +++ b/drivers/misc/eeprom/Kconfig | |||
| @@ -50,7 +50,7 @@ config EEPROM_LEGACY | |||
| 50 | 50 | ||
| 51 | config EEPROM_MAX6875 | 51 | config EEPROM_MAX6875 |
| 52 | tristate "Maxim MAX6874/5 power supply supervisor" | 52 | tristate "Maxim MAX6874/5 power supply supervisor" |
| 53 | depends on I2C && EXPERIMENTAL | 53 | depends on I2C |
| 54 | help | 54 | help |
| 55 | If you say yes here you get read-only support for the user EEPROM of | 55 | If you say yes here you get read-only support for the user EEPROM of |
| 56 | the Maxim MAX6874/5 EEPROM-programmable, quad power-supply | 56 | the Maxim MAX6874/5 EEPROM-programmable, quad power-supply |
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index 25003d6ceb56..4ed93dd54116 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c | |||
| @@ -302,6 +302,61 @@ static ssize_t at25_mem_write(struct memory_accessor *mem, const char *buf, | |||
| 302 | 302 | ||
| 303 | /*-------------------------------------------------------------------------*/ | 303 | /*-------------------------------------------------------------------------*/ |
| 304 | 304 | ||
| 305 | static int at25_np_to_chip(struct device *dev, | ||
| 306 | struct device_node *np, | ||
| 307 | struct spi_eeprom *chip) | ||
| 308 | { | ||
| 309 | u32 val; | ||
| 310 | |||
| 311 | memset(chip, 0, sizeof(*chip)); | ||
| 312 | strncpy(chip->name, np->name, sizeof(chip->name)); | ||
| 313 | |||
| 314 | if (of_property_read_u32(np, "size", &val) == 0 || | ||
| 315 | of_property_read_u32(np, "at25,byte-len", &val) == 0) { | ||
| 316 | chip->byte_len = val; | ||
| 317 | } else { | ||
| 318 | dev_err(dev, "Error: missing \"size\" property\n"); | ||
| 319 | return -ENODEV; | ||
| 320 | } | ||
| 321 | |||
| 322 | if (of_property_read_u32(np, "pagesize", &val) == 0 || | ||
| 323 | of_property_read_u32(np, "at25,page-size", &val) == 0) { | ||
| 324 | chip->page_size = (u16)val; | ||
| 325 | } else { | ||
| 326 | dev_err(dev, "Error: missing \"pagesize\" property\n"); | ||
| 327 | return -ENODEV; | ||
| 328 | } | ||
| 329 | |||
| 330 | if (of_property_read_u32(np, "at25,addr-mode", &val) == 0) { | ||
| 331 | chip->flags = (u16)val; | ||
| 332 | } else { | ||
| 333 | if (of_property_read_u32(np, "address-width", &val)) { | ||
| 334 | dev_err(dev, | ||
| 335 | "Error: missing \"address-width\" property\n"); | ||
| 336 | return -ENODEV; | ||
| 337 | } | ||
| 338 | switch (val) { | ||
| 339 | case 8: | ||
| 340 | chip->flags |= EE_ADDR1; | ||
| 341 | break; | ||
| 342 | case 16: | ||
| 343 | chip->flags |= EE_ADDR2; | ||
| 344 | break; | ||
| 345 | case 24: | ||
| 346 | chip->flags |= EE_ADDR3; | ||
| 347 | break; | ||
| 348 | default: | ||
| 349 | dev_err(dev, | ||
| 350 | "Error: bad \"address-width\" property: %u\n", | ||
| 351 | val); | ||
| 352 | return -ENODEV; | ||
| 353 | } | ||
| 354 | if (of_find_property(np, "read-only", NULL)) | ||
| 355 | chip->flags |= EE_READONLY; | ||
| 356 | } | ||
| 357 | return 0; | ||
| 358 | } | ||
| 359 | |||
| 305 | static int at25_probe(struct spi_device *spi) | 360 | static int at25_probe(struct spi_device *spi) |
| 306 | { | 361 | { |
| 307 | struct at25_data *at25 = NULL; | 362 | struct at25_data *at25 = NULL; |
| @@ -314,33 +369,11 @@ static int at25_probe(struct spi_device *spi) | |||
| 314 | /* Chip description */ | 369 | /* Chip description */ |
| 315 | if (!spi->dev.platform_data) { | 370 | if (!spi->dev.platform_data) { |
| 316 | if (np) { | 371 | if (np) { |
| 317 | u32 val; | 372 | err = at25_np_to_chip(&spi->dev, np, &chip); |
| 318 | 373 | if (err) | |
| 319 | memset(&chip, 0, sizeof(chip)); | ||
| 320 | strncpy(chip.name, np->name, 10); | ||
| 321 | |||
| 322 | err = of_property_read_u32(np, "at25,byte-len", &val); | ||
| 323 | if (err) { | ||
| 324 | dev_dbg(&spi->dev, "invalid chip dt description\n"); | ||
| 325 | goto fail; | ||
| 326 | } | ||
| 327 | chip.byte_len = val; | ||
| 328 | |||
| 329 | err = of_property_read_u32(np, "at25,addr-mode", &val); | ||
| 330 | if (err) { | ||
| 331 | dev_dbg(&spi->dev, "invalid chip dt description\n"); | ||
| 332 | goto fail; | ||
| 333 | } | ||
| 334 | chip.flags = (u16)val; | ||
| 335 | |||
| 336 | err = of_property_read_u32(np, "at25,page-size", &val); | ||
| 337 | if (err) { | ||
| 338 | dev_dbg(&spi->dev, "invalid chip dt description\n"); | ||
| 339 | goto fail; | 374 | goto fail; |
| 340 | } | ||
| 341 | chip.page_size = (u16)val; | ||
| 342 | } else { | 375 | } else { |
| 343 | dev_dbg(&spi->dev, "no chip description\n"); | 376 | dev_err(&spi->dev, "Error: no chip description\n"); |
| 344 | err = -ENODEV; | 377 | err = -ENODEV; |
| 345 | goto fail; | 378 | goto fail; |
| 346 | } | 379 | } |
diff --git a/drivers/misc/hpilo.c b/drivers/misc/hpilo.c index 6df0da4085e3..12ccdf94e4fa 100644 --- a/drivers/misc/hpilo.c +++ b/drivers/misc/hpilo.c | |||
| @@ -736,7 +736,14 @@ static void ilo_remove(struct pci_dev *pdev) | |||
| 736 | free_irq(pdev->irq, ilo_hw); | 736 | free_irq(pdev->irq, ilo_hw); |
| 737 | ilo_unmap_device(pdev, ilo_hw); | 737 | ilo_unmap_device(pdev, ilo_hw); |
| 738 | pci_release_regions(pdev); | 738 | pci_release_regions(pdev); |
| 739 | pci_disable_device(pdev); | 739 | /* |
| 740 | * pci_disable_device(pdev) used to be here. But this PCI device has | ||
| 741 | * two functions with interrupt lines connected to a single pin. The | ||
| 742 | * other one is a USB host controller. So when we disable the PIN here | ||
| 743 | * e.g. by rmmod hpilo, the controller stops working. It is because | ||
| 744 | * the interrupt link is disabled in ACPI since it is not refcounted | ||
| 745 | * yet. See acpi_pci_link_free_irq called from acpi_pci_irq_disable. | ||
| 746 | */ | ||
| 740 | kfree(ilo_hw); | 747 | kfree(ilo_hw); |
| 741 | ilo_hwdev[(minor / max_ccb)] = 0; | 748 | ilo_hwdev[(minor / max_ccb)] = 0; |
| 742 | } | 749 | } |
| @@ -826,7 +833,7 @@ unmap: | |||
| 826 | free_regions: | 833 | free_regions: |
| 827 | pci_release_regions(pdev); | 834 | pci_release_regions(pdev); |
| 828 | disable: | 835 | disable: |
| 829 | pci_disable_device(pdev); | 836 | /* pci_disable_device(pdev); see comment in ilo_remove */ |
| 830 | free: | 837 | free: |
| 831 | kfree(ilo_hw); | 838 | kfree(ilo_hw); |
| 832 | out: | 839 | out: |
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c index a981e2a42f92..4a87e5c0a320 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d.c +++ b/drivers/misc/lis3lv02d/lis3lv02d.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/miscdevice.h> | 39 | #include <linux/miscdevice.h> |
| 40 | #include <linux/pm_runtime.h> | 40 | #include <linux/pm_runtime.h> |
| 41 | #include <linux/atomic.h> | 41 | #include <linux/atomic.h> |
| 42 | #include <linux/of_device.h> | ||
| 42 | #include "lis3lv02d.h" | 43 | #include "lis3lv02d.h" |
| 43 | 44 | ||
| 44 | #define DRIVER_NAME "lis3lv02d" | 45 | #define DRIVER_NAME "lis3lv02d" |
| @@ -80,6 +81,15 @@ | |||
| 80 | #define LIS3_SENSITIVITY_12B ((LIS3_ACCURACY * 1000) / 1024) | 81 | #define LIS3_SENSITIVITY_12B ((LIS3_ACCURACY * 1000) / 1024) |
| 81 | #define LIS3_SENSITIVITY_8B (18 * LIS3_ACCURACY) | 82 | #define LIS3_SENSITIVITY_8B (18 * LIS3_ACCURACY) |
| 82 | 83 | ||
| 84 | /* | ||
| 85 | * LIS331DLH spec says 1LSBs corresponds 4G/4096 -> 1LSB is 1000/1024 mG. | ||
| 86 | * Below macros defines sensitivity values for +/-2G. Dataout bits for | ||
| 87 | * +/-2G range is 12 bits so 4 bits adjustment must be done to get 12bit | ||
| 88 | * data from 16bit value. Currently this driver supports only 2G range. | ||
| 89 | */ | ||
| 90 | #define LIS3DLH_SENSITIVITY_2G ((LIS3_ACCURACY * 1000) / 1024) | ||
| 91 | #define SHIFT_ADJ_2G 4 | ||
| 92 | |||
| 83 | #define LIS3_DEFAULT_FUZZ_12B 3 | 93 | #define LIS3_DEFAULT_FUZZ_12B 3 |
| 84 | #define LIS3_DEFAULT_FLAT_12B 3 | 94 | #define LIS3_DEFAULT_FLAT_12B 3 |
| 85 | #define LIS3_DEFAULT_FUZZ_8B 1 | 95 | #define LIS3_DEFAULT_FUZZ_8B 1 |
| @@ -135,6 +145,19 @@ static s16 lis3lv02d_read_12(struct lis3lv02d *lis3, int reg) | |||
| 135 | return (s16)((hi << 8) | lo); | 145 | return (s16)((hi << 8) | lo); |
| 136 | } | 146 | } |
| 137 | 147 | ||
| 148 | /* 12bits for 2G range, 13 bits for 4G range and 14 bits for 8G range */ | ||
| 149 | static s16 lis331dlh_read_data(struct lis3lv02d *lis3, int reg) | ||
| 150 | { | ||
| 151 | u8 lo, hi; | ||
| 152 | int v; | ||
| 153 | |||
| 154 | lis3->read(lis3, reg - 1, &lo); | ||
| 155 | lis3->read(lis3, reg, &hi); | ||
| 156 | v = (int) ((hi << 8) | lo); | ||
| 157 | |||
| 158 | return (s16) v >> lis3->shift_adj; | ||
| 159 | } | ||
| 160 | |||
| 138 | /** | 161 | /** |
| 139 | * lis3lv02d_get_axis - For the given axis, give the value converted | 162 | * lis3lv02d_get_axis - For the given axis, give the value converted |
| 140 | * @axis: 1,2,3 - can also be negative | 163 | * @axis: 1,2,3 - can also be negative |
| @@ -195,6 +218,7 @@ static void lis3lv02d_get_xyz(struct lis3lv02d *lis3, int *x, int *y, int *z) | |||
| 195 | static int lis3_12_rates[4] = {40, 160, 640, 2560}; | 218 | static int lis3_12_rates[4] = {40, 160, 640, 2560}; |
| 196 | static int lis3_8_rates[2] = {100, 400}; | 219 | static int lis3_8_rates[2] = {100, 400}; |
| 197 | static int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000}; | 220 | static int lis3_3dc_rates[16] = {0, 1, 10, 25, 50, 100, 200, 400, 1600, 5000}; |
| 221 | static int lis3_3dlh_rates[4] = {50, 100, 400, 1000}; | ||
| 198 | 222 | ||
| 199 | /* ODR is Output Data Rate */ | 223 | /* ODR is Output Data Rate */ |
| 200 | static int lis3lv02d_get_odr(struct lis3lv02d *lis3) | 224 | static int lis3lv02d_get_odr(struct lis3lv02d *lis3) |
| @@ -267,7 +291,7 @@ static int lis3lv02d_selftest(struct lis3lv02d *lis3, s16 results[3]) | |||
| 267 | (LIS3_IRQ1_DATA_READY | LIS3_IRQ2_DATA_READY)); | 291 | (LIS3_IRQ1_DATA_READY | LIS3_IRQ2_DATA_READY)); |
| 268 | } | 292 | } |
| 269 | 293 | ||
| 270 | if (lis3->whoami == WAI_3DC) { | 294 | if ((lis3->whoami == WAI_3DC) || (lis3->whoami == WAI_3DLH)) { |
| 271 | ctlreg = CTRL_REG4; | 295 | ctlreg = CTRL_REG4; |
| 272 | selftest = CTRL4_ST0; | 296 | selftest = CTRL4_ST0; |
| 273 | } else { | 297 | } else { |
| @@ -398,9 +422,17 @@ int lis3lv02d_poweron(struct lis3lv02d *lis3) | |||
| 398 | lis3->read(lis3, CTRL_REG2, ®); | 422 | lis3->read(lis3, CTRL_REG2, ®); |
| 399 | if (lis3->whoami == WAI_12B) | 423 | if (lis3->whoami == WAI_12B) |
| 400 | reg |= CTRL2_BDU | CTRL2_BOOT; | 424 | reg |= CTRL2_BDU | CTRL2_BOOT; |
| 425 | else if (lis3->whoami == WAI_3DLH) | ||
| 426 | reg |= CTRL2_BOOT_3DLH; | ||
| 401 | else | 427 | else |
| 402 | reg |= CTRL2_BOOT_8B; | 428 | reg |= CTRL2_BOOT_8B; |
| 403 | lis3->write(lis3, CTRL_REG2, reg); | 429 | lis3->write(lis3, CTRL_REG2, reg); |
| 430 | |||
| 431 | if (lis3->whoami == WAI_3DLH) { | ||
| 432 | lis3->read(lis3, CTRL_REG4, ®); | ||
| 433 | reg |= CTRL4_BDU; | ||
| 434 | lis3->write(lis3, CTRL_REG4, reg); | ||
| 435 | } | ||
| 404 | } | 436 | } |
| 405 | 437 | ||
| 406 | err = lis3lv02d_get_pwron_wait(lis3); | 438 | err = lis3lv02d_get_pwron_wait(lis3); |
| @@ -912,6 +944,154 @@ static void lis3lv02d_8b_configure(struct lis3lv02d *lis3, | |||
| 912 | } | 944 | } |
| 913 | } | 945 | } |
| 914 | 946 | ||
| 947 | #ifdef CONFIG_OF | ||
| 948 | int lis3lv02d_init_dt(struct lis3lv02d *lis3) | ||
| 949 | { | ||
| 950 | struct lis3lv02d_platform_data *pdata; | ||
| 951 | struct device_node *np = lis3->of_node; | ||
| 952 | u32 val; | ||
| 953 | |||
| 954 | if (!lis3->of_node) | ||
| 955 | return 0; | ||
| 956 | |||
| 957 | pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); | ||
| 958 | if (!pdata) | ||
| 959 | return -ENOMEM; | ||
| 960 | |||
| 961 | if (of_get_property(np, "st,click-single-x", NULL)) | ||
| 962 | pdata->click_flags |= LIS3_CLICK_SINGLE_X; | ||
| 963 | if (of_get_property(np, "st,click-double-x", NULL)) | ||
| 964 | pdata->click_flags |= LIS3_CLICK_DOUBLE_X; | ||
| 965 | |||
| 966 | if (of_get_property(np, "st,click-single-y", NULL)) | ||
| 967 | pdata->click_flags |= LIS3_CLICK_SINGLE_Y; | ||
| 968 | if (of_get_property(np, "st,click-double-y", NULL)) | ||
| 969 | pdata->click_flags |= LIS3_CLICK_DOUBLE_Y; | ||
| 970 | |||
| 971 | if (of_get_property(np, "st,click-single-z", NULL)) | ||
| 972 | pdata->click_flags |= LIS3_CLICK_SINGLE_Z; | ||
| 973 | if (of_get_property(np, "st,click-double-z", NULL)) | ||
| 974 | pdata->click_flags |= LIS3_CLICK_DOUBLE_Z; | ||
| 975 | |||
| 976 | if (!of_property_read_u32(np, "st,click-threshold-x", &val)) | ||
| 977 | pdata->click_thresh_x = val; | ||
| 978 | if (!of_property_read_u32(np, "st,click-threshold-y", &val)) | ||
| 979 | pdata->click_thresh_y = val; | ||
| 980 | if (!of_property_read_u32(np, "st,click-threshold-z", &val)) | ||
| 981 | pdata->click_thresh_z = val; | ||
| 982 | |||
| 983 | if (!of_property_read_u32(np, "st,click-time-limit", &val)) | ||
| 984 | pdata->click_time_limit = val; | ||
| 985 | if (!of_property_read_u32(np, "st,click-latency", &val)) | ||
| 986 | pdata->click_latency = val; | ||
| 987 | if (!of_property_read_u32(np, "st,click-window", &val)) | ||
| 988 | pdata->click_window = val; | ||
| 989 | |||
| 990 | if (of_get_property(np, "st,irq1-disable", NULL)) | ||
| 991 | pdata->irq_cfg |= LIS3_IRQ1_DISABLE; | ||
| 992 | if (of_get_property(np, "st,irq1-ff-wu-1", NULL)) | ||
| 993 | pdata->irq_cfg |= LIS3_IRQ1_FF_WU_1; | ||
| 994 | if (of_get_property(np, "st,irq1-ff-wu-2", NULL)) | ||
| 995 | pdata->irq_cfg |= LIS3_IRQ1_FF_WU_2; | ||
| 996 | if (of_get_property(np, "st,irq1-data-ready", NULL)) | ||
| 997 | pdata->irq_cfg |= LIS3_IRQ1_DATA_READY; | ||
| 998 | if (of_get_property(np, "st,irq1-click", NULL)) | ||
| 999 | pdata->irq_cfg |= LIS3_IRQ1_CLICK; | ||
| 1000 | |||
| 1001 | if (of_get_property(np, "st,irq2-disable", NULL)) | ||
| 1002 | pdata->irq_cfg |= LIS3_IRQ2_DISABLE; | ||
| 1003 | if (of_get_property(np, "st,irq2-ff-wu-1", NULL)) | ||
| 1004 | pdata->irq_cfg |= LIS3_IRQ2_FF_WU_1; | ||
| 1005 | if (of_get_property(np, "st,irq2-ff-wu-2", NULL)) | ||
| 1006 | pdata->irq_cfg |= LIS3_IRQ2_FF_WU_2; | ||
| 1007 | if (of_get_property(np, "st,irq2-data-ready", NULL)) | ||
| 1008 | pdata->irq_cfg |= LIS3_IRQ2_DATA_READY; | ||
| 1009 | if (of_get_property(np, "st,irq2-click", NULL)) | ||
| 1010 | pdata->irq_cfg |= LIS3_IRQ2_CLICK; | ||
| 1011 | |||
| 1012 | if (of_get_property(np, "st,irq-open-drain", NULL)) | ||
| 1013 | pdata->irq_cfg |= LIS3_IRQ_OPEN_DRAIN; | ||
| 1014 | if (of_get_property(np, "st,irq-active-low", NULL)) | ||
| 1015 | pdata->irq_cfg |= LIS3_IRQ_ACTIVE_LOW; | ||
| 1016 | |||
| 1017 | if (!of_property_read_u32(np, "st,wu-duration-1", &val)) | ||
| 1018 | pdata->duration1 = val; | ||
| 1019 | if (!of_property_read_u32(np, "st,wu-duration-2", &val)) | ||
| 1020 | pdata->duration2 = val; | ||
| 1021 | |||
| 1022 | if (of_get_property(np, "st,wakeup-x-lo", NULL)) | ||
| 1023 | pdata->wakeup_flags |= LIS3_WAKEUP_X_LO; | ||
| 1024 | if (of_get_property(np, "st,wakeup-x-hi", NULL)) | ||
| 1025 | pdata->wakeup_flags |= LIS3_WAKEUP_X_HI; | ||
| 1026 | if (of_get_property(np, "st,wakeup-y-lo", NULL)) | ||
| 1027 | pdata->wakeup_flags |= LIS3_WAKEUP_Y_LO; | ||
| 1028 | if (of_get_property(np, "st,wakeup-y-hi", NULL)) | ||
| 1029 | pdata->wakeup_flags |= LIS3_WAKEUP_Y_HI; | ||
| 1030 | if (of_get_property(np, "st,wakeup-z-lo", NULL)) | ||
| 1031 | pdata->wakeup_flags |= LIS3_WAKEUP_Z_LO; | ||
| 1032 | if (of_get_property(np, "st,wakeup-z-hi", NULL)) | ||
| 1033 | pdata->wakeup_flags |= LIS3_WAKEUP_Z_HI; | ||
| 1034 | |||
| 1035 | if (!of_property_read_u32(np, "st,highpass-cutoff-hz", &val)) { | ||
| 1036 | switch (val) { | ||
| 1037 | case 1: | ||
| 1038 | pdata->hipass_ctrl = LIS3_HIPASS_CUTFF_1HZ; | ||
| 1039 | break; | ||
| 1040 | case 2: | ||
| 1041 | pdata->hipass_ctrl = LIS3_HIPASS_CUTFF_2HZ; | ||
| 1042 | break; | ||
| 1043 | case 4: | ||
| 1044 | pdata->hipass_ctrl = LIS3_HIPASS_CUTFF_4HZ; | ||
| 1045 | break; | ||
| 1046 | case 8: | ||
| 1047 | pdata->hipass_ctrl = LIS3_HIPASS_CUTFF_8HZ; | ||
| 1048 | break; | ||
| 1049 | } | ||
| 1050 | } | ||
| 1051 | |||
| 1052 | if (of_get_property(np, "st,hipass1-disable", NULL)) | ||
| 1053 | pdata->hipass_ctrl |= LIS3_HIPASS1_DISABLE; | ||
| 1054 | if (of_get_property(np, "st,hipass2-disable", NULL)) | ||
| 1055 | pdata->hipass_ctrl |= LIS3_HIPASS2_DISABLE; | ||
| 1056 | |||
| 1057 | if (of_get_property(np, "st,axis-x", &val)) | ||
| 1058 | pdata->axis_x = val; | ||
| 1059 | if (of_get_property(np, "st,axis-y", &val)) | ||
| 1060 | pdata->axis_y = val; | ||
| 1061 | if (of_get_property(np, "st,axis-z", &val)) | ||
| 1062 | pdata->axis_z = val; | ||
| 1063 | |||
| 1064 | if (of_get_property(np, "st,default-rate", NULL)) | ||
| 1065 | pdata->default_rate = val; | ||
| 1066 | |||
| 1067 | if (of_get_property(np, "st,min-limit-x", &val)) | ||
| 1068 | pdata->st_min_limits[0] = val; | ||
| 1069 | if (of_get_property(np, "st,min-limit-y", &val)) | ||
| 1070 | pdata->st_min_limits[1] = val; | ||
| 1071 | if (of_get_property(np, "st,min-limit-z", &val)) | ||
| 1072 | pdata->st_min_limits[2] = val; | ||
| 1073 | |||
| 1074 | if (of_get_property(np, "st,max-limit-x", &val)) | ||
| 1075 | pdata->st_max_limits[0] = val; | ||
| 1076 | if (of_get_property(np, "st,max-limit-y", &val)) | ||
| 1077 | pdata->st_max_limits[1] = val; | ||
| 1078 | if (of_get_property(np, "st,max-limit-z", &val)) | ||
| 1079 | pdata->st_max_limits[2] = val; | ||
| 1080 | |||
| 1081 | |||
| 1082 | lis3->pdata = pdata; | ||
| 1083 | |||
| 1084 | return 0; | ||
| 1085 | } | ||
| 1086 | |||
| 1087 | #else | ||
| 1088 | int lis3lv02d_init_dt(struct lis3lv02d *lis3) | ||
| 1089 | { | ||
| 1090 | return 0; | ||
| 1091 | } | ||
| 1092 | #endif | ||
| 1093 | EXPORT_SYMBOL_GPL(lis3lv02d_init_dt); | ||
| 1094 | |||
| 915 | /* | 1095 | /* |
| 916 | * Initialise the accelerometer and the various subsystems. | 1096 | * Initialise the accelerometer and the various subsystems. |
| 917 | * Should be rather independent of the bus system. | 1097 | * Should be rather independent of the bus system. |
| @@ -956,6 +1136,16 @@ int lis3lv02d_init_device(struct lis3lv02d *lis3) | |||
| 956 | lis3->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3; | 1136 | lis3->odr_mask = CTRL1_ODR0|CTRL1_ODR1|CTRL1_ODR2|CTRL1_ODR3; |
| 957 | lis3->scale = LIS3_SENSITIVITY_8B; | 1137 | lis3->scale = LIS3_SENSITIVITY_8B; |
| 958 | break; | 1138 | break; |
| 1139 | case WAI_3DLH: | ||
| 1140 | pr_info("16 bits lis331dlh sensor found\n"); | ||
| 1141 | lis3->read_data = lis331dlh_read_data; | ||
| 1142 | lis3->mdps_max_val = 2048; /* 12 bits for 2G */ | ||
| 1143 | lis3->shift_adj = SHIFT_ADJ_2G; | ||
| 1144 | lis3->pwron_delay = LIS3_PWRON_DELAY_WAI_8B; | ||
| 1145 | lis3->odrs = lis3_3dlh_rates; | ||
| 1146 | lis3->odr_mask = CTRL1_DR0 | CTRL1_DR1; | ||
| 1147 | lis3->scale = LIS3DLH_SENSITIVITY_2G; | ||
| 1148 | break; | ||
| 959 | default: | 1149 | default: |
| 960 | pr_err("unknown sensor type 0x%X\n", lis3->whoami); | 1150 | pr_err("unknown sensor type 0x%X\n", lis3->whoami); |
| 961 | return -EINVAL; | 1151 | return -EINVAL; |
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.h b/drivers/misc/lis3lv02d/lis3lv02d.h index 2b1482ad3f16..c439c827eea8 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d.h +++ b/drivers/misc/lis3lv02d/lis3lv02d.h | |||
| @@ -26,12 +26,12 @@ | |||
| 26 | /* | 26 | /* |
| 27 | * This driver tries to support the "digital" accelerometer chips from | 27 | * This driver tries to support the "digital" accelerometer chips from |
| 28 | * STMicroelectronics such as LIS3LV02DL, LIS302DL, LIS3L02DQ, LIS331DL, | 28 | * STMicroelectronics such as LIS3LV02DL, LIS302DL, LIS3L02DQ, LIS331DL, |
| 29 | * LIS35DE, or LIS202DL. They are very similar in terms of programming, with | 29 | * LIS331DLH, LIS35DE, or LIS202DL. They are very similar in terms of |
| 30 | * almost the same registers. In addition to differing on physical properties, | 30 | * programming, with almost the same registers. In addition to differing |
| 31 | * they differ on the number of axes (2/3), precision (8/12 bits), and special | 31 | * on physical properties, they differ on the number of axes (2/3), |
| 32 | * features (freefall detection, click...). Unfortunately, not all the | 32 | * precision (8/12 bits), and special features (freefall detection, |
| 33 | * differences can be probed via a register. | 33 | * click...). Unfortunately, not all the differences can be probed via |
| 34 | * They can be connected either via I²C or SPI. | 34 | * a register. They can be connected either via I²C or SPI. |
| 35 | */ | 35 | */ |
| 36 | 36 | ||
| 37 | #include <linux/lis3lv02d.h> | 37 | #include <linux/lis3lv02d.h> |
| @@ -96,12 +96,22 @@ enum lis3lv02d_reg { | |||
| 96 | }; | 96 | }; |
| 97 | 97 | ||
| 98 | enum lis3_who_am_i { | 98 | enum lis3_who_am_i { |
| 99 | WAI_3DLH = 0x32, /* 16 bits: LIS331DLH */ | ||
| 99 | WAI_3DC = 0x33, /* 8 bits: LIS3DC, HP3DC */ | 100 | WAI_3DC = 0x33, /* 8 bits: LIS3DC, HP3DC */ |
| 100 | WAI_12B = 0x3A, /* 12 bits: LIS3LV02D[LQ]... */ | 101 | WAI_12B = 0x3A, /* 12 bits: LIS3LV02D[LQ]... */ |
| 101 | WAI_8B = 0x3B, /* 8 bits: LIS[23]02D[LQ]... */ | 102 | WAI_8B = 0x3B, /* 8 bits: LIS[23]02D[LQ]... */ |
| 102 | WAI_6B = 0x52, /* 6 bits: LIS331DLF - not supported */ | 103 | WAI_6B = 0x52, /* 6 bits: LIS331DLF - not supported */ |
| 103 | }; | 104 | }; |
| 104 | 105 | ||
| 106 | enum lis3_type { | ||
| 107 | LIS3LV02D, | ||
| 108 | LIS3DC, | ||
| 109 | HP3DC, | ||
| 110 | LIS2302D, | ||
| 111 | LIS331DLF, | ||
| 112 | LIS331DLH, | ||
| 113 | }; | ||
| 114 | |||
| 105 | enum lis3lv02d_ctrl1_12b { | 115 | enum lis3lv02d_ctrl1_12b { |
| 106 | CTRL1_Xen = 0x01, | 116 | CTRL1_Xen = 0x01, |
| 107 | CTRL1_Yen = 0x02, | 117 | CTRL1_Yen = 0x02, |
| @@ -129,6 +139,27 @@ enum lis3lv02d_ctrl1_3dc { | |||
| 129 | CTRL1_ODR3 = 0x80, | 139 | CTRL1_ODR3 = 0x80, |
| 130 | }; | 140 | }; |
| 131 | 141 | ||
| 142 | enum lis331dlh_ctrl1 { | ||
| 143 | CTRL1_DR0 = 0x08, | ||
| 144 | CTRL1_DR1 = 0x10, | ||
| 145 | CTRL1_PM0 = 0x20, | ||
| 146 | CTRL1_PM1 = 0x40, | ||
| 147 | CTRL1_PM2 = 0x80, | ||
| 148 | }; | ||
| 149 | |||
| 150 | enum lis331dlh_ctrl2 { | ||
| 151 | CTRL2_HPEN1 = 0x04, | ||
| 152 | CTRL2_HPEN2 = 0x08, | ||
| 153 | CTRL2_FDS_3DLH = 0x10, | ||
| 154 | CTRL2_BOOT_3DLH = 0x80, | ||
| 155 | }; | ||
| 156 | |||
| 157 | enum lis331dlh_ctrl4 { | ||
| 158 | CTRL4_STSIGN = 0x08, | ||
| 159 | CTRL4_BLE = 0x40, | ||
| 160 | CTRL4_BDU = 0x80, | ||
| 161 | }; | ||
| 162 | |||
| 132 | enum lis3lv02d_ctrl2 { | 163 | enum lis3lv02d_ctrl2 { |
| 133 | CTRL2_DAS = 0x01, | 164 | CTRL2_DAS = 0x01, |
| 134 | CTRL2_SIM = 0x02, | 165 | CTRL2_SIM = 0x02, |
| @@ -279,9 +310,14 @@ struct lis3lv02d { | |||
| 279 | int data_ready_count[2]; | 310 | int data_ready_count[2]; |
| 280 | atomic_t wake_thread; | 311 | atomic_t wake_thread; |
| 281 | unsigned char irq_cfg; | 312 | unsigned char irq_cfg; |
| 313 | unsigned int shift_adj; | ||
| 282 | 314 | ||
| 283 | struct lis3lv02d_platform_data *pdata; /* for passing board config */ | 315 | struct lis3lv02d_platform_data *pdata; /* for passing board config */ |
| 284 | struct mutex mutex; /* Serialize poll and selftest */ | 316 | struct mutex mutex; /* Serialize poll and selftest */ |
| 317 | |||
| 318 | #ifdef CONFIG_OF | ||
| 319 | struct device_node *of_node; | ||
| 320 | #endif | ||
| 285 | }; | 321 | }; |
| 286 | 322 | ||
| 287 | int lis3lv02d_init_device(struct lis3lv02d *lis3); | 323 | int lis3lv02d_init_device(struct lis3lv02d *lis3); |
| @@ -290,5 +326,6 @@ void lis3lv02d_joystick_disable(struct lis3lv02d *lis3); | |||
| 290 | void lis3lv02d_poweroff(struct lis3lv02d *lis3); | 326 | void lis3lv02d_poweroff(struct lis3lv02d *lis3); |
| 291 | int lis3lv02d_poweron(struct lis3lv02d *lis3); | 327 | int lis3lv02d_poweron(struct lis3lv02d *lis3); |
| 292 | int lis3lv02d_remove_fs(struct lis3lv02d *lis3); | 328 | int lis3lv02d_remove_fs(struct lis3lv02d *lis3); |
| 329 | int lis3lv02d_init_dt(struct lis3lv02d *lis3); | ||
| 293 | 330 | ||
| 294 | extern struct lis3lv02d lis3_dev; | 331 | extern struct lis3lv02d lis3_dev; |
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c index e8c0019da97a..60ec8689d6e3 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d_i2c.c +++ b/drivers/misc/lis3lv02d/lis3lv02d_i2c.c | |||
| @@ -31,6 +31,10 @@ | |||
| 31 | #include <linux/i2c.h> | 31 | #include <linux/i2c.h> |
| 32 | #include <linux/pm_runtime.h> | 32 | #include <linux/pm_runtime.h> |
| 33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
| 34 | #include <linux/of.h> | ||
| 35 | #include <linux/of_platform.h> | ||
| 36 | #include <linux/of_device.h> | ||
| 37 | |||
| 34 | #include "lis3lv02d.h" | 38 | #include "lis3lv02d.h" |
| 35 | 39 | ||
| 36 | #define DRV_NAME "lis3lv02d_i2c" | 40 | #define DRV_NAME "lis3lv02d_i2c" |
| @@ -90,7 +94,11 @@ static int lis3_i2c_init(struct lis3lv02d *lis3) | |||
| 90 | if (ret < 0) | 94 | if (ret < 0) |
| 91 | return ret; | 95 | return ret; |
| 92 | 96 | ||
| 93 | reg |= CTRL1_PD0 | CTRL1_Xen | CTRL1_Yen | CTRL1_Zen; | 97 | if (lis3->whoami == WAI_3DLH) |
| 98 | reg |= CTRL1_PM0 | CTRL1_Xen | CTRL1_Yen | CTRL1_Zen; | ||
| 99 | else | ||
| 100 | reg |= CTRL1_PD0 | CTRL1_Xen | CTRL1_Yen | CTRL1_Zen; | ||
| 101 | |||
| 94 | return lis3->write(lis3, CTRL_REG1, reg); | 102 | return lis3->write(lis3, CTRL_REG1, reg); |
| 95 | } | 103 | } |
| 96 | 104 | ||
| @@ -98,12 +106,30 @@ static int lis3_i2c_init(struct lis3lv02d *lis3) | |||
| 98 | static union axis_conversion lis3lv02d_axis_map = | 106 | static union axis_conversion lis3lv02d_axis_map = |
| 99 | { .as_array = { LIS3_DEV_X, LIS3_DEV_Y, LIS3_DEV_Z } }; | 107 | { .as_array = { LIS3_DEV_X, LIS3_DEV_Y, LIS3_DEV_Z } }; |
| 100 | 108 | ||
| 109 | #ifdef CONFIG_OF | ||
| 110 | static struct of_device_id lis3lv02d_i2c_dt_ids[] = { | ||
| 111 | { .compatible = "st,lis3lv02d" }, | ||
| 112 | {} | ||
| 113 | }; | ||
| 114 | MODULE_DEVICE_TABLE(of, lis3lv02d_i2c_dt_ids); | ||
| 115 | #endif | ||
| 116 | |||
| 101 | static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, | 117 | static int __devinit lis3lv02d_i2c_probe(struct i2c_client *client, |
| 102 | const struct i2c_device_id *id) | 118 | const struct i2c_device_id *id) |
| 103 | { | 119 | { |
| 104 | int ret = 0; | 120 | int ret = 0; |
| 105 | struct lis3lv02d_platform_data *pdata = client->dev.platform_data; | 121 | struct lis3lv02d_platform_data *pdata = client->dev.platform_data; |
| 106 | 122 | ||
| 123 | #ifdef CONFIG_OF | ||
| 124 | if (of_match_device(lis3lv02d_i2c_dt_ids, &client->dev)) { | ||
| 125 | lis3_dev.of_node = client->dev.of_node; | ||
| 126 | ret = lis3lv02d_init_dt(&lis3_dev); | ||
| 127 | if (ret) | ||
| 128 | return ret; | ||
| 129 | pdata = lis3_dev.pdata; | ||
| 130 | } | ||
| 131 | #endif | ||
| 132 | |||
| 107 | if (pdata) { | 133 | if (pdata) { |
| 108 | if ((pdata->driver_features & LIS3_USE_BLOCK_READ) && | 134 | if ((pdata->driver_features & LIS3_USE_BLOCK_READ) && |
| 109 | (i2c_check_functionality(client->adapter, | 135 | (i2c_check_functionality(client->adapter, |
| @@ -231,7 +257,8 @@ static int lis3_i2c_runtime_resume(struct device *dev) | |||
| 231 | #endif /* CONFIG_PM_RUNTIME */ | 257 | #endif /* CONFIG_PM_RUNTIME */ |
| 232 | 258 | ||
| 233 | static const struct i2c_device_id lis3lv02d_id[] = { | 259 | static const struct i2c_device_id lis3lv02d_id[] = { |
| 234 | {"lis3lv02d", 0 }, | 260 | {"lis3lv02d", LIS3LV02D}, |
| 261 | {"lis331dlh", LIS331DLH}, | ||
| 235 | {} | 262 | {} |
| 236 | }; | 263 | }; |
| 237 | 264 | ||
| @@ -250,6 +277,7 @@ static struct i2c_driver lis3lv02d_i2c_driver = { | |||
| 250 | .name = DRV_NAME, | 277 | .name = DRV_NAME, |
| 251 | .owner = THIS_MODULE, | 278 | .owner = THIS_MODULE, |
| 252 | .pm = &lis3_pm_ops, | 279 | .pm = &lis3_pm_ops, |
| 280 | .of_match_table = of_match_ptr(lis3lv02d_i2c_dt_ids), | ||
| 253 | }, | 281 | }, |
| 254 | .probe = lis3lv02d_i2c_probe, | 282 | .probe = lis3lv02d_i2c_probe, |
| 255 | .remove = __devexit_p(lis3lv02d_i2c_remove), | 283 | .remove = __devexit_p(lis3lv02d_i2c_remove), |
diff --git a/drivers/misc/lis3lv02d/lis3lv02d_spi.c b/drivers/misc/lis3lv02d/lis3lv02d_spi.c index 80880e984b4f..ccb6475fa059 100644 --- a/drivers/misc/lis3lv02d/lis3lv02d_spi.c +++ b/drivers/misc/lis3lv02d/lis3lv02d_spi.c | |||
| @@ -17,6 +17,9 @@ | |||
| 17 | #include <linux/workqueue.h> | 17 | #include <linux/workqueue.h> |
| 18 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
| 19 | #include <linux/pm.h> | 19 | #include <linux/pm.h> |
| 20 | #include <linux/of.h> | ||
| 21 | #include <linux/of_platform.h> | ||
| 22 | #include <linux/of_device.h> | ||
| 20 | 23 | ||
| 21 | #include "lis3lv02d.h" | 24 | #include "lis3lv02d.h" |
| 22 | 25 | ||
| @@ -58,6 +61,14 @@ static int lis3_spi_init(struct lis3lv02d *lis3) | |||
| 58 | static union axis_conversion lis3lv02d_axis_normal = | 61 | static union axis_conversion lis3lv02d_axis_normal = |
| 59 | { .as_array = { 1, 2, 3 } }; | 62 | { .as_array = { 1, 2, 3 } }; |
| 60 | 63 | ||
| 64 | #ifdef CONFIG_OF | ||
| 65 | static struct of_device_id lis302dl_spi_dt_ids[] = { | ||
| 66 | { .compatible = "st,lis302dl-spi" }, | ||
| 67 | {} | ||
| 68 | }; | ||
| 69 | MODULE_DEVICE_TABLE(of, lis302dl_spi_dt_ids); | ||
| 70 | #endif | ||
| 71 | |||
| 61 | static int __devinit lis302dl_spi_probe(struct spi_device *spi) | 72 | static int __devinit lis302dl_spi_probe(struct spi_device *spi) |
| 62 | { | 73 | { |
| 63 | int ret; | 74 | int ret; |
| @@ -75,6 +86,15 @@ static int __devinit lis302dl_spi_probe(struct spi_device *spi) | |||
| 75 | lis3_dev.irq = spi->irq; | 86 | lis3_dev.irq = spi->irq; |
| 76 | lis3_dev.ac = lis3lv02d_axis_normal; | 87 | lis3_dev.ac = lis3lv02d_axis_normal; |
| 77 | lis3_dev.pdata = spi->dev.platform_data; | 88 | lis3_dev.pdata = spi->dev.platform_data; |
| 89 | |||
| 90 | #ifdef CONFIG_OF | ||
| 91 | if (of_match_device(lis302dl_spi_dt_ids, &spi->dev)) { | ||
| 92 | lis3_dev.of_node = spi->dev.of_node; | ||
| 93 | ret = lis3lv02d_init_dt(&lis3_dev); | ||
| 94 | if (ret) | ||
| 95 | return ret; | ||
| 96 | } | ||
| 97 | #endif | ||
| 78 | spi_set_drvdata(spi, &lis3_dev); | 98 | spi_set_drvdata(spi, &lis3_dev); |
| 79 | 99 | ||
| 80 | return lis3lv02d_init_device(&lis3_dev); | 100 | return lis3lv02d_init_device(&lis3_dev); |
| @@ -121,6 +141,7 @@ static struct spi_driver lis302dl_spi_driver = { | |||
| 121 | .name = DRV_NAME, | 141 | .name = DRV_NAME, |
| 122 | .owner = THIS_MODULE, | 142 | .owner = THIS_MODULE, |
| 123 | .pm = &lis3lv02d_spi_pm, | 143 | .pm = &lis3lv02d_spi_pm, |
| 144 | .of_match_table = of_match_ptr(lis302dl_spi_dt_ids), | ||
| 124 | }, | 145 | }, |
| 125 | .probe = lis302dl_spi_probe, | 146 | .probe = lis302dl_spi_probe, |
| 126 | .remove = __devexit_p(lis302dl_spi_remove), | 147 | .remove = __devexit_p(lis302dl_spi_remove), |
diff --git a/drivers/misc/mei/Kconfig b/drivers/misc/mei/Kconfig index 47d78a72db2e..5a79ccde2fdf 100644 --- a/drivers/misc/mei/Kconfig +++ b/drivers/misc/mei/Kconfig | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | config INTEL_MEI | 1 | config INTEL_MEI |
| 2 | tristate "Intel Management Engine Interface (Intel MEI)" | 2 | tristate "Intel Management Engine Interface (Intel MEI)" |
| 3 | depends on X86 && PCI && EXPERIMENTAL && WATCHDOG_CORE | 3 | depends on X86 && PCI && WATCHDOG_CORE |
| 4 | help | 4 | help |
| 5 | The Intel Management Engine (Intel ME) provides Manageability, | 5 | The Intel Management Engine (Intel ME) provides Manageability, |
| 6 | Security and Media services for system containing Intel chipsets. | 6 | Security and Media services for system containing Intel chipsets. |
diff --git a/drivers/misc/mei/hw.h b/drivers/misc/mei/hw.h index 24c4c962819e..9700532f02f6 100644 --- a/drivers/misc/mei/hw.h +++ b/drivers/misc/mei/hw.h | |||
| @@ -40,47 +40,48 @@ | |||
| 40 | /* | 40 | /* |
| 41 | * MEI device IDs | 41 | * MEI device IDs |
| 42 | */ | 42 | */ |
| 43 | #define MEI_DEV_ID_82946GZ 0x2974 /* 82946GZ/GL */ | 43 | #define MEI_DEV_ID_82946GZ 0x2974 /* 82946GZ/GL */ |
| 44 | #define MEI_DEV_ID_82G35 0x2984 /* 82G35 Express */ | 44 | #define MEI_DEV_ID_82G35 0x2984 /* 82G35 Express */ |
| 45 | #define MEI_DEV_ID_82Q965 0x2994 /* 82Q963/Q965 */ | 45 | #define MEI_DEV_ID_82Q965 0x2994 /* 82Q963/Q965 */ |
| 46 | #define MEI_DEV_ID_82G965 0x29A4 /* 82P965/G965 */ | 46 | #define MEI_DEV_ID_82G965 0x29A4 /* 82P965/G965 */ |
| 47 | 47 | ||
| 48 | #define MEI_DEV_ID_82GM965 0x2A04 /* Mobile PM965/GM965 */ | 48 | #define MEI_DEV_ID_82GM965 0x2A04 /* Mobile PM965/GM965 */ |
| 49 | #define MEI_DEV_ID_82GME965 0x2A14 /* Mobile GME965/GLE960 */ | 49 | #define MEI_DEV_ID_82GME965 0x2A14 /* Mobile GME965/GLE960 */ |
| 50 | 50 | ||
| 51 | #define MEI_DEV_ID_ICH9_82Q35 0x29B4 /* 82Q35 Express */ | 51 | #define MEI_DEV_ID_ICH9_82Q35 0x29B4 /* 82Q35 Express */ |
| 52 | #define MEI_DEV_ID_ICH9_82G33 0x29C4 /* 82G33/G31/P35/P31 Express */ | 52 | #define MEI_DEV_ID_ICH9_82G33 0x29C4 /* 82G33/G31/P35/P31 Express */ |
| 53 | #define MEI_DEV_ID_ICH9_82Q33 0x29D4 /* 82Q33 Express */ | 53 | #define MEI_DEV_ID_ICH9_82Q33 0x29D4 /* 82Q33 Express */ |
| 54 | #define MEI_DEV_ID_ICH9_82X38 0x29E4 /* 82X38/X48 Express */ | 54 | #define MEI_DEV_ID_ICH9_82X38 0x29E4 /* 82X38/X48 Express */ |
| 55 | #define MEI_DEV_ID_ICH9_3200 0x29F4 /* 3200/3210 Server */ | 55 | #define MEI_DEV_ID_ICH9_3200 0x29F4 /* 3200/3210 Server */ |
| 56 | 56 | ||
| 57 | #define MEI_DEV_ID_ICH9_6 0x28B4 /* Bearlake */ | 57 | #define MEI_DEV_ID_ICH9_6 0x28B4 /* Bearlake */ |
| 58 | #define MEI_DEV_ID_ICH9_7 0x28C4 /* Bearlake */ | 58 | #define MEI_DEV_ID_ICH9_7 0x28C4 /* Bearlake */ |
| 59 | #define MEI_DEV_ID_ICH9_8 0x28D4 /* Bearlake */ | 59 | #define MEI_DEV_ID_ICH9_8 0x28D4 /* Bearlake */ |
| 60 | #define MEI_DEV_ID_ICH9_9 0x28E4 /* Bearlake */ | 60 | #define MEI_DEV_ID_ICH9_9 0x28E4 /* Bearlake */ |
| 61 | #define MEI_DEV_ID_ICH9_10 0x28F4 /* Bearlake */ | 61 | #define MEI_DEV_ID_ICH9_10 0x28F4 /* Bearlake */ |
| 62 | 62 | ||
| 63 | #define MEI_DEV_ID_ICH9M_1 0x2A44 /* Cantiga */ | 63 | #define MEI_DEV_ID_ICH9M_1 0x2A44 /* Cantiga */ |
| 64 | #define MEI_DEV_ID_ICH9M_2 0x2A54 /* Cantiga */ | 64 | #define MEI_DEV_ID_ICH9M_2 0x2A54 /* Cantiga */ |
| 65 | #define MEI_DEV_ID_ICH9M_3 0x2A64 /* Cantiga */ | 65 | #define MEI_DEV_ID_ICH9M_3 0x2A64 /* Cantiga */ |
| 66 | #define MEI_DEV_ID_ICH9M_4 0x2A74 /* Cantiga */ | 66 | #define MEI_DEV_ID_ICH9M_4 0x2A74 /* Cantiga */ |
| 67 | 67 | ||
| 68 | #define MEI_DEV_ID_ICH10_1 0x2E04 /* Eaglelake */ | 68 | #define MEI_DEV_ID_ICH10_1 0x2E04 /* Eaglelake */ |
| 69 | #define MEI_DEV_ID_ICH10_2 0x2E14 /* Eaglelake */ | 69 | #define MEI_DEV_ID_ICH10_2 0x2E14 /* Eaglelake */ |
| 70 | #define MEI_DEV_ID_ICH10_3 0x2E24 /* Eaglelake */ | 70 | #define MEI_DEV_ID_ICH10_3 0x2E24 /* Eaglelake */ |
| 71 | #define MEI_DEV_ID_ICH10_4 0x2E34 /* Eaglelake */ | 71 | #define MEI_DEV_ID_ICH10_4 0x2E34 /* Eaglelake */ |
| 72 | 72 | ||
| 73 | #define MEI_DEV_ID_IBXPK_1 0x3B64 /* Calpella */ | 73 | #define MEI_DEV_ID_IBXPK_1 0x3B64 /* Calpella */ |
| 74 | #define MEI_DEV_ID_IBXPK_2 0x3B65 /* Calpella */ | 74 | #define MEI_DEV_ID_IBXPK_2 0x3B65 /* Calpella */ |
| 75 | 75 | ||
| 76 | #define MEI_DEV_ID_CPT_1 0x1C3A /* Cougerpoint */ | 76 | #define MEI_DEV_ID_CPT_1 0x1C3A /* Couger Point */ |
| 77 | #define MEI_DEV_ID_PBG_1 0x1D3A /* PBG */ | 77 | #define MEI_DEV_ID_PBG_1 0x1D3A /* C600/X79 Patsburg */ |
| 78 | 78 | ||
| 79 | #define MEI_DEV_ID_PPT_1 0x1E3A /* Pantherpoint PPT */ | 79 | #define MEI_DEV_ID_PPT_1 0x1E3A /* Panther Point */ |
| 80 | #define MEI_DEV_ID_PPT_2 0x1CBA /* Pantherpoint PPT */ | 80 | #define MEI_DEV_ID_PPT_2 0x1CBA /* Panther Point */ |
| 81 | #define MEI_DEV_ID_PPT_3 0x1DBA /* Pantherpoint PPT */ | 81 | #define MEI_DEV_ID_PPT_3 0x1DBA /* Panther Point */ |
| 82 | 82 | ||
| 83 | 83 | #define MEI_DEV_ID_LPT 0x8C3A /* Lynx Point */ | |
| 84 | #define MEI_DEV_ID_LPT_LP 0x9C3A /* Lynx Point LP */ | ||
| 84 | /* | 85 | /* |
| 85 | * MEI HW Section | 86 | * MEI HW Section |
| 86 | */ | 87 | */ |
diff --git a/drivers/misc/mei/init.c b/drivers/misc/mei/init.c index e77f86e69fb5..98f1430e3e14 100644 --- a/drivers/misc/mei/init.c +++ b/drivers/misc/mei/init.c | |||
| @@ -24,6 +24,25 @@ | |||
| 24 | #include "interface.h" | 24 | #include "interface.h" |
| 25 | #include <linux/mei.h> | 25 | #include <linux/mei.h> |
| 26 | 26 | ||
| 27 | const char *mei_dev_state_str(int state) | ||
| 28 | { | ||
| 29 | #define MEI_DEV_STATE(state) case MEI_DEV_##state: return #state | ||
| 30 | switch (state) { | ||
| 31 | MEI_DEV_STATE(INITIALIZING); | ||
| 32 | MEI_DEV_STATE(INIT_CLIENTS); | ||
| 33 | MEI_DEV_STATE(ENABLED); | ||
| 34 | MEI_DEV_STATE(RESETING); | ||
| 35 | MEI_DEV_STATE(DISABLED); | ||
| 36 | MEI_DEV_STATE(RECOVERING_FROM_RESET); | ||
| 37 | MEI_DEV_STATE(POWER_DOWN); | ||
| 38 | MEI_DEV_STATE(POWER_UP); | ||
| 39 | default: | ||
| 40 | return "unkown"; | ||
| 41 | } | ||
| 42 | #undef MEI_DEV_STATE | ||
| 43 | } | ||
| 44 | |||
| 45 | |||
| 27 | const uuid_le mei_amthi_guid = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, 0xac, | 46 | const uuid_le mei_amthi_guid = UUID_LE(0x12f80028, 0xb4b7, 0x4b2d, 0xac, |
| 28 | 0xa8, 0x46, 0xe0, 0xff, 0x65, | 47 | 0xa8, 0x46, 0xe0, 0xff, 0x65, |
| 29 | 0x81, 0x4c); | 48 | 0x81, 0x4c); |
| @@ -123,7 +142,7 @@ struct mei_device *mei_device_init(struct pci_dev *pdev) | |||
| 123 | mutex_init(&dev->device_lock); | 142 | mutex_init(&dev->device_lock); |
| 124 | init_waitqueue_head(&dev->wait_recvd_msg); | 143 | init_waitqueue_head(&dev->wait_recvd_msg); |
| 125 | init_waitqueue_head(&dev->wait_stop_wd); | 144 | init_waitqueue_head(&dev->wait_stop_wd); |
| 126 | dev->mei_state = MEI_INITIALIZING; | 145 | dev->dev_state = MEI_DEV_INITIALIZING; |
| 127 | dev->iamthif_state = MEI_IAMTHIF_IDLE; | 146 | dev->iamthif_state = MEI_IAMTHIF_IDLE; |
| 128 | dev->wd_interface_reg = false; | 147 | dev->wd_interface_reg = false; |
| 129 | 148 | ||
| @@ -182,7 +201,7 @@ int mei_hw_init(struct mei_device *dev) | |||
| 182 | } | 201 | } |
| 183 | 202 | ||
| 184 | if (err <= 0 && !dev->recvd_msg) { | 203 | if (err <= 0 && !dev->recvd_msg) { |
| 185 | dev->mei_state = MEI_DISABLED; | 204 | dev->dev_state = MEI_DEV_DISABLED; |
| 186 | dev_dbg(&dev->pdev->dev, | 205 | dev_dbg(&dev->pdev->dev, |
| 187 | "wait_event_interruptible_timeout failed" | 206 | "wait_event_interruptible_timeout failed" |
| 188 | "on wait for ME to turn on ME_RDY.\n"); | 207 | "on wait for ME to turn on ME_RDY.\n"); |
| @@ -192,7 +211,7 @@ int mei_hw_init(struct mei_device *dev) | |||
| 192 | 211 | ||
| 193 | if (!(((dev->host_hw_state & H_RDY) == H_RDY) && | 212 | if (!(((dev->host_hw_state & H_RDY) == H_RDY) && |
| 194 | ((dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA))) { | 213 | ((dev->me_hw_state & ME_RDY_HRA) == ME_RDY_HRA))) { |
| 195 | dev->mei_state = MEI_DISABLED; | 214 | dev->dev_state = MEI_DEV_DISABLED; |
| 196 | dev_dbg(&dev->pdev->dev, | 215 | dev_dbg(&dev->pdev->dev, |
| 197 | "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", | 216 | "host_hw_state = 0x%08x, me_hw_state = 0x%08x.\n", |
| 198 | dev->host_hw_state, dev->me_hw_state); | 217 | dev->host_hw_state, dev->me_hw_state); |
| @@ -258,15 +277,15 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
| 258 | struct mei_cl_cb *cb_next = NULL; | 277 | struct mei_cl_cb *cb_next = NULL; |
| 259 | bool unexpected; | 278 | bool unexpected; |
| 260 | 279 | ||
| 261 | if (dev->mei_state == MEI_RECOVERING_FROM_RESET) { | 280 | if (dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) { |
| 262 | dev->need_reset = true; | 281 | dev->need_reset = true; |
| 263 | return; | 282 | return; |
| 264 | } | 283 | } |
| 265 | 284 | ||
| 266 | unexpected = (dev->mei_state != MEI_INITIALIZING && | 285 | unexpected = (dev->dev_state != MEI_DEV_INITIALIZING && |
| 267 | dev->mei_state != MEI_DISABLED && | 286 | dev->dev_state != MEI_DEV_DISABLED && |
| 268 | dev->mei_state != MEI_POWER_DOWN && | 287 | dev->dev_state != MEI_DEV_POWER_DOWN && |
| 269 | dev->mei_state != MEI_POWER_UP); | 288 | dev->dev_state != MEI_DEV_POWER_UP); |
| 270 | 289 | ||
| 271 | dev->host_hw_state = mei_hcsr_read(dev); | 290 | dev->host_hw_state = mei_hcsr_read(dev); |
| 272 | 291 | ||
| @@ -285,10 +304,10 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
| 285 | 304 | ||
| 286 | dev->need_reset = false; | 305 | dev->need_reset = false; |
| 287 | 306 | ||
| 288 | if (dev->mei_state != MEI_INITIALIZING) { | 307 | if (dev->dev_state != MEI_DEV_INITIALIZING) { |
| 289 | if (dev->mei_state != MEI_DISABLED && | 308 | if (dev->dev_state != MEI_DEV_DISABLED && |
| 290 | dev->mei_state != MEI_POWER_DOWN) | 309 | dev->dev_state != MEI_DEV_POWER_DOWN) |
| 291 | dev->mei_state = MEI_RESETING; | 310 | dev->dev_state = MEI_DEV_RESETING; |
| 292 | 311 | ||
| 293 | list_for_each_entry_safe(cl_pos, | 312 | list_for_each_entry_safe(cl_pos, |
| 294 | cl_next, &dev->file_list, link) { | 313 | cl_next, &dev->file_list, link) { |
| @@ -311,7 +330,6 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
| 311 | 330 | ||
| 312 | dev->me_clients_num = 0; | 331 | dev->me_clients_num = 0; |
| 313 | dev->rd_msg_hdr = 0; | 332 | dev->rd_msg_hdr = 0; |
| 314 | dev->stop = false; | ||
| 315 | dev->wd_pending = false; | 333 | dev->wd_pending = false; |
| 316 | 334 | ||
| 317 | /* update the state of the registers after reset */ | 335 | /* update the state of the registers after reset */ |
| @@ -322,7 +340,8 @@ void mei_reset(struct mei_device *dev, int interrupts_enabled) | |||
| 322 | dev->host_hw_state, dev->me_hw_state); | 340 | dev->host_hw_state, dev->me_hw_state); |
| 323 | 341 | ||
| 324 | if (unexpected) | 342 | if (unexpected) |
| 325 | dev_warn(&dev->pdev->dev, "unexpected reset.\n"); | 343 | dev_warn(&dev->pdev->dev, "unexpected reset: dev_state = %s\n", |
| 344 | mei_dev_state_str(dev->dev_state)); | ||
| 326 | 345 | ||
| 327 | /* Wake up all readings so they can be interrupted */ | 346 | /* Wake up all readings so they can be interrupted */ |
| 328 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { | 347 | list_for_each_entry_safe(cl_pos, cl_next, &dev->file_list, link) { |
| @@ -371,7 +390,7 @@ void mei_host_start_message(struct mei_device *dev) | |||
| 371 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_start_req, | 390 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_start_req, |
| 372 | mei_hdr->length)) { | 391 | mei_hdr->length)) { |
| 373 | dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n"); | 392 | dev_dbg(&dev->pdev->dev, "write send version message to FW fail.\n"); |
| 374 | dev->mei_state = MEI_RESETING; | 393 | dev->dev_state = MEI_DEV_RESETING; |
| 375 | mei_reset(dev, 1); | 394 | mei_reset(dev, 1); |
| 376 | } | 395 | } |
| 377 | dev->init_clients_state = MEI_START_MESSAGE; | 396 | dev->init_clients_state = MEI_START_MESSAGE; |
| @@ -403,7 +422,7 @@ void mei_host_enum_clients_message(struct mei_device *dev) | |||
| 403 | host_enum_req->hbm_cmd = HOST_ENUM_REQ_CMD; | 422 | host_enum_req->hbm_cmd = HOST_ENUM_REQ_CMD; |
| 404 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_enum_req, | 423 | if (mei_write_message(dev, mei_hdr, (unsigned char *)host_enum_req, |
| 405 | mei_hdr->length)) { | 424 | mei_hdr->length)) { |
| 406 | dev->mei_state = MEI_RESETING; | 425 | dev->dev_state = MEI_DEV_RESETING; |
| 407 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); | 426 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); |
| 408 | mei_reset(dev, 1); | 427 | mei_reset(dev, 1); |
| 409 | } | 428 | } |
| @@ -444,7 +463,7 @@ void mei_allocate_me_clients_storage(struct mei_device *dev) | |||
| 444 | sizeof(struct mei_me_client), GFP_KERNEL); | 463 | sizeof(struct mei_me_client), GFP_KERNEL); |
| 445 | if (!clients) { | 464 | if (!clients) { |
| 446 | dev_dbg(&dev->pdev->dev, "memory allocation for ME clients failed.\n"); | 465 | dev_dbg(&dev->pdev->dev, "memory allocation for ME clients failed.\n"); |
| 447 | dev->mei_state = MEI_RESETING; | 466 | dev->dev_state = MEI_DEV_RESETING; |
| 448 | mei_reset(dev, 1); | 467 | mei_reset(dev, 1); |
| 449 | return ; | 468 | return ; |
| 450 | } | 469 | } |
| @@ -490,7 +509,7 @@ int mei_host_client_properties(struct mei_device *dev) | |||
| 490 | if (mei_write_message(dev, mei_header, | 509 | if (mei_write_message(dev, mei_header, |
| 491 | (unsigned char *)host_cli_req, | 510 | (unsigned char *)host_cli_req, |
| 492 | mei_header->length)) { | 511 | mei_header->length)) { |
| 493 | dev->mei_state = MEI_RESETING; | 512 | dev->dev_state = MEI_DEV_RESETING; |
| 494 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); | 513 | dev_dbg(&dev->pdev->dev, "write send enumeration request message to FW fail.\n"); |
| 495 | mei_reset(dev, 1); | 514 | mei_reset(dev, 1); |
| 496 | return -EIO; | 515 | return -EIO; |
| @@ -522,12 +541,12 @@ void mei_cl_init(struct mei_cl *priv, struct mei_device *dev) | |||
| 522 | priv->dev = dev; | 541 | priv->dev = dev; |
| 523 | } | 542 | } |
| 524 | 543 | ||
| 525 | int mei_find_me_client_index(const struct mei_device *dev, uuid_le cuuid) | 544 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid) |
| 526 | { | 545 | { |
| 527 | int i, res = -1; | 546 | int i, res = -ENOENT; |
| 528 | 547 | ||
| 529 | for (i = 0; i < dev->me_clients_num; ++i) | 548 | for (i = 0; i < dev->me_clients_num; ++i) |
| 530 | if (uuid_le_cmp(cuuid, | 549 | if (uuid_le_cmp(*cuuid, |
| 531 | dev->me_clients[i].props.protocol_name) == 0) { | 550 | dev->me_clients[i].props.protocol_name) == 0) { |
| 532 | res = i; | 551 | res = i; |
| 533 | break; | 552 | break; |
| @@ -538,35 +557,35 @@ int mei_find_me_client_index(const struct mei_device *dev, uuid_le cuuid) | |||
| 538 | 557 | ||
| 539 | 558 | ||
| 540 | /** | 559 | /** |
| 541 | * mei_find_me_client_update_filext - searches for ME client guid | 560 | * mei_me_cl_update_filext - searches for ME client guid |
| 542 | * sets client_id in mei_file_private if found | 561 | * sets client_id in mei_file_private if found |
| 543 | * @dev: the device structure | 562 | * @dev: the device structure |
| 544 | * @priv: private file structure to set client_id in | 563 | * @cl: private file structure to set client_id in |
| 545 | * @cguid: searched guid of ME client | 564 | * @cuuid: searched uuid of ME client |
| 546 | * @client_id: id of host client to be set in file private structure | 565 | * @client_id: id of host client to be set in file private structure |
| 547 | * | 566 | * |
| 548 | * returns ME client index | 567 | * returns ME client index |
| 549 | */ | 568 | */ |
| 550 | u8 mei_find_me_client_update_filext(struct mei_device *dev, struct mei_cl *priv, | 569 | int mei_me_cl_update_filext(struct mei_device *dev, struct mei_cl *cl, |
| 551 | const uuid_le *cguid, u8 client_id) | 570 | const uuid_le *cuuid, u8 host_cl_id) |
| 552 | { | 571 | { |
| 553 | int i; | 572 | int i; |
| 554 | 573 | ||
| 555 | if (!dev || !priv || !cguid) | 574 | if (!dev || !cl || !cuuid) |
| 556 | return 0; | 575 | return -EINVAL; |
| 557 | 576 | ||
| 558 | /* check for valid client id */ | 577 | /* check for valid client id */ |
| 559 | i = mei_find_me_client_index(dev, *cguid); | 578 | i = mei_me_cl_by_uuid(dev, cuuid); |
| 560 | if (i >= 0) { | 579 | if (i >= 0) { |
| 561 | priv->me_client_id = dev->me_clients[i].client_id; | 580 | cl->me_client_id = dev->me_clients[i].client_id; |
| 562 | priv->state = MEI_FILE_CONNECTING; | 581 | cl->state = MEI_FILE_CONNECTING; |
| 563 | priv->host_client_id = client_id; | 582 | cl->host_client_id = host_cl_id; |
| 564 | 583 | ||
| 565 | list_add_tail(&priv->link, &dev->file_list); | 584 | list_add_tail(&cl->link, &dev->file_list); |
| 566 | return (u8)i; | 585 | return (u8)i; |
| 567 | } | 586 | } |
| 568 | 587 | ||
| 569 | return 0; | 588 | return -ENOENT; |
| 570 | } | 589 | } |
| 571 | 590 | ||
| 572 | /** | 591 | /** |
| @@ -577,16 +596,16 @@ u8 mei_find_me_client_update_filext(struct mei_device *dev, struct mei_cl *priv, | |||
| 577 | */ | 596 | */ |
| 578 | void mei_host_init_iamthif(struct mei_device *dev) | 597 | void mei_host_init_iamthif(struct mei_device *dev) |
| 579 | { | 598 | { |
| 580 | u8 i; | 599 | int i; |
| 581 | unsigned char *msg_buf; | 600 | unsigned char *msg_buf; |
| 582 | 601 | ||
| 583 | mei_cl_init(&dev->iamthif_cl, dev); | 602 | mei_cl_init(&dev->iamthif_cl, dev); |
| 584 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTED; | 603 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTED; |
| 585 | 604 | ||
| 586 | /* find ME amthi client */ | 605 | /* find ME amthi client */ |
| 587 | i = mei_find_me_client_update_filext(dev, &dev->iamthif_cl, | 606 | i = mei_me_cl_update_filext(dev, &dev->iamthif_cl, |
| 588 | &mei_amthi_guid, MEI_IAMTHIF_HOST_CLIENT_ID); | 607 | &mei_amthi_guid, MEI_IAMTHIF_HOST_CLIENT_ID); |
| 589 | if (dev->iamthif_cl.state != MEI_FILE_CONNECTING) { | 608 | if (i < 0) { |
| 590 | dev_dbg(&dev->pdev->dev, "failed to find iamthif client.\n"); | 609 | dev_dbg(&dev->pdev->dev, "failed to find iamthif client.\n"); |
| 591 | return; | 610 | return; |
| 592 | } | 611 | } |
diff --git a/drivers/misc/mei/interface.h b/drivers/misc/mei/interface.h index fb5c7db4723b..ec6c785a3961 100644 --- a/drivers/misc/mei/interface.h +++ b/drivers/misc/mei/interface.h | |||
| @@ -23,14 +23,6 @@ | |||
| 23 | #include "mei_dev.h" | 23 | #include "mei_dev.h" |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | #define AMT_WD_DEFAULT_TIMEOUT 120 /* seconds */ | ||
| 27 | #define AMT_WD_MIN_TIMEOUT 120 /* seconds */ | ||
| 28 | #define AMT_WD_MAX_TIMEOUT 65535 /* seconds */ | ||
| 29 | |||
| 30 | #define MEI_WATCHDOG_DATA_SIZE 16 | ||
| 31 | #define MEI_START_WD_DATA_SIZE 20 | ||
| 32 | #define MEI_WD_PARAMS_SIZE 4 | ||
| 33 | |||
| 34 | 26 | ||
| 35 | void mei_read_slots(struct mei_device *dev, | 27 | void mei_read_slots(struct mei_device *dev, |
| 36 | unsigned char *buffer, | 28 | unsigned char *buffer, |
| @@ -64,7 +56,7 @@ int mei_flow_ctrl_creds(struct mei_device *dev, struct mei_cl *cl); | |||
| 64 | 56 | ||
| 65 | 57 | ||
| 66 | int mei_wd_send(struct mei_device *dev); | 58 | int mei_wd_send(struct mei_device *dev); |
| 67 | int mei_wd_stop(struct mei_device *dev, bool preserve); | 59 | int mei_wd_stop(struct mei_device *dev); |
| 68 | int mei_wd_host_init(struct mei_device *dev); | 60 | int mei_wd_host_init(struct mei_device *dev); |
| 69 | /* | 61 | /* |
| 70 | * mei_watchdog_register - Registering watchdog interface | 62 | * mei_watchdog_register - Registering watchdog interface |
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index d78c05e693f7..3533edde04a5 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
| @@ -221,17 +221,10 @@ static int mei_irq_thread_read_client_message(struct mei_io_list *complete_list, | |||
| 221 | cl->status = 0; | 221 | cl->status = 0; |
| 222 | list_del(&cb_pos->cb_list); | 222 | list_del(&cb_pos->cb_list); |
| 223 | dev_dbg(&dev->pdev->dev, | 223 | dev_dbg(&dev->pdev->dev, |
| 224 | "completed read host client = %d," | 224 | "completed read H cl = %d, ME cl = %d, length = %lu\n", |
| 225 | "ME client = %d, " | ||
| 226 | "data length = %lu\n", | ||
| 227 | cl->host_client_id, | 225 | cl->host_client_id, |
| 228 | cl->me_client_id, | 226 | cl->me_client_id, |
| 229 | cb_pos->information); | 227 | cb_pos->information); |
| 230 | |||
| 231 | *(cb_pos->response_buffer.data + | ||
| 232 | cb_pos->information) = '\0'; | ||
| 233 | dev_dbg(&dev->pdev->dev, "cb_pos->res_buffer - %s\n", | ||
| 234 | cb_pos->response_buffer.data); | ||
| 235 | list_add_tail(&cb_pos->cb_list, | 228 | list_add_tail(&cb_pos->cb_list, |
| 236 | &complete_list->mei_cb.cb_list); | 229 | &complete_list->mei_cb.cb_list); |
| 237 | } | 230 | } |
| @@ -633,7 +626,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
| 633 | if (version_res->host_version_supported) { | 626 | if (version_res->host_version_supported) { |
| 634 | dev->version.major_version = HBM_MAJOR_VERSION; | 627 | dev->version.major_version = HBM_MAJOR_VERSION; |
| 635 | dev->version.minor_version = HBM_MINOR_VERSION; | 628 | dev->version.minor_version = HBM_MINOR_VERSION; |
| 636 | if (dev->mei_state == MEI_INIT_CLIENTS && | 629 | if (dev->dev_state == MEI_DEV_INIT_CLIENTS && |
| 637 | dev->init_clients_state == MEI_START_MESSAGE) { | 630 | dev->init_clients_state == MEI_START_MESSAGE) { |
| 638 | dev->init_clients_timer = 0; | 631 | dev->init_clients_timer = 0; |
| 639 | mei_host_enum_clients_message(dev); | 632 | mei_host_enum_clients_message(dev); |
| @@ -707,7 +700,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
| 707 | dev->me_clients[dev->me_client_presentation_num].props | 700 | dev->me_clients[dev->me_client_presentation_num].props |
| 708 | = props_res->client_properties; | 701 | = props_res->client_properties; |
| 709 | 702 | ||
| 710 | if (dev->mei_state == MEI_INIT_CLIENTS && | 703 | if (dev->dev_state == MEI_DEV_INIT_CLIENTS && |
| 711 | dev->init_clients_state == | 704 | dev->init_clients_state == |
| 712 | MEI_CLIENT_PROPERTIES_MESSAGE) { | 705 | MEI_CLIENT_PROPERTIES_MESSAGE) { |
| 713 | dev->me_client_index++; | 706 | dev->me_client_index++; |
| @@ -734,7 +727,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
| 734 | * Client ID 2 - Reserved for AMTHI | 727 | * Client ID 2 - Reserved for AMTHI |
| 735 | */ | 728 | */ |
| 736 | bitmap_set(dev->host_clients_map, 0, 3); | 729 | bitmap_set(dev->host_clients_map, 0, 3); |
| 737 | dev->mei_state = MEI_ENABLED; | 730 | dev->dev_state = MEI_DEV_ENABLED; |
| 738 | 731 | ||
| 739 | /* if wd initialization fails, initialization the AMTHI client, | 732 | /* if wd initialization fails, initialization the AMTHI client, |
| 740 | * otherwise the AMTHI client will be initialized after the WD client connect response | 733 | * otherwise the AMTHI client will be initialized after the WD client connect response |
| @@ -759,7 +752,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
| 759 | case HOST_ENUM_RES_CMD: | 752 | case HOST_ENUM_RES_CMD: |
| 760 | enum_res = (struct hbm_host_enum_response *) mei_msg; | 753 | enum_res = (struct hbm_host_enum_response *) mei_msg; |
| 761 | memcpy(dev->me_clients_map, enum_res->valid_addresses, 32); | 754 | memcpy(dev->me_clients_map, enum_res->valid_addresses, 32); |
| 762 | if (dev->mei_state == MEI_INIT_CLIENTS && | 755 | if (dev->dev_state == MEI_DEV_INIT_CLIENTS && |
| 763 | dev->init_clients_state == MEI_ENUM_CLIENTS_MESSAGE) { | 756 | dev->init_clients_state == MEI_ENUM_CLIENTS_MESSAGE) { |
| 764 | dev->init_clients_timer = 0; | 757 | dev->init_clients_timer = 0; |
| 765 | dev->me_client_presentation_num = 0; | 758 | dev->me_client_presentation_num = 0; |
| @@ -776,7 +769,7 @@ static void mei_irq_thread_read_bus_message(struct mei_device *dev, | |||
| 776 | break; | 769 | break; |
| 777 | 770 | ||
| 778 | case HOST_STOP_RES_CMD: | 771 | case HOST_STOP_RES_CMD: |
| 779 | dev->mei_state = MEI_DISABLED; | 772 | dev->dev_state = MEI_DEV_DISABLED; |
| 780 | dev_dbg(&dev->pdev->dev, "resetting because of FW stop response.\n"); | 773 | dev_dbg(&dev->pdev->dev, "resetting because of FW stop response.\n"); |
| 781 | mei_reset(dev, 1); | 774 | mei_reset(dev, 1); |
| 782 | break; | 775 | break; |
| @@ -1224,10 +1217,9 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list, | |||
| 1224 | } | 1217 | } |
| 1225 | } | 1218 | } |
| 1226 | 1219 | ||
| 1227 | if (dev->stop && !dev->wd_pending) { | 1220 | if (dev->wd_state == MEI_WD_STOPPING) { |
| 1228 | dev->wd_stopped = true; | 1221 | dev->wd_state = MEI_WD_IDLE; |
| 1229 | wake_up_interruptible(&dev->wait_stop_wd); | 1222 | wake_up_interruptible(&dev->wait_stop_wd); |
| 1230 | return 0; | ||
| 1231 | } | 1223 | } |
| 1232 | 1224 | ||
| 1233 | if (dev->extra_write_index) { | 1225 | if (dev->extra_write_index) { |
| @@ -1240,7 +1232,7 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list, | |||
| 1240 | *slots -= dev->extra_write_index; | 1232 | *slots -= dev->extra_write_index; |
| 1241 | dev->extra_write_index = 0; | 1233 | dev->extra_write_index = 0; |
| 1242 | } | 1234 | } |
| 1243 | if (dev->mei_state == MEI_ENABLED) { | 1235 | if (dev->dev_state == MEI_DEV_ENABLED) { |
| 1244 | if (dev->wd_pending && | 1236 | if (dev->wd_pending && |
| 1245 | mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) { | 1237 | mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) { |
| 1246 | if (mei_wd_send(dev)) | 1238 | if (mei_wd_send(dev)) |
| @@ -1250,14 +1242,12 @@ static int mei_irq_thread_write_handler(struct mei_io_list *cmpl_list, | |||
| 1250 | 1242 | ||
| 1251 | dev->wd_pending = false; | 1243 | dev->wd_pending = false; |
| 1252 | 1244 | ||
| 1253 | if (dev->wd_timeout) | 1245 | if (dev->wd_state == MEI_WD_RUNNING) |
| 1254 | *slots -= mei_data2slots(MEI_START_WD_DATA_SIZE); | 1246 | *slots -= mei_data2slots(MEI_WD_START_MSG_SIZE); |
| 1255 | else | 1247 | else |
| 1256 | *slots -= mei_data2slots(MEI_WD_PARAMS_SIZE); | 1248 | *slots -= mei_data2slots(MEI_WD_STOP_MSG_SIZE); |
| 1257 | } | 1249 | } |
| 1258 | } | 1250 | } |
| 1259 | if (dev->stop) | ||
| 1260 | return -ENODEV; | ||
| 1261 | 1251 | ||
| 1262 | /* complete control write list CB */ | 1252 | /* complete control write list CB */ |
| 1263 | dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); | 1253 | dev_dbg(&dev->pdev->dev, "complete control write list cb.\n"); |
| @@ -1361,8 +1351,8 @@ void mei_timer(struct work_struct *work) | |||
| 1361 | 1351 | ||
| 1362 | 1352 | ||
| 1363 | mutex_lock(&dev->device_lock); | 1353 | mutex_lock(&dev->device_lock); |
| 1364 | if (dev->mei_state != MEI_ENABLED) { | 1354 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 1365 | if (dev->mei_state == MEI_INIT_CLIENTS) { | 1355 | if (dev->dev_state == MEI_DEV_INIT_CLIENTS) { |
| 1366 | if (dev->init_clients_timer) { | 1356 | if (dev->init_clients_timer) { |
| 1367 | if (--dev->init_clients_timer == 0) { | 1357 | if (--dev->init_clients_timer == 0) { |
| 1368 | dev_dbg(&dev->pdev->dev, "IMEI reset due to init clients timeout ,init clients state = %d.\n", | 1358 | dev_dbg(&dev->pdev->dev, "IMEI reset due to init clients timeout ,init clients state = %d.\n", |
| @@ -1484,8 +1474,8 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id) | |||
| 1484 | 1474 | ||
| 1485 | /* check if ME wants a reset */ | 1475 | /* check if ME wants a reset */ |
| 1486 | if ((dev->me_hw_state & ME_RDY_HRA) == 0 && | 1476 | if ((dev->me_hw_state & ME_RDY_HRA) == 0 && |
| 1487 | dev->mei_state != MEI_RESETING && | 1477 | dev->dev_state != MEI_DEV_RESETING && |
| 1488 | dev->mei_state != MEI_INITIALIZING) { | 1478 | dev->dev_state != MEI_DEV_INITIALIZING) { |
| 1489 | dev_dbg(&dev->pdev->dev, "FW not ready.\n"); | 1479 | dev_dbg(&dev->pdev->dev, "FW not ready.\n"); |
| 1490 | mei_reset(dev, 1); | 1480 | mei_reset(dev, 1); |
| 1491 | mutex_unlock(&dev->device_lock); | 1481 | mutex_unlock(&dev->device_lock); |
| @@ -1498,7 +1488,7 @@ irqreturn_t mei_interrupt_thread_handler(int irq, void *dev_id) | |||
| 1498 | dev_dbg(&dev->pdev->dev, "we need to start the dev.\n"); | 1488 | dev_dbg(&dev->pdev->dev, "we need to start the dev.\n"); |
| 1499 | dev->host_hw_state |= (H_IE | H_IG | H_RDY); | 1489 | dev->host_hw_state |= (H_IE | H_IG | H_RDY); |
| 1500 | mei_hcsr_set(dev); | 1490 | mei_hcsr_set(dev); |
| 1501 | dev->mei_state = MEI_INIT_CLIENTS; | 1491 | dev->dev_state = MEI_DEV_INIT_CLIENTS; |
| 1502 | dev_dbg(&dev->pdev->dev, "link is established start sending messages.\n"); | 1492 | dev_dbg(&dev->pdev->dev, "link is established start sending messages.\n"); |
| 1503 | /* link is established | 1493 | /* link is established |
| 1504 | * start sending messages. | 1494 | * start sending messages. |
diff --git a/drivers/misc/mei/iorw.c b/drivers/misc/mei/iorw.c index 50f52e21f587..fcba98eb892e 100644 --- a/drivers/misc/mei/iorw.c +++ b/drivers/misc/mei/iorw.c | |||
| @@ -38,7 +38,31 @@ | |||
| 38 | #include <linux/mei.h> | 38 | #include <linux/mei.h> |
| 39 | #include "interface.h" | 39 | #include "interface.h" |
| 40 | 40 | ||
| 41 | /** | ||
| 42 | * mei_me_cl_by_id return index to me_clients for client_id | ||
| 43 | * | ||
| 44 | * @dev: the device structure | ||
| 45 | * @client_id: me client id | ||
| 46 | * | ||
| 47 | * Locking: called under "dev->device_lock" lock | ||
| 48 | * | ||
| 49 | * returns index on success, -ENOENT on failure. | ||
| 50 | */ | ||
| 41 | 51 | ||
| 52 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id) | ||
| 53 | { | ||
| 54 | int i; | ||
| 55 | for (i = 0; i < dev->me_clients_num; i++) | ||
| 56 | if (dev->me_clients[i].client_id == client_id) | ||
| 57 | break; | ||
| 58 | if (WARN_ON(dev->me_clients[i].client_id != client_id)) | ||
| 59 | return -ENOENT; | ||
| 60 | |||
| 61 | if (i == dev->me_clients_num) | ||
| 62 | return -ENOENT; | ||
| 63 | |||
| 64 | return i; | ||
| 65 | } | ||
| 42 | 66 | ||
| 43 | /** | 67 | /** |
| 44 | * mei_ioctl_connect_client - the connect to fw client IOCTL function | 68 | * mei_ioctl_connect_client - the connect to fw client IOCTL function |
| @@ -84,7 +108,7 @@ int mei_ioctl_connect_client(struct file *file, | |||
| 84 | 108 | ||
| 85 | cb->major_file_operations = MEI_IOCTL; | 109 | cb->major_file_operations = MEI_IOCTL; |
| 86 | 110 | ||
| 87 | if (dev->mei_state != MEI_ENABLED) { | 111 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 88 | rets = -ENODEV; | 112 | rets = -ENODEV; |
| 89 | goto end; | 113 | goto end; |
| 90 | } | 114 | } |
| @@ -95,7 +119,7 @@ int mei_ioctl_connect_client(struct file *file, | |||
| 95 | } | 119 | } |
| 96 | 120 | ||
| 97 | /* find ME client we're trying to connect to */ | 121 | /* find ME client we're trying to connect to */ |
| 98 | i = mei_find_me_client_index(dev, data->in_client_uuid); | 122 | i = mei_me_cl_by_uuid(dev, &data->in_client_uuid); |
| 99 | if (i >= 0 && !dev->me_clients[i].props.fixed_address) { | 123 | if (i >= 0 && !dev->me_clients[i].props.fixed_address) { |
| 100 | cl->me_client_id = dev->me_clients[i].client_id; | 124 | cl->me_client_id = dev->me_clients[i].client_id; |
| 101 | cl->state = MEI_FILE_CONNECTING; | 125 | cl->state = MEI_FILE_CONNECTING; |
| @@ -273,19 +297,12 @@ int amthi_read(struct mei_device *dev, struct file *file, | |||
| 273 | return -ETIMEDOUT; | 297 | return -ETIMEDOUT; |
| 274 | } | 298 | } |
| 275 | 299 | ||
| 276 | for (i = 0; i < dev->me_clients_num; i++) { | 300 | i = mei_me_cl_by_id(dev, dev->iamthif_cl.me_client_id); |
| 277 | if (dev->me_clients[i].client_id == | ||
| 278 | dev->iamthif_cl.me_client_id) | ||
| 279 | break; | ||
| 280 | } | ||
| 281 | 301 | ||
| 282 | if (i == dev->me_clients_num) { | 302 | if (i < 0) { |
| 283 | dev_dbg(&dev->pdev->dev, "amthi client not found.\n"); | 303 | dev_dbg(&dev->pdev->dev, "amthi client not found.\n"); |
| 284 | return -ENODEV; | 304 | return -ENODEV; |
| 285 | } | 305 | } |
| 286 | if (WARN_ON(dev->me_clients[i].client_id != cl->me_client_id)) | ||
| 287 | return -ENODEV; | ||
| 288 | |||
| 289 | dev_dbg(&dev->pdev->dev, "checking amthi data\n"); | 306 | dev_dbg(&dev->pdev->dev, "checking amthi data\n"); |
| 290 | cb = find_amthi_read_list_entry(dev, file); | 307 | cb = find_amthi_read_list_entry(dev, file); |
| 291 | 308 | ||
| @@ -316,8 +333,7 @@ int amthi_read(struct mei_device *dev, struct file *file, | |||
| 316 | dev->iamthif_timer = 0; | 333 | dev->iamthif_timer = 0; |
| 317 | 334 | ||
| 318 | if (cb) { | 335 | if (cb) { |
| 319 | timeout = cb->read_time + | 336 | timeout = cb->read_time + msecs_to_jiffies(IAMTHIF_READ_TIMER); |
| 320 | msecs_to_jiffies(IAMTHIF_READ_TIMER); | ||
| 321 | dev_dbg(&dev->pdev->dev, "amthi timeout = %lud\n", | 337 | dev_dbg(&dev->pdev->dev, "amthi timeout = %lud\n", |
| 322 | timeout); | 338 | timeout); |
| 323 | 339 | ||
| @@ -386,7 +402,7 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl) | |||
| 386 | if (cl->state != MEI_FILE_CONNECTED) | 402 | if (cl->state != MEI_FILE_CONNECTED) |
| 387 | return -ENODEV; | 403 | return -ENODEV; |
| 388 | 404 | ||
| 389 | if (dev->mei_state != MEI_ENABLED) | 405 | if (dev->dev_state != MEI_DEV_ENABLED) |
| 390 | return -ENODEV; | 406 | return -ENODEV; |
| 391 | 407 | ||
| 392 | dev_dbg(&dev->pdev->dev, "check if read is pending.\n"); | 408 | dev_dbg(&dev->pdev->dev, "check if read is pending.\n"); |
| @@ -401,19 +417,8 @@ int mei_start_read(struct mei_device *dev, struct mei_cl *cl) | |||
| 401 | 417 | ||
| 402 | dev_dbg(&dev->pdev->dev, "allocation call back successful. host client = %d, ME client = %d\n", | 418 | dev_dbg(&dev->pdev->dev, "allocation call back successful. host client = %d, ME client = %d\n", |
| 403 | cl->host_client_id, cl->me_client_id); | 419 | cl->host_client_id, cl->me_client_id); |
| 404 | 420 | i = mei_me_cl_by_id(dev, cl->me_client_id); | |
| 405 | for (i = 0; i < dev->me_clients_num; i++) { | 421 | if (i < 0) { |
| 406 | if (dev->me_clients[i].client_id == cl->me_client_id) | ||
| 407 | break; | ||
| 408 | |||
| 409 | } | ||
| 410 | |||
| 411 | if (WARN_ON(dev->me_clients[i].client_id != cl->me_client_id)) { | ||
| 412 | rets = -ENODEV; | ||
| 413 | goto unlock; | ||
| 414 | } | ||
| 415 | |||
| 416 | if (i == dev->me_clients_num) { | ||
| 417 | rets = -ENODEV; | 422 | rets = -ENODEV; |
| 418 | goto unlock; | 423 | goto unlock; |
| 419 | } | 424 | } |
diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c index 7422c7652845..e8b0858132c1 100644 --- a/drivers/misc/mei/main.c +++ b/drivers/misc/mei/main.c | |||
| @@ -41,11 +41,8 @@ | |||
| 41 | #include <linux/mei.h> | 41 | #include <linux/mei.h> |
| 42 | #include "interface.h" | 42 | #include "interface.h" |
| 43 | 43 | ||
| 44 | static const char mei_driver_name[] = "mei"; | 44 | /* AMT device is a singleton on the platform */ |
| 45 | 45 | static struct pci_dev *mei_pdev; | |
| 46 | /* The device pointer */ | ||
| 47 | /* Currently this driver works as long as there is only a single AMT device. */ | ||
| 48 | struct pci_dev *mei_device; | ||
| 49 | 46 | ||
| 50 | /* mei_pci_tbl - PCI Device ID Table */ | 47 | /* mei_pci_tbl - PCI Device ID Table */ |
| 51 | static DEFINE_PCI_DEVICE_TABLE(mei_pci_tbl) = { | 48 | static DEFINE_PCI_DEVICE_TABLE(mei_pci_tbl) = { |
| @@ -80,6 +77,8 @@ static DEFINE_PCI_DEVICE_TABLE(mei_pci_tbl) = { | |||
| 80 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_1)}, | 77 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_1)}, |
| 81 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_2)}, | 78 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_2)}, |
| 82 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_3)}, | 79 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_PPT_3)}, |
| 80 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT)}, | ||
| 81 | {PCI_DEVICE(PCI_VENDOR_ID_INTEL, MEI_DEV_ID_LPT_LP)}, | ||
| 83 | 82 | ||
| 84 | /* required last entry */ | 83 | /* required last entry */ |
| 85 | {0, } | 84 | {0, } |
| @@ -220,10 +219,10 @@ static int mei_open(struct inode *inode, struct file *file) | |||
| 220 | int err; | 219 | int err; |
| 221 | 220 | ||
| 222 | err = -ENODEV; | 221 | err = -ENODEV; |
| 223 | if (!mei_device) | 222 | if (!mei_pdev) |
| 224 | goto out; | 223 | goto out; |
| 225 | 224 | ||
| 226 | dev = pci_get_drvdata(mei_device); | 225 | dev = pci_get_drvdata(mei_pdev); |
| 227 | if (!dev) | 226 | if (!dev) |
| 228 | goto out; | 227 | goto out; |
| 229 | 228 | ||
| @@ -234,18 +233,24 @@ static int mei_open(struct inode *inode, struct file *file) | |||
| 234 | goto out_unlock; | 233 | goto out_unlock; |
| 235 | 234 | ||
| 236 | err = -ENODEV; | 235 | err = -ENODEV; |
| 237 | if (dev->mei_state != MEI_ENABLED) { | 236 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 238 | dev_dbg(&dev->pdev->dev, "mei_state != MEI_ENABLED mei_state= %d\n", | 237 | dev_dbg(&dev->pdev->dev, "dev_state != MEI_ENABLED dev_state = %s\n", |
| 239 | dev->mei_state); | 238 | mei_dev_state_str(dev->dev_state)); |
| 240 | goto out_unlock; | 239 | goto out_unlock; |
| 241 | } | 240 | } |
| 242 | err = -EMFILE; | 241 | err = -EMFILE; |
| 243 | if (dev->open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT) | 242 | if (dev->open_handle_count >= MEI_MAX_OPEN_HANDLE_COUNT) { |
| 243 | dev_err(&dev->pdev->dev, "open_handle_count exceded %d", | ||
| 244 | MEI_MAX_OPEN_HANDLE_COUNT); | ||
| 244 | goto out_unlock; | 245 | goto out_unlock; |
| 246 | } | ||
| 245 | 247 | ||
| 246 | cl_id = find_first_zero_bit(dev->host_clients_map, MEI_CLIENTS_MAX); | 248 | cl_id = find_first_zero_bit(dev->host_clients_map, MEI_CLIENTS_MAX); |
| 247 | if (cl_id >= MEI_CLIENTS_MAX) | 249 | if (cl_id >= MEI_CLIENTS_MAX) { |
| 250 | dev_err(&dev->pdev->dev, "client_id exceded %d", | ||
| 251 | MEI_CLIENTS_MAX) ; | ||
| 248 | goto out_unlock; | 252 | goto out_unlock; |
| 253 | } | ||
| 249 | 254 | ||
| 250 | cl->host_client_id = cl_id; | 255 | cl->host_client_id = cl_id; |
| 251 | 256 | ||
| @@ -386,17 +391,16 @@ static ssize_t mei_read(struct file *file, char __user *ubuf, | |||
| 386 | dev = cl->dev; | 391 | dev = cl->dev; |
| 387 | 392 | ||
| 388 | mutex_lock(&dev->device_lock); | 393 | mutex_lock(&dev->device_lock); |
| 389 | if (dev->mei_state != MEI_ENABLED) { | 394 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 390 | rets = -ENODEV; | 395 | rets = -ENODEV; |
| 391 | goto out; | 396 | goto out; |
| 392 | } | 397 | } |
| 393 | 398 | ||
| 394 | if ((cl->sm_state & MEI_WD_STATE_INDEPENDENCE_MSG_SENT) == 0) { | 399 | if ((cl->sm_state & MEI_WD_STATE_INDEPENDENCE_MSG_SENT) == 0) { |
| 395 | /* Do not allow to read watchdog client */ | 400 | /* Do not allow to read watchdog client */ |
| 396 | i = mei_find_me_client_index(dev, mei_wd_guid); | 401 | i = mei_me_cl_by_uuid(dev, &mei_wd_guid); |
| 397 | if (i >= 0) { | 402 | if (i >= 0) { |
| 398 | struct mei_me_client *me_client = &dev->me_clients[i]; | 403 | struct mei_me_client *me_client = &dev->me_clients[i]; |
| 399 | |||
| 400 | if (cl->me_client_id == me_client->client_id) { | 404 | if (cl->me_client_id == me_client->client_id) { |
| 401 | rets = -EBADF; | 405 | rets = -EBADF; |
| 402 | goto out; | 406 | goto out; |
| @@ -541,7 +545,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
| 541 | 545 | ||
| 542 | mutex_lock(&dev->device_lock); | 546 | mutex_lock(&dev->device_lock); |
| 543 | 547 | ||
| 544 | if (dev->mei_state != MEI_ENABLED) { | 548 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 545 | mutex_unlock(&dev->device_lock); | 549 | mutex_unlock(&dev->device_lock); |
| 546 | return -ENODEV; | 550 | return -ENODEV; |
| 547 | } | 551 | } |
| @@ -616,26 +620,16 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
| 616 | rets = -ENOMEM; | 620 | rets = -ENOMEM; |
| 617 | goto unlock_dev; | 621 | goto unlock_dev; |
| 618 | } | 622 | } |
| 619 | if (dev->mei_state != MEI_ENABLED) { | 623 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 620 | rets = -ENODEV; | 624 | rets = -ENODEV; |
| 621 | goto unlock_dev; | 625 | goto unlock_dev; |
| 622 | } | 626 | } |
| 623 | for (i = 0; i < dev->me_clients_num; i++) { | 627 | i = mei_me_cl_by_id(dev, dev->iamthif_cl.me_client_id); |
| 624 | if (dev->me_clients[i].client_id == | 628 | if (i < 0) { |
| 625 | dev->iamthif_cl.me_client_id) | ||
| 626 | break; | ||
| 627 | } | ||
| 628 | |||
| 629 | if (WARN_ON(dev->me_clients[i].client_id != cl->me_client_id)) { | ||
| 630 | rets = -ENODEV; | 629 | rets = -ENODEV; |
| 631 | goto unlock_dev; | 630 | goto unlock_dev; |
| 632 | } | 631 | } |
| 633 | if (i == dev->me_clients_num || | 632 | if (length > dev->me_clients[i].props.max_msg_length || |
| 634 | (dev->me_clients[i].client_id != | ||
| 635 | dev->iamthif_cl.me_client_id)) { | ||
| 636 | rets = -ENODEV; | ||
| 637 | goto unlock_dev; | ||
| 638 | } else if (length > dev->me_clients[i].props.max_msg_length || | ||
| 639 | length <= 0) { | 633 | length <= 0) { |
| 640 | rets = -EMSGSIZE; | 634 | rets = -EMSGSIZE; |
| 641 | goto unlock_dev; | 635 | goto unlock_dev; |
| @@ -688,16 +682,8 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf, | |||
| 688 | cl->me_client_id); | 682 | cl->me_client_id); |
| 689 | goto unlock_dev; | 683 | goto unlock_dev; |
| 690 | } | 684 | } |
| 691 | for (i = 0; i < dev->me_clients_num; i++) { | 685 | i = mei_me_cl_by_id(dev, cl->me_client_id); |
| 692 | if (dev->me_clients[i].client_id == | 686 | if (i < 0) { |
| 693 | cl->me_client_id) | ||
| 694 | break; | ||
| 695 | } | ||
| 696 | if (WARN_ON(dev->me_clients[i].client_id != cl->me_client_id)) { | ||
| 697 | rets = -ENODEV; | ||
| 698 | goto unlock_dev; | ||
| 699 | } | ||
| 700 | if (i == dev->me_clients_num) { | ||
| 701 | rets = -ENODEV; | 687 | rets = -ENODEV; |
| 702 | goto unlock_dev; | 688 | goto unlock_dev; |
| 703 | } | 689 | } |
| @@ -790,7 +776,7 @@ static long mei_ioctl(struct file *file, unsigned int cmd, unsigned long data) | |||
| 790 | dev_dbg(&dev->pdev->dev, "IOCTL cmd = 0x%x", cmd); | 776 | dev_dbg(&dev->pdev->dev, "IOCTL cmd = 0x%x", cmd); |
| 791 | 777 | ||
| 792 | mutex_lock(&dev->device_lock); | 778 | mutex_lock(&dev->device_lock); |
| 793 | if (dev->mei_state != MEI_ENABLED) { | 779 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 794 | rets = -ENODEV; | 780 | rets = -ENODEV; |
| 795 | goto out; | 781 | goto out; |
| 796 | } | 782 | } |
| @@ -869,7 +855,7 @@ static unsigned int mei_poll(struct file *file, poll_table *wait) | |||
| 869 | 855 | ||
| 870 | mutex_lock(&dev->device_lock); | 856 | mutex_lock(&dev->device_lock); |
| 871 | 857 | ||
| 872 | if (dev->mei_state != MEI_ENABLED) | 858 | if (dev->dev_state != MEI_DEV_ENABLED) |
| 873 | goto out; | 859 | goto out; |
| 874 | 860 | ||
| 875 | 861 | ||
| @@ -966,7 +952,7 @@ static int __devinit mei_probe(struct pci_dev *pdev, | |||
| 966 | goto end; | 952 | goto end; |
| 967 | } | 953 | } |
| 968 | 954 | ||
| 969 | if (mei_device) { | 955 | if (mei_pdev) { |
| 970 | err = -EEXIST; | 956 | err = -EEXIST; |
| 971 | goto end; | 957 | goto end; |
| 972 | } | 958 | } |
| @@ -979,7 +965,7 @@ static int __devinit mei_probe(struct pci_dev *pdev, | |||
| 979 | /* set PCI host mastering */ | 965 | /* set PCI host mastering */ |
| 980 | pci_set_master(pdev); | 966 | pci_set_master(pdev); |
| 981 | /* pci request regions for mei driver */ | 967 | /* pci request regions for mei driver */ |
| 982 | err = pci_request_regions(pdev, mei_driver_name); | 968 | err = pci_request_regions(pdev, KBUILD_MODNAME); |
| 983 | if (err) { | 969 | if (err) { |
| 984 | dev_err(&pdev->dev, "failed to get pci regions.\n"); | 970 | dev_err(&pdev->dev, "failed to get pci regions.\n"); |
| 985 | goto disable_device; | 971 | goto disable_device; |
| @@ -1004,12 +990,12 @@ static int __devinit mei_probe(struct pci_dev *pdev, | |||
| 1004 | err = request_threaded_irq(pdev->irq, | 990 | err = request_threaded_irq(pdev->irq, |
| 1005 | NULL, | 991 | NULL, |
| 1006 | mei_interrupt_thread_handler, | 992 | mei_interrupt_thread_handler, |
| 1007 | IRQF_ONESHOT, mei_driver_name, dev); | 993 | IRQF_ONESHOT, KBUILD_MODNAME, dev); |
| 1008 | else | 994 | else |
| 1009 | err = request_threaded_irq(pdev->irq, | 995 | err = request_threaded_irq(pdev->irq, |
| 1010 | mei_interrupt_quick_handler, | 996 | mei_interrupt_quick_handler, |
| 1011 | mei_interrupt_thread_handler, | 997 | mei_interrupt_thread_handler, |
| 1012 | IRQF_SHARED, mei_driver_name, dev); | 998 | IRQF_SHARED, KBUILD_MODNAME, dev); |
| 1013 | 999 | ||
| 1014 | if (err) { | 1000 | if (err) { |
| 1015 | dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n", | 1001 | dev_err(&pdev->dev, "request_threaded_irq failure. irq = %d\n", |
| @@ -1027,7 +1013,7 @@ static int __devinit mei_probe(struct pci_dev *pdev, | |||
| 1027 | if (err) | 1013 | if (err) |
| 1028 | goto release_irq; | 1014 | goto release_irq; |
| 1029 | 1015 | ||
| 1030 | mei_device = pdev; | 1016 | mei_pdev = pdev; |
| 1031 | pci_set_drvdata(pdev, dev); | 1017 | pci_set_drvdata(pdev, dev); |
| 1032 | 1018 | ||
| 1033 | 1019 | ||
| @@ -1072,7 +1058,7 @@ static void __devexit mei_remove(struct pci_dev *pdev) | |||
| 1072 | { | 1058 | { |
| 1073 | struct mei_device *dev; | 1059 | struct mei_device *dev; |
| 1074 | 1060 | ||
| 1075 | if (mei_device != pdev) | 1061 | if (mei_pdev != pdev) |
| 1076 | return; | 1062 | return; |
| 1077 | 1063 | ||
| 1078 | dev = pci_get_drvdata(pdev); | 1064 | dev = pci_get_drvdata(pdev); |
| @@ -1081,9 +1067,11 @@ static void __devexit mei_remove(struct pci_dev *pdev) | |||
| 1081 | 1067 | ||
| 1082 | mutex_lock(&dev->device_lock); | 1068 | mutex_lock(&dev->device_lock); |
| 1083 | 1069 | ||
| 1084 | mei_wd_stop(dev, false); | 1070 | cancel_delayed_work(&dev->timer_work); |
| 1085 | 1071 | ||
| 1086 | mei_device = NULL; | 1072 | mei_wd_stop(dev); |
| 1073 | |||
| 1074 | mei_pdev = NULL; | ||
| 1087 | 1075 | ||
| 1088 | if (dev->iamthif_cl.state == MEI_FILE_CONNECTED) { | 1076 | if (dev->iamthif_cl.state == MEI_FILE_CONNECTED) { |
| 1089 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTING; | 1077 | dev->iamthif_cl.state = MEI_FILE_DISCONNECTING; |
| @@ -1136,12 +1124,15 @@ static int mei_pci_suspend(struct device *device) | |||
| 1136 | if (!dev) | 1124 | if (!dev) |
| 1137 | return -ENODEV; | 1125 | return -ENODEV; |
| 1138 | mutex_lock(&dev->device_lock); | 1126 | mutex_lock(&dev->device_lock); |
| 1127 | |||
| 1128 | cancel_delayed_work(&dev->timer_work); | ||
| 1129 | |||
| 1139 | /* Stop watchdog if exists */ | 1130 | /* Stop watchdog if exists */ |
| 1140 | err = mei_wd_stop(dev, true); | 1131 | err = mei_wd_stop(dev); |
| 1141 | /* Set new mei state */ | 1132 | /* Set new mei state */ |
| 1142 | if (dev->mei_state == MEI_ENABLED || | 1133 | if (dev->dev_state == MEI_DEV_ENABLED || |
| 1143 | dev->mei_state == MEI_RECOVERING_FROM_RESET) { | 1134 | dev->dev_state == MEI_DEV_RECOVERING_FROM_RESET) { |
| 1144 | dev->mei_state = MEI_POWER_DOWN; | 1135 | dev->dev_state = MEI_DEV_POWER_DOWN; |
| 1145 | mei_reset(dev, 0); | 1136 | mei_reset(dev, 0); |
| 1146 | } | 1137 | } |
| 1147 | mutex_unlock(&dev->device_lock); | 1138 | mutex_unlock(&dev->device_lock); |
| @@ -1169,12 +1160,12 @@ static int mei_pci_resume(struct device *device) | |||
| 1169 | err = request_threaded_irq(pdev->irq, | 1160 | err = request_threaded_irq(pdev->irq, |
| 1170 | NULL, | 1161 | NULL, |
| 1171 | mei_interrupt_thread_handler, | 1162 | mei_interrupt_thread_handler, |
| 1172 | IRQF_ONESHOT, mei_driver_name, dev); | 1163 | IRQF_ONESHOT, KBUILD_MODNAME, dev); |
| 1173 | else | 1164 | else |
| 1174 | err = request_threaded_irq(pdev->irq, | 1165 | err = request_threaded_irq(pdev->irq, |
| 1175 | mei_interrupt_quick_handler, | 1166 | mei_interrupt_quick_handler, |
| 1176 | mei_interrupt_thread_handler, | 1167 | mei_interrupt_thread_handler, |
| 1177 | IRQF_SHARED, mei_driver_name, dev); | 1168 | IRQF_SHARED, KBUILD_MODNAME, dev); |
| 1178 | 1169 | ||
| 1179 | if (err) { | 1170 | if (err) { |
| 1180 | dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n", | 1171 | dev_err(&pdev->dev, "request_threaded_irq failed: irq = %d.\n", |
| @@ -1183,7 +1174,7 @@ static int mei_pci_resume(struct device *device) | |||
| 1183 | } | 1174 | } |
| 1184 | 1175 | ||
| 1185 | mutex_lock(&dev->device_lock); | 1176 | mutex_lock(&dev->device_lock); |
| 1186 | dev->mei_state = MEI_POWER_UP; | 1177 | dev->dev_state = MEI_DEV_POWER_UP; |
| 1187 | mei_reset(dev, 1); | 1178 | mei_reset(dev, 1); |
| 1188 | mutex_unlock(&dev->device_lock); | 1179 | mutex_unlock(&dev->device_lock); |
| 1189 | 1180 | ||
| @@ -1201,7 +1192,7 @@ static SIMPLE_DEV_PM_OPS(mei_pm_ops, mei_pci_suspend, mei_pci_resume); | |||
| 1201 | * PCI driver structure | 1192 | * PCI driver structure |
| 1202 | */ | 1193 | */ |
| 1203 | static struct pci_driver mei_driver = { | 1194 | static struct pci_driver mei_driver = { |
| 1204 | .name = mei_driver_name, | 1195 | .name = KBUILD_MODNAME, |
| 1205 | .id_table = mei_pci_tbl, | 1196 | .id_table = mei_pci_tbl, |
| 1206 | .probe = mei_probe, | 1197 | .probe = mei_probe, |
| 1207 | .remove = __devexit_p(mei_remove), | 1198 | .remove = __devexit_p(mei_remove), |
diff --git a/drivers/misc/mei/mei_dev.h b/drivers/misc/mei/mei_dev.h index d61c4ddfc80c..adb35fb9281c 100644 --- a/drivers/misc/mei/mei_dev.h +++ b/drivers/misc/mei/mei_dev.h | |||
| @@ -25,18 +25,20 @@ | |||
| 25 | /* | 25 | /* |
| 26 | * watch dog definition | 26 | * watch dog definition |
| 27 | */ | 27 | */ |
| 28 | #define MEI_WATCHDOG_DATA_SIZE 16 | 28 | #define MEI_WD_HDR_SIZE 4 |
| 29 | #define MEI_START_WD_DATA_SIZE 20 | 29 | #define MEI_WD_STOP_MSG_SIZE MEI_WD_HDR_SIZE |
| 30 | #define MEI_WD_PARAMS_SIZE 4 | 30 | #define MEI_WD_START_MSG_SIZE (MEI_WD_HDR_SIZE + 16) |
| 31 | |||
| 32 | #define MEI_WD_DEFAULT_TIMEOUT 120 /* seconds */ | ||
| 33 | #define MEI_WD_MIN_TIMEOUT 120 /* seconds */ | ||
| 34 | #define MEI_WD_MAX_TIMEOUT 65535 /* seconds */ | ||
| 35 | |||
| 36 | #define MEI_WD_STOP_TIMEOUT 10 /* msecs */ | ||
| 37 | |||
| 31 | #define MEI_WD_STATE_INDEPENDENCE_MSG_SENT (1 << 0) | 38 | #define MEI_WD_STATE_INDEPENDENCE_MSG_SENT (1 << 0) |
| 32 | 39 | ||
| 33 | #define MEI_RD_MSG_BUF_SIZE (128 * sizeof(u32)) | 40 | #define MEI_RD_MSG_BUF_SIZE (128 * sizeof(u32)) |
| 34 | 41 | ||
| 35 | /* | ||
| 36 | * MEI PCI Device object | ||
| 37 | */ | ||
| 38 | extern struct pci_dev *mei_device; | ||
| 39 | |||
| 40 | 42 | ||
| 41 | /* | 43 | /* |
| 42 | * AMTHI Client UUID | 44 | * AMTHI Client UUID |
| @@ -54,19 +56,21 @@ extern const uuid_le mei_wd_guid; | |||
| 54 | extern const u8 mei_wd_state_independence_msg[3][4]; | 56 | extern const u8 mei_wd_state_independence_msg[3][4]; |
| 55 | 57 | ||
| 56 | /* | 58 | /* |
| 59 | * Number of Maximum MEI Clients | ||
| 60 | */ | ||
| 61 | #define MEI_CLIENTS_MAX 256 | ||
| 62 | |||
| 63 | /* | ||
| 57 | * Number of File descriptors/handles | 64 | * Number of File descriptors/handles |
| 58 | * that can be opened to the driver. | 65 | * that can be opened to the driver. |
| 59 | * | 66 | * |
| 60 | * Limit to 253: 255 Total Clients | 67 | * Limit to 253: 256 Total Clients |
| 68 | * minus internal client for MEI Bus Messags | ||
| 61 | * minus internal client for AMTHI | 69 | * minus internal client for AMTHI |
| 62 | * minus internal client for Watchdog | 70 | * minus internal client for Watchdog |
| 63 | */ | 71 | */ |
| 64 | #define MEI_MAX_OPEN_HANDLE_COUNT 253 | 72 | #define MEI_MAX_OPEN_HANDLE_COUNT (MEI_CLIENTS_MAX - 3) |
| 65 | 73 | ||
| 66 | /* | ||
| 67 | * Number of Maximum MEI Clients | ||
| 68 | */ | ||
| 69 | #define MEI_CLIENTS_MAX 255 | ||
| 70 | 74 | ||
| 71 | /* File state */ | 75 | /* File state */ |
| 72 | enum file_state { | 76 | enum file_state { |
| @@ -78,17 +82,19 @@ enum file_state { | |||
| 78 | }; | 82 | }; |
| 79 | 83 | ||
| 80 | /* MEI device states */ | 84 | /* MEI device states */ |
| 81 | enum mei_states { | 85 | enum mei_dev_state { |
| 82 | MEI_INITIALIZING = 0, | 86 | MEI_DEV_INITIALIZING = 0, |
| 83 | MEI_INIT_CLIENTS, | 87 | MEI_DEV_INIT_CLIENTS, |
| 84 | MEI_ENABLED, | 88 | MEI_DEV_ENABLED, |
| 85 | MEI_RESETING, | 89 | MEI_DEV_RESETING, |
| 86 | MEI_DISABLED, | 90 | MEI_DEV_DISABLED, |
| 87 | MEI_RECOVERING_FROM_RESET, | 91 | MEI_DEV_RECOVERING_FROM_RESET, |
| 88 | MEI_POWER_DOWN, | 92 | MEI_DEV_POWER_DOWN, |
| 89 | MEI_POWER_UP | 93 | MEI_DEV_POWER_UP |
| 90 | }; | 94 | }; |
| 91 | 95 | ||
| 96 | const char *mei_dev_state_str(int state); | ||
| 97 | |||
| 92 | /* init clients states*/ | 98 | /* init clients states*/ |
| 93 | enum mei_init_clients_states { | 99 | enum mei_init_clients_states { |
| 94 | MEI_START_MESSAGE = 0, | 100 | MEI_START_MESSAGE = 0, |
| @@ -113,6 +119,12 @@ enum mei_file_transaction_states { | |||
| 113 | MEI_READ_COMPLETE | 119 | MEI_READ_COMPLETE |
| 114 | }; | 120 | }; |
| 115 | 121 | ||
| 122 | enum mei_wd_states { | ||
| 123 | MEI_WD_IDLE, | ||
| 124 | MEI_WD_RUNNING, | ||
| 125 | MEI_WD_STOPPING, | ||
| 126 | }; | ||
| 127 | |||
| 116 | /* MEI CB */ | 128 | /* MEI CB */ |
| 117 | enum mei_cb_major_types { | 129 | enum mei_cb_major_types { |
| 118 | MEI_READ = 0, | 130 | MEI_READ = 0, |
| @@ -128,7 +140,7 @@ enum mei_cb_major_types { | |||
| 128 | struct mei_message_data { | 140 | struct mei_message_data { |
| 129 | u32 size; | 141 | u32 size; |
| 130 | unsigned char *data; | 142 | unsigned char *data; |
| 131 | } __packed; | 143 | }; |
| 132 | 144 | ||
| 133 | 145 | ||
| 134 | struct mei_cl_cb { | 146 | struct mei_cl_cb { |
| @@ -218,10 +230,9 @@ struct mei_device { | |||
| 218 | /* | 230 | /* |
| 219 | * mei device states | 231 | * mei device states |
| 220 | */ | 232 | */ |
| 221 | enum mei_states mei_state; | 233 | enum mei_dev_state dev_state; |
| 222 | enum mei_init_clients_states init_clients_state; | 234 | enum mei_init_clients_states init_clients_state; |
| 223 | u16 init_clients_timer; | 235 | u16 init_clients_timer; |
| 224 | bool stop; | ||
| 225 | bool need_reset; | 236 | bool need_reset; |
| 226 | 237 | ||
| 227 | u32 extra_write_index; | 238 | u32 extra_write_index; |
| @@ -241,12 +252,11 @@ struct mei_device { | |||
| 241 | bool mei_host_buffer_is_empty; | 252 | bool mei_host_buffer_is_empty; |
| 242 | 253 | ||
| 243 | struct mei_cl wd_cl; | 254 | struct mei_cl wd_cl; |
| 255 | enum mei_wd_states wd_state; | ||
| 244 | bool wd_interface_reg; | 256 | bool wd_interface_reg; |
| 245 | bool wd_pending; | 257 | bool wd_pending; |
| 246 | bool wd_stopped; | 258 | u16 wd_timeout; |
| 247 | bool wd_bypass; /* if false, don't refresh watchdog ME client */ | 259 | unsigned char wd_data[MEI_WD_START_MSG_SIZE]; |
| 248 | u16 wd_timeout; /* seconds ((wd_data[1] << 8) + wd_data[0]) */ | ||
| 249 | unsigned char wd_data[MEI_START_WD_DATA_SIZE]; | ||
| 250 | 260 | ||
| 251 | 261 | ||
| 252 | struct file *iamthif_file_object; | 262 | struct file *iamthif_file_object; |
| @@ -279,9 +289,10 @@ void mei_host_init_iamthif(struct mei_device *dev); | |||
| 279 | void mei_allocate_me_clients_storage(struct mei_device *dev); | 289 | void mei_allocate_me_clients_storage(struct mei_device *dev); |
| 280 | 290 | ||
| 281 | 291 | ||
| 282 | u8 mei_find_me_client_update_filext(struct mei_device *dev, | 292 | int mei_me_cl_update_filext(struct mei_device *dev, struct mei_cl *cl, |
| 283 | struct mei_cl *priv, | 293 | const uuid_le *cguid, u8 host_client_id); |
| 284 | const uuid_le *cguid, u8 client_id); | 294 | int mei_me_cl_by_uuid(const struct mei_device *dev, const uuid_le *cuuid); |
| 295 | int mei_me_cl_by_id(struct mei_device *dev, u8 client_id); | ||
| 285 | 296 | ||
| 286 | /* | 297 | /* |
| 287 | * MEI IO List Functions | 298 | * MEI IO List Functions |
| @@ -348,7 +359,6 @@ void mei_run_next_iamthif_cmd(struct mei_device *dev); | |||
| 348 | 359 | ||
| 349 | void mei_free_cb_private(struct mei_cl_cb *priv_cb); | 360 | void mei_free_cb_private(struct mei_cl_cb *priv_cb); |
| 350 | 361 | ||
| 351 | int mei_find_me_client_index(const struct mei_device *dev, uuid_le cuuid); | ||
| 352 | 362 | ||
| 353 | /* | 363 | /* |
| 354 | * Register Access Function | 364 | * Register Access Function |
diff --git a/drivers/misc/mei/wd.c b/drivers/misc/mei/wd.c index 5133fd77b91c..d96c537f046f 100644 --- a/drivers/misc/mei/wd.c +++ b/drivers/misc/mei/wd.c | |||
| @@ -48,8 +48,8 @@ const uuid_le mei_wd_guid = UUID_LE(0x05B79A6F, 0x4628, 0x4D7F, 0x89, | |||
| 48 | static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) | 48 | static void mei_wd_set_start_timeout(struct mei_device *dev, u16 timeout) |
| 49 | { | 49 | { |
| 50 | dev_dbg(&dev->pdev->dev, "wd: set timeout=%d.\n", timeout); | 50 | dev_dbg(&dev->pdev->dev, "wd: set timeout=%d.\n", timeout); |
| 51 | memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_PARAMS_SIZE); | 51 | memcpy(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE); |
| 52 | memcpy(dev->wd_data + MEI_WD_PARAMS_SIZE, &timeout, sizeof(u16)); | 52 | memcpy(dev->wd_data + MEI_WD_HDR_SIZE, &timeout, sizeof(u16)); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| @@ -66,10 +66,11 @@ int mei_wd_host_init(struct mei_device *dev) | |||
| 66 | 66 | ||
| 67 | /* look for WD client and connect to it */ | 67 | /* look for WD client and connect to it */ |
| 68 | dev->wd_cl.state = MEI_FILE_DISCONNECTED; | 68 | dev->wd_cl.state = MEI_FILE_DISCONNECTED; |
| 69 | dev->wd_timeout = AMT_WD_DEFAULT_TIMEOUT; | 69 | dev->wd_timeout = MEI_WD_DEFAULT_TIMEOUT; |
| 70 | dev->wd_state = MEI_WD_IDLE; | ||
| 70 | 71 | ||
| 71 | /* find ME WD client */ | 72 | /* find ME WD client */ |
| 72 | mei_find_me_client_update_filext(dev, &dev->wd_cl, | 73 | mei_me_cl_update_filext(dev, &dev->wd_cl, |
| 73 | &mei_wd_guid, MEI_WD_HOST_CLIENT_ID); | 74 | &mei_wd_guid, MEI_WD_HOST_CLIENT_ID); |
| 74 | 75 | ||
| 75 | dev_dbg(&dev->pdev->dev, "wd: check client\n"); | 76 | dev_dbg(&dev->pdev->dev, "wd: check client\n"); |
| @@ -108,10 +109,10 @@ int mei_wd_send(struct mei_device *dev) | |||
| 108 | mei_hdr->msg_complete = 1; | 109 | mei_hdr->msg_complete = 1; |
| 109 | mei_hdr->reserved = 0; | 110 | mei_hdr->reserved = 0; |
| 110 | 111 | ||
| 111 | if (!memcmp(dev->wd_data, mei_start_wd_params, MEI_WD_PARAMS_SIZE)) | 112 | if (!memcmp(dev->wd_data, mei_start_wd_params, MEI_WD_HDR_SIZE)) |
| 112 | mei_hdr->length = MEI_START_WD_DATA_SIZE; | 113 | mei_hdr->length = MEI_WD_START_MSG_SIZE; |
| 113 | else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_PARAMS_SIZE)) | 114 | else if (!memcmp(dev->wd_data, mei_stop_wd_params, MEI_WD_HDR_SIZE)) |
| 114 | mei_hdr->length = MEI_WD_PARAMS_SIZE; | 115 | mei_hdr->length = MEI_WD_STOP_MSG_SIZE; |
| 115 | else | 116 | else |
| 116 | return -EINVAL; | 117 | return -EINVAL; |
| 117 | 118 | ||
| @@ -128,18 +129,17 @@ int mei_wd_send(struct mei_device *dev) | |||
| 128 | * -EIO when message send fails | 129 | * -EIO when message send fails |
| 129 | * -EINVAL when invalid message is to be sent | 130 | * -EINVAL when invalid message is to be sent |
| 130 | */ | 131 | */ |
| 131 | int mei_wd_stop(struct mei_device *dev, bool preserve) | 132 | int mei_wd_stop(struct mei_device *dev) |
| 132 | { | 133 | { |
| 133 | int ret; | 134 | int ret; |
| 134 | u16 wd_timeout = dev->wd_timeout; | ||
| 135 | 135 | ||
| 136 | cancel_delayed_work(&dev->timer_work); | 136 | if (dev->wd_cl.state != MEI_FILE_CONNECTED || |
| 137 | if (dev->wd_cl.state != MEI_FILE_CONNECTED || !dev->wd_timeout) | 137 | dev->wd_state != MEI_WD_RUNNING) |
| 138 | return 0; | 138 | return 0; |
| 139 | 139 | ||
| 140 | dev->wd_timeout = 0; | 140 | memcpy(dev->wd_data, mei_stop_wd_params, MEI_WD_STOP_MSG_SIZE); |
| 141 | memcpy(dev->wd_data, mei_stop_wd_params, MEI_WD_PARAMS_SIZE); | 141 | |
| 142 | dev->stop = true; | 142 | dev->wd_state = MEI_WD_STOPPING; |
| 143 | 143 | ||
| 144 | ret = mei_flow_ctrl_creds(dev, &dev->wd_cl); | 144 | ret = mei_flow_ctrl_creds(dev, &dev->wd_cl); |
| 145 | if (ret < 0) | 145 | if (ret < 0) |
| @@ -161,13 +161,14 @@ int mei_wd_stop(struct mei_device *dev, bool preserve) | |||
| 161 | } else { | 161 | } else { |
| 162 | dev->wd_pending = true; | 162 | dev->wd_pending = true; |
| 163 | } | 163 | } |
| 164 | dev->wd_stopped = false; | 164 | |
| 165 | mutex_unlock(&dev->device_lock); | 165 | mutex_unlock(&dev->device_lock); |
| 166 | 166 | ||
| 167 | ret = wait_event_interruptible_timeout(dev->wait_stop_wd, | 167 | ret = wait_event_interruptible_timeout(dev->wait_stop_wd, |
| 168 | dev->wd_stopped, 10 * HZ); | 168 | dev->wd_state == MEI_WD_IDLE, |
| 169 | msecs_to_jiffies(MEI_WD_STOP_TIMEOUT)); | ||
| 169 | mutex_lock(&dev->device_lock); | 170 | mutex_lock(&dev->device_lock); |
| 170 | if (dev->wd_stopped) { | 171 | if (dev->wd_state == MEI_WD_IDLE) { |
| 171 | dev_dbg(&dev->pdev->dev, "wd: stop completed ret=%d.\n", ret); | 172 | dev_dbg(&dev->pdev->dev, "wd: stop completed ret=%d.\n", ret); |
| 172 | ret = 0; | 173 | ret = 0; |
| 173 | } else { | 174 | } else { |
| @@ -177,9 +178,6 @@ int mei_wd_stop(struct mei_device *dev, bool preserve) | |||
| 177 | "wd: stop failed to complete ret=%d.\n", ret); | 178 | "wd: stop failed to complete ret=%d.\n", ret); |
| 178 | } | 179 | } |
| 179 | 180 | ||
| 180 | if (preserve) | ||
| 181 | dev->wd_timeout = wd_timeout; | ||
| 182 | |||
| 183 | out: | 181 | out: |
| 184 | return ret; | 182 | return ret; |
| 185 | } | 183 | } |
| @@ -196,16 +194,16 @@ static int mei_wd_ops_start(struct watchdog_device *wd_dev) | |||
| 196 | int err = -ENODEV; | 194 | int err = -ENODEV; |
| 197 | struct mei_device *dev; | 195 | struct mei_device *dev; |
| 198 | 196 | ||
| 199 | dev = pci_get_drvdata(mei_device); | 197 | dev = watchdog_get_drvdata(wd_dev); |
| 200 | if (!dev) | 198 | if (!dev) |
| 201 | return -ENODEV; | 199 | return -ENODEV; |
| 202 | 200 | ||
| 203 | mutex_lock(&dev->device_lock); | 201 | mutex_lock(&dev->device_lock); |
| 204 | 202 | ||
| 205 | if (dev->mei_state != MEI_ENABLED) { | 203 | if (dev->dev_state != MEI_DEV_ENABLED) { |
| 206 | dev_dbg(&dev->pdev->dev, | 204 | dev_dbg(&dev->pdev->dev, |
| 207 | "wd: mei_state != MEI_ENABLED mei_state = %d\n", | 205 | "wd: dev_state != MEI_DEV_ENABLED dev_state = %s\n", |
| 208 | dev->mei_state); | 206 | mei_dev_state_str(dev->dev_state)); |
| 209 | goto end_unlock; | 207 | goto end_unlock; |
| 210 | } | 208 | } |
| 211 | 209 | ||
| @@ -233,13 +231,13 @@ end_unlock: | |||
| 233 | static int mei_wd_ops_stop(struct watchdog_device *wd_dev) | 231 | static int mei_wd_ops_stop(struct watchdog_device *wd_dev) |
| 234 | { | 232 | { |
| 235 | struct mei_device *dev; | 233 | struct mei_device *dev; |
| 236 | dev = pci_get_drvdata(mei_device); | ||
| 237 | 234 | ||
| 235 | dev = watchdog_get_drvdata(wd_dev); | ||
| 238 | if (!dev) | 236 | if (!dev) |
| 239 | return -ENODEV; | 237 | return -ENODEV; |
| 240 | 238 | ||
| 241 | mutex_lock(&dev->device_lock); | 239 | mutex_lock(&dev->device_lock); |
| 242 | mei_wd_stop(dev, false); | 240 | mei_wd_stop(dev); |
| 243 | mutex_unlock(&dev->device_lock); | 241 | mutex_unlock(&dev->device_lock); |
| 244 | 242 | ||
| 245 | return 0; | 243 | return 0; |
| @@ -256,8 +254,8 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev) | |||
| 256 | { | 254 | { |
| 257 | int ret = 0; | 255 | int ret = 0; |
| 258 | struct mei_device *dev; | 256 | struct mei_device *dev; |
| 259 | dev = pci_get_drvdata(mei_device); | ||
| 260 | 257 | ||
| 258 | dev = watchdog_get_drvdata(wd_dev); | ||
| 261 | if (!dev) | 259 | if (!dev) |
| 262 | return -ENODEV; | 260 | return -ENODEV; |
| 263 | 261 | ||
| @@ -269,6 +267,8 @@ static int mei_wd_ops_ping(struct watchdog_device *wd_dev) | |||
| 269 | goto end; | 267 | goto end; |
| 270 | } | 268 | } |
| 271 | 269 | ||
| 270 | dev->wd_state = MEI_WD_RUNNING; | ||
| 271 | |||
| 272 | /* Check if we can send the ping to HW*/ | 272 | /* Check if we can send the ping to HW*/ |
| 273 | if (dev->mei_host_buffer_is_empty && | 273 | if (dev->mei_host_buffer_is_empty && |
| 274 | mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) { | 274 | mei_flow_ctrl_creds(dev, &dev->wd_cl) > 0) { |
| @@ -309,13 +309,13 @@ end: | |||
| 309 | static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout) | 309 | static int mei_wd_ops_set_timeout(struct watchdog_device *wd_dev, unsigned int timeout) |
| 310 | { | 310 | { |
| 311 | struct mei_device *dev; | 311 | struct mei_device *dev; |
| 312 | dev = pci_get_drvdata(mei_device); | ||
| 313 | 312 | ||
| 313 | dev = watchdog_get_drvdata(wd_dev); | ||
| 314 | if (!dev) | 314 | if (!dev) |
| 315 | return -ENODEV; | 315 | return -ENODEV; |
| 316 | 316 | ||
| 317 | /* Check Timeout value */ | 317 | /* Check Timeout value */ |
| 318 | if (timeout < AMT_WD_MIN_TIMEOUT || timeout > AMT_WD_MAX_TIMEOUT) | 318 | if (timeout < MEI_WD_MIN_TIMEOUT || timeout > MEI_WD_MAX_TIMEOUT) |
| 319 | return -EINVAL; | 319 | return -EINVAL; |
| 320 | 320 | ||
| 321 | mutex_lock(&dev->device_lock); | 321 | mutex_lock(&dev->device_lock); |
| @@ -341,37 +341,42 @@ static const struct watchdog_ops wd_ops = { | |||
| 341 | }; | 341 | }; |
| 342 | static const struct watchdog_info wd_info = { | 342 | static const struct watchdog_info wd_info = { |
| 343 | .identity = INTEL_AMT_WATCHDOG_ID, | 343 | .identity = INTEL_AMT_WATCHDOG_ID, |
| 344 | .options = WDIOF_KEEPALIVEPING | WDIOF_ALARMONLY, | 344 | .options = WDIOF_KEEPALIVEPING | |
| 345 | WDIOF_SETTIMEOUT | | ||
| 346 | WDIOF_ALARMONLY, | ||
| 345 | }; | 347 | }; |
| 346 | 348 | ||
| 347 | static struct watchdog_device amt_wd_dev = { | 349 | static struct watchdog_device amt_wd_dev = { |
| 348 | .info = &wd_info, | 350 | .info = &wd_info, |
| 349 | .ops = &wd_ops, | 351 | .ops = &wd_ops, |
| 350 | .timeout = AMT_WD_DEFAULT_TIMEOUT, | 352 | .timeout = MEI_WD_DEFAULT_TIMEOUT, |
| 351 | .min_timeout = AMT_WD_MIN_TIMEOUT, | 353 | .min_timeout = MEI_WD_MIN_TIMEOUT, |
| 352 | .max_timeout = AMT_WD_MAX_TIMEOUT, | 354 | .max_timeout = MEI_WD_MAX_TIMEOUT, |
| 353 | }; | 355 | }; |
| 354 | 356 | ||
| 355 | 357 | ||
| 356 | void mei_watchdog_register(struct mei_device *dev) | 358 | void mei_watchdog_register(struct mei_device *dev) |
| 357 | { | 359 | { |
| 358 | dev_dbg(&dev->pdev->dev, "dev->wd_timeout =%d.\n", dev->wd_timeout); | ||
| 359 | |||
| 360 | if (watchdog_register_device(&amt_wd_dev)) { | 360 | if (watchdog_register_device(&amt_wd_dev)) { |
| 361 | dev_err(&dev->pdev->dev, | 361 | dev_err(&dev->pdev->dev, |
| 362 | "wd: unable to register watchdog device.\n"); | 362 | "wd: unable to register watchdog device.\n"); |
| 363 | dev->wd_interface_reg = false; | 363 | dev->wd_interface_reg = false; |
| 364 | } else { | 364 | return; |
| 365 | dev_dbg(&dev->pdev->dev, | ||
| 366 | "wd: successfully register watchdog interface.\n"); | ||
| 367 | dev->wd_interface_reg = true; | ||
| 368 | } | 365 | } |
| 366 | |||
| 367 | dev_dbg(&dev->pdev->dev, | ||
| 368 | "wd: successfully register watchdog interface.\n"); | ||
| 369 | dev->wd_interface_reg = true; | ||
| 370 | watchdog_set_drvdata(&amt_wd_dev, dev); | ||
| 369 | } | 371 | } |
| 370 | 372 | ||
| 371 | void mei_watchdog_unregister(struct mei_device *dev) | 373 | void mei_watchdog_unregister(struct mei_device *dev) |
| 372 | { | 374 | { |
| 373 | if (dev->wd_interface_reg) | 375 | if (!dev->wd_interface_reg) |
| 374 | watchdog_unregister_device(&amt_wd_dev); | 376 | return; |
| 377 | |||
| 378 | watchdog_set_drvdata(&amt_wd_dev, NULL); | ||
| 379 | watchdog_unregister_device(&amt_wd_dev); | ||
| 375 | dev->wd_interface_reg = false; | 380 | dev->wd_interface_reg = false; |
| 376 | } | 381 | } |
| 377 | 382 | ||
diff --git a/drivers/misc/pch_phub.c b/drivers/misc/pch_phub.c index 9fbcacd703d5..c9f20dae1855 100644 --- a/drivers/misc/pch_phub.c +++ b/drivers/misc/pch_phub.c | |||
| @@ -699,7 +699,7 @@ static int __devinit pch_phub_probe(struct pci_dev *pdev, | |||
| 699 | chip->pch_phub_base_address = pci_iomap(pdev, 1, 0); | 699 | chip->pch_phub_base_address = pci_iomap(pdev, 1, 0); |
| 700 | 700 | ||
| 701 | 701 | ||
| 702 | if (chip->pch_phub_base_address == 0) { | 702 | if (chip->pch_phub_base_address == NULL) { |
| 703 | dev_err(&pdev->dev, "%s : pci_iomap FAILED", __func__); | 703 | dev_err(&pdev->dev, "%s : pci_iomap FAILED", __func__); |
| 704 | ret = -ENOMEM; | 704 | ret = -ENOMEM; |
| 705 | goto err_pci_iomap; | 705 | goto err_pci_iomap; |
| @@ -893,18 +893,7 @@ static struct pci_driver pch_phub_driver = { | |||
| 893 | .resume = pch_phub_resume | 893 | .resume = pch_phub_resume |
| 894 | }; | 894 | }; |
| 895 | 895 | ||
| 896 | static int __init pch_phub_pci_init(void) | 896 | module_pci_driver(pch_phub_driver); |
| 897 | { | ||
| 898 | return pci_register_driver(&pch_phub_driver); | ||
| 899 | } | ||
| 900 | |||
| 901 | static void __exit pch_phub_pci_exit(void) | ||
| 902 | { | ||
| 903 | pci_unregister_driver(&pch_phub_driver); | ||
| 904 | } | ||
| 905 | |||
| 906 | module_init(pch_phub_pci_init); | ||
| 907 | module_exit(pch_phub_pci_exit); | ||
| 908 | 897 | ||
| 909 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7223) PHUB"); | 898 | MODULE_DESCRIPTION("Intel EG20T PCH/LAPIS Semiconductor IOH(ML7213/ML7223) PHUB"); |
| 910 | MODULE_LICENSE("GPL"); | 899 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index acfaeeb9e01a..46937b107261 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c | |||
| @@ -30,11 +30,13 @@ | |||
| 30 | 30 | ||
| 31 | #include <linux/ti_wilink_st.h> | 31 | #include <linux/ti_wilink_st.h> |
| 32 | 32 | ||
| 33 | extern void st_kim_recv(void *, const unsigned char *, long); | ||
| 34 | void st_int_recv(void *, const unsigned char *, long); | ||
| 33 | /* function pointer pointing to either, | 35 | /* function pointer pointing to either, |
| 34 | * st_kim_recv during registration to receive fw download responses | 36 | * st_kim_recv during registration to receive fw download responses |
| 35 | * st_int_recv after registration to receive proto stack responses | 37 | * st_int_recv after registration to receive proto stack responses |
| 36 | */ | 38 | */ |
| 37 | void (*st_recv) (void*, const unsigned char*, long); | 39 | static void (*st_recv) (void *, const unsigned char *, long); |
| 38 | 40 | ||
| 39 | /********************************************************************/ | 41 | /********************************************************************/ |
| 40 | static void add_channel_to_table(struct st_data_s *st_gdata, | 42 | static void add_channel_to_table(struct st_data_s *st_gdata, |
| @@ -100,7 +102,7 @@ int st_int_write(struct st_data_s *st_gdata, | |||
| 100 | * push the skb received to relevant | 102 | * push the skb received to relevant |
| 101 | * protocol stacks | 103 | * protocol stacks |
| 102 | */ | 104 | */ |
| 103 | void st_send_frame(unsigned char chnl_id, struct st_data_s *st_gdata) | 105 | static void st_send_frame(unsigned char chnl_id, struct st_data_s *st_gdata) |
| 104 | { | 106 | { |
| 105 | pr_debug(" %s(prot:%d) ", __func__, chnl_id); | 107 | pr_debug(" %s(prot:%d) ", __func__, chnl_id); |
| 106 | 108 | ||
| @@ -140,7 +142,7 @@ void st_send_frame(unsigned char chnl_id, struct st_data_s *st_gdata) | |||
| 140 | * This function is being called with spin lock held, protocol drivers are | 142 | * This function is being called with spin lock held, protocol drivers are |
| 141 | * only expected to complete their waits and do nothing more than that. | 143 | * only expected to complete their waits and do nothing more than that. |
| 142 | */ | 144 | */ |
| 143 | void st_reg_complete(struct st_data_s *st_gdata, char err) | 145 | static void st_reg_complete(struct st_data_s *st_gdata, char err) |
| 144 | { | 146 | { |
| 145 | unsigned char i = 0; | 147 | unsigned char i = 0; |
| 146 | pr_info(" %s ", __func__); | 148 | pr_info(" %s ", __func__); |
| @@ -379,7 +381,7 @@ done: | |||
| 379 | * completely, return that skb which has the pending data. | 381 | * completely, return that skb which has the pending data. |
| 380 | * In normal cases, return top of txq. | 382 | * In normal cases, return top of txq. |
| 381 | */ | 383 | */ |
| 382 | struct sk_buff *st_int_dequeue(struct st_data_s *st_gdata) | 384 | static struct sk_buff *st_int_dequeue(struct st_data_s *st_gdata) |
| 383 | { | 385 | { |
| 384 | struct sk_buff *returning_skb; | 386 | struct sk_buff *returning_skb; |
| 385 | 387 | ||
| @@ -401,7 +403,7 @@ struct sk_buff *st_int_dequeue(struct st_data_s *st_gdata) | |||
| 401 | * txq and waitq needs protection since the other contexts | 403 | * txq and waitq needs protection since the other contexts |
| 402 | * may be sending data, waking up chip. | 404 | * may be sending data, waking up chip. |
| 403 | */ | 405 | */ |
| 404 | void st_int_enqueue(struct st_data_s *st_gdata, struct sk_buff *skb) | 406 | static void st_int_enqueue(struct st_data_s *st_gdata, struct sk_buff *skb) |
| 405 | { | 407 | { |
| 406 | unsigned long flags = 0; | 408 | unsigned long flags = 0; |
| 407 | 409 | ||
diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 7c14f8fd98db..04a819944f6b 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c | |||
| @@ -63,10 +63,27 @@ static struct platform_device *st_get_plat_device(int id) | |||
| 63 | * in case of error don't complete so that waiting for proper | 63 | * in case of error don't complete so that waiting for proper |
| 64 | * response times out | 64 | * response times out |
| 65 | */ | 65 | */ |
| 66 | void validate_firmware_response(struct kim_data_s *kim_gdata) | 66 | static void validate_firmware_response(struct kim_data_s *kim_gdata) |
| 67 | { | 67 | { |
| 68 | struct sk_buff *skb = kim_gdata->rx_skb; | 68 | struct sk_buff *skb = kim_gdata->rx_skb; |
| 69 | if (unlikely(skb->data[5] != 0)) { | 69 | if (!skb) |
| 70 | return; | ||
| 71 | |||
| 72 | /* these magic numbers are the position in the response buffer which | ||
| 73 | * allows us to distinguish whether the response is for the read | ||
| 74 | * version info. command | ||
| 75 | */ | ||
| 76 | if (skb->data[2] == 0x01 && skb->data[3] == 0x01 && | ||
| 77 | skb->data[4] == 0x10 && skb->data[5] == 0x00) { | ||
| 78 | /* fw version response */ | ||
| 79 | memcpy(kim_gdata->resp_buffer, | ||
| 80 | kim_gdata->rx_skb->data, | ||
| 81 | kim_gdata->rx_skb->len); | ||
| 82 | complete_all(&kim_gdata->kim_rcvd); | ||
| 83 | kim_gdata->rx_state = ST_W4_PACKET_TYPE; | ||
| 84 | kim_gdata->rx_skb = NULL; | ||
| 85 | kim_gdata->rx_count = 0; | ||
| 86 | } else if (unlikely(skb->data[5] != 0)) { | ||
| 70 | pr_err("no proper response during fw download"); | 87 | pr_err("no proper response during fw download"); |
| 71 | pr_err("data6 %x", skb->data[5]); | 88 | pr_err("data6 %x", skb->data[5]); |
| 72 | kfree_skb(skb); | 89 | kfree_skb(skb); |
| @@ -119,7 +136,7 @@ static inline int kim_check_data_len(struct kim_data_s *kim_gdata, int len) | |||
| 119 | * have been observed to come in bursts of different | 136 | * have been observed to come in bursts of different |
| 120 | * tty_receive and hence the logic | 137 | * tty_receive and hence the logic |
| 121 | */ | 138 | */ |
| 122 | void kim_int_recv(struct kim_data_s *kim_gdata, | 139 | static void kim_int_recv(struct kim_data_s *kim_gdata, |
| 123 | const unsigned char *data, long count) | 140 | const unsigned char *data, long count) |
| 124 | { | 141 | { |
| 125 | const unsigned char *ptr; | 142 | const unsigned char *ptr; |
| @@ -207,16 +224,19 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name) | |||
| 207 | return -EIO; | 224 | return -EIO; |
| 208 | } | 225 | } |
| 209 | 226 | ||
| 210 | if (!wait_for_completion_timeout | 227 | if (!wait_for_completion_interruptible_timeout( |
| 211 | (&kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME))) { | 228 | &kim_gdata->kim_rcvd, msecs_to_jiffies(CMD_RESP_TIME))) { |
| 212 | pr_err(" waiting for ver info- timed out "); | 229 | pr_err(" waiting for ver info- timed out "); |
| 213 | return -ETIMEDOUT; | 230 | return -ETIMEDOUT; |
| 214 | } | 231 | } |
| 215 | INIT_COMPLETION(kim_gdata->kim_rcvd); | 232 | INIT_COMPLETION(kim_gdata->kim_rcvd); |
| 233 | /* the positions 12 & 13 in the response buffer provide with the | ||
| 234 | * chip, major & minor numbers | ||
| 235 | */ | ||
| 216 | 236 | ||
| 217 | version = | 237 | version = |
| 218 | MAKEWORD(kim_gdata->resp_buffer[13], | 238 | MAKEWORD(kim_gdata->resp_buffer[12], |
| 219 | kim_gdata->resp_buffer[14]); | 239 | kim_gdata->resp_buffer[13]); |
| 220 | chip = (version & 0x7C00) >> 10; | 240 | chip = (version & 0x7C00) >> 10; |
| 221 | min_ver = (version & 0x007F); | 241 | min_ver = (version & 0x007F); |
| 222 | maj_ver = (version & 0x0380) >> 7; | 242 | maj_ver = (version & 0x0380) >> 7; |
| @@ -236,7 +256,7 @@ static long read_local_version(struct kim_data_s *kim_gdata, char *bts_scr_name) | |||
| 236 | return 0; | 256 | return 0; |
| 237 | } | 257 | } |
| 238 | 258 | ||
| 239 | void skip_change_remote_baud(unsigned char **ptr, long *len) | 259 | static void skip_change_remote_baud(unsigned char **ptr, long *len) |
| 240 | { | 260 | { |
| 241 | unsigned char *nxt_action, *cur_action; | 261 | unsigned char *nxt_action, *cur_action; |
| 242 | cur_action = *ptr; | 262 | cur_action = *ptr; |
| @@ -370,9 +390,9 @@ static long download_firmware(struct kim_data_s *kim_gdata) | |||
| 370 | break; | 390 | break; |
| 371 | case ACTION_WAIT_EVENT: /* wait */ | 391 | case ACTION_WAIT_EVENT: /* wait */ |
| 372 | pr_debug("W"); | 392 | pr_debug("W"); |
| 373 | if (!wait_for_completion_timeout | 393 | if (!wait_for_completion_interruptible_timeout( |
| 374 | (&kim_gdata->kim_rcvd, | 394 | &kim_gdata->kim_rcvd, |
| 375 | msecs_to_jiffies(CMD_RESP_TIME))) { | 395 | msecs_to_jiffies(CMD_RESP_TIME))) { |
| 376 | pr_err("response timeout during fw download "); | 396 | pr_err("response timeout during fw download "); |
| 377 | /* timed out */ | 397 | /* timed out */ |
| 378 | release_firmware(kim_gdata->fw_entry); | 398 | release_firmware(kim_gdata->fw_entry); |
| @@ -410,16 +430,10 @@ void st_kim_recv(void *disc_data, const unsigned char *data, long count) | |||
| 410 | struct st_data_s *st_gdata = (struct st_data_s *)disc_data; | 430 | struct st_data_s *st_gdata = (struct st_data_s *)disc_data; |
| 411 | struct kim_data_s *kim_gdata = st_gdata->kim_data; | 431 | struct kim_data_s *kim_gdata = st_gdata->kim_data; |
| 412 | 432 | ||
| 413 | /* copy to local buffer */ | 433 | /* proceed to gather all data and distinguish read fw version response |
| 414 | if (unlikely(data[4] == 0x01 && data[5] == 0x10 && data[0] == 0x04)) { | 434 | * from other fw responses when data gathering is complete |
| 415 | /* must be the read_ver_cmd */ | 435 | */ |
| 416 | memcpy(kim_gdata->resp_buffer, data, count); | 436 | kim_int_recv(kim_gdata, data, count); |
| 417 | complete_all(&kim_gdata->kim_rcvd); | ||
| 418 | return; | ||
| 419 | } else { | ||
| 420 | kim_int_recv(kim_gdata, data, count); | ||
| 421 | /* either completes or times out */ | ||
| 422 | } | ||
| 423 | return; | 437 | return; |
| 424 | } | 438 | } |
| 425 | 439 | ||
| @@ -454,11 +468,6 @@ long st_kim_start(void *kim_data) | |||
| 454 | if (pdata->chip_enable) | 468 | if (pdata->chip_enable) |
| 455 | pdata->chip_enable(kim_gdata); | 469 | pdata->chip_enable(kim_gdata); |
| 456 | 470 | ||
| 457 | /* Configure BT nShutdown to HIGH state */ | ||
| 458 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); | ||
| 459 | mdelay(5); /* FIXME: a proper toggle */ | ||
| 460 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); | ||
| 461 | mdelay(100); | ||
| 462 | /* re-initialize the completion */ | 471 | /* re-initialize the completion */ |
| 463 | INIT_COMPLETION(kim_gdata->ldisc_installed); | 472 | INIT_COMPLETION(kim_gdata->ldisc_installed); |
| 464 | /* send notification to UIM */ | 473 | /* send notification to UIM */ |
| @@ -467,8 +476,8 @@ long st_kim_start(void *kim_data) | |||
| 467 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, | 476 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, |
| 468 | NULL, "install"); | 477 | NULL, "install"); |
| 469 | /* wait for ldisc to be installed */ | 478 | /* wait for ldisc to be installed */ |
| 470 | err = wait_for_completion_timeout(&kim_gdata->ldisc_installed, | 479 | err = wait_for_completion_interruptible_timeout( |
| 471 | msecs_to_jiffies(LDISC_TIME)); | 480 | &kim_gdata->ldisc_installed, msecs_to_jiffies(LDISC_TIME)); |
| 472 | if (!err) { | 481 | if (!err) { |
| 473 | /* ldisc installation timeout, | 482 | /* ldisc installation timeout, |
| 474 | * flush uart, power cycle BT_EN */ | 483 | * flush uart, power cycle BT_EN */ |
| @@ -500,8 +509,7 @@ long st_kim_start(void *kim_data) | |||
| 500 | * (b) upon failure to either install ldisc or download firmware. | 509 | * (b) upon failure to either install ldisc or download firmware. |
| 501 | * The function is responsible to (a) notify UIM about un-installation, | 510 | * The function is responsible to (a) notify UIM about un-installation, |
| 502 | * (b) flush UART if the ldisc was installed. | 511 | * (b) flush UART if the ldisc was installed. |
| 503 | * (c) reset BT_EN - pull down nshutdown at the end. | 512 | * (c) invoke platform's chip disabling routine. |
| 504 | * (d) invoke platform's chip disabling routine. | ||
| 505 | */ | 513 | */ |
| 506 | long st_kim_stop(void *kim_data) | 514 | long st_kim_stop(void *kim_data) |
| 507 | { | 515 | { |
| @@ -526,20 +534,13 @@ long st_kim_stop(void *kim_data) | |||
| 526 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, NULL, "install"); | 534 | sysfs_notify(&kim_gdata->kim_pdev->dev.kobj, NULL, "install"); |
| 527 | 535 | ||
| 528 | /* wait for ldisc to be un-installed */ | 536 | /* wait for ldisc to be un-installed */ |
| 529 | err = wait_for_completion_timeout(&kim_gdata->ldisc_installed, | 537 | err = wait_for_completion_interruptible_timeout( |
| 530 | msecs_to_jiffies(LDISC_TIME)); | 538 | &kim_gdata->ldisc_installed, msecs_to_jiffies(LDISC_TIME)); |
| 531 | if (!err) { /* timeout */ | 539 | if (!err) { /* timeout */ |
| 532 | pr_err(" timed out waiting for ldisc to be un-installed"); | 540 | pr_err(" timed out waiting for ldisc to be un-installed"); |
| 533 | return -ETIMEDOUT; | 541 | err = -ETIMEDOUT; |
| 534 | } | 542 | } |
| 535 | 543 | ||
| 536 | /* By default configure BT nShutdown to LOW state */ | ||
| 537 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); | ||
| 538 | mdelay(1); | ||
| 539 | gpio_set_value(kim_gdata->nshutdown, GPIO_HIGH); | ||
| 540 | mdelay(1); | ||
| 541 | gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); | ||
| 542 | |||
| 543 | /* platform specific disable */ | 544 | /* platform specific disable */ |
| 544 | if (pdata->chip_disable) | 545 | if (pdata->chip_disable) |
| 545 | pdata->chip_disable(kim_gdata); | 546 | pdata->chip_disable(kim_gdata); |
| @@ -701,7 +702,7 @@ static const struct file_operations list_debugfs_fops = { | |||
| 701 | * board-*.c file | 702 | * board-*.c file |
| 702 | */ | 703 | */ |
| 703 | 704 | ||
| 704 | struct dentry *kim_debugfs_dir; | 705 | static struct dentry *kim_debugfs_dir; |
| 705 | static int kim_probe(struct platform_device *pdev) | 706 | static int kim_probe(struct platform_device *pdev) |
| 706 | { | 707 | { |
| 707 | long status; | 708 | long status; |
| @@ -731,20 +732,6 @@ static int kim_probe(struct platform_device *pdev) | |||
| 731 | /* refer to itself */ | 732 | /* refer to itself */ |
| 732 | kim_gdata->core_data->kim_data = kim_gdata; | 733 | kim_gdata->core_data->kim_data = kim_gdata; |
| 733 | 734 | ||
| 734 | /* Claim the chip enable nShutdown gpio from the system */ | ||
| 735 | kim_gdata->nshutdown = pdata->nshutdown_gpio; | ||
| 736 | status = gpio_request(kim_gdata->nshutdown, "kim"); | ||
| 737 | if (unlikely(status)) { | ||
| 738 | pr_err(" gpio %ld request failed ", kim_gdata->nshutdown); | ||
| 739 | return status; | ||
| 740 | } | ||
| 741 | |||
| 742 | /* Configure nShutdown GPIO as output=0 */ | ||
| 743 | status = gpio_direction_output(kim_gdata->nshutdown, 0); | ||
| 744 | if (unlikely(status)) { | ||
| 745 | pr_err(" unable to configure gpio %ld", kim_gdata->nshutdown); | ||
| 746 | return status; | ||
| 747 | } | ||
| 748 | /* get reference of pdev for request_firmware | 735 | /* get reference of pdev for request_firmware |
| 749 | */ | 736 | */ |
| 750 | kim_gdata->kim_pdev = pdev; | 737 | kim_gdata->kim_pdev = pdev; |
| @@ -780,18 +767,10 @@ static int kim_probe(struct platform_device *pdev) | |||
| 780 | 767 | ||
| 781 | static int kim_remove(struct platform_device *pdev) | 768 | static int kim_remove(struct platform_device *pdev) |
| 782 | { | 769 | { |
| 783 | /* free the GPIOs requested */ | ||
| 784 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; | ||
| 785 | struct kim_data_s *kim_gdata; | 770 | struct kim_data_s *kim_gdata; |
| 786 | 771 | ||
| 787 | kim_gdata = dev_get_drvdata(&pdev->dev); | 772 | kim_gdata = dev_get_drvdata(&pdev->dev); |
| 788 | 773 | ||
| 789 | /* Free the Bluetooth/FM/GPIO | ||
| 790 | * nShutdown gpio from the system | ||
| 791 | */ | ||
| 792 | gpio_free(pdata->nshutdown_gpio); | ||
| 793 | pr_info("nshutdown GPIO Freed"); | ||
| 794 | |||
| 795 | debugfs_remove_recursive(kim_debugfs_dir); | 774 | debugfs_remove_recursive(kim_debugfs_dir); |
| 796 | sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); | 775 | sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); |
| 797 | pr_info("sysfs entries removed"); | 776 | pr_info("sysfs entries removed"); |
| @@ -804,7 +783,7 @@ static int kim_remove(struct platform_device *pdev) | |||
| 804 | return 0; | 783 | return 0; |
| 805 | } | 784 | } |
| 806 | 785 | ||
| 807 | int kim_suspend(struct platform_device *pdev, pm_message_t state) | 786 | static int kim_suspend(struct platform_device *pdev, pm_message_t state) |
| 808 | { | 787 | { |
| 809 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; | 788 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; |
| 810 | 789 | ||
| @@ -814,7 +793,7 @@ int kim_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 814 | return -EOPNOTSUPP; | 793 | return -EOPNOTSUPP; |
| 815 | } | 794 | } |
| 816 | 795 | ||
| 817 | int kim_resume(struct platform_device *pdev) | 796 | static int kim_resume(struct platform_device *pdev) |
| 818 | { | 797 | { |
| 819 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; | 798 | struct ti_st_plat_data *pdata = pdev->dev.platform_data; |
| 820 | 799 | ||
diff --git a/drivers/misc/tifm_7xx1.c b/drivers/misc/tifm_7xx1.c index ba2479022670..f8d6654391e5 100644 --- a/drivers/misc/tifm_7xx1.c +++ b/drivers/misc/tifm_7xx1.c | |||
| @@ -434,21 +434,9 @@ static struct pci_driver tifm_7xx1_driver = { | |||
| 434 | .resume = tifm_7xx1_resume, | 434 | .resume = tifm_7xx1_resume, |
| 435 | }; | 435 | }; |
| 436 | 436 | ||
| 437 | static int __init tifm_7xx1_init(void) | 437 | module_pci_driver(tifm_7xx1_driver); |
| 438 | { | ||
| 439 | return pci_register_driver(&tifm_7xx1_driver); | ||
| 440 | } | ||
| 441 | |||
| 442 | static void __exit tifm_7xx1_exit(void) | ||
| 443 | { | ||
| 444 | pci_unregister_driver(&tifm_7xx1_driver); | ||
| 445 | } | ||
| 446 | |||
| 447 | MODULE_AUTHOR("Alex Dubov"); | 438 | MODULE_AUTHOR("Alex Dubov"); |
| 448 | MODULE_DESCRIPTION("TI FlashMedia host driver"); | 439 | MODULE_DESCRIPTION("TI FlashMedia host driver"); |
| 449 | MODULE_LICENSE("GPL"); | 440 | MODULE_LICENSE("GPL"); |
| 450 | MODULE_DEVICE_TABLE(pci, tifm_7xx1_pci_tbl); | 441 | MODULE_DEVICE_TABLE(pci, tifm_7xx1_pci_tbl); |
| 451 | MODULE_VERSION(DRIVER_VERSION); | 442 | MODULE_VERSION(DRIVER_VERSION); |
| 452 | |||
| 453 | module_init(tifm_7xx1_init); | ||
| 454 | module_exit(tifm_7xx1_exit); | ||
diff --git a/drivers/w1/masters/Kconfig b/drivers/w1/masters/Kconfig index 5ceb1cd50195..7e984034a11b 100644 --- a/drivers/w1/masters/Kconfig +++ b/drivers/w1/masters/Kconfig | |||
| @@ -60,7 +60,6 @@ config W1_MASTER_GPIO | |||
| 60 | 60 | ||
| 61 | config HDQ_MASTER_OMAP | 61 | config HDQ_MASTER_OMAP |
| 62 | tristate "OMAP HDQ driver" | 62 | tristate "OMAP HDQ driver" |
| 63 | depends on ARCH_OMAP2PLUS | ||
| 64 | help | 63 | help |
| 65 | Say Y here if you want support for the 1-wire or HDQ Interface | 64 | Say Y here if you want support for the 1-wire or HDQ Interface |
| 66 | on an OMAP processor. | 65 | on an OMAP processor. |
diff --git a/drivers/w1/masters/omap_hdq.c b/drivers/w1/masters/omap_hdq.c index 4b0fcf3c2d03..ca8e60bb2f9c 100644 --- a/drivers/w1/masters/omap_hdq.c +++ b/drivers/w1/masters/omap_hdq.c | |||
| @@ -18,9 +18,6 @@ | |||
| 18 | #include <linux/sched.h> | 18 | #include <linux/sched.h> |
| 19 | #include <linux/pm_runtime.h> | 19 | #include <linux/pm_runtime.h> |
| 20 | 20 | ||
| 21 | #include <asm/irq.h> | ||
| 22 | #include <mach/hardware.h> | ||
| 23 | |||
| 24 | #include "../w1.h" | 21 | #include "../w1.h" |
| 25 | #include "../w1_int.h" | 22 | #include "../w1_int.h" |
| 26 | 23 | ||
| @@ -73,11 +70,11 @@ struct hdq_data { | |||
| 73 | }; | 70 | }; |
| 74 | 71 | ||
| 75 | static int __devinit omap_hdq_probe(struct platform_device *pdev); | 72 | static int __devinit omap_hdq_probe(struct platform_device *pdev); |
| 76 | static int omap_hdq_remove(struct platform_device *pdev); | 73 | static int __devexit omap_hdq_remove(struct platform_device *pdev); |
| 77 | 74 | ||
| 78 | static struct platform_driver omap_hdq_driver = { | 75 | static struct platform_driver omap_hdq_driver = { |
| 79 | .probe = omap_hdq_probe, | 76 | .probe = omap_hdq_probe, |
| 80 | .remove = omap_hdq_remove, | 77 | .remove = __devexit_p(omap_hdq_remove), |
| 81 | .driver = { | 78 | .driver = { |
| 82 | .name = "omap_hdq", | 79 | .name = "omap_hdq", |
| 83 | }, | 80 | }, |
| @@ -538,39 +535,35 @@ static void omap_w1_write_byte(void *_hdq, u8 byte) | |||
| 538 | hdq_data->init_trans = 0; | 535 | hdq_data->init_trans = 0; |
| 539 | mutex_unlock(&hdq_data->hdq_mutex); | 536 | mutex_unlock(&hdq_data->hdq_mutex); |
| 540 | } | 537 | } |
| 541 | |||
| 542 | return; | ||
| 543 | } | 538 | } |
| 544 | 539 | ||
| 545 | static int __devinit omap_hdq_probe(struct platform_device *pdev) | 540 | static int __devinit omap_hdq_probe(struct platform_device *pdev) |
| 546 | { | 541 | { |
| 542 | struct device *dev = &pdev->dev; | ||
| 547 | struct hdq_data *hdq_data; | 543 | struct hdq_data *hdq_data; |
| 548 | struct resource *res; | 544 | struct resource *res; |
| 549 | int ret, irq; | 545 | int ret, irq; |
| 550 | u8 rev; | 546 | u8 rev; |
| 551 | 547 | ||
| 552 | hdq_data = kmalloc(sizeof(*hdq_data), GFP_KERNEL); | 548 | hdq_data = devm_kzalloc(dev, sizeof(*hdq_data), GFP_KERNEL); |
| 553 | if (!hdq_data) { | 549 | if (!hdq_data) { |
| 554 | dev_dbg(&pdev->dev, "unable to allocate memory\n"); | 550 | dev_dbg(&pdev->dev, "unable to allocate memory\n"); |
| 555 | ret = -ENOMEM; | 551 | return -ENOMEM; |
| 556 | goto err_kmalloc; | ||
| 557 | } | 552 | } |
| 558 | 553 | ||
| 559 | hdq_data->dev = &pdev->dev; | 554 | hdq_data->dev = dev; |
| 560 | platform_set_drvdata(pdev, hdq_data); | 555 | platform_set_drvdata(pdev, hdq_data); |
| 561 | 556 | ||
| 562 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 557 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 563 | if (!res) { | 558 | if (!res) { |
| 564 | dev_dbg(&pdev->dev, "unable to get resource\n"); | 559 | dev_dbg(&pdev->dev, "unable to get resource\n"); |
| 565 | ret = -ENXIO; | 560 | return -ENXIO; |
| 566 | goto err_resource; | ||
| 567 | } | 561 | } |
| 568 | 562 | ||
| 569 | hdq_data->hdq_base = ioremap(res->start, SZ_4K); | 563 | hdq_data->hdq_base = devm_request_and_ioremap(dev, res); |
| 570 | if (!hdq_data->hdq_base) { | 564 | if (!hdq_data->hdq_base) { |
| 571 | dev_dbg(&pdev->dev, "ioremap failed\n"); | 565 | dev_dbg(&pdev->dev, "ioremap failed\n"); |
| 572 | ret = -EINVAL; | 566 | return -ENOMEM; |
| 573 | goto err_ioremap; | ||
| 574 | } | 567 | } |
| 575 | 568 | ||
| 576 | hdq_data->hdq_usecount = 0; | 569 | hdq_data->hdq_usecount = 0; |
| @@ -591,7 +584,8 @@ static int __devinit omap_hdq_probe(struct platform_device *pdev) | |||
| 591 | goto err_irq; | 584 | goto err_irq; |
| 592 | } | 585 | } |
| 593 | 586 | ||
| 594 | ret = request_irq(irq, hdq_isr, IRQF_DISABLED, "omap_hdq", hdq_data); | 587 | ret = devm_request_irq(dev, irq, hdq_isr, IRQF_DISABLED, |
| 588 | "omap_hdq", hdq_data); | ||
| 595 | if (ret < 0) { | 589 | if (ret < 0) { |
| 596 | dev_dbg(&pdev->dev, "could not request irq\n"); | 590 | dev_dbg(&pdev->dev, "could not request irq\n"); |
| 597 | goto err_irq; | 591 | goto err_irq; |
| @@ -616,19 +610,10 @@ err_irq: | |||
| 616 | err_w1: | 610 | err_w1: |
| 617 | pm_runtime_disable(&pdev->dev); | 611 | pm_runtime_disable(&pdev->dev); |
| 618 | 612 | ||
| 619 | iounmap(hdq_data->hdq_base); | ||
| 620 | |||
| 621 | err_ioremap: | ||
| 622 | err_resource: | ||
| 623 | platform_set_drvdata(pdev, NULL); | ||
| 624 | kfree(hdq_data); | ||
| 625 | |||
| 626 | err_kmalloc: | ||
| 627 | return ret; | 613 | return ret; |
| 628 | |||
| 629 | } | 614 | } |
| 630 | 615 | ||
| 631 | static int omap_hdq_remove(struct platform_device *pdev) | 616 | static int __devexit omap_hdq_remove(struct platform_device *pdev) |
| 632 | { | 617 | { |
| 633 | struct hdq_data *hdq_data = platform_get_drvdata(pdev); | 618 | struct hdq_data *hdq_data = platform_get_drvdata(pdev); |
| 634 | 619 | ||
| @@ -644,27 +629,11 @@ static int omap_hdq_remove(struct platform_device *pdev) | |||
| 644 | 629 | ||
| 645 | /* remove module dependency */ | 630 | /* remove module dependency */ |
| 646 | pm_runtime_disable(&pdev->dev); | 631 | pm_runtime_disable(&pdev->dev); |
| 647 | free_irq(INT_24XX_HDQ_IRQ, hdq_data); | ||
| 648 | platform_set_drvdata(pdev, NULL); | ||
| 649 | iounmap(hdq_data->hdq_base); | ||
| 650 | kfree(hdq_data); | ||
| 651 | 632 | ||
| 652 | return 0; | 633 | return 0; |
| 653 | } | 634 | } |
| 654 | 635 | ||
| 655 | static int __init | 636 | module_platform_driver(omap_hdq_driver); |
| 656 | omap_hdq_init(void) | ||
| 657 | { | ||
| 658 | return platform_driver_register(&omap_hdq_driver); | ||
| 659 | } | ||
| 660 | module_init(omap_hdq_init); | ||
| 661 | |||
| 662 | static void __exit | ||
| 663 | omap_hdq_exit(void) | ||
| 664 | { | ||
| 665 | platform_driver_unregister(&omap_hdq_driver); | ||
| 666 | } | ||
| 667 | module_exit(omap_hdq_exit); | ||
| 668 | 637 | ||
| 669 | module_param(w1_id, int, S_IRUSR); | 638 | module_param(w1_id, int, S_IRUSR); |
| 670 | MODULE_PARM_DESC(w1_id, "1-wire id for the slave detection"); | 639 | MODULE_PARM_DESC(w1_id, "1-wire id for the slave detection"); |
diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index df600d14974d..6012c4ea3206 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
| 15 | #include <linux/w1-gpio.h> | 15 | #include <linux/w1-gpio.h> |
| 16 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
| 17 | #include <linux/of_platform.h> | ||
| 18 | #include <linux/of_gpio.h> | ||
| 17 | 19 | ||
| 18 | #include "../w1.h" | 20 | #include "../w1.h" |
| 19 | #include "../w1_int.h" | 21 | #include "../w1_int.h" |
| @@ -42,12 +44,55 @@ static u8 w1_gpio_read_bit(void *data) | |||
| 42 | return gpio_get_value(pdata->pin) ? 1 : 0; | 44 | return gpio_get_value(pdata->pin) ? 1 : 0; |
| 43 | } | 45 | } |
| 44 | 46 | ||
| 47 | #ifdef CONFIG_OF | ||
| 48 | static struct of_device_id w1_gpio_dt_ids[] = { | ||
| 49 | { .compatible = "w1-gpio" }, | ||
| 50 | {} | ||
| 51 | }; | ||
| 52 | MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); | ||
| 53 | |||
| 54 | static int w1_gpio_probe_dt(struct platform_device *pdev) | ||
| 55 | { | ||
| 56 | struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; | ||
| 57 | struct device_node *np = pdev->dev.of_node; | ||
| 58 | const struct of_device_id *of_id = | ||
| 59 | of_match_device(w1_gpio_dt_ids, &pdev->dev); | ||
| 60 | |||
| 61 | if (!of_id) | ||
| 62 | return 0; | ||
| 63 | |||
| 64 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | ||
| 65 | if (!pdata) | ||
| 66 | return -ENOMEM; | ||
| 67 | |||
| 68 | if (of_get_property(np, "linux,open-drain", NULL)) | ||
| 69 | pdata->is_open_drain = 1; | ||
| 70 | |||
| 71 | pdata->pin = of_get_gpio(np, 0); | ||
| 72 | pdata->ext_pullup_enable_pin = of_get_gpio(np, 1); | ||
| 73 | pdev->dev.platform_data = pdata; | ||
| 74 | |||
| 75 | return 0; | ||
| 76 | } | ||
| 77 | #else | ||
| 78 | static int w1_gpio_probe_dt(struct platform_device *pdev) | ||
| 79 | { | ||
| 80 | return 0; | ||
| 81 | } | ||
| 82 | #endif | ||
| 83 | |||
| 45 | static int __init w1_gpio_probe(struct platform_device *pdev) | 84 | static int __init w1_gpio_probe(struct platform_device *pdev) |
| 46 | { | 85 | { |
| 47 | struct w1_bus_master *master; | 86 | struct w1_bus_master *master; |
| 48 | struct w1_gpio_platform_data *pdata = pdev->dev.platform_data; | 87 | struct w1_gpio_platform_data *pdata; |
| 49 | int err; | 88 | int err; |
| 50 | 89 | ||
| 90 | err = w1_gpio_probe_dt(pdev); | ||
| 91 | if (err < 0) | ||
| 92 | return err; | ||
| 93 | |||
| 94 | pdata = pdev->dev.platform_data; | ||
| 95 | |||
| 51 | if (!pdata) | 96 | if (!pdata) |
| 52 | return -ENXIO; | 97 | return -ENXIO; |
| 53 | 98 | ||
| @@ -59,6 +104,13 @@ static int __init w1_gpio_probe(struct platform_device *pdev) | |||
| 59 | if (err) | 104 | if (err) |
| 60 | goto free_master; | 105 | goto free_master; |
| 61 | 106 | ||
| 107 | if (gpio_is_valid(pdata->ext_pullup_enable_pin)) { | ||
| 108 | err = gpio_request_one(pdata->ext_pullup_enable_pin, | ||
| 109 | GPIOF_INIT_LOW, "w1 pullup"); | ||
| 110 | if (err < 0) | ||
| 111 | goto free_gpio; | ||
| 112 | } | ||
| 113 | |||
| 62 | master->data = pdata; | 114 | master->data = pdata; |
| 63 | master->read_bit = w1_gpio_read_bit; | 115 | master->read_bit = w1_gpio_read_bit; |
| 64 | 116 | ||
| @@ -72,15 +124,21 @@ static int __init w1_gpio_probe(struct platform_device *pdev) | |||
| 72 | 124 | ||
| 73 | err = w1_add_master_device(master); | 125 | err = w1_add_master_device(master); |
| 74 | if (err) | 126 | if (err) |
| 75 | goto free_gpio; | 127 | goto free_gpio_ext_pu; |
| 76 | 128 | ||
| 77 | if (pdata->enable_external_pullup) | 129 | if (pdata->enable_external_pullup) |
| 78 | pdata->enable_external_pullup(1); | 130 | pdata->enable_external_pullup(1); |
| 79 | 131 | ||
| 132 | if (gpio_is_valid(pdata->ext_pullup_enable_pin)) | ||
| 133 | gpio_set_value(pdata->ext_pullup_enable_pin, 1); | ||
| 134 | |||
| 80 | platform_set_drvdata(pdev, master); | 135 | platform_set_drvdata(pdev, master); |
| 81 | 136 | ||
| 82 | return 0; | 137 | return 0; |
| 83 | 138 | ||
| 139 | free_gpio_ext_pu: | ||
| 140 | if (gpio_is_valid(pdata->ext_pullup_enable_pin)) | ||
| 141 | gpio_free(pdata->ext_pullup_enable_pin); | ||
| 84 | free_gpio: | 142 | free_gpio: |
| 85 | gpio_free(pdata->pin); | 143 | gpio_free(pdata->pin); |
| 86 | free_master: | 144 | free_master: |
| @@ -97,6 +155,9 @@ static int __exit w1_gpio_remove(struct platform_device *pdev) | |||
| 97 | if (pdata->enable_external_pullup) | 155 | if (pdata->enable_external_pullup) |
| 98 | pdata->enable_external_pullup(0); | 156 | pdata->enable_external_pullup(0); |
| 99 | 157 | ||
| 158 | if (gpio_is_valid(pdata->ext_pullup_enable_pin)) | ||
| 159 | gpio_set_value(pdata->ext_pullup_enable_pin, 0); | ||
| 160 | |||
| 100 | w1_remove_master_device(master); | 161 | w1_remove_master_device(master); |
| 101 | gpio_free(pdata->pin); | 162 | gpio_free(pdata->pin); |
| 102 | kfree(master); | 163 | kfree(master); |
| @@ -135,6 +196,7 @@ static struct platform_driver w1_gpio_driver = { | |||
| 135 | .driver = { | 196 | .driver = { |
| 136 | .name = "w1-gpio", | 197 | .name = "w1-gpio", |
| 137 | .owner = THIS_MODULE, | 198 | .owner = THIS_MODULE, |
| 199 | .of_match_table = of_match_ptr(w1_gpio_dt_ids), | ||
| 138 | }, | 200 | }, |
| 139 | .remove = __exit_p(w1_gpio_remove), | 201 | .remove = __exit_p(w1_gpio_remove), |
| 140 | .suspend = w1_gpio_suspend, | 202 | .suspend = w1_gpio_suspend, |
diff --git a/include/linux/ti_wilink_st.h b/include/linux/ti_wilink_st.h index 3ca0269dd0b5..932b76392248 100644 --- a/include/linux/ti_wilink_st.h +++ b/include/linux/ti_wilink_st.h | |||
| @@ -281,9 +281,10 @@ struct kim_data_s { | |||
| 281 | long st_kim_start(void *); | 281 | long st_kim_start(void *); |
| 282 | long st_kim_stop(void *); | 282 | long st_kim_stop(void *); |
| 283 | 283 | ||
| 284 | void st_kim_recv(void *, const unsigned char *, long count); | ||
| 285 | void st_kim_complete(void *); | 284 | void st_kim_complete(void *); |
| 286 | void kim_st_list_protocols(struct st_data_s *, void *); | 285 | void kim_st_list_protocols(struct st_data_s *, void *); |
| 286 | void st_kim_recv(void *, const unsigned char *, long); | ||
| 287 | |||
| 287 | 288 | ||
| 288 | /* | 289 | /* |
| 289 | * BTS headers | 290 | * BTS headers |
diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h index 3adeff82212f..065e3ae79ab0 100644 --- a/include/linux/w1-gpio.h +++ b/include/linux/w1-gpio.h | |||
| @@ -19,6 +19,7 @@ struct w1_gpio_platform_data { | |||
| 19 | unsigned int pin; | 19 | unsigned int pin; |
| 20 | unsigned int is_open_drain:1; | 20 | unsigned int is_open_drain:1; |
| 21 | void (*enable_external_pullup)(int enable); | 21 | void (*enable_external_pullup)(int enable); |
| 22 | unsigned int ext_pullup_enable_pin; | ||
| 22 | }; | 23 | }; |
| 23 | 24 | ||
| 24 | #endif /* _LINUX_W1_GPIO_H */ | 25 | #endif /* _LINUX_W1_GPIO_H */ |
