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:
"A new driver for slidebar on Ideapad laptops and a bunch of assorted
driver fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (32 commits)
Input: add SYN_MAX and SYN_CNT constants
Input: max11801_ts - convert to devm
Input: egalax-ts - fix typo and improve text
Input: MAINTAINERS - change maintainer for cyttsp driver
Input: cyttsp4 - kill 'defined but not used' compiler warnings
Input: add driver for slidebar on Lenovo IdeaPad laptops
Input: omap-keypad - set up irq type from DT
Input: omap-keypad - enable wakeup capability for keypad.
Input: omap-keypad - clear interrupts on open
Input: omap-keypad - convert to threaded IRQ
Input: omap-keypad - use bitfiled instead of hardcoded values
Input: cyttsp4 - remove useless NULL test from cyttsp4_watchdog_timer()
Input: wacom - fix error return code in wacom_probe()
Input: as5011 - fix error return code in as5011_probe()
Input: keyboard, serio - simplify use of devm_ioremap_resource
Input: tegra-kbc - simplify use of devm_ioremap_resource
Input: htcpen - fix incorrect placement of __initdata
Input: qt1070 - add power management ops
Input: wistron_btns - add MODULE_DEVICE_TABLE
Input: wistron_btns - mark the Medion MD96500 keymap as tested
...

