diff options
| -rw-r--r-- | Documentation/devicetree/bindings/input/gpio-keys.txt | 10 | ||||
| -rw-r--r-- | Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt | 23 | ||||
| -rw-r--r-- | arch/arm/boot/dts/bcm-cygnus.dtsi | 11 | ||||
| -rw-r--r-- | drivers/input/keyboard/omap-keypad.c | 52 | ||||
| -rw-r--r-- | drivers/input/keyboard/twl4030_keypad.c | 28 | ||||
| -rw-r--r-- | drivers/input/misc/cm109.c | 47 | ||||
| -rw-r--r-- | drivers/input/misc/rotary_encoder.c | 8 | ||||
| -rw-r--r-- | drivers/input/misc/twl6040-vibra.c | 15 | ||||
| -rw-r--r-- | drivers/input/mouse/byd.c | 1 | ||||
| -rw-r--r-- | drivers/input/tablet/acecad.c | 12 | ||||
| -rw-r--r-- | drivers/input/tablet/aiptek.c | 20 | ||||
| -rw-r--r-- | drivers/input/tablet/gtco.c | 24 | ||||
| -rw-r--r-- | drivers/input/tablet/kbtab.c | 8 | ||||
| -rw-r--r-- | drivers/input/touchscreen/bcm_iproc_tsc.c | 77 | ||||
| -rw-r--r-- | drivers/input/touchscreen/ti_am335x_tsc.c | 16 |
15 files changed, 170 insertions, 182 deletions
diff --git a/Documentation/devicetree/bindings/input/gpio-keys.txt b/Documentation/devicetree/bindings/input/gpio-keys.txt index 21641236c095..a94940481e55 100644 --- a/Documentation/devicetree/bindings/input/gpio-keys.txt +++ b/Documentation/devicetree/bindings/input/gpio-keys.txt | |||
| @@ -32,17 +32,17 @@ Optional subnode-properties: | |||
| 32 | 32 | ||
| 33 | Example nodes: | 33 | Example nodes: |
| 34 | 34 | ||
| 35 | gpio_keys { | 35 | gpio-keys { |
| 36 | compatible = "gpio-keys"; | 36 | compatible = "gpio-keys"; |
| 37 | #address-cells = <1>; | ||
| 38 | #size-cells = <0>; | ||
| 39 | autorepeat; | 37 | autorepeat; |
| 40 | button@21 { | 38 | |
| 39 | up { | ||
| 41 | label = "GPIO Key UP"; | 40 | label = "GPIO Key UP"; |
| 42 | linux,code = <103>; | 41 | linux,code = <103>; |
| 43 | gpios = <&gpio1 0 1>; | 42 | gpios = <&gpio1 0 1>; |
| 44 | }; | 43 | }; |
| 45 | button@22 { | 44 | |
| 45 | down { | ||
| 46 | label = "GPIO Key DOWN"; | 46 | label = "GPIO Key DOWN"; |
| 47 | linux,code = <108>; | 47 | linux,code = <108>; |
| 48 | interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; | 48 | interrupts = <1 IRQ_TYPE_LEVEL_HIGH 7>; |
diff --git a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt index 34e3382a0659..ac5dff412e25 100644 --- a/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt +++ b/Documentation/devicetree/bindings/input/touchscreen/brcm,iproc-touchscreen.txt | |||
| @@ -2,11 +2,17 @@ | |||
| 2 | 2 | ||
| 3 | Required properties: | 3 | Required properties: |
| 4 | - compatible: must be "brcm,iproc-touchscreen" | 4 | - compatible: must be "brcm,iproc-touchscreen" |
| 5 | - reg: physical base address of the controller and length of memory mapped | 5 | - ts_syscon: handler of syscon node defining physical base |
| 6 | region. | 6 | address of the controller and length of memory mapped region. |
| 7 | If this property is selected please make sure MFD_SYSCON config | ||
| 8 | is enabled in the defconfig file. | ||
| 7 | - clocks: The clock provided by the SOC to driver the tsc | 9 | - clocks: The clock provided by the SOC to driver the tsc |
| 8 | - clock-name: name for the clock | 10 | - clock-names: name for the clock |
| 9 | - interrupts: The touchscreen controller's interrupt | 11 | - interrupts: The touchscreen controller's interrupt |
| 12 | - address-cells: Specify the number of u32 entries needed in child nodes. | ||
| 13 | Should set to 1. | ||
| 14 | - size-cells: Specify number of u32 entries needed to specify child nodes size | ||
| 15 | in reg property. Should set to 1. | ||
| 10 | 16 | ||
| 11 | Optional properties: | 17 | Optional properties: |
| 12 | - scanning_period: Time between scans. Each step is 1024 us. Valid 1-256. | 18 | - scanning_period: Time between scans. Each step is 1024 us. Valid 1-256. |
| @@ -53,13 +59,18 @@ Optional properties: | |||
| 53 | - touchscreen-inverted-x: X axis is inverted (boolean) | 59 | - touchscreen-inverted-x: X axis is inverted (boolean) |
| 54 | - touchscreen-inverted-y: Y axis is inverted (boolean) | 60 | - touchscreen-inverted-y: Y axis is inverted (boolean) |
| 55 | 61 | ||
| 56 | Example: | 62 | Example: An example of touchscreen node |
| 57 | 63 | ||
| 58 | touchscreen: tsc@0x180A6000 { | 64 | ts_adc_syscon: ts_adc_syscon@180a6000 { |
| 65 | compatible = "brcm,iproc-ts-adc-syscon","syscon"; | ||
| 66 | reg = <0x180a6000 0xc30>; | ||
| 67 | }; | ||
| 68 | |||
| 69 | touchscreen: touchscreen@180A6000 { | ||
| 59 | compatible = "brcm,iproc-touchscreen"; | 70 | compatible = "brcm,iproc-touchscreen"; |
| 60 | #address-cells = <1>; | 71 | #address-cells = <1>; |
| 61 | #size-cells = <1>; | 72 | #size-cells = <1>; |
| 62 | reg = <0x180A6000 0x40>; | 73 | ts_syscon = <&ts_adc_syscon>; |
| 63 | clocks = <&adc_clk>; | 74 | clocks = <&adc_clk>; |
| 64 | clock-names = "tsc_clk"; | 75 | clock-names = "tsc_clk"; |
| 65 | interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; | 76 | interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; |
diff --git a/arch/arm/boot/dts/bcm-cygnus.dtsi b/arch/arm/boot/dts/bcm-cygnus.dtsi index 3878793364f0..b42fe5596b94 100644 --- a/arch/arm/boot/dts/bcm-cygnus.dtsi +++ b/arch/arm/boot/dts/bcm-cygnus.dtsi | |||
| @@ -351,9 +351,16 @@ | |||
| 351 | <&pinctrl 142 10 1>; | 351 | <&pinctrl 142 10 1>; |
| 352 | }; | 352 | }; |
| 353 | 353 | ||
| 354 | touchscreen: tsc@180a6000 { | 354 | ts_adc_syscon: ts_adc_syscon@180a6000 { |
| 355 | compatible = "brcm,iproc-ts-adc-syscon", "syscon"; | ||
| 356 | reg = <0x180a6000 0xc30>; | ||
| 357 | }; | ||
| 358 | |||
| 359 | touchscreen: touchscreen@180a6000 { | ||
| 355 | compatible = "brcm,iproc-touchscreen"; | 360 | compatible = "brcm,iproc-touchscreen"; |
| 356 | reg = <0x180a6000 0x40>; | 361 | #address-cells = <1>; |
| 362 | #size-cells = <1>; | ||
| 363 | ts_syscon = <&ts_adc_syscon>; | ||
| 357 | clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>; | 364 | clocks = <&asiu_clks BCM_CYGNUS_ASIU_ADC_CLK>; |
| 358 | clock-names = "tsc_clk"; | 365 | clock-names = "tsc_clk"; |
| 359 | interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; | 366 | interrupts = <GIC_SPI 164 IRQ_TYPE_LEVEL_HIGH>; |
diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c index e0d72c8c01e4..146b26f665f6 100644 --- a/drivers/input/keyboard/omap-keypad.c +++ b/drivers/input/keyboard/omap-keypad.c | |||
| @@ -64,31 +64,6 @@ static DECLARE_TASKLET_DISABLED(kp_tasklet, omap_kp_tasklet, 0); | |||
| 64 | static unsigned int *row_gpios; | 64 | static unsigned int *row_gpios; |
| 65 | static unsigned int *col_gpios; | 65 | static unsigned int *col_gpios; |
| 66 | 66 | ||
| 67 | #ifdef CONFIG_ARCH_OMAP2 | ||
| 68 | static void set_col_gpio_val(struct omap_kp *omap_kp, u8 value) | ||
| 69 | { | ||
| 70 | int col; | ||
| 71 | |||
| 72 | for (col = 0; col < omap_kp->cols; col++) | ||
| 73 | gpio_set_value(col_gpios[col], value & (1 << col)); | ||
| 74 | } | ||
| 75 | |||
| 76 | static u8 get_row_gpio_val(struct omap_kp *omap_kp) | ||
| 77 | { | ||
| 78 | int row; | ||
| 79 | u8 value = 0; | ||
| 80 | |||
| 81 | for (row = 0; row < omap_kp->rows; row++) { | ||
| 82 | if (gpio_get_value(row_gpios[row])) | ||
| 83 | value |= (1 << row); | ||
| 84 | } | ||
| 85 | return value; | ||
| 86 | } | ||
| 87 | #else | ||
| 88 | #define set_col_gpio_val(x, y) do {} while (0) | ||
| 89 | #define get_row_gpio_val(x) 0 | ||
| 90 | #endif | ||
| 91 | |||
| 92 | static irqreturn_t omap_kp_interrupt(int irq, void *dev_id) | 67 | static irqreturn_t omap_kp_interrupt(int irq, void *dev_id) |
| 93 | { | 68 | { |
| 94 | /* disable keyboard interrupt and schedule for handling */ | 69 | /* disable keyboard interrupt and schedule for handling */ |
| @@ -133,7 +108,6 @@ static void omap_kp_tasklet(unsigned long data) | |||
| 133 | unsigned int row_shift = get_count_order(omap_kp_data->cols); | 108 | unsigned int row_shift = get_count_order(omap_kp_data->cols); |
| 134 | unsigned char new_state[8], changed, key_down = 0; | 109 | unsigned char new_state[8], changed, key_down = 0; |
| 135 | int col, row; | 110 | int col, row; |
| 136 | int spurious = 0; | ||
| 137 | 111 | ||
| 138 | /* check for any changes */ | 112 | /* check for any changes */ |
| 139 | omap_kp_scan_keypad(omap_kp_data, new_state); | 113 | omap_kp_scan_keypad(omap_kp_data, new_state); |
| @@ -170,12 +144,9 @@ static void omap_kp_tasklet(unsigned long data) | |||
| 170 | memcpy(keypad_state, new_state, sizeof(keypad_state)); | 144 | memcpy(keypad_state, new_state, sizeof(keypad_state)); |
| 171 | 145 | ||
| 172 | if (key_down) { | 146 | if (key_down) { |
| 173 | int delay = HZ / 20; | ||
| 174 | /* some key is pressed - keep irq disabled and use timer | 147 | /* some key is pressed - keep irq disabled and use timer |
| 175 | * to poll the keypad */ | 148 | * to poll the keypad */ |
| 176 | if (spurious) | 149 | mod_timer(&omap_kp_data->timer, jiffies + HZ / 20); |
| 177 | delay = 2 * HZ; | ||
| 178 | mod_timer(&omap_kp_data->timer, jiffies + delay); | ||
| 179 | } else { | 150 | } else { |
| 180 | /* enable interrupts */ | 151 | /* enable interrupts */ |
| 181 | omap_writew(0, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); | 152 | omap_writew(0, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); |
| @@ -216,25 +187,6 @@ static ssize_t omap_kp_enable_store(struct device *dev, struct device_attribute | |||
| 216 | 187 | ||
| 217 | static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, omap_kp_enable_show, omap_kp_enable_store); | 188 | static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, omap_kp_enable_show, omap_kp_enable_store); |
| 218 | 189 | ||
| 219 | #ifdef CONFIG_PM | ||
| 220 | static int omap_kp_suspend(struct platform_device *dev, pm_message_t state) | ||
| 221 | { | ||
| 222 | /* Nothing yet */ | ||
| 223 | |||
| 224 | return 0; | ||
| 225 | } | ||
| 226 | |||
| 227 | static int omap_kp_resume(struct platform_device *dev) | ||
| 228 | { | ||
| 229 | /* Nothing yet */ | ||
| 230 | |||
| 231 | return 0; | ||
| 232 | } | ||
| 233 | #else | ||
| 234 | #define omap_kp_suspend NULL | ||
| 235 | #define omap_kp_resume NULL | ||
| 236 | #endif | ||
| 237 | |||
| 238 | static int omap_kp_probe(struct platform_device *pdev) | 190 | static int omap_kp_probe(struct platform_device *pdev) |
| 239 | { | 191 | { |
| 240 | struct omap_kp *omap_kp; | 192 | struct omap_kp *omap_kp; |
| @@ -371,8 +323,6 @@ static int omap_kp_remove(struct platform_device *pdev) | |||
| 371 | static struct platform_driver omap_kp_driver = { | 323 | static struct platform_driver omap_kp_driver = { |
| 372 | .probe = omap_kp_probe, | 324 | .probe = omap_kp_probe, |
| 373 | .remove = omap_kp_remove, | 325 | .remove = omap_kp_remove, |
| 374 | .suspend = omap_kp_suspend, | ||
| 375 | .resume = omap_kp_resume, | ||
| 376 | .driver = { | 326 | .driver = { |
| 377 | .name = "omap-keypad", | 327 | .name = "omap-keypad", |
| 378 | }, | 328 | }, |
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index bbcccd67247d..323a0fb575a4 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c | |||
| @@ -61,9 +61,9 @@ struct twl4030_keypad { | |||
| 61 | unsigned short keymap[TWL4030_KEYMAP_SIZE]; | 61 | unsigned short keymap[TWL4030_KEYMAP_SIZE]; |
| 62 | u16 kp_state[TWL4030_MAX_ROWS]; | 62 | u16 kp_state[TWL4030_MAX_ROWS]; |
| 63 | bool autorepeat; | 63 | bool autorepeat; |
| 64 | unsigned n_rows; | 64 | unsigned int n_rows; |
| 65 | unsigned n_cols; | 65 | unsigned int n_cols; |
| 66 | unsigned irq; | 66 | unsigned int irq; |
| 67 | 67 | ||
| 68 | struct device *dbg_dev; | 68 | struct device *dbg_dev; |
| 69 | struct input_dev *input; | 69 | struct input_dev *input; |
| @@ -110,7 +110,7 @@ struct twl4030_keypad { | |||
| 110 | #define KEYP_CTRL_KBD_ON BIT(6) | 110 | #define KEYP_CTRL_KBD_ON BIT(6) |
| 111 | 111 | ||
| 112 | /* KEYP_DEB, KEYP_LONG_KEY, KEYP_TIMEOUT_x*/ | 112 | /* KEYP_DEB, KEYP_LONG_KEY, KEYP_TIMEOUT_x*/ |
| 113 | #define KEYP_PERIOD_US(t, prescale) ((t) / (31 << (prescale + 1)) - 1) | 113 | #define KEYP_PERIOD_US(t, prescale) ((t) / (31 << ((prescale) + 1)) - 1) |
| 114 | 114 | ||
| 115 | /* KEYP_LK_PTV_REG Fields */ | 115 | /* KEYP_LK_PTV_REG Fields */ |
| 116 | #define KEYP_LK_PTV_PTV_SHIFT 5 | 116 | #define KEYP_LK_PTV_PTV_SHIFT 5 |
| @@ -162,9 +162,10 @@ static int twl4030_kpwrite_u8(struct twl4030_keypad *kp, u8 data, u32 reg) | |||
| 162 | 162 | ||
| 163 | static inline u16 twl4030_col_xlate(struct twl4030_keypad *kp, u8 col) | 163 | static inline u16 twl4030_col_xlate(struct twl4030_keypad *kp, u8 col) |
| 164 | { | 164 | { |
| 165 | /* If all bits in a row are active for all coloumns then | 165 | /* |
| 166 | * If all bits in a row are active for all columns then | ||
| 166 | * we have that row line connected to gnd. Mark this | 167 | * we have that row line connected to gnd. Mark this |
| 167 | * key on as if it was on matrix position n_cols (ie | 168 | * key on as if it was on matrix position n_cols (i.e. |
| 168 | * one higher than the size of the matrix). | 169 | * one higher than the size of the matrix). |
| 169 | */ | 170 | */ |
| 170 | if (col == 0xFF) | 171 | if (col == 0xFF) |
| @@ -209,9 +210,9 @@ static void twl4030_kp_scan(struct twl4030_keypad *kp, bool release_all) | |||
| 209 | u16 new_state[TWL4030_MAX_ROWS]; | 210 | u16 new_state[TWL4030_MAX_ROWS]; |
| 210 | int col, row; | 211 | int col, row; |
| 211 | 212 | ||
| 212 | if (release_all) | 213 | if (release_all) { |
| 213 | memset(new_state, 0, sizeof(new_state)); | 214 | memset(new_state, 0, sizeof(new_state)); |
| 214 | else { | 215 | } else { |
| 215 | /* check for any changes */ | 216 | /* check for any changes */ |
| 216 | int ret = twl4030_read_kp_matrix_state(kp, new_state); | 217 | int ret = twl4030_read_kp_matrix_state(kp, new_state); |
| 217 | 218 | ||
| @@ -262,8 +263,10 @@ static irqreturn_t do_kp_irq(int irq, void *_kp) | |||
| 262 | /* Read & Clear TWL4030 pending interrupt */ | 263 | /* Read & Clear TWL4030 pending interrupt */ |
| 263 | ret = twl4030_kpread(kp, ®, KEYP_ISR1, 1); | 264 | ret = twl4030_kpread(kp, ®, KEYP_ISR1, 1); |
| 264 | 265 | ||
| 265 | /* Release all keys if I2C has gone bad or | 266 | /* |
| 266 | * the KEYP has gone to idle state */ | 267 | * Release all keys if I2C has gone bad or |
| 268 | * the KEYP has gone to idle state. | ||
| 269 | */ | ||
| 267 | if (ret >= 0 && (reg & KEYP_IMR1_KP)) | 270 | if (ret >= 0 && (reg & KEYP_IMR1_KP)) |
| 268 | twl4030_kp_scan(kp, false); | 271 | twl4030_kp_scan(kp, false); |
| 269 | else | 272 | else |
| @@ -283,7 +286,8 @@ static int twl4030_kp_program(struct twl4030_keypad *kp) | |||
| 283 | if (twl4030_kpwrite_u8(kp, reg, KEYP_CTRL) < 0) | 286 | if (twl4030_kpwrite_u8(kp, reg, KEYP_CTRL) < 0) |
| 284 | return -EIO; | 287 | return -EIO; |
| 285 | 288 | ||
| 286 | /* NOTE: we could use sih_setup() here to package keypad | 289 | /* |
| 290 | * NOTE: we could use sih_setup() here to package keypad | ||
| 287 | * event sources as four different IRQs ... but we don't. | 291 | * event sources as four different IRQs ... but we don't. |
| 288 | */ | 292 | */ |
| 289 | 293 | ||
| @@ -312,7 +316,7 @@ static int twl4030_kp_program(struct twl4030_keypad *kp) | |||
| 312 | 316 | ||
| 313 | /* | 317 | /* |
| 314 | * Enable Clear-on-Read; disable remembering events that fire | 318 | * Enable Clear-on-Read; disable remembering events that fire |
| 315 | * after the IRQ but before our handler acks (reads) them, | 319 | * after the IRQ but before our handler acks (reads) them. |
| 316 | */ | 320 | */ |
| 317 | reg = TWL4030_SIH_CTRL_COR_MASK | TWL4030_SIH_CTRL_PENDDIS_MASK; | 321 | reg = TWL4030_SIH_CTRL_COR_MASK | TWL4030_SIH_CTRL_PENDDIS_MASK; |
| 318 | if (twl4030_kpwrite_u8(kp, reg, KEYP_SIH_CTRL) < 0) | 322 | if (twl4030_kpwrite_u8(kp, reg, KEYP_SIH_CTRL) < 0) |
diff --git a/drivers/input/misc/cm109.c b/drivers/input/misc/cm109.c index 9365535ba7f1..9cc6d057c302 100644 --- a/drivers/input/misc/cm109.c +++ b/drivers/input/misc/cm109.c | |||
| @@ -76,8 +76,8 @@ enum { | |||
| 76 | 76 | ||
| 77 | BUZZER_ON = 1 << 5, | 77 | BUZZER_ON = 1 << 5, |
| 78 | 78 | ||
| 79 | /* up to 256 normal keys, up to 16 special keys */ | 79 | /* up to 256 normal keys, up to 15 special key combinations */ |
| 80 | KEYMAP_SIZE = 256 + 16, | 80 | KEYMAP_SIZE = 256 + 15, |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | /* CM109 protocol packet */ | 83 | /* CM109 protocol packet */ |
| @@ -139,7 +139,7 @@ static unsigned short special_keymap(int code) | |||
| 139 | { | 139 | { |
| 140 | if (code > 0xff) { | 140 | if (code > 0xff) { |
| 141 | switch (code - 0xff) { | 141 | switch (code - 0xff) { |
| 142 | case RECORD_MUTE: return KEY_MUTE; | 142 | case RECORD_MUTE: return KEY_MICMUTE; |
| 143 | case PLAYBACK_MUTE: return KEY_MUTE; | 143 | case PLAYBACK_MUTE: return KEY_MUTE; |
| 144 | case VOLUME_DOWN: return KEY_VOLUMEDOWN; | 144 | case VOLUME_DOWN: return KEY_VOLUMEDOWN; |
| 145 | case VOLUME_UP: return KEY_VOLUMEUP; | 145 | case VOLUME_UP: return KEY_VOLUMEUP; |
| @@ -312,6 +312,32 @@ static void report_key(struct cm109_dev *dev, int key) | |||
| 312 | input_sync(idev); | 312 | input_sync(idev); |
| 313 | } | 313 | } |
| 314 | 314 | ||
| 315 | /* | ||
| 316 | * Converts data of special key presses (volume, mute) into events | ||
| 317 | * for the input subsystem, sends press-n-release for mute keys. | ||
| 318 | */ | ||
| 319 | static void cm109_report_special(struct cm109_dev *dev) | ||
| 320 | { | ||
| 321 | static const u8 autorelease = RECORD_MUTE | PLAYBACK_MUTE; | ||
| 322 | struct input_dev *idev = dev->idev; | ||
| 323 | u8 data = dev->irq_data->byte[HID_IR0]; | ||
| 324 | unsigned short keycode; | ||
| 325 | int i; | ||
| 326 | |||
| 327 | for (i = 0; i < 4; i++) { | ||
| 328 | keycode = dev->keymap[0xff + BIT(i)]; | ||
| 329 | if (keycode == KEY_RESERVED) | ||
| 330 | continue; | ||
| 331 | |||
| 332 | input_report_key(idev, keycode, data & BIT(i)); | ||
| 333 | if (data & autorelease & BIT(i)) { | ||
| 334 | input_sync(idev); | ||
| 335 | input_report_key(idev, keycode, 0); | ||
| 336 | } | ||
| 337 | } | ||
| 338 | input_sync(idev); | ||
| 339 | } | ||
| 340 | |||
| 315 | /****************************************************************************** | 341 | /****************************************************************************** |
| 316 | * CM109 usb communication interface | 342 | * CM109 usb communication interface |
| 317 | *****************************************************************************/ | 343 | *****************************************************************************/ |
| @@ -340,6 +366,7 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
| 340 | struct cm109_dev *dev = urb->context; | 366 | struct cm109_dev *dev = urb->context; |
| 341 | const int status = urb->status; | 367 | const int status = urb->status; |
| 342 | int error; | 368 | int error; |
| 369 | unsigned long flags; | ||
| 343 | 370 | ||
| 344 | dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", | 371 | dev_dbg(&dev->intf->dev, "### URB IRQ: [0x%02x 0x%02x 0x%02x 0x%02x] keybit=0x%02x\n", |
| 345 | dev->irq_data->byte[0], | 372 | dev->irq_data->byte[0], |
| @@ -357,10 +384,7 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
| 357 | } | 384 | } |
| 358 | 385 | ||
| 359 | /* Special keys */ | 386 | /* Special keys */ |
| 360 | if (dev->irq_data->byte[HID_IR0] & 0x0f) { | 387 | cm109_report_special(dev); |
| 361 | const int code = (dev->irq_data->byte[HID_IR0] & 0x0f); | ||
| 362 | report_key(dev, dev->keymap[0xff + code]); | ||
| 363 | } | ||
| 364 | 388 | ||
| 365 | /* Scan key column */ | 389 | /* Scan key column */ |
| 366 | if (dev->keybit == 0xf) { | 390 | if (dev->keybit == 0xf) { |
| @@ -381,7 +405,7 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
| 381 | 405 | ||
| 382 | out: | 406 | out: |
| 383 | 407 | ||
| 384 | spin_lock(&dev->ctl_submit_lock); | 408 | spin_lock_irqsave(&dev->ctl_submit_lock, flags); |
| 385 | 409 | ||
| 386 | dev->irq_urb_pending = 0; | 410 | dev->irq_urb_pending = 0; |
| 387 | 411 | ||
| @@ -405,7 +429,7 @@ static void cm109_urb_irq_callback(struct urb *urb) | |||
| 405 | __func__, error); | 429 | __func__, error); |
| 406 | } | 430 | } |
| 407 | 431 | ||
| 408 | spin_unlock(&dev->ctl_submit_lock); | 432 | spin_unlock_irqrestore(&dev->ctl_submit_lock, flags); |
| 409 | } | 433 | } |
| 410 | 434 | ||
| 411 | static void cm109_urb_ctl_callback(struct urb *urb) | 435 | static void cm109_urb_ctl_callback(struct urb *urb) |
| @@ -413,6 +437,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
| 413 | struct cm109_dev *dev = urb->context; | 437 | struct cm109_dev *dev = urb->context; |
| 414 | const int status = urb->status; | 438 | const int status = urb->status; |
| 415 | int error; | 439 | int error; |
| 440 | unsigned long flags; | ||
| 416 | 441 | ||
| 417 | dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", | 442 | dev_dbg(&dev->intf->dev, "### URB CTL: [0x%02x 0x%02x 0x%02x 0x%02x]\n", |
| 418 | dev->ctl_data->byte[0], | 443 | dev->ctl_data->byte[0], |
| @@ -427,7 +452,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
| 427 | __func__, status); | 452 | __func__, status); |
| 428 | } | 453 | } |
| 429 | 454 | ||
| 430 | spin_lock(&dev->ctl_submit_lock); | 455 | spin_lock_irqsave(&dev->ctl_submit_lock, flags); |
| 431 | 456 | ||
| 432 | dev->ctl_urb_pending = 0; | 457 | dev->ctl_urb_pending = 0; |
| 433 | 458 | ||
| @@ -448,7 +473,7 @@ static void cm109_urb_ctl_callback(struct urb *urb) | |||
| 448 | } | 473 | } |
| 449 | } | 474 | } |
| 450 | 475 | ||
| 451 | spin_unlock(&dev->ctl_submit_lock); | 476 | spin_unlock_irqrestore(&dev->ctl_submit_lock, flags); |
| 452 | } | 477 | } |
| 453 | 478 | ||
| 454 | static void cm109_toggle_buzzer_async(struct cm109_dev *dev) | 479 | static void cm109_toggle_buzzer_async(struct cm109_dev *dev) |
diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c index 96c486de49e0..c7fc8d4fb080 100644 --- a/drivers/input/misc/rotary_encoder.c +++ b/drivers/input/misc/rotary_encoder.c | |||
| @@ -47,13 +47,13 @@ struct rotary_encoder { | |||
| 47 | bool armed; | 47 | bool armed; |
| 48 | signed char dir; /* 1 - clockwise, -1 - CCW */ | 48 | signed char dir; /* 1 - clockwise, -1 - CCW */ |
| 49 | 49 | ||
| 50 | unsigned last_stable; | 50 | unsigned int last_stable; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | static unsigned rotary_encoder_get_state(struct rotary_encoder *encoder) | 53 | static unsigned int rotary_encoder_get_state(struct rotary_encoder *encoder) |
| 54 | { | 54 | { |
| 55 | int i; | 55 | int i; |
| 56 | unsigned ret = 0; | 56 | unsigned int ret = 0; |
| 57 | 57 | ||
| 58 | for (i = 0; i < encoder->gpios->ndescs; ++i) { | 58 | for (i = 0; i < encoder->gpios->ndescs; ++i) { |
| 59 | int val = gpiod_get_value_cansleep(encoder->gpios->desc[i]); | 59 | int val = gpiod_get_value_cansleep(encoder->gpios->desc[i]); |
| @@ -100,7 +100,7 @@ static void rotary_encoder_report_event(struct rotary_encoder *encoder) | |||
| 100 | static irqreturn_t rotary_encoder_irq(int irq, void *dev_id) | 100 | static irqreturn_t rotary_encoder_irq(int irq, void *dev_id) |
| 101 | { | 101 | { |
| 102 | struct rotary_encoder *encoder = dev_id; | 102 | struct rotary_encoder *encoder = dev_id; |
| 103 | unsigned state; | 103 | unsigned int state; |
| 104 | 104 | ||
| 105 | mutex_lock(&encoder->access_mutex); | 105 | mutex_lock(&encoder->access_mutex); |
| 106 | 106 | ||
diff --git a/drivers/input/misc/twl6040-vibra.c b/drivers/input/misc/twl6040-vibra.c index 42de34b92996..5690eb7ff954 100644 --- a/drivers/input/misc/twl6040-vibra.c +++ b/drivers/input/misc/twl6040-vibra.c | |||
| @@ -46,7 +46,7 @@ struct vibra_info { | |||
| 46 | struct device *dev; | 46 | struct device *dev; |
| 47 | struct input_dev *input_dev; | 47 | struct input_dev *input_dev; |
| 48 | struct work_struct play_work; | 48 | struct work_struct play_work; |
| 49 | struct mutex mutex; | 49 | |
| 50 | int irq; | 50 | int irq; |
| 51 | 51 | ||
| 52 | bool enabled; | 52 | bool enabled; |
| @@ -190,8 +190,6 @@ static void vibra_play_work(struct work_struct *work) | |||
| 190 | return; | 190 | return; |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | mutex_lock(&info->mutex); | ||
| 194 | |||
| 195 | if (info->weak_speed || info->strong_speed) { | 193 | if (info->weak_speed || info->strong_speed) { |
| 196 | if (!info->enabled) | 194 | if (!info->enabled) |
| 197 | twl6040_vibra_enable(info); | 195 | twl6040_vibra_enable(info); |
| @@ -200,7 +198,6 @@ static void vibra_play_work(struct work_struct *work) | |||
| 200 | } else if (info->enabled) | 198 | } else if (info->enabled) |
| 201 | twl6040_vibra_disable(info); | 199 | twl6040_vibra_disable(info); |
| 202 | 200 | ||
| 203 | mutex_unlock(&info->mutex); | ||
| 204 | } | 201 | } |
| 205 | 202 | ||
| 206 | static int vibra_play(struct input_dev *input, void *data, | 203 | static int vibra_play(struct input_dev *input, void *data, |
| @@ -223,12 +220,8 @@ static void twl6040_vibra_close(struct input_dev *input) | |||
| 223 | 220 | ||
| 224 | cancel_work_sync(&info->play_work); | 221 | cancel_work_sync(&info->play_work); |
| 225 | 222 | ||
| 226 | mutex_lock(&info->mutex); | ||
| 227 | |||
| 228 | if (info->enabled) | 223 | if (info->enabled) |
| 229 | twl6040_vibra_disable(info); | 224 | twl6040_vibra_disable(info); |
| 230 | |||
| 231 | mutex_unlock(&info->mutex); | ||
| 232 | } | 225 | } |
| 233 | 226 | ||
| 234 | static int __maybe_unused twl6040_vibra_suspend(struct device *dev) | 227 | static int __maybe_unused twl6040_vibra_suspend(struct device *dev) |
| @@ -236,13 +229,11 @@ static int __maybe_unused twl6040_vibra_suspend(struct device *dev) | |||
| 236 | struct platform_device *pdev = to_platform_device(dev); | 229 | struct platform_device *pdev = to_platform_device(dev); |
| 237 | struct vibra_info *info = platform_get_drvdata(pdev); | 230 | struct vibra_info *info = platform_get_drvdata(pdev); |
| 238 | 231 | ||
| 239 | mutex_lock(&info->mutex); | 232 | cancel_work_sync(&info->play_work); |
| 240 | 233 | ||
| 241 | if (info->enabled) | 234 | if (info->enabled) |
| 242 | twl6040_vibra_disable(info); | 235 | twl6040_vibra_disable(info); |
| 243 | 236 | ||
| 244 | mutex_unlock(&info->mutex); | ||
| 245 | |||
| 246 | return 0; | 237 | return 0; |
| 247 | } | 238 | } |
| 248 | 239 | ||
| @@ -301,8 +292,6 @@ static int twl6040_vibra_probe(struct platform_device *pdev) | |||
| 301 | return -EINVAL; | 292 | return -EINVAL; |
| 302 | } | 293 | } |
| 303 | 294 | ||
| 304 | mutex_init(&info->mutex); | ||
| 305 | |||
| 306 | error = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, | 295 | error = devm_request_threaded_irq(&pdev->dev, info->irq, NULL, |
| 307 | twl6040_vib_irq_handler, | 296 | twl6040_vib_irq_handler, |
| 308 | IRQF_ONESHOT, | 297 | IRQF_ONESHOT, |
diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c index e583f8b50454..b27aa637f877 100644 --- a/drivers/input/mouse/byd.c +++ b/drivers/input/mouse/byd.c | |||
| @@ -478,7 +478,6 @@ int byd_init(struct psmouse *psmouse) | |||
| 478 | if (!priv) | 478 | if (!priv) |
| 479 | return -ENOMEM; | 479 | return -ENOMEM; |
| 480 | 480 | ||
| 481 | memset(priv, 0, sizeof(*priv)); | ||
| 482 | setup_timer(&priv->timer, byd_clear_touch, (unsigned long) psmouse); | 481 | setup_timer(&priv->timer, byd_clear_touch, (unsigned long) psmouse); |
| 483 | 482 | ||
| 484 | psmouse->private = priv; | 483 | psmouse->private = priv; |
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c index 889f6b77e8cb..e86e377a90f5 100644 --- a/drivers/input/tablet/acecad.c +++ b/drivers/input/tablet/acecad.c | |||
| @@ -49,7 +49,6 @@ MODULE_LICENSE(DRIVER_LICENSE); | |||
| 49 | struct usb_acecad { | 49 | struct usb_acecad { |
| 50 | char name[128]; | 50 | char name[128]; |
| 51 | char phys[64]; | 51 | char phys[64]; |
| 52 | struct usb_device *usbdev; | ||
| 53 | struct usb_interface *intf; | 52 | struct usb_interface *intf; |
| 54 | struct input_dev *input; | 53 | struct input_dev *input; |
| 55 | struct urb *irq; | 54 | struct urb *irq; |
| @@ -64,6 +63,7 @@ static void usb_acecad_irq(struct urb *urb) | |||
| 64 | unsigned char *data = acecad->data; | 63 | unsigned char *data = acecad->data; |
| 65 | struct input_dev *dev = acecad->input; | 64 | struct input_dev *dev = acecad->input; |
| 66 | struct usb_interface *intf = acecad->intf; | 65 | struct usb_interface *intf = acecad->intf; |
| 66 | struct usb_device *udev = interface_to_usbdev(intf); | ||
| 67 | int prox, status; | 67 | int prox, status; |
| 68 | 68 | ||
| 69 | switch (urb->status) { | 69 | switch (urb->status) { |
| @@ -110,15 +110,15 @@ resubmit: | |||
| 110 | if (status) | 110 | if (status) |
| 111 | dev_err(&intf->dev, | 111 | dev_err(&intf->dev, |
| 112 | "can't resubmit intr, %s-%s/input0, status %d\n", | 112 | "can't resubmit intr, %s-%s/input0, status %d\n", |
| 113 | acecad->usbdev->bus->bus_name, | 113 | udev->bus->bus_name, |
| 114 | acecad->usbdev->devpath, status); | 114 | udev->devpath, status); |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | static int usb_acecad_open(struct input_dev *dev) | 117 | static int usb_acecad_open(struct input_dev *dev) |
| 118 | { | 118 | { |
| 119 | struct usb_acecad *acecad = input_get_drvdata(dev); | 119 | struct usb_acecad *acecad = input_get_drvdata(dev); |
| 120 | 120 | ||
| 121 | acecad->irq->dev = acecad->usbdev; | 121 | acecad->irq->dev = interface_to_usbdev(acecad->intf); |
| 122 | if (usb_submit_urb(acecad->irq, GFP_KERNEL)) | 122 | if (usb_submit_urb(acecad->irq, GFP_KERNEL)) |
| 123 | return -EIO; | 123 | return -EIO; |
| 124 | 124 | ||
| @@ -172,7 +172,6 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
| 172 | goto fail2; | 172 | goto fail2; |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | acecad->usbdev = dev; | ||
| 176 | acecad->intf = intf; | 175 | acecad->intf = intf; |
| 177 | acecad->input = input_dev; | 176 | acecad->input = input_dev; |
| 178 | 177 | ||
| @@ -251,12 +250,13 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
| 251 | static void usb_acecad_disconnect(struct usb_interface *intf) | 250 | static void usb_acecad_disconnect(struct usb_interface *intf) |
| 252 | { | 251 | { |
| 253 | struct usb_acecad *acecad = usb_get_intfdata(intf); | 252 | struct usb_acecad *acecad = usb_get_intfdata(intf); |
| 253 | struct usb_device *udev = interface_to_usbdev(intf); | ||
| 254 | 254 | ||
| 255 | usb_set_intfdata(intf, NULL); | 255 | usb_set_intfdata(intf, NULL); |
| 256 | 256 | ||
| 257 | input_unregister_device(acecad->input); | 257 | input_unregister_device(acecad->input); |
| 258 | usb_free_urb(acecad->irq); | 258 | usb_free_urb(acecad->irq); |
| 259 | usb_free_coherent(acecad->usbdev, 8, acecad->data, acecad->data_dma); | 259 | usb_free_coherent(udev, 8, acecad->data, acecad->data_dma); |
| 260 | kfree(acecad); | 260 | kfree(acecad); |
| 261 | } | 261 | } |
| 262 | 262 | ||
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 78ca44840d60..4613f0aefd08 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c | |||
| @@ -307,7 +307,6 @@ struct aiptek_settings { | |||
| 307 | 307 | ||
| 308 | struct aiptek { | 308 | struct aiptek { |
| 309 | struct input_dev *inputdev; /* input device struct */ | 309 | struct input_dev *inputdev; /* input device struct */ |
| 310 | struct usb_device *usbdev; /* usb device struct */ | ||
| 311 | struct usb_interface *intf; /* usb interface struct */ | 310 | struct usb_interface *intf; /* usb interface struct */ |
| 312 | struct urb *urb; /* urb for incoming reports */ | 311 | struct urb *urb; /* urb for incoming reports */ |
| 313 | dma_addr_t data_dma; /* our dma stuffage */ | 312 | dma_addr_t data_dma; /* our dma stuffage */ |
| @@ -847,7 +846,7 @@ static int aiptek_open(struct input_dev *inputdev) | |||
| 847 | { | 846 | { |
| 848 | struct aiptek *aiptek = input_get_drvdata(inputdev); | 847 | struct aiptek *aiptek = input_get_drvdata(inputdev); |
| 849 | 848 | ||
| 850 | aiptek->urb->dev = aiptek->usbdev; | 849 | aiptek->urb->dev = interface_to_usbdev(aiptek->intf); |
| 851 | if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) | 850 | if (usb_submit_urb(aiptek->urb, GFP_KERNEL) != 0) |
| 852 | return -EIO; | 851 | return -EIO; |
| 853 | 852 | ||
| @@ -873,8 +872,10 @@ aiptek_set_report(struct aiptek *aiptek, | |||
| 873 | unsigned char report_type, | 872 | unsigned char report_type, |
| 874 | unsigned char report_id, void *buffer, int size) | 873 | unsigned char report_id, void *buffer, int size) |
| 875 | { | 874 | { |
| 876 | return usb_control_msg(aiptek->usbdev, | 875 | struct usb_device *udev = interface_to_usbdev(aiptek->intf); |
| 877 | usb_sndctrlpipe(aiptek->usbdev, 0), | 876 | |
| 877 | return usb_control_msg(udev, | ||
| 878 | usb_sndctrlpipe(udev, 0), | ||
| 878 | USB_REQ_SET_REPORT, | 879 | USB_REQ_SET_REPORT, |
| 879 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | | 880 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | |
| 880 | USB_DIR_OUT, (report_type << 8) + report_id, | 881 | USB_DIR_OUT, (report_type << 8) + report_id, |
| @@ -886,8 +887,10 @@ aiptek_get_report(struct aiptek *aiptek, | |||
| 886 | unsigned char report_type, | 887 | unsigned char report_type, |
| 887 | unsigned char report_id, void *buffer, int size) | 888 | unsigned char report_id, void *buffer, int size) |
| 888 | { | 889 | { |
| 889 | return usb_control_msg(aiptek->usbdev, | 890 | struct usb_device *udev = interface_to_usbdev(aiptek->intf); |
| 890 | usb_rcvctrlpipe(aiptek->usbdev, 0), | 891 | |
| 892 | return usb_control_msg(udev, | ||
| 893 | usb_rcvctrlpipe(udev, 0), | ||
| 891 | USB_REQ_GET_REPORT, | 894 | USB_REQ_GET_REPORT, |
| 892 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | | 895 | USB_TYPE_CLASS | USB_RECIP_INTERFACE | |
| 893 | USB_DIR_IN, (report_type << 8) + report_id, | 896 | USB_DIR_IN, (report_type << 8) + report_id, |
| @@ -1729,7 +1732,6 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
| 1729 | } | 1732 | } |
| 1730 | 1733 | ||
| 1731 | aiptek->inputdev = inputdev; | 1734 | aiptek->inputdev = inputdev; |
| 1732 | aiptek->usbdev = usbdev; | ||
| 1733 | aiptek->intf = intf; | 1735 | aiptek->intf = intf; |
| 1734 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; | 1736 | aiptek->ifnum = intf->altsetting[0].desc.bInterfaceNumber; |
| 1735 | aiptek->inDelay = 0; | 1737 | aiptek->inDelay = 0; |
| @@ -1833,8 +1835,8 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
| 1833 | * input. | 1835 | * input. |
| 1834 | */ | 1836 | */ |
| 1835 | usb_fill_int_urb(aiptek->urb, | 1837 | usb_fill_int_urb(aiptek->urb, |
| 1836 | aiptek->usbdev, | 1838 | usbdev, |
| 1837 | usb_rcvintpipe(aiptek->usbdev, | 1839 | usb_rcvintpipe(usbdev, |
| 1838 | endpoint->bEndpointAddress), | 1840 | endpoint->bEndpointAddress), |
| 1839 | aiptek->data, 8, aiptek_irq, aiptek, | 1841 | aiptek->data, 8, aiptek_irq, aiptek, |
| 1840 | endpoint->bInterval); | 1842 | endpoint->bInterval); |
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c index 7c18249d6c8e..abf09ac42ce4 100644 --- a/drivers/input/tablet/gtco.c +++ b/drivers/input/tablet/gtco.c | |||
| @@ -104,7 +104,6 @@ MODULE_DEVICE_TABLE (usb, gtco_usbid_table); | |||
| 104 | struct gtco { | 104 | struct gtco { |
| 105 | 105 | ||
| 106 | struct input_dev *inputdevice; /* input device struct pointer */ | 106 | struct input_dev *inputdevice; /* input device struct pointer */ |
| 107 | struct usb_device *usbdev; /* the usb device for this device */ | ||
| 108 | struct usb_interface *intf; /* the usb interface for this device */ | 107 | struct usb_interface *intf; /* the usb interface for this device */ |
| 109 | struct urb *urbinfo; /* urb for incoming reports */ | 108 | struct urb *urbinfo; /* urb for incoming reports */ |
| 110 | dma_addr_t buf_dma; /* dma addr of the data buffer*/ | 109 | dma_addr_t buf_dma; /* dma addr of the data buffer*/ |
| @@ -540,7 +539,7 @@ static int gtco_input_open(struct input_dev *inputdev) | |||
| 540 | { | 539 | { |
| 541 | struct gtco *device = input_get_drvdata(inputdev); | 540 | struct gtco *device = input_get_drvdata(inputdev); |
| 542 | 541 | ||
| 543 | device->urbinfo->dev = device->usbdev; | 542 | device->urbinfo->dev = interface_to_usbdev(device->intf); |
| 544 | if (usb_submit_urb(device->urbinfo, GFP_KERNEL)) | 543 | if (usb_submit_urb(device->urbinfo, GFP_KERNEL)) |
| 545 | return -EIO; | 544 | return -EIO; |
| 546 | 545 | ||
| @@ -824,6 +823,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 824 | int result = 0, retry; | 823 | int result = 0, retry; |
| 825 | int error; | 824 | int error; |
| 826 | struct usb_endpoint_descriptor *endpoint; | 825 | struct usb_endpoint_descriptor *endpoint; |
| 826 | struct usb_device *udev = interface_to_usbdev(usbinterface); | ||
| 827 | 827 | ||
| 828 | /* Allocate memory for device structure */ | 828 | /* Allocate memory for device structure */ |
| 829 | gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); | 829 | gtco = kzalloc(sizeof(struct gtco), GFP_KERNEL); |
| @@ -838,11 +838,10 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 838 | gtco->inputdevice = input_dev; | 838 | gtco->inputdevice = input_dev; |
| 839 | 839 | ||
| 840 | /* Save interface information */ | 840 | /* Save interface information */ |
| 841 | gtco->usbdev = interface_to_usbdev(usbinterface); | ||
| 842 | gtco->intf = usbinterface; | 841 | gtco->intf = usbinterface; |
| 843 | 842 | ||
| 844 | /* Allocate some data for incoming reports */ | 843 | /* Allocate some data for incoming reports */ |
| 845 | gtco->buffer = usb_alloc_coherent(gtco->usbdev, REPORT_MAX_SIZE, | 844 | gtco->buffer = usb_alloc_coherent(udev, REPORT_MAX_SIZE, |
| 846 | GFP_KERNEL, >co->buf_dma); | 845 | GFP_KERNEL, >co->buf_dma); |
| 847 | if (!gtco->buffer) { | 846 | if (!gtco->buffer) { |
| 848 | dev_err(&usbinterface->dev, "No more memory for us buffers\n"); | 847 | dev_err(&usbinterface->dev, "No more memory for us buffers\n"); |
| @@ -907,8 +906,8 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 907 | 906 | ||
| 908 | /* Couple of tries to get reply */ | 907 | /* Couple of tries to get reply */ |
| 909 | for (retry = 0; retry < 3; retry++) { | 908 | for (retry = 0; retry < 3; retry++) { |
| 910 | result = usb_control_msg(gtco->usbdev, | 909 | result = usb_control_msg(udev, |
| 911 | usb_rcvctrlpipe(gtco->usbdev, 0), | 910 | usb_rcvctrlpipe(udev, 0), |
| 912 | USB_REQ_GET_DESCRIPTOR, | 911 | USB_REQ_GET_DESCRIPTOR, |
| 913 | USB_RECIP_INTERFACE | USB_DIR_IN, | 912 | USB_RECIP_INTERFACE | USB_DIR_IN, |
| 914 | REPORT_DEVICE_TYPE << 8, | 913 | REPORT_DEVICE_TYPE << 8, |
| @@ -936,7 +935,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 936 | } | 935 | } |
| 937 | 936 | ||
| 938 | /* Create a device file node */ | 937 | /* Create a device file node */ |
| 939 | usb_make_path(gtco->usbdev, gtco->usbpath, sizeof(gtco->usbpath)); | 938 | usb_make_path(udev, gtco->usbpath, sizeof(gtco->usbpath)); |
| 940 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); | 939 | strlcat(gtco->usbpath, "/input0", sizeof(gtco->usbpath)); |
| 941 | 940 | ||
| 942 | /* Set Input device functions */ | 941 | /* Set Input device functions */ |
| @@ -953,15 +952,15 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 953 | gtco_setup_caps(input_dev); | 952 | gtco_setup_caps(input_dev); |
| 954 | 953 | ||
| 955 | /* Set input device required ID information */ | 954 | /* Set input device required ID information */ |
| 956 | usb_to_input_id(gtco->usbdev, &input_dev->id); | 955 | usb_to_input_id(udev, &input_dev->id); |
| 957 | input_dev->dev.parent = &usbinterface->dev; | 956 | input_dev->dev.parent = &usbinterface->dev; |
| 958 | 957 | ||
| 959 | /* Setup the URB, it will be posted later on open of input device */ | 958 | /* Setup the URB, it will be posted later on open of input device */ |
| 960 | endpoint = &usbinterface->altsetting[0].endpoint[0].desc; | 959 | endpoint = &usbinterface->altsetting[0].endpoint[0].desc; |
| 961 | 960 | ||
| 962 | usb_fill_int_urb(gtco->urbinfo, | 961 | usb_fill_int_urb(gtco->urbinfo, |
| 963 | gtco->usbdev, | 962 | udev, |
| 964 | usb_rcvintpipe(gtco->usbdev, | 963 | usb_rcvintpipe(udev, |
| 965 | endpoint->bEndpointAddress), | 964 | endpoint->bEndpointAddress), |
| 966 | gtco->buffer, | 965 | gtco->buffer, |
| 967 | REPORT_MAX_SIZE, | 966 | REPORT_MAX_SIZE, |
| @@ -985,7 +984,7 @@ static int gtco_probe(struct usb_interface *usbinterface, | |||
| 985 | err_free_urb: | 984 | err_free_urb: |
| 986 | usb_free_urb(gtco->urbinfo); | 985 | usb_free_urb(gtco->urbinfo); |
| 987 | err_free_buf: | 986 | err_free_buf: |
| 988 | usb_free_coherent(gtco->usbdev, REPORT_MAX_SIZE, | 987 | usb_free_coherent(udev, REPORT_MAX_SIZE, |
| 989 | gtco->buffer, gtco->buf_dma); | 988 | gtco->buffer, gtco->buf_dma); |
| 990 | err_free_devs: | 989 | err_free_devs: |
| 991 | input_free_device(input_dev); | 990 | input_free_device(input_dev); |
| @@ -1002,13 +1001,14 @@ static void gtco_disconnect(struct usb_interface *interface) | |||
| 1002 | { | 1001 | { |
| 1003 | /* Grab private device ptr */ | 1002 | /* Grab private device ptr */ |
| 1004 | struct gtco *gtco = usb_get_intfdata(interface); | 1003 | struct gtco *gtco = usb_get_intfdata(interface); |
| 1004 | struct usb_device *udev = interface_to_usbdev(interface); | ||
| 1005 | 1005 | ||
| 1006 | /* Now reverse all the registration stuff */ | 1006 | /* Now reverse all the registration stuff */ |
| 1007 | if (gtco) { | 1007 | if (gtco) { |
| 1008 | input_unregister_device(gtco->inputdevice); | 1008 | input_unregister_device(gtco->inputdevice); |
| 1009 | usb_kill_urb(gtco->urbinfo); | 1009 | usb_kill_urb(gtco->urbinfo); |
| 1010 | usb_free_urb(gtco->urbinfo); | 1010 | usb_free_urb(gtco->urbinfo); |
| 1011 | usb_free_coherent(gtco->usbdev, REPORT_MAX_SIZE, | 1011 | usb_free_coherent(udev, REPORT_MAX_SIZE, |
| 1012 | gtco->buffer, gtco->buf_dma); | 1012 | gtco->buffer, gtco->buf_dma); |
| 1013 | kfree(gtco); | 1013 | kfree(gtco); |
| 1014 | } | 1014 | } |
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c index d2ac7c2b5b82..e850d7e8afbc 100644 --- a/drivers/input/tablet/kbtab.c +++ b/drivers/input/tablet/kbtab.c | |||
| @@ -31,7 +31,6 @@ struct kbtab { | |||
| 31 | unsigned char *data; | 31 | unsigned char *data; |
| 32 | dma_addr_t data_dma; | 32 | dma_addr_t data_dma; |
| 33 | struct input_dev *dev; | 33 | struct input_dev *dev; |
| 34 | struct usb_device *usbdev; | ||
| 35 | struct usb_interface *intf; | 34 | struct usb_interface *intf; |
| 36 | struct urb *irq; | 35 | struct urb *irq; |
| 37 | char phys[32]; | 36 | char phys[32]; |
| @@ -99,8 +98,9 @@ MODULE_DEVICE_TABLE(usb, kbtab_ids); | |||
| 99 | static int kbtab_open(struct input_dev *dev) | 98 | static int kbtab_open(struct input_dev *dev) |
| 100 | { | 99 | { |
| 101 | struct kbtab *kbtab = input_get_drvdata(dev); | 100 | struct kbtab *kbtab = input_get_drvdata(dev); |
| 101 | struct usb_device *udev = interface_to_usbdev(kbtab->intf); | ||
| 102 | 102 | ||
| 103 | kbtab->irq->dev = kbtab->usbdev; | 103 | kbtab->irq->dev = udev; |
| 104 | if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) | 104 | if (usb_submit_urb(kbtab->irq, GFP_KERNEL)) |
| 105 | return -EIO; | 105 | return -EIO; |
| 106 | 106 | ||
| @@ -135,7 +135,6 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 135 | if (!kbtab->irq) | 135 | if (!kbtab->irq) |
| 136 | goto fail2; | 136 | goto fail2; |
| 137 | 137 | ||
| 138 | kbtab->usbdev = dev; | ||
| 139 | kbtab->intf = intf; | 138 | kbtab->intf = intf; |
| 140 | kbtab->dev = input_dev; | 139 | kbtab->dev = input_dev; |
| 141 | 140 | ||
| @@ -188,12 +187,13 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
| 188 | static void kbtab_disconnect(struct usb_interface *intf) | 187 | static void kbtab_disconnect(struct usb_interface *intf) |
| 189 | { | 188 | { |
| 190 | struct kbtab *kbtab = usb_get_intfdata(intf); | 189 | struct kbtab *kbtab = usb_get_intfdata(intf); |
| 190 | struct usb_device *udev = interface_to_usbdev(intf); | ||
| 191 | 191 | ||
| 192 | usb_set_intfdata(intf, NULL); | 192 | usb_set_intfdata(intf, NULL); |
| 193 | 193 | ||
| 194 | input_unregister_device(kbtab->dev); | 194 | input_unregister_device(kbtab->dev); |
| 195 | usb_free_urb(kbtab->irq); | 195 | usb_free_urb(kbtab->irq); |
| 196 | usb_free_coherent(kbtab->usbdev, 8, kbtab->data, kbtab->data_dma); | 196 | usb_free_coherent(udev, 8, kbtab->data, kbtab->data_dma); |
| 197 | kfree(kbtab); | 197 | kfree(kbtab); |
| 198 | } | 198 | } |
| 199 | 199 | ||
diff --git a/drivers/input/touchscreen/bcm_iproc_tsc.c b/drivers/input/touchscreen/bcm_iproc_tsc.c index ae460a5c93d5..4d11b27c7c43 100644 --- a/drivers/input/touchscreen/bcm_iproc_tsc.c +++ b/drivers/input/touchscreen/bcm_iproc_tsc.c | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
| 24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
| 25 | #include <linux/serio.h> | 25 | #include <linux/serio.h> |
| 26 | #include <linux/mfd/syscon.h> | ||
| 27 | #include <linux/regmap.h> | ||
| 26 | 28 | ||
| 27 | #define IPROC_TS_NAME "iproc-ts" | 29 | #define IPROC_TS_NAME "iproc-ts" |
| 28 | 30 | ||
| @@ -88,7 +90,11 @@ | |||
| 88 | #define TS_WIRE_MODE_BIT BIT(1) | 90 | #define TS_WIRE_MODE_BIT BIT(1) |
| 89 | 91 | ||
| 90 | #define dbg_reg(dev, priv, reg) \ | 92 | #define dbg_reg(dev, priv, reg) \ |
| 91 | dev_dbg(dev, "%20s= 0x%08x\n", #reg, readl((priv)->regs + reg)) | 93 | do { \ |
| 94 | u32 val; \ | ||
| 95 | regmap_read(priv->regmap, reg, &val); \ | ||
| 96 | dev_dbg(dev, "%20s= 0x%08x\n", #reg, val); \ | ||
| 97 | } while (0) | ||
| 92 | 98 | ||
| 93 | struct tsc_param { | 99 | struct tsc_param { |
| 94 | /* Each step is 1024 us. Valid 1-256 */ | 100 | /* Each step is 1024 us. Valid 1-256 */ |
| @@ -141,7 +147,7 @@ struct iproc_ts_priv { | |||
| 141 | struct platform_device *pdev; | 147 | struct platform_device *pdev; |
| 142 | struct input_dev *idev; | 148 | struct input_dev *idev; |
| 143 | 149 | ||
| 144 | void __iomem *regs; | 150 | struct regmap *regmap; |
| 145 | struct clk *tsc_clk; | 151 | struct clk *tsc_clk; |
| 146 | 152 | ||
| 147 | int pen_status; | 153 | int pen_status; |
| @@ -196,22 +202,22 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data) | |||
| 196 | int i; | 202 | int i; |
| 197 | bool needs_sync = false; | 203 | bool needs_sync = false; |
| 198 | 204 | ||
| 199 | intr_status = readl(priv->regs + INTERRUPT_STATUS); | 205 | regmap_read(priv->regmap, INTERRUPT_STATUS, &intr_status); |
| 200 | intr_status &= TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK; | 206 | intr_status &= TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK; |
| 201 | if (intr_status == 0) | 207 | if (intr_status == 0) |
| 202 | return IRQ_NONE; | 208 | return IRQ_NONE; |
| 203 | 209 | ||
| 204 | /* Clear all interrupt status bits, write-1-clear */ | 210 | /* Clear all interrupt status bits, write-1-clear */ |
| 205 | writel(intr_status, priv->regs + INTERRUPT_STATUS); | 211 | regmap_write(priv->regmap, INTERRUPT_STATUS, intr_status); |
| 206 | |||
| 207 | /* Pen up/down */ | 212 | /* Pen up/down */ |
| 208 | if (intr_status & TS_PEN_INTR_MASK) { | 213 | if (intr_status & TS_PEN_INTR_MASK) { |
| 209 | if (readl(priv->regs + CONTROLLER_STATUS) & TS_PEN_DOWN) | 214 | regmap_read(priv->regmap, CONTROLLER_STATUS, &priv->pen_status); |
| 215 | if (priv->pen_status & TS_PEN_DOWN) | ||
| 210 | priv->pen_status = PEN_DOWN_STATUS; | 216 | priv->pen_status = PEN_DOWN_STATUS; |
| 211 | else | 217 | else |
| 212 | priv->pen_status = PEN_UP_STATUS; | 218 | priv->pen_status = PEN_UP_STATUS; |
| 213 | 219 | ||
| 214 | input_report_key(priv->idev, BTN_TOUCH, priv->pen_status); | 220 | input_report_key(priv->idev, BTN_TOUCH, priv->pen_status); |
| 215 | needs_sync = true; | 221 | needs_sync = true; |
| 216 | 222 | ||
| 217 | dev_dbg(&priv->pdev->dev, | 223 | dev_dbg(&priv->pdev->dev, |
| @@ -221,7 +227,7 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data) | |||
| 221 | /* coordinates in FIFO exceed the theshold */ | 227 | /* coordinates in FIFO exceed the theshold */ |
| 222 | if (intr_status & TS_FIFO_INTR_MASK) { | 228 | if (intr_status & TS_FIFO_INTR_MASK) { |
| 223 | for (i = 0; i < priv->cfg_params.fifo_threshold; i++) { | 229 | for (i = 0; i < priv->cfg_params.fifo_threshold; i++) { |
| 224 | raw_coordinate = readl(priv->regs + FIFO_DATA); | 230 | regmap_read(priv->regmap, FIFO_DATA, &raw_coordinate); |
| 225 | if (raw_coordinate == INVALID_COORD) | 231 | if (raw_coordinate == INVALID_COORD) |
| 226 | continue; | 232 | continue; |
| 227 | 233 | ||
| @@ -239,7 +245,7 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data) | |||
| 239 | x = (x >> 4) & 0x0FFF; | 245 | x = (x >> 4) & 0x0FFF; |
| 240 | y = (y >> 4) & 0x0FFF; | 246 | y = (y >> 4) & 0x0FFF; |
| 241 | 247 | ||
| 242 | /* adjust x y according to lcd tsc mount angle */ | 248 | /* Adjust x y according to LCD tsc mount angle. */ |
| 243 | if (priv->cfg_params.invert_x) | 249 | if (priv->cfg_params.invert_x) |
| 244 | x = priv->cfg_params.max_x - x; | 250 | x = priv->cfg_params.max_x - x; |
| 245 | 251 | ||
| @@ -262,9 +268,10 @@ static irqreturn_t iproc_touchscreen_interrupt(int irq, void *data) | |||
| 262 | 268 | ||
| 263 | static int iproc_ts_start(struct input_dev *idev) | 269 | static int iproc_ts_start(struct input_dev *idev) |
| 264 | { | 270 | { |
| 265 | struct iproc_ts_priv *priv = input_get_drvdata(idev); | ||
| 266 | u32 val; | 271 | u32 val; |
| 272 | u32 mask; | ||
| 267 | int error; | 273 | int error; |
| 274 | struct iproc_ts_priv *priv = input_get_drvdata(idev); | ||
| 268 | 275 | ||
| 269 | /* Enable clock */ | 276 | /* Enable clock */ |
| 270 | error = clk_prepare_enable(priv->tsc_clk); | 277 | error = clk_prepare_enable(priv->tsc_clk); |
| @@ -279,9 +286,10 @@ static int iproc_ts_start(struct input_dev *idev) | |||
| 279 | * FIFO reaches the int_th value, and pen event(up/down) | 286 | * FIFO reaches the int_th value, and pen event(up/down) |
| 280 | */ | 287 | */ |
| 281 | val = TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK; | 288 | val = TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK; |
| 282 | writel(val, priv->regs + INTERRUPT_MASK); | 289 | regmap_update_bits(priv->regmap, INTERRUPT_MASK, val, val); |
| 283 | 290 | ||
| 284 | writel(priv->cfg_params.fifo_threshold, priv->regs + INTERRUPT_THRES); | 291 | val = priv->cfg_params.fifo_threshold; |
| 292 | regmap_write(priv->regmap, INTERRUPT_THRES, val); | ||
| 285 | 293 | ||
| 286 | /* Initialize control reg1 */ | 294 | /* Initialize control reg1 */ |
| 287 | val = 0; | 295 | val = 0; |
| @@ -289,26 +297,23 @@ static int iproc_ts_start(struct input_dev *idev) | |||
| 289 | val |= priv->cfg_params.debounce_timeout << DEBOUNCE_TIMEOUT_SHIFT; | 297 | val |= priv->cfg_params.debounce_timeout << DEBOUNCE_TIMEOUT_SHIFT; |
| 290 | val |= priv->cfg_params.settling_timeout << SETTLING_TIMEOUT_SHIFT; | 298 | val |= priv->cfg_params.settling_timeout << SETTLING_TIMEOUT_SHIFT; |
| 291 | val |= priv->cfg_params.touch_timeout << TOUCH_TIMEOUT_SHIFT; | 299 | val |= priv->cfg_params.touch_timeout << TOUCH_TIMEOUT_SHIFT; |
| 292 | writel(val, priv->regs + REGCTL1); | 300 | regmap_write(priv->regmap, REGCTL1, val); |
| 293 | 301 | ||
| 294 | /* Try to clear all interrupt status */ | 302 | /* Try to clear all interrupt status */ |
| 295 | val = readl(priv->regs + INTERRUPT_STATUS); | 303 | val = TS_FIFO_INTR_MASK | TS_PEN_INTR_MASK; |
| 296 | val |= TS_FIFO_INTR_MASK | TS_PEN_INTR_MASK; | 304 | regmap_update_bits(priv->regmap, INTERRUPT_STATUS, val, val); |
| 297 | writel(val, priv->regs + INTERRUPT_STATUS); | ||
| 298 | 305 | ||
| 299 | /* Initialize control reg2 */ | 306 | /* Initialize control reg2 */ |
| 300 | val = readl(priv->regs + REGCTL2); | 307 | val = TS_CONTROLLER_EN_BIT | TS_WIRE_MODE_BIT; |
| 301 | val |= TS_CONTROLLER_EN_BIT | TS_WIRE_MODE_BIT; | ||
| 302 | |||
| 303 | val &= ~TS_CONTROLLER_AVGDATA_MASK; | ||
| 304 | val |= priv->cfg_params.average_data << TS_CONTROLLER_AVGDATA_SHIFT; | 308 | val |= priv->cfg_params.average_data << TS_CONTROLLER_AVGDATA_SHIFT; |
| 305 | 309 | ||
| 306 | val &= ~(TS_CONTROLLER_PWR_LDO | /* PWR up LDO */ | 310 | mask = (TS_CONTROLLER_AVGDATA_MASK); |
| 311 | mask |= (TS_CONTROLLER_PWR_LDO | /* PWR up LDO */ | ||
| 307 | TS_CONTROLLER_PWR_ADC | /* PWR up ADC */ | 312 | TS_CONTROLLER_PWR_ADC | /* PWR up ADC */ |
| 308 | TS_CONTROLLER_PWR_BGP | /* PWR up BGP */ | 313 | TS_CONTROLLER_PWR_BGP | /* PWR up BGP */ |
| 309 | TS_CONTROLLER_PWR_TS); /* PWR up TS */ | 314 | TS_CONTROLLER_PWR_TS); /* PWR up TS */ |
| 310 | 315 | mask |= val; | |
| 311 | writel(val, priv->regs + REGCTL2); | 316 | regmap_update_bits(priv->regmap, REGCTL2, mask, val); |
| 312 | 317 | ||
| 313 | ts_reg_dump(priv); | 318 | ts_reg_dump(priv); |
| 314 | 319 | ||
| @@ -320,12 +325,17 @@ static void iproc_ts_stop(struct input_dev *dev) | |||
| 320 | u32 val; | 325 | u32 val; |
| 321 | struct iproc_ts_priv *priv = input_get_drvdata(dev); | 326 | struct iproc_ts_priv *priv = input_get_drvdata(dev); |
| 322 | 327 | ||
| 323 | writel(0, priv->regs + INTERRUPT_MASK); /* Disable all interrupts */ | 328 | /* |
| 329 | * Disable FIFO int_th and pen event(up/down)Interrupts only | ||
| 330 | * as the interrupt mask register is shared between ADC, TS and | ||
| 331 | * flextimer. | ||
| 332 | */ | ||
| 333 | val = TS_PEN_INTR_MASK | TS_FIFO_INTR_MASK; | ||
| 334 | regmap_update_bits(priv->regmap, INTERRUPT_MASK, val, 0); | ||
| 324 | 335 | ||
| 325 | /* Only power down touch screen controller */ | 336 | /* Only power down touch screen controller */ |
| 326 | val = readl(priv->regs + REGCTL2); | 337 | val = TS_CONTROLLER_PWR_TS; |
| 327 | val |= TS_CONTROLLER_PWR_TS; | 338 | regmap_update_bits(priv->regmap, REGCTL2, val, val); |
| 328 | writel(val, priv->regs + REGCTL2); | ||
| 329 | 339 | ||
| 330 | clk_disable(priv->tsc_clk); | 340 | clk_disable(priv->tsc_clk); |
| 331 | } | 341 | } |
| @@ -414,7 +424,6 @@ static int iproc_ts_probe(struct platform_device *pdev) | |||
| 414 | { | 424 | { |
| 415 | struct iproc_ts_priv *priv; | 425 | struct iproc_ts_priv *priv; |
| 416 | struct input_dev *idev; | 426 | struct input_dev *idev; |
| 417 | struct resource *res; | ||
| 418 | int irq; | 427 | int irq; |
| 419 | int error; | 428 | int error; |
| 420 | 429 | ||
| @@ -422,12 +431,12 @@ static int iproc_ts_probe(struct platform_device *pdev) | |||
| 422 | if (!priv) | 431 | if (!priv) |
| 423 | return -ENOMEM; | 432 | return -ENOMEM; |
| 424 | 433 | ||
| 425 | /* touchscreen controller memory mapped regs */ | 434 | /* touchscreen controller memory mapped regs via syscon*/ |
| 426 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 435 | priv->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, |
| 427 | priv->regs = devm_ioremap_resource(&pdev->dev, res); | 436 | "ts_syscon"); |
| 428 | if (IS_ERR(priv->regs)) { | 437 | if (IS_ERR(priv->regmap)) { |
| 429 | error = PTR_ERR(priv->regs); | 438 | error = PTR_ERR(priv->regmap); |
| 430 | dev_err(&pdev->dev, "unable to map I/O memory: %d\n", error); | 439 | dev_err(&pdev->dev, "unable to map I/O memory:%d\n", error); |
| 431 | return error; | 440 | return error; |
| 432 | } | 441 | } |
| 433 | 442 | ||
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index a21a07c3ab6d..8b3f15ca7725 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c | |||
| @@ -487,8 +487,7 @@ static int titsc_remove(struct platform_device *pdev) | |||
| 487 | return 0; | 487 | return 0; |
| 488 | } | 488 | } |
| 489 | 489 | ||
| 490 | #ifdef CONFIG_PM | 490 | static int __maybe_unused titsc_suspend(struct device *dev) |
| 491 | static int titsc_suspend(struct device *dev) | ||
| 492 | { | 491 | { |
| 493 | struct titsc *ts_dev = dev_get_drvdata(dev); | 492 | struct titsc *ts_dev = dev_get_drvdata(dev); |
| 494 | struct ti_tscadc_dev *tscadc_dev; | 493 | struct ti_tscadc_dev *tscadc_dev; |
| @@ -504,7 +503,7 @@ static int titsc_suspend(struct device *dev) | |||
| 504 | return 0; | 503 | return 0; |
| 505 | } | 504 | } |
| 506 | 505 | ||
| 507 | static int titsc_resume(struct device *dev) | 506 | static int __maybe_unused titsc_resume(struct device *dev) |
| 508 | { | 507 | { |
| 509 | struct titsc *ts_dev = dev_get_drvdata(dev); | 508 | struct titsc *ts_dev = dev_get_drvdata(dev); |
| 510 | struct ti_tscadc_dev *tscadc_dev; | 509 | struct ti_tscadc_dev *tscadc_dev; |
| @@ -521,14 +520,7 @@ static int titsc_resume(struct device *dev) | |||
| 521 | return 0; | 520 | return 0; |
| 522 | } | 521 | } |
| 523 | 522 | ||
| 524 | static const struct dev_pm_ops titsc_pm_ops = { | 523 | static SIMPLE_DEV_PM_OPS(titsc_pm_ops, titsc_suspend, titsc_resume); |
| 525 | .suspend = titsc_suspend, | ||
| 526 | .resume = titsc_resume, | ||
| 527 | }; | ||
| 528 | #define TITSC_PM_OPS (&titsc_pm_ops) | ||
| 529 | #else | ||
| 530 | #define TITSC_PM_OPS NULL | ||
| 531 | #endif | ||
| 532 | 524 | ||
| 533 | static const struct of_device_id ti_tsc_dt_ids[] = { | 525 | static const struct of_device_id ti_tsc_dt_ids[] = { |
| 534 | { .compatible = "ti,am3359-tsc", }, | 526 | { .compatible = "ti,am3359-tsc", }, |
| @@ -541,7 +533,7 @@ static struct platform_driver ti_tsc_driver = { | |||
| 541 | .remove = titsc_remove, | 533 | .remove = titsc_remove, |
| 542 | .driver = { | 534 | .driver = { |
| 543 | .name = "TI-am335x-tsc", | 535 | .name = "TI-am335x-tsc", |
| 544 | .pm = TITSC_PM_OPS, | 536 | .pm = &titsc_pm_ops, |
| 545 | .of_match_table = ti_tsc_dt_ids, | 537 | .of_match_table = ti_tsc_dt_ids, |
| 546 | }, | 538 | }, |
| 547 | }; | 539 | }; |
