Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input

Pull input updates from Dmitry Torokhov:
"First round of updates for the input subsystem. No new drivers here,
just some driver fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input:
Input: rotary-encoder - fix bare use of 'unsigned'
Input: cm109 - spin_lock in complete() cleanup
Input: cm109 - fix handling of volume and mute buttons
Input: byd - don't wipe dynamically allocated memory twice
Input: twl4030 - fix unsafe macro definition
Input: twl6040-vibra - remove mutex
Input: bcm_iproc_tsc - DT spelling s/clock-name/clock-names/
Input: bcm_iproc_tsc - use syscon to access shared registers
Input: ti_am335x_tsc - use SIMPLE_DEV_PM_OPS
Input: omap-keypad - remove set_col_gpio_val() and get_row_gpio_val()
Input: omap-keypad - drop empty PM stubs
Input: omap-keypad - remove adjusting of scan delay
Input: gpio-keys - clean up device tree binding example
Input: kbtab - stop saving struct usb_device
Input: gtco - stop saving struct usb_device
Input: aiptek - stop saving struct usb_device
Input: acecad - stop saving struct usb_device

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