+770 -321
+33
Documentation/devicetree/bindings/input/input-reset.txt
··· 1 + Input: sysrq reset sequence 2 + 3 + A simple binding to represent a set of keys as described in 4 + include/uapi/linux/input.h. This is to communicate a sequence of keys to the 5 + sysrq driver. Upon holding the keys for a specified amount of time (if 6 + specified) the system is sync'ed and reset. 7 + 8 + Key sequences are global to the system but all the keys in a set must be coming 9 + from the same input device. 10 + 11 + The /chosen node should contain a 'linux,sysrq-reset-seq' child node to define 12 + a set of keys. 13 + 14 + Required property: 15 + sysrq-reset-seq: array of Linux keycodes, one keycode per cell. 16 + 17 + Optional property: 18 + timeout-ms: duration keys must be pressed together in milliseconds before 19 + generating a sysrq. If omitted the system is rebooted immediately when a valid 20 + sequence has been recognized. 21 + 22 + Example: 23 + 24 + chosen { 25 + linux,sysrq-reset-seq { 26 + keyset = <0x03 27 + 0x04 28 + 0x0a>; 29 + timeout-ms = <3000>; 30 + }; 31 + }; 32 + 33 + Would represent KEY_2, KEY_3 and KEY_9.
+1 -1
Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt
··· 6 6 - interrupt-parent: the phandle for the interrupt controller 7 7 - interrupts: touch controller interrupt 8 8 - wakeup-gpios: the gpio pin to be used for waking up the controller 9 - as well as uased as irq pin 9 + and also used as irq pin 10 10 11 11 Example: 12 12
+9 -2
MAINTAINERS
··· 2494 2494 F: drivers/media/common/cypress_firmware* 2495 2495 2496 2496 CYTTSP TOUCHSCREEN DRIVER 2497 - M: Javier Martinez Canillas <javier@dowhile0.org> 2497 + M: Ferruh Yigit <fery@cypress.com> 2498 2498 L: linux-input@vger.kernel.org 2499 - S: Maintained 2499 + S: Supported 2500 2500 F: drivers/input/touchscreen/cyttsp* 2501 2501 F: include/linux/input/cyttsp.h 2502 2502 ··· 4140 4140 W: http://launchpad.net/ideapad-laptop 4141 4141 S: Maintained 4142 4142 F: drivers/platform/x86/ideapad-laptop.c 4143 + 4144 + IDEAPAD LAPTOP SLIDEBAR DRIVER 4145 + M: Andrey Moiseev <o2g.org.ru@gmail.com> 4146 + L: linux-input@vger.kernel.org 4147 + W: https://github.com/o2genum/ideapad-slidebar 4148 + S: Maintained 4149 + F: drivers/input/misc/ideapad_slidebar.c 4143 4150 4144 4151 IDE/ATAPI DRIVERS 4145 4152 M: Borislav Petkov <bp@alien8.de>
+2 -1
drivers/input/joystick/as5011.c
··· 234 234 int irq; 235 235 int error; 236 236 237 - plat_data = client->dev.platform_data; 237 + plat_data = dev_get_platdata(&client->dev); 238 238 if (!plat_data) 239 239 return -EINVAL; 240 240 ··· 288 288 if (irq < 0) { 289 289 dev_err(&client->dev, 290 290 "Failed to get irq number for button gpio\n"); 291 + error = irq; 291 292 goto err_free_button_gpio; 292 293 } 293 294
+2 -2
drivers/input/joystick/maplecontrol.c
··· 61 61 62 62 static int dc_pad_open(struct input_dev *dev) 63 63 { 64 - struct dc_pad *pad = dev->dev.platform_data; 64 + struct dc_pad *pad = dev_get_platdata(&dev->dev); 65 65 66 66 maple_getcond_callback(pad->mdev, dc_pad_callback, HZ/20, 67 67 MAPLE_FUNC_CONTROLLER); ··· 71 71 72 72 static void dc_pad_close(struct input_dev *dev) 73 73 { 74 - struct dc_pad *pad = dev->dev.platform_data; 74 + struct dc_pad *pad = dev_get_platdata(&dev->dev); 75 75 76 76 maple_getcond_callback(pad->mdev, dc_pad_callback, 0, 77 77 MAPLE_FUNC_CONTROLLER);
+1 -6
drivers/input/keyboard/imx_keypad.c
··· 442 442 return -EINVAL; 443 443 } 444 444 445 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 446 - if (res == NULL) { 447 - dev_err(&pdev->dev, "no I/O memory defined in platform data\n"); 448 - return -EINVAL; 449 - } 450 - 451 445 input_dev = devm_input_allocate_device(&pdev->dev); 452 446 if (!input_dev) { 453 447 dev_err(&pdev->dev, "failed to allocate the input device\n"); ··· 462 468 setup_timer(&keypad->check_matrix_timer, 463 469 imx_keypad_check_for_events, (unsigned long) keypad); 464 470 471 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 465 472 keypad->mmio_base = devm_ioremap_resource(&pdev->dev, res); 466 473 if (IS_ERR(keypad->mmio_base)) 467 474 return PTR_ERR(keypad->mmio_base);
+1 -1
drivers/input/keyboard/max7359_keypad.c
··· 271 271 return 0; 272 272 } 273 273 274 - #ifdef CONFIG_PM 274 + #ifdef CONFIG_PM_SLEEP 275 275 static int max7359_suspend(struct device *dev) 276 276 { 277 277 struct i2c_client *client = to_i2c_client(dev);
+1 -6
drivers/input/keyboard/nspire-keypad.c
··· 171 171 return -EINVAL; 172 172 } 173 173 174 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 175 - if (!res) { 176 - dev_err(&pdev->dev, "missing platform resources\n"); 177 - return -EINVAL; 178 - } 179 - 180 174 keypad = devm_kzalloc(&pdev->dev, sizeof(struct nspire_keypad), 181 175 GFP_KERNEL); 182 176 if (!keypad) { ··· 202 208 return PTR_ERR(keypad->clk); 203 209 } 204 210 211 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 205 212 keypad->reg_base = devm_ioremap_resource(&pdev->dev, res); 206 213 if (IS_ERR(keypad->reg_base)) 207 214 return PTR_ERR(keypad->reg_base);
+71 -24
drivers/input/keyboard/omap4-keypad.c
··· 53 53 #define OMAP4_KBD_FULLCODE63_32 0x48 54 54 55 55 /* OMAP4 bit definitions */ 56 - #define OMAP4_DEF_IRQENABLE_EVENTEN (1 << 0) 57 - #define OMAP4_DEF_IRQENABLE_LONGKEY (1 << 1) 58 - #define OMAP4_DEF_IRQENABLE_TIMEOUTEN (1 << 2) 59 - #define OMAP4_DEF_WUP_EVENT_ENA (1 << 0) 60 - #define OMAP4_DEF_WUP_LONG_KEY_ENA (1 << 1) 61 - #define OMAP4_DEF_CTRL_NOSOFTMODE (1 << 1) 62 - #define OMAP4_DEF_CTRLPTVVALUE (1 << 2) 63 - #define OMAP4_DEF_CTRLPTV (1 << 1) 56 + #define OMAP4_DEF_IRQENABLE_EVENTEN BIT(0) 57 + #define OMAP4_DEF_IRQENABLE_LONGKEY BIT(1) 58 + #define OMAP4_DEF_WUP_EVENT_ENA BIT(0) 59 + #define OMAP4_DEF_WUP_LONG_KEY_ENA BIT(1) 60 + #define OMAP4_DEF_CTRL_NOSOFTMODE BIT(1) 61 + #define OMAP4_DEF_CTRL_PTV_SHIFT 2 64 62 65 63 /* OMAP4 values */ 66 - #define OMAP4_VAL_IRQDISABLE 0x00 67 - #define OMAP4_VAL_DEBOUNCINGTIME 0x07 68 - #define OMAP4_VAL_FUNCTIONALCFG 0x1E 69 - 70 - #define OMAP4_MASK_IRQSTATUSDISABLE 0xFFFF 64 + #define OMAP4_VAL_IRQDISABLE 0x0 65 + #define OMAP4_VAL_DEBOUNCINGTIME 0x7 66 + #define OMAP4_VAL_PVT 0x7 71 67 72 68 enum { 73 69 KBD_REVISION_OMAP4 = 0, ··· 74 78 struct input_dev *input; 75 79 76 80 void __iomem *base; 81 + bool irq_wake_enabled; 77 82 unsigned int irq; 78 83 79 84 unsigned int rows; ··· 113 116 } 114 117 115 118 116 - /* Interrupt handler */ 117 - static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id) 119 + /* Interrupt handlers */ 120 + static irqreturn_t omap4_keypad_irq_handler(int irq, void *dev_id) 121 + { 122 + struct omap4_keypad *keypad_data = dev_id; 123 + 124 + if (kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)) { 125 + /* Disable interrupts */ 126 + kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, 127 + OMAP4_VAL_IRQDISABLE); 128 + return IRQ_WAKE_THREAD; 129 + } 130 + 131 + return IRQ_NONE; 132 + } 133 + 134 + static irqreturn_t omap4_keypad_irq_thread_fn(int irq, void *dev_id) 118 135 { 119 136 struct omap4_keypad *keypad_data = dev_id; 120 137 struct input_dev *input_dev = keypad_data->input; 121 138 unsigned char key_state[ARRAY_SIZE(keypad_data->key_state)]; 122 139 unsigned int col, row, code, changed; 123 140 u32 *new_state = (u32 *) key_state; 124 - 125 - /* Disable interrupts */ 126 - kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, 127 - OMAP4_VAL_IRQDISABLE); 128 141 129 142 *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0); 130 143 *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32); ··· 182 175 disable_irq(keypad_data->irq); 183 176 184 177 kbd_writel(keypad_data, OMAP4_KBD_CTRL, 185 - OMAP4_VAL_FUNCTIONALCFG); 178 + OMAP4_DEF_CTRL_NOSOFTMODE | 179 + (OMAP4_VAL_PVT << OMAP4_DEF_CTRL_PTV_SHIFT)); 186 180 kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME, 187 181 OMAP4_VAL_DEBOUNCINGTIME); 182 + /* clear pending interrupts */ 188 183 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS, 189 - OMAP4_VAL_IRQDISABLE); 184 + kbd_read_irqreg(keypad_data, OMAP4_KBD_IRQSTATUS)); 190 185 kbd_write_irqreg(keypad_data, OMAP4_KBD_IRQENABLE, 191 186 OMAP4_DEF_IRQENABLE_EVENTEN | 192 187 OMAP4_DEF_IRQENABLE_LONGKEY); ··· 372 363 goto err_free_keymap; 373 364 } 374 365 375 - error = request_irq(keypad_data->irq, omap4_keypad_interrupt, 376 - IRQF_TRIGGER_RISING, 377 - "omap4-keypad", keypad_data); 366 + error = request_threaded_irq(keypad_data->irq, omap4_keypad_irq_handler, 367 + omap4_keypad_irq_thread_fn, 0, 368 + "omap4-keypad", keypad_data); 378 369 if (error) { 379 370 dev_err(&pdev->dev, "failed to register interrupt\n"); 380 371 goto err_free_input; 381 372 } 382 373 374 + device_init_wakeup(&pdev->dev, true); 383 375 pm_runtime_put_sync(&pdev->dev); 384 376 385 377 error = input_register_device(keypad_data->input); ··· 394 384 395 385 err_pm_disable: 396 386 pm_runtime_disable(&pdev->dev); 387 + device_init_wakeup(&pdev->dev, false); 397 388 free_irq(keypad_data->irq, keypad_data); 398 389 err_free_keymap: 399 390 kfree(keypad_data->keymap); ··· 420 409 421 410 pm_runtime_disable(&pdev->dev); 422 411 412 + device_init_wakeup(&pdev->dev, false); 413 + 423 414 input_unregister_device(keypad_data->input); 424 415 425 416 iounmap(keypad_data->base); ··· 443 430 MODULE_DEVICE_TABLE(of, omap_keypad_dt_match); 444 431 #endif 445 432 433 + #ifdef CONFIG_PM_SLEEP 434 + static int omap4_keypad_suspend(struct device *dev) 435 + { 436 + struct platform_device *pdev = to_platform_device(dev); 437 + struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); 438 + int error; 439 + 440 + if (device_may_wakeup(&pdev->dev)) { 441 + error = enable_irq_wake(keypad_data->irq); 442 + if (!error) 443 + keypad_data->irq_wake_enabled = true; 444 + } 445 + 446 + return 0; 447 + } 448 + 449 + static int omap4_keypad_resume(struct device *dev) 450 + { 451 + struct platform_device *pdev = to_platform_device(dev); 452 + struct omap4_keypad *keypad_data = platform_get_drvdata(pdev); 453 + 454 + if (device_may_wakeup(&pdev->dev) && keypad_data->irq_wake_enabled) { 455 + disable_irq_wake(keypad_data->irq); 456 + keypad_data->irq_wake_enabled = false; 457 + } 458 + 459 + return 0; 460 + } 461 + #endif 462 + 463 + static SIMPLE_DEV_PM_OPS(omap4_keypad_pm_ops, 464 + omap4_keypad_suspend, omap4_keypad_resume); 465 + 446 466 static struct platform_driver omap4_keypad_driver = { 447 467 .probe = omap4_keypad_probe, 448 468 .remove = omap4_keypad_remove, 449 469 .driver = { 450 470 .name = "omap4-keypad", 451 471 .owner = THIS_MODULE, 472 + .pm = &omap4_keypad_pm_ops, 452 473 .of_match_table = of_match_ptr(omap_keypad_dt_match), 453 474 }, 454 475 };
+27
drivers/input/keyboard/qt1070.c
··· 243 243 return 0; 244 244 } 245 245 246 + #ifdef CONFIG_PM_SLEEP 247 + static int qt1070_suspend(struct device *dev) 248 + { 249 + struct i2c_client *client = to_i2c_client(dev); 250 + struct qt1070_data *data = i2c_get_clientdata(client); 251 + 252 + if (device_may_wakeup(dev)) 253 + enable_irq_wake(data->irq); 254 + 255 + return 0; 256 + } 257 + 258 + static int qt1070_resume(struct device *dev) 259 + { 260 + struct i2c_client *client = to_i2c_client(dev); 261 + struct qt1070_data *data = i2c_get_clientdata(client); 262 + 263 + if (device_may_wakeup(dev)) 264 + disable_irq_wake(data->irq); 265 + 266 + return 0; 267 + } 268 + #endif 269 + 270 + static SIMPLE_DEV_PM_OPS(qt1070_pm_ops, qt1070_suspend, qt1070_resume); 271 + 246 272 static const struct i2c_device_id qt1070_id[] = { 247 273 { "qt1070", 0 }, 248 274 { }, ··· 279 253 .driver = { 280 254 .name = "qt1070", 281 255 .owner = THIS_MODULE, 256 + .pm = &qt1070_pm_ops, 282 257 }, 283 258 .id_table = qt1070_id, 284 259 .probe = qt1070_probe,
+1 -6
drivers/input/keyboard/spear-keyboard.c
··· 191 191 int irq; 192 192 int error; 193 193 194 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 195 - if (!res) { 196 - dev_err(&pdev->dev, "no keyboard resource defined\n"); 197 - return -EBUSY; 198 - } 199 - 200 194 irq = platform_get_irq(pdev, 0); 201 195 if (irq < 0) { 202 196 dev_err(&pdev->dev, "not able to get irq for the device\n"); ··· 222 228 kbd->suspended_rate = pdata->suspended_rate; 223 229 } 224 230 231 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 225 232 kbd->io_base = devm_ioremap_resource(&pdev->dev, res); 226 233 if (IS_ERR(kbd->io_base)) 227 234 return PTR_ERR(kbd->io_base);
+1 -6
drivers/input/keyboard/tegra-kbc.c
··· 638 638 if (!tegra_kbc_check_pin_cfg(kbc, &num_rows)) 639 639 return -EINVAL; 640 640 641 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 642 - if (!res) { 643 - dev_err(&pdev->dev, "failed to get I/O memory\n"); 644 - return -ENXIO; 645 - } 646 - 647 641 kbc->irq = platform_get_irq(pdev, 0); 648 642 if (kbc->irq < 0) { 649 643 dev_err(&pdev->dev, "failed to get keyboard IRQ\n"); ··· 652 658 653 659 setup_timer(&kbc->timer, tegra_kbc_keypress_timer, (unsigned long)kbc); 654 660 661 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 655 662 kbc->mmio = devm_ioremap_resource(&pdev->dev, res); 656 663 if (IS_ERR(kbc->mmio)) 657 664 return PTR_ERR(kbc->mmio);
+10
drivers/input/misc/Kconfig
··· 647 647 648 648 If unsure, say N. 649 649 650 + config INPUT_IDEAPAD_SLIDEBAR 651 + tristate "IdeaPad Laptop Slidebar" 652 + depends on INPUT 653 + depends on SERIO_I8042 654 + help 655 + Say Y here if you have an IdeaPad laptop with a slidebar. 656 + 657 + To compile this driver as a module, choose M here: the 658 + module will be called ideapad_slidebar. 659 + 650 660 endif
+1
drivers/input/misc/Makefile
··· 61 61 obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o 62 62 obj-$(CONFIG_INPUT_XEN_KBDDEV_FRONTEND) += xen-kbdfront.o 63 63 obj-$(CONFIG_INPUT_YEALINK) += yealink.o 64 + obj-$(CONFIG_INPUT_IDEAPAD_SLIDEBAR) += ideapad_slidebar.o
+358
drivers/input/misc/ideapad_slidebar.c
··· 1 + /* 2 + * Input driver for slidebars on some Lenovo IdeaPad laptops 3 + * 4 + * Copyright (C) 2013 Andrey Moiseev <o2g.org.ru@gmail.com> 5 + * 6 + * Reverse-engineered from Lenovo SlideNav software (SBarHook.dll). 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the Free 10 + * Software Foundation; either version 2 of the License, or (at your option) 11 + * any later version. 12 + * 13 + * Trademarks are the property of their respective owners. 14 + */ 15 + 16 + /* 17 + * Currently tested and works on: 18 + * Lenovo IdeaPad Y550 19 + * Lenovo IdeaPad Y550P 20 + * 21 + * Other models can be added easily. To test, 22 + * load with 'force' parameter set 'true'. 23 + * 24 + * LEDs blinking and input mode are managed via sysfs, 25 + * (hex, unsigned byte value): 26 + * /sys/devices/platform/ideapad_slidebar/slidebar_mode 27 + * 28 + * The value is in byte range, however, I only figured out 29 + * how bits 0b10011001 work. Some other bits, probably, 30 + * are meaningfull too. 31 + * 32 + * Possible states: 33 + * 34 + * STD_INT, ONMOV_INT, OFF_INT, LAST_POLL, OFF_POLL 35 + * 36 + * Meaning: 37 + * released touched 38 + * STD 'heartbeat' lights follow the finger 39 + * ONMOV no lights lights follow the finger 40 + * LAST at last pos lights follow the finger 41 + * OFF no lights no lights 42 + * 43 + * INT all input events are generated, interrupts are used 44 + * POLL no input events by default, to get them, 45 + * send 0b10000000 (read below) 46 + * 47 + * Commands: write 48 + * 49 + * All | 0b01001 -> STD_INT 50 + * possible | 0b10001 -> ONMOV_INT 51 + * states | 0b01000 -> OFF_INT 52 + * 53 + * | 0b0 -> LAST_POLL 54 + * STD_INT or ONMOV_INT | 55 + * | 0b1 -> STD_INT 56 + * 57 + * | 0b0 -> OFF_POLL 58 + * OFF_INT or OFF_POLL | 59 + * | 0b1 -> OFF_INT 60 + * 61 + * Any state | 0b10000000 -> if the slidebar has updated data, 62 + * produce one input event (last position), 63 + * switch to respective POLL mode 64 + * (like 0x0), if not in POLL mode yet. 65 + * 66 + * Get current state: read 67 + * 68 + * masked by 0x11 read value means: 69 + * 70 + * 0x00 LAST 71 + * 0x01 STD 72 + * 0x10 OFF 73 + * 0x11 ONMOV 74 + */ 75 + 76 + #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 77 + 78 + #include <linux/module.h> 79 + #include <linux/kernel.h> 80 + #include <linux/dmi.h> 81 + #include <linux/spinlock.h> 82 + #include <linux/platform_device.h> 83 + #include <linux/input.h> 84 + #include <linux/io.h> 85 + #include <linux/ioport.h> 86 + #include <linux/i8042.h> 87 + #include <linux/serio.h> 88 + 89 + #define IDEAPAD_BASE 0xff29 90 + 91 + static bool force; 92 + module_param(force, bool, 0); 93 + MODULE_PARM_DESC(force, "Force driver load, ignore DMI data"); 94 + 95 + static DEFINE_SPINLOCK(io_lock); 96 + 97 + static struct input_dev *slidebar_input_dev; 98 + static struct platform_device *slidebar_platform_dev; 99 + 100 + static u8 slidebar_pos_get(void) 101 + { 102 + u8 res; 103 + unsigned long flags; 104 + 105 + spin_lock_irqsave(&io_lock, flags); 106 + outb(0xf4, 0xff29); 107 + outb(0xbf, 0xff2a); 108 + res = inb(0xff2b); 109 + spin_unlock_irqrestore(&io_lock, flags); 110 + 111 + return res; 112 + } 113 + 114 + static u8 slidebar_mode_get(void) 115 + { 116 + u8 res; 117 + unsigned long flags; 118 + 119 + spin_lock_irqsave(&io_lock, flags); 120 + outb(0xf7, 0xff29); 121 + outb(0x8b, 0xff2a); 122 + res = inb(0xff2b); 123 + spin_unlock_irqrestore(&io_lock, flags); 124 + 125 + return res; 126 + } 127 + 128 + static void slidebar_mode_set(u8 mode) 129 + { 130 + unsigned long flags; 131 + 132 + spin_lock_irqsave(&io_lock, flags); 133 + outb(0xf7, 0xff29); 134 + outb(0x8b, 0xff2a); 135 + outb(mode, 0xff2b); 136 + spin_unlock_irqrestore(&io_lock, flags); 137 + } 138 + 139 + static bool slidebar_i8042_filter(unsigned char data, unsigned char str, 140 + struct serio *port) 141 + { 142 + static bool extended = false; 143 + 144 + /* We are only interested in data coming form KBC port */ 145 + if (str & I8042_STR_AUXDATA) 146 + return false; 147 + 148 + /* Scancodes: e03b on move, e0bb on release. */ 149 + if (data == 0xe0) { 150 + extended = true; 151 + return true; 152 + } 153 + 154 + if (!extended) 155 + return false; 156 + 157 + extended = false; 158 + 159 + if (likely((data & 0x7f) != 0x3b)) { 160 + serio_interrupt(port, 0xe0, 0); 161 + return false; 162 + } 163 + 164 + if (data & 0x80) { 165 + input_report_key(slidebar_input_dev, BTN_TOUCH, 0); 166 + } else { 167 + input_report_key(slidebar_input_dev, BTN_TOUCH, 1); 168 + input_report_abs(slidebar_input_dev, ABS_X, slidebar_pos_get()); 169 + } 170 + input_sync(slidebar_input_dev); 171 + 172 + return true; 173 + } 174 + 175 + static ssize_t show_slidebar_mode(struct device *dev, 176 + struct device_attribute *attr, 177 + char *buf) 178 + { 179 + return sprintf(buf, "%x\n", slidebar_mode_get()); 180 + } 181 + 182 + static ssize_t store_slidebar_mode(struct device *dev, 183 + struct device_attribute *attr, 184 + const char *buf, size_t count) 185 + { 186 + u8 mode; 187 + int error; 188 + 189 + error = kstrtou8(buf, 0, &mode); 190 + if (error) 191 + return error; 192 + 193 + slidebar_mode_set(mode); 194 + 195 + return count; 196 + } 197 + 198 + static DEVICE_ATTR(slidebar_mode, S_IWUSR | S_IRUGO, 199 + show_slidebar_mode, store_slidebar_mode); 200 + 201 + static struct attribute *ideapad_attrs[] = { 202 + &dev_attr_slidebar_mode.attr, 203 + NULL 204 + }; 205 + 206 + static struct attribute_group ideapad_attr_group = { 207 + .attrs = ideapad_attrs 208 + }; 209 + 210 + static const struct attribute_group *ideapad_attr_groups[] = { 211 + &ideapad_attr_group, 212 + NULL 213 + }; 214 + 215 + static int __init ideapad_probe(struct platform_device* pdev) 216 + { 217 + int err; 218 + 219 + if (!request_region(IDEAPAD_BASE, 3, "ideapad_slidebar")) { 220 + dev_err(&pdev->dev, "IO ports are busy\n"); 221 + return -EBUSY; 222 + } 223 + 224 + slidebar_input_dev = input_allocate_device(); 225 + if (!slidebar_input_dev) { 226 + dev_err(&pdev->dev, "Failed to allocate input device\n"); 227 + err = -ENOMEM; 228 + goto err_release_ports; 229 + } 230 + 231 + slidebar_input_dev->name = "IdeaPad Slidebar"; 232 + slidebar_input_dev->id.bustype = BUS_HOST; 233 + slidebar_input_dev->dev.parent = &pdev->dev; 234 + input_set_capability(slidebar_input_dev, EV_KEY, BTN_TOUCH); 235 + input_set_capability(slidebar_input_dev, EV_ABS, ABS_X); 236 + input_set_abs_params(slidebar_input_dev, ABS_X, 0, 0xff, 0, 0); 237 + 238 + err = i8042_install_filter(slidebar_i8042_filter); 239 + if (err) { 240 + dev_err(&pdev->dev, 241 + "Failed to install i8042 filter: %d\n", err); 242 + goto err_free_dev; 243 + } 244 + 245 + err = input_register_device(slidebar_input_dev); 246 + if (err) { 247 + dev_err(&pdev->dev, 248 + "Failed to register input device: %d\n", err); 249 + goto err_remove_filter; 250 + } 251 + 252 + return 0; 253 + 254 + err_remove_filter: 255 + i8042_remove_filter(slidebar_i8042_filter); 256 + err_free_dev: 257 + input_free_device(slidebar_input_dev); 258 + err_release_ports: 259 + release_region(IDEAPAD_BASE, 3); 260 + return err; 261 + } 262 + 263 + static int ideapad_remove(struct platform_device *pdev) 264 + { 265 + i8042_remove_filter(slidebar_i8042_filter); 266 + input_unregister_device(slidebar_input_dev); 267 + release_region(IDEAPAD_BASE, 3); 268 + 269 + return 0; 270 + } 271 + 272 + static struct platform_driver slidebar_drv = { 273 + .driver = { 274 + .name = "ideapad_slidebar", 275 + .owner = THIS_MODULE, 276 + }, 277 + .remove = ideapad_remove, 278 + }; 279 + 280 + static int __init ideapad_dmi_check(const struct dmi_system_id *id) 281 + { 282 + pr_info("Laptop model '%s'\n", id->ident); 283 + return 1; 284 + } 285 + 286 + static const struct dmi_system_id ideapad_dmi[] __initconst = { 287 + { 288 + .ident = "Lenovo IdeaPad Y550", 289 + .matches = { 290 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 291 + DMI_MATCH(DMI_PRODUCT_NAME, "20017"), 292 + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550") 293 + }, 294 + .callback = ideapad_dmi_check 295 + }, 296 + { 297 + .ident = "Lenovo IdeaPad Y550P", 298 + .matches = { 299 + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), 300 + DMI_MATCH(DMI_PRODUCT_NAME, "20035"), 301 + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo IdeaPad Y550P") 302 + }, 303 + .callback = ideapad_dmi_check 304 + }, 305 + { NULL, } 306 + }; 307 + MODULE_DEVICE_TABLE(dmi, ideapad_dmi); 308 + 309 + static int __init slidebar_init(void) 310 + { 311 + int err; 312 + 313 + if (!force && !dmi_check_system(ideapad_dmi)) { 314 + pr_err("DMI does not match\n"); 315 + return -ENODEV; 316 + } 317 + 318 + slidebar_platform_dev = platform_device_alloc("ideapad_slidebar", -1); 319 + if (!slidebar_platform_dev) { 320 + pr_err("Not enough memory\n"); 321 + return -ENOMEM; 322 + } 323 + 324 + slidebar_platform_dev->dev.groups = ideapad_attr_groups; 325 + 326 + err = platform_device_add(slidebar_platform_dev); 327 + if (err) { 328 + pr_err("Failed to register platform device\n"); 329 + goto err_free_dev; 330 + } 331 + 332 + err = platform_driver_probe(&slidebar_drv, ideapad_probe); 333 + if (err) { 334 + pr_err("Failed to register platform driver\n"); 335 + goto err_delete_dev; 336 + } 337 + 338 + return 0; 339 + 340 + err_delete_dev: 341 + platform_device_del(slidebar_platform_dev); 342 + err_free_dev: 343 + platform_device_put(slidebar_platform_dev); 344 + return err; 345 + } 346 + 347 + static void __exit slidebar_exit(void) 348 + { 349 + platform_device_unregister(slidebar_platform_dev); 350 + platform_driver_unregister(&slidebar_drv); 351 + } 352 + 353 + module_init(slidebar_init); 354 + module_exit(slidebar_exit); 355 + 356 + MODULE_AUTHOR("Andrey Moiseev <o2g.org.ru@gmail.com>"); 357 + MODULE_DESCRIPTION("Slidebar input support for some Lenovo IdeaPad laptops"); 358 + MODULE_LICENSE("GPL");
+1 -1
drivers/input/misc/pwm-beeper.c
··· 143 143 return 0; 144 144 } 145 145 146 - #ifdef CONFIG_PM 146 + #ifdef CONFIG_PM_SLEEP 147 147 static int pwm_beeper_suspend(struct device *dev) 148 148 { 149 149 struct pwm_beeper *beeper = dev_get_drvdata(dev);
+15 -26
drivers/input/misc/twl6040-vibra.c
··· 257 257 258 258 static int twl6040_vibra_probe(struct platform_device *pdev) 259 259 { 260 - struct twl6040_vibra_data *pdata = pdev->dev.platform_data; 261 260 struct device *twl6040_core_dev = pdev->dev.parent; 262 261 struct device_node *twl6040_core_node = NULL; 263 262 struct vibra_info *info; ··· 269 270 "vibra"); 270 271 #endif 271 272 272 - if (!pdata && !twl6040_core_node) { 273 - dev_err(&pdev->dev, "platform_data not available\n"); 273 + if (!twl6040_core_node) { 274 + dev_err(&pdev->dev, "parent of node is missing?\n"); 274 275 return -EINVAL; 275 276 } 276 277 ··· 283 284 info->dev = &pdev->dev; 284 285 285 286 info->twl6040 = dev_get_drvdata(pdev->dev.parent); 286 - if (pdata) { 287 - info->vibldrv_res = pdata->vibldrv_res; 288 - info->vibrdrv_res = pdata->vibrdrv_res; 289 - info->viblmotor_res = pdata->viblmotor_res; 290 - info->vibrmotor_res = pdata->vibrmotor_res; 291 - vddvibl_uV = pdata->vddvibl_uV; 292 - vddvibr_uV = pdata->vddvibr_uV; 293 - } else { 294 - of_property_read_u32(twl6040_core_node, "ti,vibldrv-res", 295 - &info->vibldrv_res); 296 - of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res", 297 - &info->vibrdrv_res); 298 - of_property_read_u32(twl6040_core_node, "ti,viblmotor-res", 299 - &info->viblmotor_res); 300 - of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res", 301 - &info->vibrmotor_res); 302 - of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", 303 - &vddvibl_uV); 304 - of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", 305 - &vddvibr_uV); 306 - } 287 + 288 + of_property_read_u32(twl6040_core_node, "ti,vibldrv-res", 289 + &info->vibldrv_res); 290 + of_property_read_u32(twl6040_core_node, "ti,vibrdrv-res", 291 + &info->vibrdrv_res); 292 + of_property_read_u32(twl6040_core_node, "ti,viblmotor-res", 293 + &info->viblmotor_res); 294 + of_property_read_u32(twl6040_core_node, "ti,vibrmotor-res", 295 + &info->vibrmotor_res); 296 + of_property_read_u32(twl6040_core_node, "ti,vddvibl-uV", &vddvibl_uV); 297 + of_property_read_u32(twl6040_core_node, "ti,vddvibr-uV", &vddvibr_uV); 307 298 308 299 if ((!info->vibldrv_res && !info->viblmotor_res) || 309 300 (!info->vibrdrv_res && !info->vibrmotor_res)) { ··· 323 334 * When booted with Device tree the regulators are attached to the 324 335 * parent device (twl6040 MFD core) 325 336 */ 326 - ret = regulator_bulk_get(pdata ? info->dev : twl6040_core_dev, 327 - ARRAY_SIZE(info->supplies), info->supplies); 337 + ret = regulator_bulk_get(twl6040_core_dev, ARRAY_SIZE(info->supplies), 338 + info->supplies); 328 339 if (ret) { 329 340 dev_err(info->dev, "couldn't get regulators %d\n", ret); 330 341 return ret;
+3 -3
drivers/input/misc/wistron_btns.c
··· 46 46 MODULE_AUTHOR("Miloslav Trmac <mitr@volny.cz>"); 47 47 MODULE_DESCRIPTION("Wistron laptop button driver"); 48 48 MODULE_LICENSE("GPL v2"); 49 - MODULE_VERSION("0.3"); 50 49 51 50 static bool force; /* = 0; */ 52 51 module_param(force, bool, 0); ··· 562 563 { KE_KEY, 0x36, {KEY_WWW} }, 563 564 { KE_WIFI, 0x30 }, 564 565 { KE_BLUETOOTH, 0x44 }, 565 - { KE_END, FE_UNTESTED } 566 + { KE_END, 0 } 566 567 }; 567 568 568 569 static struct key_entry keymap_wistron_generic[] __initdata = { ··· 634 635 * a list of buttons and their key codes (reported when loading this module 635 636 * with force=1) and the output of dmidecode to $MODULE_AUTHOR. 636 637 */ 637 - static const struct dmi_system_id __initconst dmi_ids[] = { 638 + static const struct dmi_system_id dmi_ids[] __initconst = { 638 639 { 639 640 /* Fujitsu-Siemens Amilo Pro V2000 */ 640 641 .callback = dmi_matched, ··· 971 972 }, 972 973 { NULL, } 973 974 }; 975 + MODULE_DEVICE_TABLE(dmi, dmi_ids); 974 976 975 977 /* Copy the good keymap, as the original ones are free'd */ 976 978 static int __init copy_keymap(void)
+1 -1
drivers/input/mouse/lifebook.c
··· 44 44 return 1; 45 45 } 46 46 47 - static const struct dmi_system_id __initconst lifebook_dmi_table[] = { 47 + static const struct dmi_system_id lifebook_dmi_table[] __initconst = { 48 48 { 49 49 /* FLORA-ie 55mi */ 50 50 .matches = {
+2 -2
drivers/input/mouse/synaptics.c
··· 1433 1433 1434 1434 static bool impaired_toshiba_kbc; 1435 1435 1436 - static const struct dmi_system_id __initconst toshiba_dmi_table[] = { 1436 + static const struct dmi_system_id toshiba_dmi_table[] __initconst = { 1437 1437 #if defined(CONFIG_DMI) && defined(CONFIG_X86) 1438 1438 { 1439 1439 /* Toshiba Satellite */ ··· 1472 1472 1473 1473 static bool broken_olpc_ec; 1474 1474 1475 - static const struct dmi_system_id __initconst olpc_dmi_table[] = { 1475 + static const struct dmi_system_id olpc_dmi_table[] __initconst = { 1476 1476 #if defined(CONFIG_DMI) && defined(CONFIG_OLPC) 1477 1477 { 1478 1478 /* OLPC XO-1 or XO-1.5 */
+1 -6
drivers/input/serio/arc_ps2.c
··· 189 189 int irq; 190 190 int error, id, i; 191 191 192 - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 193 - if (!res) { 194 - dev_err(&pdev->dev, "no IO memory defined\n"); 195 - return -EINVAL; 196 - } 197 - 198 192 irq = platform_get_irq_byname(pdev, "arc_ps2_irq"); 199 193 if (irq < 0) { 200 194 dev_err(&pdev->dev, "no IRQ defined\n"); ··· 202 208 return -ENOMEM; 203 209 } 204 210 211 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 205 212 arc_ps2->addr = devm_ioremap_resource(&pdev->dev, res); 206 213 if (IS_ERR(arc_ps2->addr)) 207 214 return PTR_ERR(arc_ps2->addr);
-24
drivers/input/serio/i8042.h
··· 41 41 #define I8042_CTL_TIMEOUT 10000 42 42 43 43 /* 44 - * Status register bits. 45 - */ 46 - 47 - #define I8042_STR_PARITY 0x80 48 - #define I8042_STR_TIMEOUT 0x40 49 - #define I8042_STR_AUXDATA 0x20 50 - #define I8042_STR_KEYLOCK 0x10 51 - #define I8042_STR_CMDDAT 0x08 52 - #define I8042_STR_MUXERR 0x04 53 - #define I8042_STR_IBF 0x02 54 - #define I8042_STR_OBF 0x01 55 - 56 - /* 57 - * Control register bits. 58 - */ 59 - 60 - #define I8042_CTR_KBDINT 0x01 61 - #define I8042_CTR_AUXINT 0x02 62 - #define I8042_CTR_IGNKEYLOCK 0x08 63 - #define I8042_CTR_KBDDIS 0x10 64 - #define I8042_CTR_AUXDIS 0x20 65 - #define I8042_CTR_XLATE 0x40 66 - 67 - /* 68 44 * Return codes. 69 45 */ 70 46
-3
drivers/input/serio/olpc_apsp.c
··· 183 183 184 184 np = pdev->dev.of_node; 185 185 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 186 - if (!res) 187 - return -ENOENT; 188 - 189 186 priv->base = devm_ioremap_resource(&pdev->dev, res); 190 187 if (IS_ERR(priv->base)) { 191 188 dev_err(&pdev->dev, "Failed to map WTM registers\n");
+42 -45
drivers/input/tablet/wacom_sys.c
··· 221 221 return logical_extents / physical_extents; 222 222 } 223 223 224 - /* 225 - * The physical dimension specified by the HID descriptor is likely not in 226 - * the "100th of a mm" units expected by wacom_calculate_touch_res. This 227 - * function adjusts the value of [xy]_phy based on the unit and exponent 228 - * provided by the HID descriptor. If an error occurs durring conversion 229 - * (e.g. from the unit being left unspecified) [xy]_phy is not modified. 230 - */ 231 - static void wacom_fix_phy_from_hid(struct wacom_features *features) 232 - { 233 - int xres = wacom_calc_hid_res(features->x_max, features->x_phy, 234 - features->unit, features->unitExpo); 235 - int yres = wacom_calc_hid_res(features->y_max, features->y_phy, 236 - features->unit, features->unitExpo); 237 - 238 - if (xres > 0 && yres > 0) { 239 - features->x_phy = (100 * features->x_max) / xres; 240 - features->y_phy = (100 * features->y_max) / yres; 241 - } 242 - } 243 - 244 - /* 245 - * Static values for max X/Y and resolution of Pen interface is stored in 246 - * features. This mean physical size of active area can be computed. 247 - * This is useful to do when Pen and Touch have same active area of tablet. 248 - * This means for Touch device, we only need to find max X/Y value and we 249 - * have enough information to compute resolution of touch. 250 - */ 251 - static void wacom_set_phy_from_res(struct wacom_features *features) 252 - { 253 - features->x_phy = (features->x_max * 100) / features->x_resolution; 254 - features->y_phy = (features->y_max * 100) / features->y_resolution; 255 - } 256 - 257 224 static int wacom_parse_logical_collection(unsigned char *report, 258 225 struct wacom_features *features) 259 226 { ··· 231 264 /* Logical collection is only used by 3rd gen Bamboo Touch */ 232 265 features->pktlen = WACOM_PKGLEN_BBTOUCH3; 233 266 features->device_type = BTN_TOOL_FINGER; 234 - 235 - wacom_set_phy_from_res(features); 236 267 237 268 features->x_max = features->y_max = 238 269 get_unaligned_le16(&report[10]); ··· 605 640 } 606 641 } 607 642 error = wacom_parse_hid(intf, hid_desc, features); 608 - if (error) 609 - goto out; 610 - wacom_fix_phy_from_hid(features); 611 643 612 644 out: 613 645 return error; ··· 1190 1228 *((struct wacom_features *)id->driver_info); 1191 1229 wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3; 1192 1230 wacom_wac2->features.device_type = BTN_TOOL_FINGER; 1193 - wacom_set_phy_from_res(&wacom_wac2->features); 1194 1231 wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096; 1195 1232 error = wacom_register_input(wacom2); 1196 1233 if (error) ··· 1210 1249 wacom_wac1->input = NULL; 1211 1250 fail1: 1212 1251 return; 1252 + } 1253 + 1254 + /* 1255 + * Not all devices report physical dimensions from HID. 1256 + * Compute the default from hardcoded logical dimension 1257 + * and resolution before driver overwrites them. 1258 + */ 1259 + static void wacom_set_default_phy(struct wacom_features *features) 1260 + { 1261 + if (features->x_resolution) { 1262 + features->x_phy = (features->x_max * 100) / 1263 + features->x_resolution; 1264 + features->y_phy = (features->y_max * 100) / 1265 + features->y_resolution; 1266 + } 1267 + } 1268 + 1269 + static void wacom_calculate_res(struct wacom_features *features) 1270 + { 1271 + features->x_resolution = wacom_calc_hid_res(features->x_max, 1272 + features->x_phy, 1273 + features->unit, 1274 + features->unitExpo); 1275 + features->y_resolution = wacom_calc_hid_res(features->y_max, 1276 + features->y_phy, 1277 + features->unit, 1278 + features->unitExpo); 1213 1279 } 1214 1280 1215 1281 static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id) ··· 1285 1297 1286 1298 endpoint = &intf->cur_altsetting->endpoint[0].desc; 1287 1299 1300 + /* set the default size in case we do not get them from hid */ 1301 + wacom_set_default_phy(features); 1302 + 1288 1303 /* Retrieve the physical and logical size for touch devices */ 1289 1304 error = wacom_retrieve_hid_descriptor(intf, features); 1290 1305 if (error) ··· 1303 1312 features->device_type = BTN_TOOL_FINGER; 1304 1313 features->pktlen = WACOM_PKGLEN_BBTOUCH3; 1305 1314 1306 - wacom_set_phy_from_res(features); 1307 - 1308 1315 features->x_max = 4096; 1309 1316 features->y_max = 4096; 1310 1317 } else { ··· 1311 1322 } 1312 1323 1313 1324 wacom_setup_device_quirks(features); 1325 + 1326 + /* set unit to "100th of a mm" for devices not reported by HID */ 1327 + if (!features->unit) { 1328 + features->unit = 0x11; 1329 + features->unitExpo = 16 - 3; 1330 + } 1331 + wacom_calculate_res(features); 1314 1332 1315 1333 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); 1316 1334 ··· 1329 1333 features->device_type == BTN_TOOL_PEN ? 1330 1334 " Pen" : " Finger", 1331 1335 sizeof(wacom_wac->name)); 1332 - 1333 1336 1334 1337 other_dev = wacom_get_sibling(dev, features->oVid, features->oPid); 1335 1338 if (other_dev == NULL || wacom_get_usbdev_data(other_dev) == NULL) ··· 1361 1366 usb_set_intfdata(intf, wacom); 1362 1367 1363 1368 if (features->quirks & WACOM_QUIRK_MONITOR) { 1364 - if (usb_submit_urb(wacom->irq, GFP_KERNEL)) 1369 + if (usb_submit_urb(wacom->irq, GFP_KERNEL)) { 1370 + error = -EIO; 1365 1371 goto fail5; 1372 + } 1366 1373 } 1367 1374 1368 1375 return 0; ··· 1419 1422 wacom_query_tablet_data(intf, features); 1420 1423 wacom_led_control(wacom); 1421 1424 1422 - if ((wacom->open || features->quirks & WACOM_QUIRK_MONITOR) 1423 - && usb_submit_urb(wacom->irq, GFP_NOIO) < 0) 1425 + if ((wacom->open || (features->quirks & WACOM_QUIRK_MONITOR)) && 1426 + usb_submit_urb(wacom->irq, GFP_NOIO) < 0) 1424 1427 rv = -EIO; 1425 1428 1426 1429 mutex_unlock(&wacom->lock);
+4 -15
drivers/input/tablet/wacom_wac.c
··· 1445 1445 } 1446 1446 } 1447 1447 1448 - static unsigned int wacom_calculate_touch_res(unsigned int logical_max, 1449 - unsigned int physical_max) 1450 - { 1451 - /* Touch physical dimensions are in 100th of mm */ 1452 - return (logical_max * 100) / physical_max; 1453 - } 1454 - 1455 1448 static void wacom_abs_set_axis(struct input_dev *input_dev, 1456 1449 struct wacom_wac *wacom_wac) 1457 1450 { ··· 1468 1475 input_set_abs_params(input_dev, ABS_Y, 0, 1469 1476 features->y_max, features->y_fuzz, 0); 1470 1477 input_abs_set_res(input_dev, ABS_X, 1471 - wacom_calculate_touch_res(features->x_max, 1472 - features->x_phy)); 1478 + features->x_resolution); 1473 1479 input_abs_set_res(input_dev, ABS_Y, 1474 - wacom_calculate_touch_res(features->y_max, 1475 - features->y_phy)); 1480 + features->y_resolution); 1476 1481 } 1477 1482 1478 1483 if (features->touch_max > 1) { ··· 1479 1488 input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, 1480 1489 features->y_max, features->y_fuzz, 0); 1481 1490 input_abs_set_res(input_dev, ABS_MT_POSITION_X, 1482 - wacom_calculate_touch_res(features->x_max, 1483 - features->x_phy)); 1491 + features->x_resolution); 1484 1492 input_abs_set_res(input_dev, ABS_MT_POSITION_Y, 1485 - wacom_calculate_touch_res(features->y_max, 1486 - features->y_phy)); 1493 + features->y_resolution); 1487 1494 } 1488 1495 } 1489 1496 }
+2 -4
drivers/input/touchscreen/cy8ctmg110_ts.c
··· 291 291 return err; 292 292 } 293 293 294 - #ifdef CONFIG_PM 294 + #ifdef CONFIG_PM_SLEEP 295 295 static int cy8ctmg110_suspend(struct device *dev) 296 296 { 297 297 struct i2c_client *client = to_i2c_client(dev); ··· 319 319 } 320 320 return 0; 321 321 } 322 + #endif 322 323 323 324 static SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, cy8ctmg110_suspend, cy8ctmg110_resume); 324 - #endif 325 325 326 326 static int cy8ctmg110_remove(struct i2c_client *client) 327 327 { ··· 351 351 .driver = { 352 352 .owner = THIS_MODULE, 353 353 .name = CY8CTMG110_DRIVER_NAME, 354 - #ifdef CONFIG_PM 355 354 .pm = &cy8ctmg110_pm, 356 - #endif 357 355 }, 358 356 .id_table = cy8ctmg110_idtable, 359 357 .probe = cy8ctmg110_probe,
+100 -103
drivers/input/touchscreen/cyttsp4_core.c
··· 1246 1246 1247 1247 dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__); 1248 1248 1249 - if (!cd) 1250 - return; 1251 - 1252 1249 if (!work_pending(&cd->watchdog_work)) 1253 1250 schedule_work(&cd->watchdog_work); 1254 1251 ··· 1549 1552 return rc; 1550 1553 } 1551 1554 1552 - static int cyttsp4_core_sleep(struct cyttsp4 *cd) 1553 - { 1554 - int rc; 1555 - 1556 - rc = cyttsp4_request_exclusive(cd, cd->dev, 1557 - CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); 1558 - if (rc < 0) { 1559 - dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", 1560 - __func__, cd->exclusive_dev, cd->dev); 1561 - return 0; 1562 - } 1563 - 1564 - rc = cyttsp4_core_sleep_(cd); 1565 - 1566 - if (cyttsp4_release_exclusive(cd, cd->dev) < 0) 1567 - dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); 1568 - else 1569 - dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); 1570 - 1571 - return rc; 1572 - } 1573 - 1574 - static int cyttsp4_core_wake_(struct cyttsp4 *cd) 1575 - { 1576 - struct device *dev = cd->dev; 1577 - int rc; 1578 - u8 mode; 1579 - int t; 1580 - 1581 - /* Already woken? */ 1582 - mutex_lock(&cd->system_lock); 1583 - if (cd->sleep_state == SS_SLEEP_OFF) { 1584 - mutex_unlock(&cd->system_lock); 1585 - return 0; 1586 - } 1587 - cd->int_status &= ~CY_INT_IGNORE; 1588 - cd->int_status |= CY_INT_AWAKE; 1589 - cd->sleep_state = SS_WAKING; 1590 - 1591 - if (cd->cpdata->power) { 1592 - dev_dbg(dev, "%s: Power up HW\n", __func__); 1593 - rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); 1594 - } else { 1595 - dev_dbg(dev, "%s: No power function\n", __func__); 1596 - rc = -ENOSYS; 1597 - } 1598 - if (rc < 0) { 1599 - dev_err(dev, "%s: HW Power up fails r=%d\n", 1600 - __func__, rc); 1601 - 1602 - /* Initiate a read transaction to wake up */ 1603 - cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); 1604 - } else 1605 - dev_vdbg(cd->dev, "%s: HW power up succeeds\n", 1606 - __func__); 1607 - mutex_unlock(&cd->system_lock); 1608 - 1609 - t = wait_event_timeout(cd->wait_q, 1610 - (cd->int_status & CY_INT_AWAKE) == 0, 1611 - msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); 1612 - if (IS_TMO(t)) { 1613 - dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); 1614 - mutex_lock(&cd->system_lock); 1615 - cd->int_status &= ~CY_INT_AWAKE; 1616 - /* Try starting up */ 1617 - cyttsp4_queue_startup_(cd); 1618 - mutex_unlock(&cd->system_lock); 1619 - } 1620 - 1621 - mutex_lock(&cd->system_lock); 1622 - cd->sleep_state = SS_SLEEP_OFF; 1623 - mutex_unlock(&cd->system_lock); 1624 - 1625 - cyttsp4_start_wd_timer(cd); 1626 - 1627 - return 0; 1628 - } 1629 - 1630 - static int cyttsp4_core_wake(struct cyttsp4 *cd) 1631 - { 1632 - int rc; 1633 - 1634 - rc = cyttsp4_request_exclusive(cd, cd->dev, 1635 - CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); 1636 - if (rc < 0) { 1637 - dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", 1638 - __func__, cd->exclusive_dev, cd->dev); 1639 - return 0; 1640 - } 1641 - 1642 - rc = cyttsp4_core_wake_(cd); 1643 - 1644 - if (cyttsp4_release_exclusive(cd, cd->dev) < 0) 1645 - dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); 1646 - else 1647 - dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); 1648 - 1649 - return rc; 1650 - } 1651 - 1652 1555 static int cyttsp4_startup_(struct cyttsp4 *cd) 1653 1556 { 1654 1557 int retry = CY_CORE_STARTUP_RETRY_COUNT; ··· 1718 1821 } 1719 1822 1720 1823 #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) 1824 + static int cyttsp4_core_sleep(struct cyttsp4 *cd) 1825 + { 1826 + int rc; 1827 + 1828 + rc = cyttsp4_request_exclusive(cd, cd->dev, 1829 + CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); 1830 + if (rc < 0) { 1831 + dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", 1832 + __func__, cd->exclusive_dev, cd->dev); 1833 + return 0; 1834 + } 1835 + 1836 + rc = cyttsp4_core_sleep_(cd); 1837 + 1838 + if (cyttsp4_release_exclusive(cd, cd->dev) < 0) 1839 + dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); 1840 + else 1841 + dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); 1842 + 1843 + return rc; 1844 + } 1845 + 1846 + static int cyttsp4_core_wake_(struct cyttsp4 *cd) 1847 + { 1848 + struct device *dev = cd->dev; 1849 + int rc; 1850 + u8 mode; 1851 + int t; 1852 + 1853 + /* Already woken? */ 1854 + mutex_lock(&cd->system_lock); 1855 + if (cd->sleep_state == SS_SLEEP_OFF) { 1856 + mutex_unlock(&cd->system_lock); 1857 + return 0; 1858 + } 1859 + cd->int_status &= ~CY_INT_IGNORE; 1860 + cd->int_status |= CY_INT_AWAKE; 1861 + cd->sleep_state = SS_WAKING; 1862 + 1863 + if (cd->cpdata->power) { 1864 + dev_dbg(dev, "%s: Power up HW\n", __func__); 1865 + rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); 1866 + } else { 1867 + dev_dbg(dev, "%s: No power function\n", __func__); 1868 + rc = -ENOSYS; 1869 + } 1870 + if (rc < 0) { 1871 + dev_err(dev, "%s: HW Power up fails r=%d\n", 1872 + __func__, rc); 1873 + 1874 + /* Initiate a read transaction to wake up */ 1875 + cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); 1876 + } else 1877 + dev_vdbg(cd->dev, "%s: HW power up succeeds\n", 1878 + __func__); 1879 + mutex_unlock(&cd->system_lock); 1880 + 1881 + t = wait_event_timeout(cd->wait_q, 1882 + (cd->int_status & CY_INT_AWAKE) == 0, 1883 + msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); 1884 + if (IS_TMO(t)) { 1885 + dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); 1886 + mutex_lock(&cd->system_lock); 1887 + cd->int_status &= ~CY_INT_AWAKE; 1888 + /* Try starting up */ 1889 + cyttsp4_queue_startup_(cd); 1890 + mutex_unlock(&cd->system_lock); 1891 + } 1892 + 1893 + mutex_lock(&cd->system_lock); 1894 + cd->sleep_state = SS_SLEEP_OFF; 1895 + mutex_unlock(&cd->system_lock); 1896 + 1897 + cyttsp4_start_wd_timer(cd); 1898 + 1899 + return 0; 1900 + } 1901 + 1902 + static int cyttsp4_core_wake(struct cyttsp4 *cd) 1903 + { 1904 + int rc; 1905 + 1906 + rc = cyttsp4_request_exclusive(cd, cd->dev, 1907 + CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); 1908 + if (rc < 0) { 1909 + dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", 1910 + __func__, cd->exclusive_dev, cd->dev); 1911 + return 0; 1912 + } 1913 + 1914 + rc = cyttsp4_core_wake_(cd); 1915 + 1916 + if (cyttsp4_release_exclusive(cd, cd->dev) < 0) 1917 + dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); 1918 + else 1919 + dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); 1920 + 1921 + return rc; 1922 + } 1923 + 1721 1924 static int cyttsp4_core_suspend(struct device *dev) 1722 1925 { 1723 1926 struct cyttsp4 *cd = dev_get_drvdata(dev);
+2 -4
drivers/input/touchscreen/eeti_ts.c
··· 264 264 return 0; 265 265 } 266 266 267 - #ifdef CONFIG_PM 267 + #ifdef CONFIG_PM_SLEEP 268 268 static int eeti_ts_suspend(struct device *dev) 269 269 { 270 270 struct i2c_client *client = to_i2c_client(dev); ··· 302 302 303 303 return 0; 304 304 } 305 + #endif 305 306 306 307 static SIMPLE_DEV_PM_OPS(eeti_ts_pm, eeti_ts_suspend, eeti_ts_resume); 307 - #endif 308 308 309 309 static const struct i2c_device_id eeti_ts_id[] = { 310 310 { "eeti_ts", 0 }, ··· 315 315 static struct i2c_driver eeti_ts_driver = { 316 316 .driver = { 317 317 .name = "eeti_ts", 318 - #ifdef CONFIG_PM 319 318 .pm = &eeti_ts_pm, 320 - #endif 321 319 }, 322 320 .probe = eeti_ts_probe, 323 321 .remove = eeti_ts_remove,
+1 -1
drivers/input/touchscreen/htcpen.c
··· 221 221 } 222 222 }; 223 223 224 - static struct dmi_system_id __initdata htcshift_dmi_table[] = { 224 + static struct dmi_system_id htcshift_dmi_table[] __initdata = { 225 225 { 226 226 .ident = "Shift", 227 227 .matches = {
+9 -28
drivers/input/touchscreen/max11801_ts.c
··· 181 181 struct input_dev *input_dev; 182 182 int error; 183 183 184 - data = kzalloc(sizeof(struct max11801_data), GFP_KERNEL); 185 - input_dev = input_allocate_device(); 184 + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); 185 + input_dev = devm_input_allocate_device(&client->dev); 186 186 if (!data || !input_dev) { 187 187 dev_err(&client->dev, "Failed to allocate memory\n"); 188 - error = -ENOMEM; 189 - goto err_free_mem; 188 + return -ENOMEM; 190 189 } 191 190 192 191 data->client = client; ··· 204 205 205 206 max11801_ts_phy_init(data); 206 207 207 - error = request_threaded_irq(client->irq, NULL, max11801_ts_interrupt, 208 - IRQF_TRIGGER_LOW | IRQF_ONESHOT, 209 - "max11801_ts", data); 208 + error = devm_request_threaded_irq(&client->dev, client->irq, NULL, 209 + max11801_ts_interrupt, 210 + IRQF_TRIGGER_LOW | IRQF_ONESHOT, 211 + "max11801_ts", data); 210 212 if (error) { 211 213 dev_err(&client->dev, "Failed to register interrupt\n"); 212 - goto err_free_mem; 214 + return error; 213 215 } 214 216 215 217 error = input_register_device(data->input_dev); 216 218 if (error) 217 - goto err_free_irq; 219 + return error; 218 220 219 221 i2c_set_clientdata(client, data); 220 - return 0; 221 - 222 - err_free_irq: 223 - free_irq(client->irq, data); 224 - err_free_mem: 225 - input_free_device(input_dev); 226 - kfree(data); 227 - return error; 228 - } 229 - 230 - static int max11801_ts_remove(struct i2c_client *client) 231 - { 232 - struct max11801_data *data = i2c_get_clientdata(client); 233 - 234 - free_irq(client->irq, data); 235 - input_unregister_device(data->input_dev); 236 - kfree(data); 237 - 238 222 return 0; 239 223 } 240 224 ··· 234 252 }, 235 253 .id_table = max11801_ts_id, 236 254 .probe = max11801_ts_probe, 237 - .remove = max11801_ts_remove, 238 255 }; 239 256 240 257 module_i2c_driver(max11801_ts_driver);
+42
drivers/tty/sysrq.c
··· 45 45 #include <linux/moduleparam.h> 46 46 #include <linux/jiffies.h> 47 47 #include <linux/syscalls.h> 48 + #include <linux/of.h> 48 49 49 50 #include <asm/ptrace.h> 50 51 #include <asm/irq_regs.h> ··· 682 681 } 683 682 } 684 683 684 + #ifdef CONFIG_OF 685 + static void sysrq_of_get_keyreset_config(void) 686 + { 687 + u32 key; 688 + struct device_node *np; 689 + struct property *prop; 690 + const __be32 *p; 691 + 692 + np = of_find_node_by_path("/chosen/linux,sysrq-reset-seq"); 693 + if (!np) { 694 + pr_debug("No sysrq node found"); 695 + return; 696 + } 697 + 698 + /* Reset in case a __weak definition was present */ 699 + sysrq_reset_seq_len = 0; 700 + 701 + of_property_for_each_u32(np, "keyset", prop, p, key) { 702 + if (key == KEY_RESERVED || key > KEY_MAX || 703 + sysrq_reset_seq_len == SYSRQ_KEY_RESET_MAX) 704 + break; 705 + 706 + sysrq_reset_seq[sysrq_reset_seq_len++] = (unsigned short)key; 707 + } 708 + 709 + /* Get reset timeout if any. */ 710 + of_property_read_u32(np, "timeout-ms", &sysrq_reset_downtime_ms); 711 + } 712 + #else 713 + static void sysrq_of_get_keyreset_config(void) 714 + { 715 + } 716 + #endif 717 + 685 718 static void sysrq_reinject_alt_sysrq(struct work_struct *work) 686 719 { 687 720 struct sysrq_state *sysrq = ··· 949 914 int error; 950 915 int i; 951 916 917 + /* First check if a __weak interface was instantiated. */ 952 918 for (i = 0; i < ARRAY_SIZE(sysrq_reset_seq); i++) { 953 919 key = platform_sysrq_reset_seq[i]; 954 920 if (key == KEY_RESERVED || key > KEY_MAX) ··· 957 921 958 922 sysrq_reset_seq[sysrq_reset_seq_len++] = key; 959 923 } 924 + 925 + /* 926 + * DT configuration takes precedence over anything that would 927 + * have been defined via the __weak interface. 928 + */ 929 + sysrq_of_get_keyreset_config(); 960 930 961 931 error = input_register_handler(&sysrq_handler); 962 932 if (error)
+24
include/linux/i8042.h
··· 31 31 #define I8042_CMD_MUX_PFX 0x0090 32 32 #define I8042_CMD_MUX_SEND 0x1090 33 33 34 + /* 35 + * Status register bits. 36 + */ 37 + 38 + #define I8042_STR_PARITY 0x80 39 + #define I8042_STR_TIMEOUT 0x40 40 + #define I8042_STR_AUXDATA 0x20 41 + #define I8042_STR_KEYLOCK 0x10 42 + #define I8042_STR_CMDDAT 0x08 43 + #define I8042_STR_MUXERR 0x04 44 + #define I8042_STR_IBF 0x02 45 + #define I8042_STR_OBF 0x01 46 + 47 + /* 48 + * Control register bits. 49 + */ 50 + 51 + #define I8042_CTR_KBDINT 0x01 52 + #define I8042_CTR_AUXINT 0x02 53 + #define I8042_CTR_IGNKEYLOCK 0x08 54 + #define I8042_CTR_KBDDIS 0x10 55 + #define I8042_CTR_AUXDIS 0x20 56 + #define I8042_CTR_XLATE 0x40 57 + 34 58 struct serio; 35 59 36 60 #if defined(CONFIG_SERIO_I8042) || defined(CONFIG_SERIO_I8042_MODULE)
+2
include/uapi/linux/input.h
··· 194 194 #define SYN_CONFIG 1 195 195 #define SYN_MT_REPORT 2 196 196 #define SYN_DROPPED 3 197 + #define SYN_MAX 0xf 198 + #define SYN_CNT (SYN_MAX+1) 197 199 198 200 /* 199 201 * Keys and buttons