summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/input/atmel,maxtouch.txt2
-rw-r--r--Documentation/devicetree/bindings/serio/ps2-gpio.txt23
-rw-r--r--Documentation/gpio/drivers-on-gpio.txt5
-rw-r--r--arch/arm/mach-pxa/raumfeld.c2
-rw-r--r--drivers/input/input.c6
-rw-r--r--drivers/input/joystick/iforce/iforce-serio.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c2
-rw-r--r--drivers/input/joystick/magellan.c2
-rw-r--r--drivers/input/joystick/spaceball.c2
-rw-r--r--drivers/input/joystick/spaceorb.c2
-rw-r--r--drivers/input/joystick/stinger.c2
-rw-r--r--drivers/input/joystick/twidjoy.c2
-rw-r--r--drivers/input/joystick/warrior.c2
-rw-r--r--drivers/input/joystick/xpad.c2
-rw-r--r--drivers/input/joystick/zhenhua.c2
-rw-r--r--drivers/input/keyboard/atkbd.c2
-rw-r--r--drivers/input/keyboard/gpio_keys.c2
-rw-r--r--drivers/input/keyboard/hil_kbd.c2
-rw-r--r--drivers/input/keyboard/lkkbd.c2
-rw-r--r--drivers/input/keyboard/newtonkbd.c2
-rw-r--r--drivers/input/keyboard/pxa27x_keypad.c15
-rw-r--r--drivers/input/keyboard/stowaway.c2
-rw-r--r--drivers/input/keyboard/sunkbd.c2
-rw-r--r--drivers/input/keyboard/tegra-kbc.c5
-rw-r--r--drivers/input/keyboard/xtkbd.c2
-rw-r--r--drivers/input/misc/Kconfig11
-rw-r--r--drivers/input/misc/Makefile1
-rw-r--r--drivers/input/misc/ati_remote2.c2
-rw-r--r--drivers/input/misc/axp20x-pek.c149
-rw-r--r--drivers/input/misc/ims-pcu.c4
-rw-r--r--drivers/input/misc/keyspan_remote.c2
-rw-r--r--drivers/input/misc/pcspkr.c17
-rw-r--r--drivers/input/misc/powermate.c2
-rw-r--r--drivers/input/misc/rk805-pwrkey.c111
-rw-r--r--drivers/input/misc/xen-kbdfront.c5
-rw-r--r--drivers/input/misc/yealink.c2
-rw-r--r--drivers/input/mouse/appletouch.c2
-rw-r--r--drivers/input/mouse/byd.c2
-rw-r--r--drivers/input/mouse/elan_i2c.h2
-rw-r--r--drivers/input/mouse/elan_i2c_core.c9
-rw-r--r--drivers/input/mouse/elan_i2c_i2c.c13
-rw-r--r--drivers/input/mouse/elan_i2c_smbus.c4
-rw-r--r--drivers/input/mouse/elantech.c2
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mouse/synaptics_usb.c2
-rw-r--r--drivers/input/mousedev.c62
-rw-r--r--drivers/input/rmi4/rmi_f01.c2
-rw-r--r--drivers/input/rmi4/rmi_f34.c2
-rw-r--r--drivers/input/serio/Kconfig11
-rw-r--r--drivers/input/serio/Makefile1
-rw-r--r--drivers/input/serio/ambakmi.c2
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h4
-rw-r--r--drivers/input/serio/ps2-gpio.c453
-rw-r--r--drivers/input/serio/serio.c4
-rw-r--r--drivers/input/serio/serio_raw.c2
-rw-r--r--drivers/input/serio/xilinx_ps2.c12
-rw-r--r--drivers/input/tablet/acecad.c2
-rw-r--r--drivers/input/tablet/aiptek.c2
-rw-r--r--drivers/input/tablet/kbtab.c2
-rw-r--r--drivers/input/tablet/wacom_serial4.c2
-rw-r--r--drivers/input/touchscreen/ads7846.c4
-rw-r--r--drivers/input/touchscreen/atmel_mxt_ts.c46
-rw-r--r--drivers/input/touchscreen/dynapro.c2
-rw-r--r--drivers/input/touchscreen/elants_i2c.c2
-rw-r--r--drivers/input/touchscreen/elo.c2
-rw-r--r--drivers/input/touchscreen/fujitsu_ts.c2
-rw-r--r--drivers/input/touchscreen/gunze.c2
-rw-r--r--drivers/input/touchscreen/hampshire.c2
-rw-r--r--drivers/input/touchscreen/inexio.c2
-rw-r--r--drivers/input/touchscreen/mtouch.c2
-rw-r--r--drivers/input/touchscreen/mxs-lradc-ts.c8
-rw-r--r--drivers/input/touchscreen/penmount.c2
-rw-r--r--drivers/input/touchscreen/raydium_i2c_ts.c2
-rw-r--r--drivers/input/touchscreen/sun4i-ts.c2
-rw-r--r--drivers/input/touchscreen/sur40.c46
-rw-r--r--drivers/input/touchscreen/touchit213.c2
-rw-r--r--drivers/input/touchscreen/touchright.c2
-rw-r--r--drivers/input/touchscreen/touchwin.c2
-rw-r--r--drivers/input/touchscreen/tsc40.c2
-rw-r--r--drivers/input/touchscreen/wacom_w8001.c2
80 files changed, 947 insertions, 190 deletions
diff --git a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
index 1852906517ab..23e3abc3fdef 100644
--- a/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
+++ b/Documentation/devicetree/bindings/input/atmel,maxtouch.txt
@@ -22,6 +22,8 @@ Optional properties for main touchpad device:
22 experiment to determine which bit corresponds to which input. Use 22 experiment to determine which bit corresponds to which input. Use
23 KEY_RESERVED for unused padding values. 23 KEY_RESERVED for unused padding values.
24 24
25- reset-gpios: GPIO specifier for the touchscreen's reset pin (active low)
26
25Example: 27Example:
26 28
27 touch@4b { 29 touch@4b {
diff --git a/Documentation/devicetree/bindings/serio/ps2-gpio.txt b/Documentation/devicetree/bindings/serio/ps2-gpio.txt
new file mode 100644
index 000000000000..7b7bc9cdf986
--- /dev/null
+++ b/Documentation/devicetree/bindings/serio/ps2-gpio.txt
@@ -0,0 +1,23 @@
1Device-Tree binding for ps/2 gpio device
2
3Required properties:
4 - compatible = "ps2-gpio"
5 - data-gpios: the data pin
6 - clk-gpios: the clock pin
7 - interrupts: Should trigger on the falling edge of the clock line.
8
9Optional properties:
10 - write-enable: Indicates whether write function is provided
11 to serio device. Possibly providing the write fn will not work, because
12 of the tough timing requirements.
13
14Example nodes:
15
16ps2@0 {
17 compatible = "ps2-gpio";
18 interrupt-parent = <&gpio>;
19 interrupts = <23 IRQ_TYPE_EDGE_FALLING>;
20 data-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
21 clk-gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
22 write-enable;
23};
diff --git a/Documentation/gpio/drivers-on-gpio.txt b/Documentation/gpio/drivers-on-gpio.txt
index 306513251713..9a78d385b92e 100644
--- a/Documentation/gpio/drivers-on-gpio.txt
+++ b/Documentation/gpio/drivers-on-gpio.txt
@@ -84,6 +84,11 @@ hardware descriptions such as device tree or ACPI:
84 NAND flash MTD subsystem and provides chip access and partition parsing like 84 NAND flash MTD subsystem and provides chip access and partition parsing like
85 any other NAND driving hardware. 85 any other NAND driving hardware.
86 86
87- ps2-gpio: drivers/input/serio/ps2-gpio.c is used to drive a PS/2 (IBM) serio
88 bus, data and clock line, by bit banging two GPIO lines. It will appear as
89 any other serio bus to the system and makes it possible to connect drivers
90 for e.g. keyboards and other PS/2 protocol based devices.
91
87Apart from this there are special GPIO drivers in subsystems like MMC/SD to 92Apart from this there are special GPIO drivers in subsystems like MMC/SD to
88read card detect and write protect GPIO lines, and in the TTY serial subsystem 93read card detect and write protect GPIO lines, and in the TTY serial subsystem
89to emulate MCTRL (modem control) signals CTS/RTS by using two GPIO lines. The 94to emulate MCTRL (modem control) signals CTS/RTS by using two GPIO lines. The
diff --git a/arch/arm/mach-pxa/raumfeld.c b/arch/arm/mach-pxa/raumfeld.c
index e2c97728b3c6..9d662fed03ec 100644
--- a/arch/arm/mach-pxa/raumfeld.c
+++ b/arch/arm/mach-pxa/raumfeld.c
@@ -377,7 +377,7 @@ static struct gpiod_lookup_table raumfeld_rotary_gpios_table = {
377 }, 377 },
378}; 378};
379 379
380static struct property_entry raumfeld_rotary_properties[] = { 380static const struct property_entry raumfeld_rotary_properties[] __initconst = {
381 PROPERTY_ENTRY_INTEGER("rotary-encoder,steps-per-period", u32, 24), 381 PROPERTY_ENTRY_INTEGER("rotary-encoder,steps-per-period", u32, 24),
382 PROPERTY_ENTRY_INTEGER("linux,axis", u32, REL_X), 382 PROPERTY_ENTRY_INTEGER("linux,axis", u32, REL_X),
383 PROPERTY_ENTRY_INTEGER("rotary-encoder,relative_axis", u32, 1), 383 PROPERTY_ENTRY_INTEGER("rotary-encoder,relative_axis", u32, 1),
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 7e6842bd525c..d268fdc23c64 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1398,7 +1398,7 @@ static struct attribute *input_dev_attrs[] = {
1398 NULL 1398 NULL
1399}; 1399};
1400 1400
1401static struct attribute_group input_dev_attr_group = { 1401static const struct attribute_group input_dev_attr_group = {
1402 .attrs = input_dev_attrs, 1402 .attrs = input_dev_attrs,
1403}; 1403};
1404 1404
@@ -1425,7 +1425,7 @@ static struct attribute *input_dev_id_attrs[] = {
1425 NULL 1425 NULL
1426}; 1426};
1427 1427
1428static struct attribute_group input_dev_id_attr_group = { 1428static const struct attribute_group input_dev_id_attr_group = {
1429 .name = "id", 1429 .name = "id",
1430 .attrs = input_dev_id_attrs, 1430 .attrs = input_dev_id_attrs,
1431}; 1431};
@@ -1495,7 +1495,7 @@ static struct attribute *input_dev_caps_attrs[] = {
1495 NULL 1495 NULL
1496}; 1496};
1497 1497
1498static struct attribute_group input_dev_caps_attr_group = { 1498static const struct attribute_group input_dev_caps_attr_group = {
1499 .name = "capabilities", 1499 .name = "capabilities",
1500 .attrs = input_dev_caps_attrs, 1500 .attrs = input_dev_caps_attrs,
1501}; 1501};
diff --git a/drivers/input/joystick/iforce/iforce-serio.c b/drivers/input/joystick/iforce/iforce-serio.c
index 46d5041d2d9d..154e827b559b 100644
--- a/drivers/input/joystick/iforce/iforce-serio.c
+++ b/drivers/input/joystick/iforce/iforce-serio.c
@@ -164,7 +164,7 @@ static void iforce_serio_disconnect(struct serio *serio)
164 kfree(iforce); 164 kfree(iforce);
165} 165}
166 166
167static struct serio_device_id iforce_serio_ids[] = { 167static const struct serio_device_id iforce_serio_ids[] = {
168 { 168 {
169 .type = SERIO_RS232, 169 .type = SERIO_RS232,
170 .proto = SERIO_IFORCE, 170 .proto = SERIO_IFORCE,
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index db64adfbe1af..e8724f1a4a25 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -209,7 +209,7 @@ static void iforce_usb_disconnect(struct usb_interface *intf)
209 kfree(iforce); 209 kfree(iforce);
210} 210}
211 211
212static struct usb_device_id iforce_usb_ids [] = { 212static const struct usb_device_id iforce_usb_ids[] = {
213 { USB_DEVICE(0x044f, 0xa01c) }, /* Thrustmaster Motor Sport GT */ 213 { USB_DEVICE(0x044f, 0xa01c) }, /* Thrustmaster Motor Sport GT */
214 { USB_DEVICE(0x046d, 0xc281) }, /* Logitech WingMan Force */ 214 { USB_DEVICE(0x046d, 0xc281) }, /* Logitech WingMan Force */
215 { USB_DEVICE(0x046d, 0xc291) }, /* Logitech WingMan Formula Force */ 215 { USB_DEVICE(0x046d, 0xc291) }, /* Logitech WingMan Formula Force */
diff --git a/drivers/input/joystick/magellan.c b/drivers/input/joystick/magellan.c
index c5358ba1f571..a9d0e3edca94 100644
--- a/drivers/input/joystick/magellan.c
+++ b/drivers/input/joystick/magellan.c
@@ -198,7 +198,7 @@ static int magellan_connect(struct serio *serio, struct serio_driver *drv)
198 * The serio driver structure. 198 * The serio driver structure.
199 */ 199 */
200 200
201static struct serio_device_id magellan_serio_ids[] = { 201static const struct serio_device_id magellan_serio_ids[] = {
202 { 202 {
203 .type = SERIO_RS232, 203 .type = SERIO_RS232,
204 .proto = SERIO_MAGELLAN, 204 .proto = SERIO_MAGELLAN,
diff --git a/drivers/input/joystick/spaceball.c b/drivers/input/joystick/spaceball.c
index f4445a4e8d6a..e9712a1b7cad 100644
--- a/drivers/input/joystick/spaceball.c
+++ b/drivers/input/joystick/spaceball.c
@@ -272,7 +272,7 @@ static int spaceball_connect(struct serio *serio, struct serio_driver *drv)
272 * The serio driver structure. 272 * The serio driver structure.
273 */ 273 */
274 274
275static struct serio_device_id spaceball_serio_ids[] = { 275static const struct serio_device_id spaceball_serio_ids[] = {
276 { 276 {
277 .type = SERIO_RS232, 277 .type = SERIO_RS232,
278 .proto = SERIO_SPACEBALL, 278 .proto = SERIO_SPACEBALL,
diff --git a/drivers/input/joystick/spaceorb.c b/drivers/input/joystick/spaceorb.c
index f2667820e8c5..05da0ed514e2 100644
--- a/drivers/input/joystick/spaceorb.c
+++ b/drivers/input/joystick/spaceorb.c
@@ -213,7 +213,7 @@ static int spaceorb_connect(struct serio *serio, struct serio_driver *drv)
213 * The serio driver structure. 213 * The serio driver structure.
214 */ 214 */
215 215
216static struct serio_device_id spaceorb_serio_ids[] = { 216static const struct serio_device_id spaceorb_serio_ids[] = {
217 { 217 {
218 .type = SERIO_RS232, 218 .type = SERIO_RS232,
219 .proto = SERIO_SPACEORB, 219 .proto = SERIO_SPACEORB,
diff --git a/drivers/input/joystick/stinger.c b/drivers/input/joystick/stinger.c
index 099c6d7b5e08..cb10e7b097ae 100644
--- a/drivers/input/joystick/stinger.c
+++ b/drivers/input/joystick/stinger.c
@@ -184,7 +184,7 @@ static int stinger_connect(struct serio *serio, struct serio_driver *drv)
184 * The serio driver structure. 184 * The serio driver structure.
185 */ 185 */
186 186
187static struct serio_device_id stinger_serio_ids[] = { 187static const struct serio_device_id stinger_serio_ids[] = {
188 { 188 {
189 .type = SERIO_RS232, 189 .type = SERIO_RS232,
190 .proto = SERIO_STINGER, 190 .proto = SERIO_STINGER,
diff --git a/drivers/input/joystick/twidjoy.c b/drivers/input/joystick/twidjoy.c
index 7f7e5ab3f9e3..e60cb004cb8c 100644
--- a/drivers/input/joystick/twidjoy.c
+++ b/drivers/input/joystick/twidjoy.c
@@ -233,7 +233,7 @@ static int twidjoy_connect(struct serio *serio, struct serio_driver *drv)
233 * The serio driver structure. 233 * The serio driver structure.
234 */ 234 */
235 235
236static struct serio_device_id twidjoy_serio_ids[] = { 236static const struct serio_device_id twidjoy_serio_ids[] = {
237 { 237 {
238 .type = SERIO_RS232, 238 .type = SERIO_RS232,
239 .proto = SERIO_TWIDJOY, 239 .proto = SERIO_TWIDJOY,
diff --git a/drivers/input/joystick/warrior.c b/drivers/input/joystick/warrior.c
index e13a9144a25d..ef5391ba4470 100644
--- a/drivers/input/joystick/warrior.c
+++ b/drivers/input/joystick/warrior.c
@@ -193,7 +193,7 @@ static int warrior_connect(struct serio *serio, struct serio_driver *drv)
193 * The serio driver structure. 193 * The serio driver structure.
194 */ 194 */
195 195
196static struct serio_device_id warrior_serio_ids[] = { 196static const struct serio_device_id warrior_serio_ids[] = {
197 { 197 {
198 .type = SERIO_RS232, 198 .type = SERIO_RS232,
199 .proto = SERIO_WARRIOR, 199 .proto = SERIO_WARRIOR,
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index ca0e19ae7a90..f8e34ef643c7 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -408,7 +408,7 @@ static const signed short xpad_abs_triggers[] = {
408#define XPAD_XBOXONE_VENDOR(vend) \ 408#define XPAD_XBOXONE_VENDOR(vend) \
409 { XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) } 409 { XPAD_XBOXONE_VENDOR_PROTOCOL(vend, 208) }
410 410
411static struct usb_device_id xpad_table[] = { 411static const struct usb_device_id xpad_table[] = {
412 { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */ 412 { USB_INTERFACE_INFO('X', 'B', 0) }, /* X-Box USB-IF not approved class */
413 XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */ 413 XPAD_XBOX360_VENDOR(0x044f), /* Thrustmaster X-Box 360 controllers */
414 XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */ 414 XPAD_XBOX360_VENDOR(0x045e), /* Microsoft X-Box 360 controllers */
diff --git a/drivers/input/joystick/zhenhua.c b/drivers/input/joystick/zhenhua.c
index 4a8258bf13fd..5c6d5de743f1 100644
--- a/drivers/input/joystick/zhenhua.c
+++ b/drivers/input/joystick/zhenhua.c
@@ -192,7 +192,7 @@ static int zhenhua_connect(struct serio *serio, struct serio_driver *drv)
192 * The serio driver structure. 192 * The serio driver structure.
193 */ 193 */
194 194
195static struct serio_device_id zhenhua_serio_ids[] = { 195static const struct serio_device_id zhenhua_serio_ids[] = {
196 { 196 {
197 .type = SERIO_RS232, 197 .type = SERIO_RS232,
198 .proto = SERIO_ZHENHUA, 198 .proto = SERIO_ZHENHUA,
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index ec876b5b1382..7e75835e220f 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -1270,7 +1270,7 @@ static int atkbd_reconnect(struct serio *serio)
1270 return retval; 1270 return retval;
1271} 1271}
1272 1272
1273static struct serio_device_id atkbd_serio_ids[] = { 1273static const struct serio_device_id atkbd_serio_ids[] = {
1274 { 1274 {
1275 .type = SERIO_8042, 1275 .type = SERIO_8042,
1276 .proto = SERIO_ANY, 1276 .proto = SERIO_ANY,
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 0b10d4b356db..e9f0ebf3267a 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -353,7 +353,7 @@ static struct attribute *gpio_keys_attrs[] = {
353 NULL, 353 NULL,
354}; 354};
355 355
356static struct attribute_group gpio_keys_attr_group = { 356static const struct attribute_group gpio_keys_attr_group = {
357 .attrs = gpio_keys_attrs, 357 .attrs = gpio_keys_attrs,
358}; 358};
359 359
diff --git a/drivers/input/keyboard/hil_kbd.c b/drivers/input/keyboard/hil_kbd.c
index 5b152f25a8e1..bb29a7c9a1c0 100644
--- a/drivers/input/keyboard/hil_kbd.c
+++ b/drivers/input/keyboard/hil_kbd.c
@@ -559,7 +559,7 @@ static int hil_dev_connect(struct serio *serio, struct serio_driver *drv)
559 return error; 559 return error;
560} 560}
561 561
562static struct serio_device_id hil_dev_ids[] = { 562static const struct serio_device_id hil_dev_ids[] = {
563 { 563 {
564 .type = SERIO_HIL_MLC, 564 .type = SERIO_HIL_MLC,
565 .proto = SERIO_HIL, 565 .proto = SERIO_HIL,
diff --git a/drivers/input/keyboard/lkkbd.c b/drivers/input/keyboard/lkkbd.c
index 9fcd9f1d5dc8..471d53815c6d 100644
--- a/drivers/input/keyboard/lkkbd.c
+++ b/drivers/input/keyboard/lkkbd.c
@@ -707,7 +707,7 @@ static void lkkbd_disconnect(struct serio *serio)
707 kfree(lk); 707 kfree(lk);
708} 708}
709 709
710static struct serio_device_id lkkbd_serio_ids[] = { 710static const struct serio_device_id lkkbd_serio_ids[] = {
711 { 711 {
712 .type = SERIO_RS232, 712 .type = SERIO_RS232,
713 .proto = SERIO_LKKBD, 713 .proto = SERIO_LKKBD,
diff --git a/drivers/input/keyboard/newtonkbd.c b/drivers/input/keyboard/newtonkbd.c
index 20f044377990..fb9b8e23ab93 100644
--- a/drivers/input/keyboard/newtonkbd.c
+++ b/drivers/input/keyboard/newtonkbd.c
@@ -142,7 +142,7 @@ static void nkbd_disconnect(struct serio *serio)
142 kfree(nkbd); 142 kfree(nkbd);
143} 143}
144 144
145static struct serio_device_id nkbd_serio_ids[] = { 145static const struct serio_device_id nkbd_serio_ids[] = {
146 { 146 {
147 .type = SERIO_RS232, 147 .type = SERIO_RS232,
148 .proto = SERIO_NEWTON, 148 .proto = SERIO_NEWTON,
diff --git a/drivers/input/keyboard/pxa27x_keypad.c b/drivers/input/keyboard/pxa27x_keypad.c
index 3841fa30db33..d0bdaeadf86d 100644
--- a/drivers/input/keyboard/pxa27x_keypad.c
+++ b/drivers/input/keyboard/pxa27x_keypad.c
@@ -644,9 +644,12 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad)
644static int pxa27x_keypad_open(struct input_dev *dev) 644static int pxa27x_keypad_open(struct input_dev *dev)
645{ 645{
646 struct pxa27x_keypad *keypad = input_get_drvdata(dev); 646 struct pxa27x_keypad *keypad = input_get_drvdata(dev);
647 647 int ret;
648 /* Enable unit clock */ 648 /* Enable unit clock */
649 clk_prepare_enable(keypad->clk); 649 ret = clk_prepare_enable(keypad->clk);
650 if (ret)
651 return ret;
652
650 pxa27x_keypad_config(keypad); 653 pxa27x_keypad_config(keypad);
651 654
652 return 0; 655 return 0;
@@ -683,6 +686,7 @@ static int pxa27x_keypad_resume(struct device *dev)
683 struct platform_device *pdev = to_platform_device(dev); 686 struct platform_device *pdev = to_platform_device(dev);
684 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev); 687 struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
685 struct input_dev *input_dev = keypad->input_dev; 688 struct input_dev *input_dev = keypad->input_dev;
689 int ret = 0;
686 690
687 /* 691 /*
688 * If the keypad is used as wake up source, the clock is not turned 692 * If the keypad is used as wake up source, the clock is not turned
@@ -695,14 +699,15 @@ static int pxa27x_keypad_resume(struct device *dev)
695 699
696 if (input_dev->users) { 700 if (input_dev->users) {
697 /* Enable unit clock */ 701 /* Enable unit clock */
698 clk_prepare_enable(keypad->clk); 702 ret = clk_prepare_enable(keypad->clk);
699 pxa27x_keypad_config(keypad); 703 if (!ret)
704 pxa27x_keypad_config(keypad);
700 } 705 }
701 706
702 mutex_unlock(&input_dev->mutex); 707 mutex_unlock(&input_dev->mutex);
703 } 708 }
704 709
705 return 0; 710 return ret;
706} 711}
707#endif 712#endif
708 713
diff --git a/drivers/input/keyboard/stowaway.c b/drivers/input/keyboard/stowaway.c
index a6e0d565e306..8b6de9a692dc 100644
--- a/drivers/input/keyboard/stowaway.c
+++ b/drivers/input/keyboard/stowaway.c
@@ -146,7 +146,7 @@ static void skbd_disconnect(struct serio *serio)
146 kfree(skbd); 146 kfree(skbd);
147} 147}
148 148
149static struct serio_device_id skbd_serio_ids[] = { 149static const struct serio_device_id skbd_serio_ids[] = {
150 { 150 {
151 .type = SERIO_RS232, 151 .type = SERIO_RS232,
152 .proto = SERIO_STOWAWAY, 152 .proto = SERIO_STOWAWAY,
diff --git a/drivers/input/keyboard/sunkbd.c b/drivers/input/keyboard/sunkbd.c
index dc6bb9d5b4f0..c95707ea2656 100644
--- a/drivers/input/keyboard/sunkbd.c
+++ b/drivers/input/keyboard/sunkbd.c
@@ -339,7 +339,7 @@ static void sunkbd_disconnect(struct serio *serio)
339 kfree(sunkbd); 339 kfree(sunkbd);
340} 340}
341 341
342static struct serio_device_id sunkbd_serio_ids[] = { 342static const struct serio_device_id sunkbd_serio_ids[] = {
343 { 343 {
344 .type = SERIO_RS232, 344 .type = SERIO_RS232,
345 .proto = SERIO_SUNKBD, 345 .proto = SERIO_SUNKBD,
diff --git a/drivers/input/keyboard/tegra-kbc.c b/drivers/input/keyboard/tegra-kbc.c
index 0c07e1023a46..edc1385ca00b 100644
--- a/drivers/input/keyboard/tegra-kbc.c
+++ b/drivers/input/keyboard/tegra-kbc.c
@@ -370,8 +370,11 @@ static int tegra_kbc_start(struct tegra_kbc *kbc)
370{ 370{
371 unsigned int debounce_cnt; 371 unsigned int debounce_cnt;
372 u32 val = 0; 372 u32 val = 0;
373 int ret;
373 374
374 clk_prepare_enable(kbc->clk); 375 ret = clk_prepare_enable(kbc->clk);
376 if (ret)
377 return ret;
375 378
376 /* Reset the KBC controller to clear all previous status.*/ 379 /* Reset the KBC controller to clear all previous status.*/
377 reset_control_assert(kbc->rst); 380 reset_control_assert(kbc->rst);
diff --git a/drivers/input/keyboard/xtkbd.c b/drivers/input/keyboard/xtkbd.c
index 7c2325bd7408..8f64b9ded8d0 100644
--- a/drivers/input/keyboard/xtkbd.c
+++ b/drivers/input/keyboard/xtkbd.c
@@ -145,7 +145,7 @@ static void xtkbd_disconnect(struct serio *serio)
145 kfree(xtkbd); 145 kfree(xtkbd);
146} 146}
147 147
148static struct serio_device_id xtkbd_serio_ids[] = { 148static const struct serio_device_id xtkbd_serio_ids[] = {
149 { 149 {
150 .type = SERIO_XT, 150 .type = SERIO_XT,
151 .proto = SERIO_ANY, 151 .proto = SERIO_ANY,
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 3872488c3fd7..f47e836eaa0f 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -581,6 +581,17 @@ config INPUT_PWM_BEEPER
581 To compile this driver as a module, choose M here: the module will be 581 To compile this driver as a module, choose M here: the module will be
582 called pwm-beeper. 582 called pwm-beeper.
583 583
584config INPUT_RK805_PWRKEY
585 tristate "Rockchip RK805 PMIC power key support"
586 depends on MFD_RK808
587 help
588 Select this option to enable power key driver for RK805.
589
590 If unsure, say N.
591
592 To compile this driver as a module, choose M here: the module will be
593 called rk805_pwrkey.
594
584config INPUT_GPIO_ROTARY_ENCODER 595config INPUT_GPIO_ROTARY_ENCODER
585 tristate "Rotary encoders connected to GPIO pins" 596 tristate "Rotary encoders connected to GPIO pins"
586 depends on GPIOLIB || COMPILE_TEST 597 depends on GPIOLIB || COMPILE_TEST
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index b923a9828c88..1072e0760c19 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -64,6 +64,7 @@ obj-$(CONFIG_INPUT_REGULATOR_HAPTIC) += regulator-haptic.o
64obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o 64obj-$(CONFIG_INPUT_RETU_PWRBUTTON) += retu-pwrbutton.o
65obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o 65obj-$(CONFIG_INPUT_AXP20X_PEK) += axp20x-pek.o
66obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o 66obj-$(CONFIG_INPUT_GPIO_ROTARY_ENCODER) += rotary_encoder.o
67obj-$(CONFIG_INPUT_RK805_PWRKEY) += rk805-pwrkey.o
67obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o 68obj-$(CONFIG_INPUT_SGI_BTNS) += sgi_btns.o
68obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o 69obj-$(CONFIG_INPUT_SIRFSOC_ONKEY) += sirfsoc-onkey.o
69obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o 70obj-$(CONFIG_INPUT_SOC_BUTTON_ARRAY) += soc_button_array.o
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c
index 1c5914cae853..ebf4448b31b9 100644
--- a/drivers/input/misc/ati_remote2.c
+++ b/drivers/input/misc/ati_remote2.c
@@ -110,7 +110,7 @@ static const struct kernel_param_ops param_ops_mode_mask = {
110module_param(mode_mask, mode_mask, 0644); 110module_param(mode_mask, mode_mask, 0644);
111MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>"); 111MODULE_PARM_DESC(mode_mask, "Bitmask of modes to accept <4:PC><3:AUX4><2:AUX3><1:AUX2><0:AUX1>");
112 112
113static struct usb_device_id ati_remote2_id_table[] = { 113static const struct usb_device_id ati_remote2_id_table[] = {
114 { USB_DEVICE(0x0471, 0x0602) }, /* ATI Remote Wonder II */ 114 { USB_DEVICE(0x0471, 0x0602) }, /* ATI Remote Wonder II */
115 { } 115 { }
116}; 116};
diff --git a/drivers/input/misc/axp20x-pek.c b/drivers/input/misc/axp20x-pek.c
index cfeb0e943de6..6cee5adc3b5c 100644
--- a/drivers/input/misc/axp20x-pek.c
+++ b/drivers/input/misc/axp20x-pek.c
@@ -29,9 +29,17 @@
29#define AXP20X_PEK_STARTUP_MASK (0xc0) 29#define AXP20X_PEK_STARTUP_MASK (0xc0)
30#define AXP20X_PEK_SHUTDOWN_MASK (0x03) 30#define AXP20X_PEK_SHUTDOWN_MASK (0x03)
31 31
32struct axp20x_info {
33 const struct axp20x_time *startup_time;
34 unsigned int startup_mask;
35 const struct axp20x_time *shutdown_time;
36 unsigned int shutdown_mask;
37};
38
32struct axp20x_pek { 39struct axp20x_pek {
33 struct axp20x_dev *axp20x; 40 struct axp20x_dev *axp20x;
34 struct input_dev *input; 41 struct input_dev *input;
42 struct axp20x_info *info;
35 int irq_dbr; 43 int irq_dbr;
36 int irq_dbf; 44 int irq_dbf;
37}; 45};
@@ -48,6 +56,13 @@ static const struct axp20x_time startup_time[] = {
48 { .time = 2000, .idx = 3 }, 56 { .time = 2000, .idx = 3 },
49}; 57};
50 58
59static const struct axp20x_time axp221_startup_time[] = {
60 { .time = 128, .idx = 0 },
61 { .time = 1000, .idx = 1 },
62 { .time = 2000, .idx = 2 },
63 { .time = 3000, .idx = 3 },
64};
65
51static const struct axp20x_time shutdown_time[] = { 66static const struct axp20x_time shutdown_time[] = {
52 { .time = 4000, .idx = 0 }, 67 { .time = 4000, .idx = 0 },
53 { .time = 6000, .idx = 1 }, 68 { .time = 6000, .idx = 1 },
@@ -55,31 +70,25 @@ static const struct axp20x_time shutdown_time[] = {
55 { .time = 10000, .idx = 3 }, 70 { .time = 10000, .idx = 3 },
56}; 71};
57 72
58struct axp20x_pek_ext_attr { 73static const struct axp20x_info axp20x_info = {
59 const struct axp20x_time *p_time; 74 .startup_time = startup_time,
60 unsigned int mask; 75 .startup_mask = AXP20X_PEK_STARTUP_MASK,
76 .shutdown_time = shutdown_time,
77 .shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
61}; 78};
62 79
63static struct axp20x_pek_ext_attr axp20x_pek_startup_ext_attr = { 80static const struct axp20x_info axp221_info = {
64 .p_time = startup_time, 81 .startup_time = axp221_startup_time,
65 .mask = AXP20X_PEK_STARTUP_MASK, 82 .startup_mask = AXP20X_PEK_STARTUP_MASK,
83 .shutdown_time = shutdown_time,
84 .shutdown_mask = AXP20X_PEK_SHUTDOWN_MASK,
66}; 85};
67 86
68static struct axp20x_pek_ext_attr axp20x_pek_shutdown_ext_attr = { 87static ssize_t axp20x_show_attr(struct device *dev,
69 .p_time = shutdown_time, 88 const struct axp20x_time *time,
70 .mask = AXP20X_PEK_SHUTDOWN_MASK, 89 unsigned int mask, char *buf)
71};
72
73static struct axp20x_pek_ext_attr *get_axp_ext_attr(struct device_attribute *attr)
74{
75 return container_of(attr, struct dev_ext_attribute, attr)->var;
76}
77
78static ssize_t axp20x_show_ext_attr(struct device *dev,
79 struct device_attribute *attr, char *buf)
80{ 90{
81 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); 91 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
82 struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
83 unsigned int val; 92 unsigned int val;
84 int ret, i; 93 int ret, i;
85 94
@@ -87,22 +96,42 @@ static ssize_t axp20x_show_ext_attr(struct device *dev,
87 if (ret != 0) 96 if (ret != 0)
88 return ret; 97 return ret;
89 98
90 val &= axp20x_ea->mask; 99 val &= mask;
91 val >>= ffs(axp20x_ea->mask) - 1; 100 val >>= ffs(mask) - 1;
92 101
93 for (i = 0; i < 4; i++) 102 for (i = 0; i < 4; i++)
94 if (val == axp20x_ea->p_time[i].idx) 103 if (val == time[i].idx)
95 val = axp20x_ea->p_time[i].time; 104 val = time[i].time;
96 105
97 return sprintf(buf, "%u\n", val); 106 return sprintf(buf, "%u\n", val);
98} 107}
99 108
100static ssize_t axp20x_store_ext_attr(struct device *dev, 109static ssize_t axp20x_show_attr_startup(struct device *dev,
101 struct device_attribute *attr, 110 struct device_attribute *attr,
102 const char *buf, size_t count) 111 char *buf)
112{
113 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
114
115 return axp20x_show_attr(dev, axp20x_pek->info->startup_time,
116 axp20x_pek->info->startup_mask, buf);
117}
118
119static ssize_t axp20x_show_attr_shutdown(struct device *dev,
120 struct device_attribute *attr,
121 char *buf)
122{
123 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
124
125 return axp20x_show_attr(dev, axp20x_pek->info->shutdown_time,
126 axp20x_pek->info->shutdown_mask, buf);
127}
128
129static ssize_t axp20x_store_attr(struct device *dev,
130 const struct axp20x_time *time,
131 unsigned int mask, const char *buf,
132 size_t count)
103{ 133{
104 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev); 134 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
105 struct axp20x_pek_ext_attr *axp20x_ea = get_axp_ext_attr(attr);
106 char val_str[20]; 135 char val_str[20];
107 size_t len; 136 size_t len;
108 int ret, i; 137 int ret, i;
@@ -123,39 +152,52 @@ static ssize_t axp20x_store_ext_attr(struct device *dev,
123 for (i = 3; i >= 0; i--) { 152 for (i = 3; i >= 0; i--) {
124 unsigned int err; 153 unsigned int err;
125 154
126 err = abs(axp20x_ea->p_time[i].time - val); 155 err = abs(time[i].time - val);
127 if (err < best_err) { 156 if (err < best_err) {
128 best_err = err; 157 best_err = err;
129 idx = axp20x_ea->p_time[i].idx; 158 idx = time[i].idx;
130 } 159 }
131 160
132 if (!err) 161 if (!err)
133 break; 162 break;
134 } 163 }
135 164
136 idx <<= ffs(axp20x_ea->mask) - 1; 165 idx <<= ffs(mask) - 1;
137 ret = regmap_update_bits(axp20x_pek->axp20x->regmap, 166 ret = regmap_update_bits(axp20x_pek->axp20x->regmap, AXP20X_PEK_KEY,
138 AXP20X_PEK_KEY, 167 mask, idx);
139 axp20x_ea->mask, idx);
140 if (ret != 0) 168 if (ret != 0)
141 return -EINVAL; 169 return -EINVAL;
142 170
143 return count; 171 return count;
144} 172}
145 173
146static struct dev_ext_attribute axp20x_dev_attr_startup = { 174static ssize_t axp20x_store_attr_startup(struct device *dev,
147 .attr = __ATTR(startup, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr), 175 struct device_attribute *attr,
148 .var = &axp20x_pek_startup_ext_attr, 176 const char *buf, size_t count)
149}; 177{
178 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
150 179
151static struct dev_ext_attribute axp20x_dev_attr_shutdown = { 180 return axp20x_store_attr(dev, axp20x_pek->info->startup_time,
152 .attr = __ATTR(shutdown, 0644, axp20x_show_ext_attr, axp20x_store_ext_attr), 181 axp20x_pek->info->startup_mask, buf, count);
153 .var = &axp20x_pek_shutdown_ext_attr, 182}
154}; 183
184static ssize_t axp20x_store_attr_shutdown(struct device *dev,
185 struct device_attribute *attr,
186 const char *buf, size_t count)
187{
188 struct axp20x_pek *axp20x_pek = dev_get_drvdata(dev);
189
190 return axp20x_store_attr(dev, axp20x_pek->info->shutdown_time,
191 axp20x_pek->info->shutdown_mask, buf, count);
192}
193
194DEVICE_ATTR(startup, 0644, axp20x_show_attr_startup, axp20x_store_attr_startup);
195DEVICE_ATTR(shutdown, 0644, axp20x_show_attr_shutdown,
196 axp20x_store_attr_shutdown);
155 197
156static struct attribute *axp20x_attributes[] = { 198static struct attribute *axp20x_attributes[] = {
157 &axp20x_dev_attr_startup.attr.attr, 199 &dev_attr_startup.attr,
158 &axp20x_dev_attr_shutdown.attr.attr, 200 &dev_attr_shutdown.attr,
159 NULL, 201 NULL,
160}; 202};
161 203
@@ -291,8 +333,14 @@ static bool axp20x_pek_should_register_input(struct axp20x_pek *axp20x_pek,
291static int axp20x_pek_probe(struct platform_device *pdev) 333static int axp20x_pek_probe(struct platform_device *pdev)
292{ 334{
293 struct axp20x_pek *axp20x_pek; 335 struct axp20x_pek *axp20x_pek;
336 const struct platform_device_id *match = platform_get_device_id(pdev);
294 int error; 337 int error;
295 338
339 if (!match) {
340 dev_err(&pdev->dev, "Failed to get platform_device_id\n");
341 return -EINVAL;
342 }
343
296 axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek), 344 axp20x_pek = devm_kzalloc(&pdev->dev, sizeof(struct axp20x_pek),
297 GFP_KERNEL); 345 GFP_KERNEL);
298 if (!axp20x_pek) 346 if (!axp20x_pek)
@@ -306,6 +354,8 @@ static int axp20x_pek_probe(struct platform_device *pdev)
306 return error; 354 return error;
307 } 355 }
308 356
357 axp20x_pek->info = (struct axp20x_info *)match->driver_data;
358
309 error = devm_device_add_group(&pdev->dev, &axp20x_attribute_group); 359 error = devm_device_add_group(&pdev->dev, &axp20x_attribute_group);
310 if (error) { 360 if (error) {
311 dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n", 361 dev_err(&pdev->dev, "Failed to create sysfs attributes: %d\n",
@@ -342,8 +392,21 @@ static const struct dev_pm_ops axp20x_pek_pm_ops = {
342#endif 392#endif
343}; 393};
344 394
395static const struct platform_device_id axp_pek_id_match[] = {
396 {
397 .name = "axp20x-pek",
398 .driver_data = (kernel_ulong_t)&axp20x_info,
399 },
400 {
401 .name = "axp221-pek",
402 .driver_data = (kernel_ulong_t)&axp221_info,
403 },
404 { /* sentinel */ }
405};
406
345static struct platform_driver axp20x_pek_driver = { 407static struct platform_driver axp20x_pek_driver = {
346 .probe = axp20x_pek_probe, 408 .probe = axp20x_pek_probe,
409 .id_table = axp_pek_id_match,
347 .driver = { 410 .driver = {
348 .name = "axp20x-pek", 411 .name = "axp20x-pek",
349 .pm = &axp20x_pek_pm_ops, 412 .pm = &axp20x_pek_pm_ops,
diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
index f4e8fbec6a94..6bf82ea8c918 100644
--- a/drivers/input/misc/ims-pcu.c
+++ b/drivers/input/misc/ims-pcu.c
@@ -1261,7 +1261,7 @@ static umode_t ims_pcu_is_attr_visible(struct kobject *kobj,
1261 return mode; 1261 return mode;
1262} 1262}
1263 1263
1264static struct attribute_group ims_pcu_attr_group = { 1264static const struct attribute_group ims_pcu_attr_group = {
1265 .is_visible = ims_pcu_is_attr_visible, 1265 .is_visible = ims_pcu_is_attr_visible,
1266 .attrs = ims_pcu_attrs, 1266 .attrs = ims_pcu_attrs,
1267}; 1267};
@@ -1480,7 +1480,7 @@ static struct attribute *ims_pcu_ofn_attrs[] = {
1480 NULL 1480 NULL
1481}; 1481};
1482 1482
1483static struct attribute_group ims_pcu_ofn_attr_group = { 1483static const struct attribute_group ims_pcu_ofn_attr_group = {
1484 .name = "ofn", 1484 .name = "ofn",
1485 .attrs = ims_pcu_ofn_attrs, 1485 .attrs = ims_pcu_ofn_attrs,
1486}; 1486};
diff --git a/drivers/input/misc/keyspan_remote.c b/drivers/input/misc/keyspan_remote.c
index a3fe4a990cc9..77c47d6325fe 100644
--- a/drivers/input/misc/keyspan_remote.c
+++ b/drivers/input/misc/keyspan_remote.c
@@ -85,7 +85,7 @@ static const unsigned short keyspan_key_table[] = {
85}; 85};
86 86
87/* table of devices that work with this driver */ 87/* table of devices that work with this driver */
88static struct usb_device_id keyspan_table[] = { 88static const struct usb_device_id keyspan_table[] = {
89 { USB_DEVICE(USB_KEYSPAN_VENDOR_ID, USB_KEYSPAN_PRODUCT_UIA11) }, 89 { USB_DEVICE(USB_KEYSPAN_VENDOR_ID, USB_KEYSPAN_PRODUCT_UIA11) },
90 { } /* Terminating entry */ 90 { } /* Terminating entry */
91}; 91};
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index 72b1fc3ab910..56ddba21de84 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -18,25 +18,30 @@
18#include <linux/input.h> 18#include <linux/input.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/timex.h> 20#include <linux/timex.h>
21#include <asm/io.h> 21#include <linux/io.h>
22 22
23MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>"); 23MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
24MODULE_DESCRIPTION("PC Speaker beeper driver"); 24MODULE_DESCRIPTION("PC Speaker beeper driver");
25MODULE_LICENSE("GPL"); 25MODULE_LICENSE("GPL");
26MODULE_ALIAS("platform:pcspkr"); 26MODULE_ALIAS("platform:pcspkr");
27 27
28static int pcspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) 28static int pcspkr_event(struct input_dev *dev, unsigned int type,
29 unsigned int code, int value)
29{ 30{
30 unsigned int count = 0; 31 unsigned int count = 0;
31 unsigned long flags; 32 unsigned long flags;
32 33
33 if (type != EV_SND) 34 if (type != EV_SND)
34 return -1; 35 return -EINVAL;
35 36
36 switch (code) { 37 switch (code) {
37 case SND_BELL: if (value) value = 1000; 38 case SND_BELL:
38 case SND_TONE: break; 39 if (value)
39 default: return -1; 40 value = 1000;
41 case SND_TONE:
42 break;
43 default:
44 return -EINVAL;
40 } 45 }
41 46
42 if (value > 20 && value < 32767) 47 if (value > 20 && value < 32767)
diff --git a/drivers/input/misc/powermate.c b/drivers/input/misc/powermate.c
index 84909a12ff36..5c8c79623c87 100644
--- a/drivers/input/misc/powermate.c
+++ b/drivers/input/misc/powermate.c
@@ -432,7 +432,7 @@ static void powermate_disconnect(struct usb_interface *intf)
432 } 432 }
433} 433}
434 434
435static struct usb_device_id powermate_devices [] = { 435static const struct usb_device_id powermate_devices[] = {
436 { USB_DEVICE(POWERMATE_VENDOR, POWERMATE_PRODUCT_NEW) }, 436 { USB_DEVICE(POWERMATE_VENDOR, POWERMATE_PRODUCT_NEW) },
437 { USB_DEVICE(POWERMATE_VENDOR, POWERMATE_PRODUCT_OLD) }, 437 { USB_DEVICE(POWERMATE_VENDOR, POWERMATE_PRODUCT_OLD) },
438 { USB_DEVICE(CONTOUR_VENDOR, CONTOUR_JOG) }, 438 { USB_DEVICE(CONTOUR_VENDOR, CONTOUR_JOG) },
diff --git a/drivers/input/misc/rk805-pwrkey.c b/drivers/input/misc/rk805-pwrkey.c
new file mode 100644
index 000000000000..921003963a53
--- /dev/null
+++ b/drivers/input/misc/rk805-pwrkey.c
@@ -0,0 +1,111 @@
1/*
2 * Rockchip RK805 PMIC Power Key driver
3 *
4 * Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
5 *
6 * Author: Joseph Chen <chenjh@rock-chips.com>
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
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/errno.h>
15#include <linux/init.h>
16#include <linux/input.h>
17#include <linux/interrupt.h>
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/platform_device.h>
21
22static irqreturn_t pwrkey_fall_irq(int irq, void *_pwr)
23{
24 struct input_dev *pwr = _pwr;
25
26 input_report_key(pwr, KEY_POWER, 1);
27 input_sync(pwr);
28
29 return IRQ_HANDLED;
30}
31
32static irqreturn_t pwrkey_rise_irq(int irq, void *_pwr)
33{
34 struct input_dev *pwr = _pwr;
35
36 input_report_key(pwr, KEY_POWER, 0);
37 input_sync(pwr);
38
39 return IRQ_HANDLED;
40}
41
42static int rk805_pwrkey_probe(struct platform_device *pdev)
43{
44 struct input_dev *pwr;
45 int fall_irq, rise_irq;
46 int err;
47
48 pwr = devm_input_allocate_device(&pdev->dev);
49 if (!pwr) {
50 dev_err(&pdev->dev, "Can't allocate power button\n");
51 return -ENOMEM;
52 }
53
54 pwr->name = "rk805 pwrkey";
55 pwr->phys = "rk805_pwrkey/input0";
56 pwr->id.bustype = BUS_HOST;
57 input_set_capability(pwr, EV_KEY, KEY_POWER);
58
59 fall_irq = platform_get_irq(pdev, 0);
60 if (fall_irq < 0) {
61 dev_err(&pdev->dev, "Can't get fall irq: %d\n", fall_irq);
62 return fall_irq;
63 }
64
65 rise_irq = platform_get_irq(pdev, 1);
66 if (rise_irq < 0) {
67 dev_err(&pdev->dev, "Can't get rise irq: %d\n", rise_irq);
68 return rise_irq;
69 }
70
71 err = devm_request_any_context_irq(&pwr->dev, fall_irq,
72 pwrkey_fall_irq,
73 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
74 "rk805_pwrkey_fall", pwr);
75 if (err < 0) {
76 dev_err(&pdev->dev, "Can't register fall irq: %d\n", err);
77 return err;
78 }
79
80 err = devm_request_any_context_irq(&pwr->dev, rise_irq,
81 pwrkey_rise_irq,
82 IRQF_TRIGGER_RISING | IRQF_ONESHOT,
83 "rk805_pwrkey_rise", pwr);
84 if (err < 0) {
85 dev_err(&pdev->dev, "Can't register rise irq: %d\n", err);
86 return err;
87 }
88
89 err = input_register_device(pwr);
90 if (err) {
91 dev_err(&pdev->dev, "Can't register power button: %d\n", err);
92 return err;
93 }
94
95 platform_set_drvdata(pdev, pwr);
96 device_init_wakeup(&pdev->dev, true);
97
98 return 0;
99}
100
101static struct platform_driver rk805_pwrkey_driver = {
102 .probe = rk805_pwrkey_probe,
103 .driver = {
104 .name = "rk805-pwrkey",
105 },
106};
107module_platform_driver(rk805_pwrkey_driver);
108
109MODULE_AUTHOR("Joseph Chen <chenjh@rock-chips.com>");
110MODULE_DESCRIPTION("RK805 PMIC Power Key driver");
111MODULE_LICENSE("GPL");
diff --git a/drivers/input/misc/xen-kbdfront.c b/drivers/input/misc/xen-kbdfront.c
index fa130e7b734c..6bf56bb5f8d9 100644
--- a/drivers/input/misc/xen-kbdfront.c
+++ b/drivers/input/misc/xen-kbdfront.c
@@ -84,17 +84,20 @@ static void xenkbd_handle_key_event(struct xenkbd_info *info,
84 struct xenkbd_key *key) 84 struct xenkbd_key *key)
85{ 85{
86 struct input_dev *dev; 86 struct input_dev *dev;
87 int value = key->pressed;
87 88
88 if (test_bit(key->keycode, info->ptr->keybit)) { 89 if (test_bit(key->keycode, info->ptr->keybit)) {
89 dev = info->ptr; 90 dev = info->ptr;
90 } else if (test_bit(key->keycode, info->kbd->keybit)) { 91 } else if (test_bit(key->keycode, info->kbd->keybit)) {
91 dev = info->kbd; 92 dev = info->kbd;
93 if (key->pressed && test_bit(key->keycode, info->kbd->key))
94 value = 2; /* Mark as autorepeat */
92 } else { 95 } else {
93 pr_warn("unhandled keycode 0x%x\n", key->keycode); 96 pr_warn("unhandled keycode 0x%x\n", key->keycode);
94 return; 97 return;
95 } 98 }
96 99
97 input_report_key(dev, key->keycode, key->pressed); 100 input_event(dev, EV_KEY, key->keycode, value);
98 input_sync(dev); 101 input_sync(dev);
99} 102}
100 103
diff --git a/drivers/input/misc/yealink.c b/drivers/input/misc/yealink.c
index 6e7ff9561d92..a1e0ff59d2f2 100644
--- a/drivers/input/misc/yealink.c
+++ b/drivers/input/misc/yealink.c
@@ -798,7 +798,7 @@ static struct attribute *yld_attributes[] = {
798 NULL 798 NULL
799}; 799};
800 800
801static struct attribute_group yld_attr_group = { 801static const struct attribute_group yld_attr_group = {
802 .attrs = yld_attributes 802 .attrs = yld_attributes
803}; 803};
804 804
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index ef234c9b2f2f..81a695d0b4e0 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -125,7 +125,7 @@ static const struct atp_info geyser4_info = {
125 * According to Info.plist Geyser IV is the same as Geyser III.) 125 * According to Info.plist Geyser IV is the same as Geyser III.)
126 */ 126 */
127 127
128static struct usb_device_id atp_table[] = { 128static const struct usb_device_id atp_table[] = {
129 /* PowerBooks Feb 2005, iBooks G4 */ 129 /* PowerBooks Feb 2005, iBooks G4 */
130 ATP_DEVICE(0x020e, fountain_info), /* FOUNTAIN ANSI */ 130 ATP_DEVICE(0x020e, fountain_info), /* FOUNTAIN ANSI */
131 ATP_DEVICE(0x020f, fountain_info), /* FOUNTAIN ISO */ 131 ATP_DEVICE(0x020f, fountain_info), /* FOUNTAIN ISO */
diff --git a/drivers/input/mouse/byd.c b/drivers/input/mouse/byd.c
index b27aa637f877..b64b81599f7e 100644
--- a/drivers/input/mouse/byd.c
+++ b/drivers/input/mouse/byd.c
@@ -344,7 +344,7 @@ static int byd_reset_touchpad(struct psmouse *psmouse)
344 u8 param[4]; 344 u8 param[4];
345 size_t i; 345 size_t i;
346 346
347 const struct { 347 static const struct {
348 u16 command; 348 u16 command;
349 u8 arg; 349 u8 arg;
350 } seq[] = { 350 } seq[] = {
diff --git a/drivers/input/mouse/elan_i2c.h b/drivers/input/mouse/elan_i2c.h
index 61c202436250..599544c1a91c 100644
--- a/drivers/input/mouse/elan_i2c.h
+++ b/drivers/input/mouse/elan_i2c.h
@@ -58,7 +58,7 @@ struct elan_transport_ops {
58 58
59 int (*get_version)(struct i2c_client *client, bool iap, u8 *version); 59 int (*get_version)(struct i2c_client *client, bool iap, u8 *version);
60 int (*get_sm_version)(struct i2c_client *client, 60 int (*get_sm_version)(struct i2c_client *client,
61 u16 *ic_type, u8 *version); 61 u16 *ic_type, u8 *version, u8 *clickpad);
62 int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum); 62 int (*get_checksum)(struct i2c_client *client, bool iap, u16 *csum);
63 int (*get_product_id)(struct i2c_client *client, u16 *id); 63 int (*get_product_id)(struct i2c_client *client, u16 *id);
64 64
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index cfbc8ba4c96c..0e761d079dc4 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -95,6 +95,7 @@ struct elan_tp_data {
95 u8 min_baseline; 95 u8 min_baseline;
96 u8 max_baseline; 96 u8 max_baseline;
97 bool baseline_ready; 97 bool baseline_ready;
98 u8 clickpad;
98}; 99};
99 100
100static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count, 101static int elan_get_fwinfo(u16 ic_type, u16 *validpage_count,
@@ -213,7 +214,7 @@ static int elan_query_product(struct elan_tp_data *data)
213 return error; 214 return error;
214 215
215 error = data->ops->get_sm_version(data->client, &data->ic_type, 216 error = data->ops->get_sm_version(data->client, &data->ic_type,
216 &data->sm_version); 217 &data->sm_version, &data->clickpad);
217 if (error) 218 if (error)
218 return error; 219 return error;
219 220
@@ -923,6 +924,7 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
923 } 924 }
924 925
925 input_report_key(input, BTN_LEFT, tp_info & 0x01); 926 input_report_key(input, BTN_LEFT, tp_info & 0x01);
927 input_report_key(input, BTN_RIGHT, tp_info & 0x02);
926 input_report_abs(input, ABS_DISTANCE, hover_event != 0); 928 input_report_abs(input, ABS_DISTANCE, hover_event != 0);
927 input_mt_report_pointer_emulation(input, true); 929 input_mt_report_pointer_emulation(input, true);
928 input_sync(input); 930 input_sync(input);
@@ -991,7 +993,10 @@ static int elan_setup_input_device(struct elan_tp_data *data)
991 993
992 __set_bit(EV_ABS, input->evbit); 994 __set_bit(EV_ABS, input->evbit);
993 __set_bit(INPUT_PROP_POINTER, input->propbit); 995 __set_bit(INPUT_PROP_POINTER, input->propbit);
994 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); 996 if (data->clickpad)
997 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
998 else
999 __set_bit(BTN_RIGHT, input->keybit);
995 __set_bit(BTN_LEFT, input->keybit); 1000 __set_bit(BTN_LEFT, input->keybit);
996 1001
997 /* Set up ST parameters */ 1002 /* Set up ST parameters */
diff --git a/drivers/input/mouse/elan_i2c_i2c.c b/drivers/input/mouse/elan_i2c_i2c.c
index 80172f25974d..15b1330606c1 100644
--- a/drivers/input/mouse/elan_i2c_i2c.c
+++ b/drivers/input/mouse/elan_i2c_i2c.c
@@ -288,7 +288,8 @@ static int elan_i2c_get_version(struct i2c_client *client,
288} 288}
289 289
290static int elan_i2c_get_sm_version(struct i2c_client *client, 290static int elan_i2c_get_sm_version(struct i2c_client *client,
291 u16 *ic_type, u8 *version) 291 u16 *ic_type, u8 *version,
292 u8 *clickpad)
292{ 293{
293 int error; 294 int error;
294 u8 pattern_ver; 295 u8 pattern_ver;
@@ -317,6 +318,7 @@ static int elan_i2c_get_sm_version(struct i2c_client *client,
317 return error; 318 return error;
318 } 319 }
319 *version = val[1]; 320 *version = val[1];
321 *clickpad = val[0] & 0x10;
320 } else { 322 } else {
321 error = elan_i2c_read_cmd(client, ETP_I2C_OSM_VERSION_CMD, val); 323 error = elan_i2c_read_cmd(client, ETP_I2C_OSM_VERSION_CMD, val);
322 if (error) { 324 if (error) {
@@ -326,6 +328,15 @@ static int elan_i2c_get_sm_version(struct i2c_client *client,
326 } 328 }
327 *version = val[0]; 329 *version = val[0];
328 *ic_type = val[1]; 330 *ic_type = val[1];
331
332 error = elan_i2c_read_cmd(client, ETP_I2C_NSM_VERSION_CMD,
333 val);
334 if (error) {
335 dev_err(&client->dev, "failed to get SM version: %d\n",
336 error);
337 return error;
338 }
339 *clickpad = val[0] & 0x10;
329 } 340 }
330 341
331 return 0; 342 return 0;
diff --git a/drivers/input/mouse/elan_i2c_smbus.c b/drivers/input/mouse/elan_i2c_smbus.c
index df7a57ca7331..29f99529b187 100644
--- a/drivers/input/mouse/elan_i2c_smbus.c
+++ b/drivers/input/mouse/elan_i2c_smbus.c
@@ -166,7 +166,8 @@ static int elan_smbus_get_version(struct i2c_client *client,
166} 166}
167 167
168static int elan_smbus_get_sm_version(struct i2c_client *client, 168static int elan_smbus_get_sm_version(struct i2c_client *client,
169 u16 *ic_type, u8 *version) 169 u16 *ic_type, u8 *version,
170 u8 *clickpad)
170{ 171{
171 int error; 172 int error;
172 u8 val[3]; 173 u8 val[3];
@@ -180,6 +181,7 @@ static int elan_smbus_get_sm_version(struct i2c_client *client,
180 181
181 *version = val[0]; 182 *version = val[0];
182 *ic_type = val[1]; 183 *ic_type = val[1];
184 *clickpad = val[0] & 0x10;
183 return 0; 185 return 0;
184} 186}
185 187
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
index 791993215ea3..6428d6f4d568 100644
--- a/drivers/input/mouse/elantech.c
+++ b/drivers/input/mouse/elantech.c
@@ -1377,7 +1377,7 @@ static struct attribute *elantech_attrs[] = {
1377 NULL 1377 NULL
1378}; 1378};
1379 1379
1380static struct attribute_group elantech_attr_group = { 1380static const struct attribute_group elantech_attr_group = {
1381 .attrs = elantech_attrs, 1381 .attrs = elantech_attrs,
1382}; 1382};
1383 1383
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index f73b47b8c578..6a5649e52eed 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -101,7 +101,7 @@ static struct attribute *psmouse_attributes[] = {
101 NULL 101 NULL
102}; 102};
103 103
104static struct attribute_group psmouse_attribute_group = { 104static const struct attribute_group psmouse_attribute_group = {
105 .attrs = psmouse_attributes, 105 .attrs = psmouse_attributes,
106}; 106};
107 107
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c
index 6bcc0189c1c9..cb7d15d826d0 100644
--- a/drivers/input/mouse/synaptics_usb.c
+++ b/drivers/input/mouse/synaptics_usb.c
@@ -525,7 +525,7 @@ static int synusb_reset_resume(struct usb_interface *intf)
525 return synusb_resume(intf); 525 return synusb_resume(intf);
526} 526}
527 527
528static struct usb_device_id synusb_idtable[] = { 528static const struct usb_device_id synusb_idtable[] = {
529 { USB_DEVICE_SYNAPTICS(TP, SYNUSB_TOUCHPAD) }, 529 { USB_DEVICE_SYNAPTICS(TP, SYNUSB_TOUCHPAD) },
530 { USB_DEVICE_SYNAPTICS(INT_TP, SYNUSB_TOUCHPAD) }, 530 { USB_DEVICE_SYNAPTICS(INT_TP, SYNUSB_TOUCHPAD) },
531 { USB_DEVICE_SYNAPTICS(CPAD, 531 { USB_DEVICE_SYNAPTICS(CPAD,
diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c
index 0e0ff84088fd..2d7f691ec71c 100644
--- a/drivers/input/mousedev.c
+++ b/drivers/input/mousedev.c
@@ -15,6 +15,7 @@
15#define MOUSEDEV_MINORS 31 15#define MOUSEDEV_MINORS 31
16#define MOUSEDEV_MIX 63 16#define MOUSEDEV_MIX 63
17 17
18#include <linux/bitops.h>
18#include <linux/sched.h> 19#include <linux/sched.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
20#include <linux/poll.h> 21#include <linux/poll.h>
@@ -103,7 +104,7 @@ struct mousedev_client {
103 spinlock_t packet_lock; 104 spinlock_t packet_lock;
104 int pos_x, pos_y; 105 int pos_x, pos_y;
105 106
106 signed char ps2[6]; 107 u8 ps2[6];
107 unsigned char ready, buffer, bufsiz; 108 unsigned char ready, buffer, bufsiz;
108 unsigned char imexseq, impsseq; 109 unsigned char imexseq, impsseq;
109 enum mousedev_emul mode; 110 enum mousedev_emul mode;
@@ -291,11 +292,10 @@ static void mousedev_notify_readers(struct mousedev *mousedev,
291 } 292 }
292 293
293 client->pos_x += packet->dx; 294 client->pos_x += packet->dx;
294 client->pos_x = client->pos_x < 0 ? 295 client->pos_x = clamp_val(client->pos_x, 0, xres);
295 0 : (client->pos_x >= xres ? xres : client->pos_x); 296
296 client->pos_y += packet->dy; 297 client->pos_y += packet->dy;
297 client->pos_y = client->pos_y < 0 ? 298 client->pos_y = clamp_val(client->pos_y, 0, yres);
298 0 : (client->pos_y >= yres ? yres : client->pos_y);
299 299
300 p->dx += packet->dx; 300 p->dx += packet->dx;
301 p->dy += packet->dy; 301 p->dy += packet->dy;
@@ -571,44 +571,50 @@ static int mousedev_open(struct inode *inode, struct file *file)
571 return error; 571 return error;
572} 572}
573 573
574static inline int mousedev_limit_delta(int delta, int limit) 574static void mousedev_packet(struct mousedev_client *client, u8 *ps2_data)
575{
576 return delta > limit ? limit : (delta < -limit ? -limit : delta);
577}
578
579static void mousedev_packet(struct mousedev_client *client,
580 signed char *ps2_data)
581{ 575{
582 struct mousedev_motion *p = &client->packets[client->tail]; 576 struct mousedev_motion *p = &client->packets[client->tail];
577 s8 dx, dy, dz;
578
579 dx = clamp_val(p->dx, -127, 127);
580 p->dx -= dx;
581
582 dy = clamp_val(p->dy, -127, 127);
583 p->dy -= dy;
583 584
584 ps2_data[0] = 0x08 | 585 ps2_data[0] = BIT(3);
585 ((p->dx < 0) << 4) | ((p->dy < 0) << 5) | (p->buttons & 0x07); 586 ps2_data[0] |= ((dx & BIT(7)) >> 3) | ((dy & BIT(7)) >> 2);
586 ps2_data[1] = mousedev_limit_delta(p->dx, 127); 587 ps2_data[0] |= p->buttons & 0x07;
587 ps2_data[2] = mousedev_limit_delta(p->dy, 127); 588 ps2_data[1] = dx;
588 p->dx -= ps2_data[1]; 589 ps2_data[2] = dy;
589 p->dy -= ps2_data[2];
590 590
591 switch (client->mode) { 591 switch (client->mode) {
592 case MOUSEDEV_EMUL_EXPS: 592 case MOUSEDEV_EMUL_EXPS:
593 ps2_data[3] = mousedev_limit_delta(p->dz, 7); 593 dz = clamp_val(p->dz, -7, 7);
594 p->dz -= ps2_data[3]; 594 p->dz -= dz;
595 ps2_data[3] = (ps2_data[3] & 0x0f) | ((p->buttons & 0x18) << 1); 595
596 ps2_data[3] = (dz & 0x0f) | ((p->buttons & 0x18) << 1);
596 client->bufsiz = 4; 597 client->bufsiz = 4;
597 break; 598 break;
598 599
599 case MOUSEDEV_EMUL_IMPS: 600 case MOUSEDEV_EMUL_IMPS:
600 ps2_data[0] |= 601 dz = clamp_val(p->dz, -127, 127);
601 ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1); 602 p->dz -= dz;
602 ps2_data[3] = mousedev_limit_delta(p->dz, 127); 603
603 p->dz -= ps2_data[3]; 604 ps2_data[0] |= ((p->buttons & 0x10) >> 3) |
605 ((p->buttons & 0x08) >> 1);
606 ps2_data[3] = dz;
607
604 client->bufsiz = 4; 608 client->bufsiz = 4;
605 break; 609 break;
606 610
607 case MOUSEDEV_EMUL_PS2: 611 case MOUSEDEV_EMUL_PS2:
608 default: 612 default:
609 ps2_data[0] |=
610 ((p->buttons & 0x10) >> 3) | ((p->buttons & 0x08) >> 1);
611 p->dz = 0; 613 p->dz = 0;
614
615 ps2_data[0] |= ((p->buttons & 0x10) >> 3) |
616 ((p->buttons & 0x08) >> 1);
617
612 client->bufsiz = 3; 618 client->bufsiz = 3;
613 break; 619 break;
614 } 620 }
@@ -714,7 +720,7 @@ static ssize_t mousedev_read(struct file *file, char __user *buffer,
714{ 720{
715 struct mousedev_client *client = file->private_data; 721 struct mousedev_client *client = file->private_data;
716 struct mousedev *mousedev = client->mousedev; 722 struct mousedev *mousedev = client->mousedev;
717 signed char data[sizeof(client->ps2)]; 723 u8 data[sizeof(client->ps2)];
718 int retval = 0; 724 int retval = 0;
719 725
720 if (!client->ready && !client->buffer && mousedev->exist && 726 if (!client->ready && !client->buffer && mousedev->exist &&
diff --git a/drivers/input/rmi4/rmi_f01.c b/drivers/input/rmi4/rmi_f01.c
index 6dca3c0fbb4a..ae966e333a2f 100644
--- a/drivers/input/rmi4/rmi_f01.c
+++ b/drivers/input/rmi4/rmi_f01.c
@@ -334,7 +334,7 @@ static struct attribute *rmi_f01_attrs[] = {
334 NULL 334 NULL
335}; 335};
336 336
337static struct attribute_group rmi_f01_attr_group = { 337static const struct attribute_group rmi_f01_attr_group = {
338 .attrs = rmi_f01_attrs, 338 .attrs = rmi_f01_attrs,
339}; 339};
340 340
diff --git a/drivers/input/rmi4/rmi_f34.c b/drivers/input/rmi4/rmi_f34.c
index b8ee78e0d61f..4cfe9703a8e7 100644
--- a/drivers/input/rmi4/rmi_f34.c
+++ b/drivers/input/rmi4/rmi_f34.c
@@ -516,7 +516,7 @@ static struct attribute *rmi_firmware_attrs[] = {
516 NULL 516 NULL
517}; 517};
518 518
519static struct attribute_group rmi_firmware_attr_group = { 519static const struct attribute_group rmi_firmware_attr_group = {
520 .attrs = rmi_firmware_attrs, 520 .attrs = rmi_firmware_attrs,
521}; 521};
522 522
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index c3d05b4d3118..21488c048fa3 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -292,6 +292,17 @@ config SERIO_SUN4I_PS2
292 To compile this driver as a module, choose M here: the 292 To compile this driver as a module, choose M here: the
293 module will be called sun4i-ps2. 293 module will be called sun4i-ps2.
294 294
295config SERIO_GPIO_PS2
296 tristate "GPIO PS/2 bit banging driver"
297 depends on GPIOLIB
298 help
299 Say Y here if you want PS/2 bit banging support via GPIO.
300
301 To compile this driver as a module, choose M here: the
302 module will be called ps2-gpio.
303
304 If you are unsure, say N.
305
295config USERIO 306config USERIO
296 tristate "User space serio port driver support" 307 tristate "User space serio port driver support"
297 help 308 help
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile
index 2374ef9b33d7..767bd9b6e1ed 100644
--- a/drivers/input/serio/Makefile
+++ b/drivers/input/serio/Makefile
@@ -30,4 +30,5 @@ obj-$(CONFIG_SERIO_APBPS2) += apbps2.o
30obj-$(CONFIG_SERIO_OLPC_APSP) += olpc_apsp.o 30obj-$(CONFIG_SERIO_OLPC_APSP) += olpc_apsp.o
31obj-$(CONFIG_HYPERV_KEYBOARD) += hyperv-keyboard.o 31obj-$(CONFIG_HYPERV_KEYBOARD) += hyperv-keyboard.o
32obj-$(CONFIG_SERIO_SUN4I_PS2) += sun4i-ps2.o 32obj-$(CONFIG_SERIO_SUN4I_PS2) += sun4i-ps2.o
33obj-$(CONFIG_SERIO_GPIO_PS2) += ps2-gpio.o
33obj-$(CONFIG_USERIO) += userio.o 34obj-$(CONFIG_USERIO) += userio.o
diff --git a/drivers/input/serio/ambakmi.c b/drivers/input/serio/ambakmi.c
index c6606cacb6a7..ff3875cf3da1 100644
--- a/drivers/input/serio/ambakmi.c
+++ b/drivers/input/serio/ambakmi.c
@@ -187,7 +187,7 @@ static int __maybe_unused amba_kmi_resume(struct device *dev)
187 187
188static SIMPLE_DEV_PM_OPS(amba_kmi_dev_pm_ops, NULL, amba_kmi_resume); 188static SIMPLE_DEV_PM_OPS(amba_kmi_dev_pm_ops, NULL, amba_kmi_resume);
189 189
190static struct amba_id amba_kmi_idtable[] = { 190static const struct amba_id amba_kmi_idtable[] = {
191 { 191 {
192 .id = 0x00041050, 192 .id = 0x00041050,
193 .mask = 0x000fffff, 193 .mask = 0x000fffff,
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index f932a83b4990..ae81e57e13b9 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -927,7 +927,7 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *
927 return 0; 927 return 0;
928} 928}
929 929
930static struct pnp_device_id pnp_kbd_devids[] = { 930static const struct pnp_device_id pnp_kbd_devids[] = {
931 { .id = "PNP0300", .driver_data = 0 }, 931 { .id = "PNP0300", .driver_data = 0 },
932 { .id = "PNP0301", .driver_data = 0 }, 932 { .id = "PNP0301", .driver_data = 0 },
933 { .id = "PNP0302", .driver_data = 0 }, 933 { .id = "PNP0302", .driver_data = 0 },
@@ -957,7 +957,7 @@ static struct pnp_driver i8042_pnp_kbd_driver = {
957 }, 957 },
958}; 958};
959 959
960static struct pnp_device_id pnp_aux_devids[] = { 960static const struct pnp_device_id pnp_aux_devids[] = {
961 { .id = "AUI0200", .driver_data = 0 }, 961 { .id = "AUI0200", .driver_data = 0 },
962 { .id = "FJC6000", .driver_data = 0 }, 962 { .id = "FJC6000", .driver_data = 0 },
963 { .id = "FJC6001", .driver_data = 0 }, 963 { .id = "FJC6001", .driver_data = 0 },
diff --git a/drivers/input/serio/ps2-gpio.c b/drivers/input/serio/ps2-gpio.c
new file mode 100644
index 000000000000..b50e3817f3c4
--- /dev/null
+++ b/drivers/input/serio/ps2-gpio.c
@@ -0,0 +1,453 @@
1/*
2 * GPIO based serio bus driver for bit banging the PS/2 protocol
3 *
4 * Author: Danilo Krummrich <danilokrummrich@dk-develop.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/gpio/consumer.h>
12#include <linux/interrupt.h>
13#include <linux/module.h>
14#include <linux/serio.h>
15#include <linux/slab.h>
16#include <linux/platform_device.h>
17#include <linux/workqueue.h>
18#include <linux/completion.h>
19#include <linux/mutex.h>
20#include <linux/preempt.h>
21#include <linux/property.h>
22#include <linux/of.h>
23#include <linux/jiffies.h>
24#include <linux/delay.h>
25
26#define DRIVER_NAME "ps2-gpio"
27
28#define PS2_MODE_RX 0
29#define PS2_MODE_TX 1
30
31#define PS2_START_BIT 0
32#define PS2_DATA_BIT0 1
33#define PS2_DATA_BIT1 2
34#define PS2_DATA_BIT2 3
35#define PS2_DATA_BIT3 4
36#define PS2_DATA_BIT4 5
37#define PS2_DATA_BIT5 6
38#define PS2_DATA_BIT6 7
39#define PS2_DATA_BIT7 8
40#define PS2_PARITY_BIT 9
41#define PS2_STOP_BIT 10
42#define PS2_TX_TIMEOUT 11
43#define PS2_ACK_BIT 12
44
45#define PS2_DEV_RET_ACK 0xfa
46#define PS2_DEV_RET_NACK 0xfe
47
48#define PS2_CMD_RESEND 0xfe
49
50struct ps2_gpio_data {
51 struct device *dev;
52 struct serio *serio;
53 unsigned char mode;
54 struct gpio_desc *gpio_clk;
55 struct gpio_desc *gpio_data;
56 bool write_enable;
57 int irq;
58 unsigned char rx_cnt;
59 unsigned char rx_byte;
60 unsigned char tx_cnt;
61 unsigned char tx_byte;
62 struct completion tx_done;
63 struct mutex tx_mutex;
64 struct delayed_work tx_work;
65};
66
67static int ps2_gpio_open(struct serio *serio)
68{
69 struct ps2_gpio_data *drvdata = serio->port_data;
70
71 enable_irq(drvdata->irq);
72 return 0;
73}
74
75static void ps2_gpio_close(struct serio *serio)
76{
77 struct ps2_gpio_data *drvdata = serio->port_data;
78
79 disable_irq(drvdata->irq);
80}
81
82static int __ps2_gpio_write(struct serio *serio, unsigned char val)
83{
84 struct ps2_gpio_data *drvdata = serio->port_data;
85
86 disable_irq_nosync(drvdata->irq);
87 gpiod_direction_output(drvdata->gpio_clk, 0);
88
89 drvdata->mode = PS2_MODE_TX;
90 drvdata->tx_byte = val;
91
92 schedule_delayed_work(&drvdata->tx_work, usecs_to_jiffies(200));
93
94 return 0;
95}
96
97static int ps2_gpio_write(struct serio *serio, unsigned char val)
98{
99 struct ps2_gpio_data *drvdata = serio->port_data;
100 int ret = 0;
101
102 if (in_task()) {
103 mutex_lock(&drvdata->tx_mutex);
104 __ps2_gpio_write(serio, val);
105 if (!wait_for_completion_timeout(&drvdata->tx_done,
106 msecs_to_jiffies(10000)))
107 ret = SERIO_TIMEOUT;
108 mutex_unlock(&drvdata->tx_mutex);
109 } else {
110 __ps2_gpio_write(serio, val);
111 }
112
113 return ret;
114}
115
116static void ps2_gpio_tx_work_fn(struct work_struct *work)
117{
118 struct delayed_work *dwork = to_delayed_work(work);
119 struct ps2_gpio_data *drvdata = container_of(dwork,
120 struct ps2_gpio_data,
121 tx_work);
122
123 enable_irq(drvdata->irq);
124 gpiod_direction_output(drvdata->gpio_data, 0);
125 gpiod_direction_input(drvdata->gpio_clk);
126}
127
128static irqreturn_t ps2_gpio_irq_rx(struct ps2_gpio_data *drvdata)
129{
130 unsigned char byte, cnt;
131 int data;
132 int rxflags = 0;
133 static unsigned long old_jiffies;
134
135 byte = drvdata->rx_byte;
136 cnt = drvdata->rx_cnt;
137
138 if (old_jiffies == 0)
139 old_jiffies = jiffies;
140
141 if ((jiffies - old_jiffies) > usecs_to_jiffies(100)) {
142 dev_err(drvdata->dev,
143 "RX: timeout, probably we missed an interrupt\n");
144 goto err;
145 }
146 old_jiffies = jiffies;
147
148 data = gpiod_get_value(drvdata->gpio_data);
149 if (unlikely(data < 0)) {
150 dev_err(drvdata->dev, "RX: failed to get data gpio val: %d\n",
151 data);
152 goto err;
153 }
154
155 switch (cnt) {
156 case PS2_START_BIT:
157 /* start bit should be low */
158 if (unlikely(data)) {
159 dev_err(drvdata->dev, "RX: start bit should be low\n");
160 goto err;
161 }
162 break;
163 case PS2_DATA_BIT0:
164 case PS2_DATA_BIT1:
165 case PS2_DATA_BIT2:
166 case PS2_DATA_BIT3:
167 case PS2_DATA_BIT4:
168 case PS2_DATA_BIT5:
169 case PS2_DATA_BIT6:
170 case PS2_DATA_BIT7:
171 /* processing data bits */
172 if (data)
173 byte |= (data << (cnt - 1));
174 break;
175 case PS2_PARITY_BIT:
176 /* check odd parity */
177 if (!((hweight8(byte) & 1) ^ data)) {
178 rxflags |= SERIO_PARITY;
179 dev_warn(drvdata->dev, "RX: parity error\n");
180 if (!drvdata->write_enable)
181 goto err;
182 }
183
184 /* Do not send spurious ACK's and NACK's when write fn is
185 * not provided.
186 */
187 if (!drvdata->write_enable) {
188 if (byte == PS2_DEV_RET_NACK)
189 goto err;
190 else if (byte == PS2_DEV_RET_ACK)
191 break;
192 }
193
194 /* Let's send the data without waiting for the stop bit to be
195 * sent. It may happen that we miss the stop bit. When this
196 * happens we have no way to recover from this, certainly
197 * missing the parity bit would be recognized when processing
198 * the stop bit. When missing both, data is lost.
199 */
200 serio_interrupt(drvdata->serio, byte, rxflags);
201 dev_dbg(drvdata->dev, "RX: sending byte 0x%x\n", byte);
202 break;
203 case PS2_STOP_BIT:
204 /* stop bit should be high */
205 if (unlikely(!data)) {
206 dev_err(drvdata->dev, "RX: stop bit should be high\n");
207 goto err;
208 }
209 cnt = byte = 0;
210 old_jiffies = 0;
211 goto end; /* success */
212 default:
213 dev_err(drvdata->dev, "RX: got out of sync with the device\n");
214 goto err;
215 }
216
217 cnt++;
218 goto end; /* success */
219
220err:
221 cnt = byte = 0;
222 old_jiffies = 0;
223 __ps2_gpio_write(drvdata->serio, PS2_CMD_RESEND);
224end:
225 drvdata->rx_cnt = cnt;
226 drvdata->rx_byte = byte;
227 return IRQ_HANDLED;
228}
229
230static irqreturn_t ps2_gpio_irq_tx(struct ps2_gpio_data *drvdata)
231{
232 unsigned char byte, cnt;
233 int data;
234 static unsigned long old_jiffies;
235
236 cnt = drvdata->tx_cnt;
237 byte = drvdata->tx_byte;
238
239 if (old_jiffies == 0)
240 old_jiffies = jiffies;
241
242 if ((jiffies - old_jiffies) > usecs_to_jiffies(100)) {
243 dev_err(drvdata->dev,
244 "TX: timeout, probably we missed an interrupt\n");
245 goto err;
246 }
247 old_jiffies = jiffies;
248
249 switch (cnt) {
250 case PS2_START_BIT:
251 /* should never happen */
252 dev_err(drvdata->dev,
253 "TX: start bit should have been sent already\n");
254 goto err;
255 case PS2_DATA_BIT0:
256 case PS2_DATA_BIT1:
257 case PS2_DATA_BIT2:
258 case PS2_DATA_BIT3:
259 case PS2_DATA_BIT4:
260 case PS2_DATA_BIT5:
261 case PS2_DATA_BIT6:
262 case PS2_DATA_BIT7:
263 data = byte & BIT(cnt - 1);
264 gpiod_set_value(drvdata->gpio_data, data);
265 break;
266 case PS2_PARITY_BIT:
267 /* do odd parity */
268 data = !(hweight8(byte) & 1);
269 gpiod_set_value(drvdata->gpio_data, data);
270 break;
271 case PS2_STOP_BIT:
272 /* release data line to generate stop bit */
273 gpiod_direction_input(drvdata->gpio_data);
274 break;
275 case PS2_TX_TIMEOUT:
276 /* Devices generate one extra clock pulse before sending the
277 * acknowledgment.
278 */
279 break;
280 case PS2_ACK_BIT:
281 gpiod_direction_input(drvdata->gpio_data);
282 data = gpiod_get_value(drvdata->gpio_data);
283 if (data) {
284 dev_warn(drvdata->dev, "TX: received NACK, retry\n");
285 goto err;
286 }
287
288 drvdata->mode = PS2_MODE_RX;
289 complete(&drvdata->tx_done);
290
291 cnt = 1;
292 old_jiffies = 0;
293 goto end; /* success */
294 default:
295 /* Probably we missed the stop bit. Therefore we release data
296 * line and try again.
297 */
298 gpiod_direction_input(drvdata->gpio_data);
299 dev_err(drvdata->dev, "TX: got out of sync with the device\n");
300 goto err;
301 }
302
303 cnt++;
304 goto end; /* success */
305
306err:
307 cnt = 1;
308 old_jiffies = 0;
309 gpiod_direction_input(drvdata->gpio_data);
310 __ps2_gpio_write(drvdata->serio, drvdata->tx_byte);
311end:
312 drvdata->tx_cnt = cnt;
313 return IRQ_HANDLED;
314}
315
316static irqreturn_t ps2_gpio_irq(int irq, void *dev_id)
317{
318 struct ps2_gpio_data *drvdata = dev_id;
319
320 return drvdata->mode ? ps2_gpio_irq_tx(drvdata) :
321 ps2_gpio_irq_rx(drvdata);
322}
323
324static int ps2_gpio_get_props(struct device *dev,
325 struct ps2_gpio_data *drvdata)
326{
327 drvdata->gpio_data = devm_gpiod_get(dev, "data", GPIOD_IN);
328 if (IS_ERR(drvdata->gpio_data)) {
329 dev_err(dev, "failed to request data gpio: %ld",
330 PTR_ERR(drvdata->gpio_data));
331 return PTR_ERR(drvdata->gpio_data);
332 }
333
334 drvdata->gpio_clk = devm_gpiod_get(dev, "clk", GPIOD_IN);
335 if (IS_ERR(drvdata->gpio_clk)) {
336 dev_err(dev, "failed to request clock gpio: %ld",
337 PTR_ERR(drvdata->gpio_clk));
338 return PTR_ERR(drvdata->gpio_clk);
339 }
340
341 drvdata->write_enable = device_property_read_bool(dev,
342 "write-enable");
343
344 return 0;
345}
346
347static int ps2_gpio_probe(struct platform_device *pdev)
348{
349 struct ps2_gpio_data *drvdata;
350 struct serio *serio;
351 struct device *dev = &pdev->dev;
352 int error;
353
354 drvdata = devm_kzalloc(dev, sizeof(struct ps2_gpio_data), GFP_KERNEL);
355 serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
356 if (!drvdata || !serio) {
357 error = -ENOMEM;
358 goto err_free_serio;
359 }
360
361 error = ps2_gpio_get_props(dev, drvdata);
362 if (error)
363 goto err_free_serio;
364
365 if (gpiod_cansleep(drvdata->gpio_data) ||
366 gpiod_cansleep(drvdata->gpio_clk)) {
367 dev_err(dev, "GPIO data or clk are connected via slow bus\n");
368 error = -EINVAL;
369 }
370
371 drvdata->irq = platform_get_irq(pdev, 0);
372 if (drvdata->irq < 0) {
373 dev_err(dev, "failed to get irq from platform resource: %d\n",
374 drvdata->irq);
375 error = drvdata->irq;
376 goto err_free_serio;
377 }
378
379 error = devm_request_irq(dev, drvdata->irq, ps2_gpio_irq,
380 IRQF_NO_THREAD, DRIVER_NAME, drvdata);
381 if (error) {
382 dev_err(dev, "failed to request irq %d: %d\n",
383 drvdata->irq, error);
384 goto err_free_serio;
385 }
386
387 /* Keep irq disabled until serio->open is called. */
388 disable_irq(drvdata->irq);
389
390 serio->id.type = SERIO_8042;
391 serio->open = ps2_gpio_open;
392 serio->close = ps2_gpio_close;
393 /* Write can be enabled in platform/dt data, but possibly it will not
394 * work because of the tough timings.
395 */
396 serio->write = drvdata->write_enable ? ps2_gpio_write : NULL;
397 serio->port_data = drvdata;
398 serio->dev.parent = dev;
399 strlcpy(serio->name, dev_name(dev), sizeof(serio->name));
400 strlcpy(serio->phys, dev_name(dev), sizeof(serio->phys));
401
402 drvdata->serio = serio;
403 drvdata->dev = dev;
404 drvdata->mode = PS2_MODE_RX;
405
406 /* Tx count always starts at 1, as the start bit is sent implicitly by
407 * host-to-device communication initialization.
408 */
409 drvdata->tx_cnt = 1;
410
411 INIT_DELAYED_WORK(&drvdata->tx_work, ps2_gpio_tx_work_fn);
412 init_completion(&drvdata->tx_done);
413 mutex_init(&drvdata->tx_mutex);
414
415 serio_register_port(serio);
416 platform_set_drvdata(pdev, drvdata);
417
418 return 0; /* success */
419
420err_free_serio:
421 kfree(serio);
422 return error;
423}
424
425static int ps2_gpio_remove(struct platform_device *pdev)
426{
427 struct ps2_gpio_data *drvdata = platform_get_drvdata(pdev);
428
429 serio_unregister_port(drvdata->serio);
430 return 0;
431}
432
433#if defined(CONFIG_OF)
434static const struct of_device_id ps2_gpio_match[] = {
435 { .compatible = "ps2-gpio", },
436 { },
437};
438MODULE_DEVICE_TABLE(of, ps2_gpio_match);
439#endif
440
441static struct platform_driver ps2_gpio_driver = {
442 .probe = ps2_gpio_probe,
443 .remove = ps2_gpio_remove,
444 .driver = {
445 .name = DRIVER_NAME,
446 .of_match_table = of_match_ptr(ps2_gpio_match),
447 },
448};
449module_platform_driver(ps2_gpio_driver);
450
451MODULE_AUTHOR("Danilo Krummrich <danilokrummrich@dk-develop.de>");
452MODULE_DESCRIPTION("GPIO PS2 driver");
453MODULE_LICENSE("GPL v2");
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 30d6230d48f7..24a90c8db5b3 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -469,7 +469,7 @@ static struct attribute *serio_device_id_attrs[] = {
469 NULL 469 NULL
470}; 470};
471 471
472static struct attribute_group serio_id_attr_group = { 472static const struct attribute_group serio_id_attr_group = {
473 .name = "id", 473 .name = "id",
474 .attrs = serio_device_id_attrs, 474 .attrs = serio_device_id_attrs,
475}; 475};
@@ -489,7 +489,7 @@ static struct attribute *serio_device_attrs[] = {
489 NULL 489 NULL
490}; 490};
491 491
492static struct attribute_group serio_device_attr_group = { 492static const struct attribute_group serio_device_attr_group = {
493 .attrs = serio_device_attrs, 493 .attrs = serio_device_attrs,
494}; 494};
495 495
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c
index 71ef5d65a0c6..516f9fe77a17 100644
--- a/drivers/input/serio/serio_raw.c
+++ b/drivers/input/serio/serio_raw.c
@@ -410,7 +410,7 @@ static void serio_raw_disconnect(struct serio *serio)
410 serio_set_drvdata(serio, NULL); 410 serio_set_drvdata(serio, NULL);
411} 411}
412 412
413static struct serio_device_id serio_raw_serio_ids[] = { 413static const struct serio_device_id serio_raw_serio_ids[] = {
414 { 414 {
415 .type = SERIO_8042, 415 .type = SERIO_8042,
416 .proto = SERIO_ANY, 416 .proto = SERIO_ANY,
diff --git a/drivers/input/serio/xilinx_ps2.c b/drivers/input/serio/xilinx_ps2.c
index 14c40892ed82..07de1b49293c 100644
--- a/drivers/input/serio/xilinx_ps2.c
+++ b/drivers/input/serio/xilinx_ps2.c
@@ -45,8 +45,10 @@
45#define XPS2_STATUS_RX_FULL 0x00000001 /* Receive Full */ 45#define XPS2_STATUS_RX_FULL 0x00000001 /* Receive Full */
46#define XPS2_STATUS_TX_FULL 0x00000002 /* Transmit Full */ 46#define XPS2_STATUS_TX_FULL 0x00000002 /* Transmit Full */
47 47
48/* Bit definitions for ISR/IER registers. Both the registers have the same bit 48/*
49 * definitions and are only defined once. */ 49 * Bit definitions for ISR/IER registers. Both the registers have the same bit
50 * definitions and are only defined once.
51 */
50#define XPS2_IPIXR_WDT_TOUT 0x00000001 /* Watchdog Timeout Interrupt */ 52#define XPS2_IPIXR_WDT_TOUT 0x00000001 /* Watchdog Timeout Interrupt */
51#define XPS2_IPIXR_TX_NOACK 0x00000002 /* Transmit No ACK Interrupt */ 53#define XPS2_IPIXR_TX_NOACK 0x00000002 /* Transmit No ACK Interrupt */
52#define XPS2_IPIXR_TX_ACK 0x00000004 /* Transmit ACK (Data) Interrupt */ 54#define XPS2_IPIXR_TX_ACK 0x00000004 /* Transmit ACK (Data) Interrupt */
@@ -292,8 +294,10 @@ static int xps2_of_probe(struct platform_device *ofdev)
292 /* Disable all the interrupts, just in case */ 294 /* Disable all the interrupts, just in case */
293 out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0); 295 out_be32(drvdata->base_address + XPS2_IPIER_OFFSET, 0);
294 296
295 /* Reset the PS2 device and abort any current transaction, to make sure 297 /*
296 * we have the PS2 in a good state */ 298 * Reset the PS2 device and abort any current transaction,
299 * to make sure we have the PS2 in a good state.
300 */
297 out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET); 301 out_be32(drvdata->base_address + XPS2_SRST_OFFSET, XPS2_SRST_RESET);
298 302
299 dev_info(dev, "Xilinx PS2 at 0x%08llX mapped to 0x%p, irq=%d\n", 303 dev_info(dev, "Xilinx PS2 at 0x%08llX mapped to 0x%p, irq=%d\n",
diff --git a/drivers/input/tablet/acecad.c b/drivers/input/tablet/acecad.c
index e86e377a90f5..aebb3f9090cd 100644
--- a/drivers/input/tablet/acecad.c
+++ b/drivers/input/tablet/acecad.c
@@ -260,7 +260,7 @@ static void usb_acecad_disconnect(struct usb_interface *intf)
260 kfree(acecad); 260 kfree(acecad);
261} 261}
262 262
263static struct usb_device_id usb_acecad_id_table [] = { 263static const struct usb_device_id usb_acecad_id_table[] = {
264 { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_FLAIR), .driver_info = 0 }, 264 { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_FLAIR), .driver_info = 0 },
265 { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_302), .driver_info = 1 }, 265 { USB_DEVICE(USB_VENDOR_ID_ACECAD, USB_DEVICE_ID_302), .driver_info = 1 },
266 { } 266 { }
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index d67547bded3e..0b55e1f375b3 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1676,7 +1676,7 @@ static struct attribute *aiptek_attributes[] = {
1676 NULL 1676 NULL
1677}; 1677};
1678 1678
1679static struct attribute_group aiptek_attribute_group = { 1679static const struct attribute_group aiptek_attribute_group = {
1680 .attrs = aiptek_attributes, 1680 .attrs = aiptek_attributes,
1681}; 1681};
1682 1682
diff --git a/drivers/input/tablet/kbtab.c b/drivers/input/tablet/kbtab.c
index 4d9d64908b59..a41c3ff7c9af 100644
--- a/drivers/input/tablet/kbtab.c
+++ b/drivers/input/tablet/kbtab.c
@@ -88,7 +88,7 @@ static void kbtab_irq(struct urb *urb)
88 __func__, retval); 88 __func__, retval);
89} 89}
90 90
91static struct usb_device_id kbtab_ids[] = { 91static const struct usb_device_id kbtab_ids[] = {
92 { USB_DEVICE(USB_VENDOR_ID_KBGEAR, 0x1001), .driver_info = 0 }, 92 { USB_DEVICE(USB_VENDOR_ID_KBGEAR, 0x1001), .driver_info = 0 },
93 { } 93 { }
94}; 94};
diff --git a/drivers/input/tablet/wacom_serial4.c b/drivers/input/tablet/wacom_serial4.c
index 20ab802461e7..38bfaca48eab 100644
--- a/drivers/input/tablet/wacom_serial4.c
+++ b/drivers/input/tablet/wacom_serial4.c
@@ -594,7 +594,7 @@ free_device:
594 return err; 594 return err;
595} 595}
596 596
597static struct serio_device_id wacom_serio_ids[] = { 597static const struct serio_device_id wacom_serio_ids[] = {
598 { 598 {
599 .type = SERIO_RS232, 599 .type = SERIO_RS232,
600 .proto = SERIO_WACOM_IV, 600 .proto = SERIO_WACOM_IV,
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
index 735a0be1ad95..a2f45aefce08 100644
--- a/drivers/input/touchscreen/ads7846.c
+++ b/drivers/input/touchscreen/ads7846.c
@@ -499,7 +499,7 @@ static struct attribute *ads7846_attributes[] = {
499 NULL, 499 NULL,
500}; 500};
501 501
502static struct attribute_group ads7846_attr_group = { 502static const struct attribute_group ads7846_attr_group = {
503 .attrs = ads7846_attributes, 503 .attrs = ads7846_attributes,
504 .is_visible = ads7846_is_visible, 504 .is_visible = ads7846_is_visible,
505}; 505};
@@ -599,7 +599,7 @@ static struct attribute *ads784x_attributes[] = {
599 NULL, 599 NULL,
600}; 600};
601 601
602static struct attribute_group ads784x_attr_group = { 602static const struct attribute_group ads784x_attr_group = {
603 .attrs = ads784x_attributes, 603 .attrs = ads784x_attributes,
604}; 604};
605 605
diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index dd042a9b0aaa..7659bc48f1db 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -28,6 +28,7 @@
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/gpio/consumer.h>
31#include <asm/unaligned.h> 32#include <asm/unaligned.h>
32#include <media/v4l2-device.h> 33#include <media/v4l2-device.h>
33#include <media/v4l2-ioctl.h> 34#include <media/v4l2-ioctl.h>
@@ -300,6 +301,7 @@ struct mxt_data {
300 u8 multitouch; 301 u8 multitouch;
301 struct t7_config t7_cfg; 302 struct t7_config t7_cfg;
302 struct mxt_dbg dbg; 303 struct mxt_dbg dbg;
304 struct gpio_desc *reset_gpio;
303 305
304 /* Cached parameters from object table */ 306 /* Cached parameters from object table */
305 u16 T5_address; 307 u16 T5_address;
@@ -3117,11 +3119,9 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
3117 if (IS_ERR(pdata)) 3119 if (IS_ERR(pdata))
3118 return PTR_ERR(pdata); 3120 return PTR_ERR(pdata);
3119 3121
3120 data = kzalloc(sizeof(struct mxt_data), GFP_KERNEL); 3122 data = devm_kzalloc(&client->dev, sizeof(struct mxt_data), GFP_KERNEL);
3121 if (!data) { 3123 if (!data)
3122 dev_err(&client->dev, "Failed to allocate memory\n");
3123 return -ENOMEM; 3124 return -ENOMEM;
3124 }
3125 3125
3126 snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0", 3126 snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0",
3127 client->adapter->nr, client->addr); 3127 client->adapter->nr, client->addr);
@@ -3135,19 +3135,40 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
3135 init_completion(&data->reset_completion); 3135 init_completion(&data->reset_completion);
3136 init_completion(&data->crc_completion); 3136 init_completion(&data->crc_completion);
3137 3137
3138 error = request_threaded_irq(client->irq, NULL, mxt_interrupt, 3138 data->reset_gpio = devm_gpiod_get_optional(&client->dev,
3139 pdata->irqflags | IRQF_ONESHOT, 3139 "reset", GPIOD_OUT_LOW);
3140 client->name, data); 3140 if (IS_ERR(data->reset_gpio)) {
3141 error = PTR_ERR(data->reset_gpio);
3142 dev_err(&client->dev, "Failed to get reset gpio: %d\n", error);
3143 return error;
3144 }
3145
3146 error = devm_request_threaded_irq(&client->dev, client->irq,
3147 NULL, mxt_interrupt,
3148 pdata->irqflags | IRQF_ONESHOT,
3149 client->name, data);
3141 if (error) { 3150 if (error) {
3142 dev_err(&client->dev, "Failed to register interrupt\n"); 3151 dev_err(&client->dev, "Failed to register interrupt\n");
3143 goto err_free_mem; 3152 return error;
3153 }
3154
3155 if (data->reset_gpio) {
3156 data->in_bootloader = true;
3157 msleep(MXT_RESET_TIME);
3158 reinit_completion(&data->bl_completion);
3159 gpiod_set_value(data->reset_gpio, 1);
3160 error = mxt_wait_for_completion(data, &data->bl_completion,
3161 MXT_RESET_TIMEOUT);
3162 if (error)
3163 return error;
3164 data->in_bootloader = false;
3144 } 3165 }
3145 3166
3146 disable_irq(client->irq); 3167 disable_irq(client->irq);
3147 3168
3148 error = mxt_initialize(data); 3169 error = mxt_initialize(data);
3149 if (error) 3170 if (error)
3150 goto err_free_irq; 3171 return error;
3151 3172
3152 error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group); 3173 error = sysfs_create_group(&client->dev.kobj, &mxt_attr_group);
3153 if (error) { 3174 if (error) {
@@ -3161,10 +3182,6 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
3161err_free_object: 3182err_free_object:
3162 mxt_free_input_device(data); 3183 mxt_free_input_device(data);
3163 mxt_free_object_table(data); 3184 mxt_free_object_table(data);
3164err_free_irq:
3165 free_irq(client->irq, data);
3166err_free_mem:
3167 kfree(data);
3168 return error; 3185 return error;
3169} 3186}
3170 3187
@@ -3172,11 +3189,10 @@ static int mxt_remove(struct i2c_client *client)
3172{ 3189{
3173 struct mxt_data *data = i2c_get_clientdata(client); 3190 struct mxt_data *data = i2c_get_clientdata(client);
3174 3191
3192 disable_irq(data->irq);
3175 sysfs_remove_group(&client->dev.kobj, &mxt_attr_group); 3193 sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);
3176 free_irq(data->irq, data);
3177 mxt_free_input_device(data); 3194 mxt_free_input_device(data);
3178 mxt_free_object_table(data); 3195 mxt_free_object_table(data);
3179 kfree(data);
3180 3196
3181 return 0; 3197 return 0;
3182} 3198}
diff --git a/drivers/input/touchscreen/dynapro.c b/drivers/input/touchscreen/dynapro.c
index 86237a910876..5b1b66fffbe3 100644
--- a/drivers/input/touchscreen/dynapro.c
+++ b/drivers/input/touchscreen/dynapro.c
@@ -164,7 +164,7 @@ static int dynapro_connect(struct serio *serio, struct serio_driver *drv)
164 * The serio driver structure. 164 * The serio driver structure.
165 */ 165 */
166 166
167static struct serio_device_id dynapro_serio_ids[] = { 167static const struct serio_device_id dynapro_serio_ids[] = {
168 { 168 {
169 .type = SERIO_RS232, 169 .type = SERIO_RS232,
170 .proto = SERIO_DYNAPRO, 170 .proto = SERIO_DYNAPRO,
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 872750eeca93..0f4cda7282a2 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1066,7 +1066,7 @@ static struct attribute *elants_attributes[] = {
1066 NULL 1066 NULL
1067}; 1067};
1068 1068
1069static struct attribute_group elants_attribute_group = { 1069static const struct attribute_group elants_attribute_group = {
1070 .attrs = elants_attributes, 1070 .attrs = elants_attributes,
1071}; 1071};
1072 1072
diff --git a/drivers/input/touchscreen/elo.c b/drivers/input/touchscreen/elo.c
index 8051a4b704ea..83433e8efff7 100644
--- a/drivers/input/touchscreen/elo.c
+++ b/drivers/input/touchscreen/elo.c
@@ -381,7 +381,7 @@ static int elo_connect(struct serio *serio, struct serio_driver *drv)
381 * The serio driver structure. 381 * The serio driver structure.
382 */ 382 */
383 383
384static struct serio_device_id elo_serio_ids[] = { 384static const struct serio_device_id elo_serio_ids[] = {
385 { 385 {
386 .type = SERIO_RS232, 386 .type = SERIO_RS232,
387 .proto = SERIO_ELO, 387 .proto = SERIO_ELO,
diff --git a/drivers/input/touchscreen/fujitsu_ts.c b/drivers/input/touchscreen/fujitsu_ts.c
index d0e46a7e183b..a0fbb454499d 100644
--- a/drivers/input/touchscreen/fujitsu_ts.c
+++ b/drivers/input/touchscreen/fujitsu_ts.c
@@ -151,7 +151,7 @@ static int fujitsu_connect(struct serio *serio, struct serio_driver *drv)
151/* 151/*
152 * The serio driver structure. 152 * The serio driver structure.
153 */ 153 */
154static struct serio_device_id fujitsu_serio_ids[] = { 154static const struct serio_device_id fujitsu_serio_ids[] = {
155 { 155 {
156 .type = SERIO_RS232, 156 .type = SERIO_RS232,
157 .proto = SERIO_FUJITSU, 157 .proto = SERIO_FUJITSU,
diff --git a/drivers/input/touchscreen/gunze.c b/drivers/input/touchscreen/gunze.c
index e2ee62615273..481586909d28 100644
--- a/drivers/input/touchscreen/gunze.c
+++ b/drivers/input/touchscreen/gunze.c
@@ -162,7 +162,7 @@ static int gunze_connect(struct serio *serio, struct serio_driver *drv)
162 * The serio driver structure. 162 * The serio driver structure.
163 */ 163 */
164 164
165static struct serio_device_id gunze_serio_ids[] = { 165static const struct serio_device_id gunze_serio_ids[] = {
166 { 166 {
167 .type = SERIO_RS232, 167 .type = SERIO_RS232,
168 .proto = SERIO_GUNZE, 168 .proto = SERIO_GUNZE,
diff --git a/drivers/input/touchscreen/hampshire.c b/drivers/input/touchscreen/hampshire.c
index ecb1e0e01328..eb052d559e54 100644
--- a/drivers/input/touchscreen/hampshire.c
+++ b/drivers/input/touchscreen/hampshire.c
@@ -163,7 +163,7 @@ static int hampshire_connect(struct serio *serio, struct serio_driver *drv)
163 * The serio driver structure. 163 * The serio driver structure.
164 */ 164 */
165 165
166static struct serio_device_id hampshire_serio_ids[] = { 166static const struct serio_device_id hampshire_serio_ids[] = {
167 { 167 {
168 .type = SERIO_RS232, 168 .type = SERIO_RS232,
169 .proto = SERIO_HAMPSHIRE, 169 .proto = SERIO_HAMPSHIRE,
diff --git a/drivers/input/touchscreen/inexio.c b/drivers/input/touchscreen/inexio.c
index adb80b65a259..b9bc56233ccc 100644
--- a/drivers/input/touchscreen/inexio.c
+++ b/drivers/input/touchscreen/inexio.c
@@ -165,7 +165,7 @@ static int inexio_connect(struct serio *serio, struct serio_driver *drv)
165 * The serio driver structure. 165 * The serio driver structure.
166 */ 166 */
167 167
168static struct serio_device_id inexio_serio_ids[] = { 168static const struct serio_device_id inexio_serio_ids[] = {
169 { 169 {
170 .type = SERIO_RS232, 170 .type = SERIO_RS232,
171 .proto = SERIO_INEXIO, 171 .proto = SERIO_INEXIO,
diff --git a/drivers/input/touchscreen/mtouch.c b/drivers/input/touchscreen/mtouch.c
index 9b5552a26169..a3707fad4d1c 100644
--- a/drivers/input/touchscreen/mtouch.c
+++ b/drivers/input/touchscreen/mtouch.c
@@ -178,7 +178,7 @@ static int mtouch_connect(struct serio *serio, struct serio_driver *drv)
178 * The serio driver structure. 178 * The serio driver structure.
179 */ 179 */
180 180
181static struct serio_device_id mtouch_serio_ids[] = { 181static const struct serio_device_id mtouch_serio_ids[] = {
182 { 182 {
183 .type = SERIO_RS232, 183 .type = SERIO_RS232,
184 .proto = SERIO_MICROTOUCH, 184 .proto = SERIO_MICROTOUCH,
diff --git a/drivers/input/touchscreen/mxs-lradc-ts.c b/drivers/input/touchscreen/mxs-lradc-ts.c
index 58c016cd6809..3707e927f770 100644
--- a/drivers/input/touchscreen/mxs-lradc-ts.c
+++ b/drivers/input/touchscreen/mxs-lradc-ts.c
@@ -30,7 +30,7 @@
30#include <linux/of_irq.h> 30#include <linux/of_irq.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32 32
33const char *mxs_lradc_ts_irq_names[] = { 33static const char * const mxs_lradc_ts_irq_names[] = {
34 "mxs-lradc-touchscreen", 34 "mxs-lradc-touchscreen",
35 "mxs-lradc-channel6", 35 "mxs-lradc-channel6",
36 "mxs-lradc-channel7", 36 "mxs-lradc-channel7",
@@ -630,9 +630,11 @@ static int mxs_lradc_ts_probe(struct platform_device *pdev)
630 spin_lock_init(&ts->lock); 630 spin_lock_init(&ts->lock);
631 631
632 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 632 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
633 if (!iores)
634 return -EINVAL;
633 ts->base = devm_ioremap(dev, iores->start, resource_size(iores)); 635 ts->base = devm_ioremap(dev, iores->start, resource_size(iores));
634 if (IS_ERR(ts->base)) 636 if (!ts->base)
635 return PTR_ERR(ts->base); 637 return -ENOMEM;
636 638
637 ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires", 639 ret = of_property_read_u32(node, "fsl,lradc-touchscreen-wires",
638 &ts_wires); 640 &ts_wires);
diff --git a/drivers/input/touchscreen/penmount.c b/drivers/input/touchscreen/penmount.c
index 417d87379265..6e6d7fd98cd2 100644
--- a/drivers/input/touchscreen/penmount.c
+++ b/drivers/input/touchscreen/penmount.c
@@ -293,7 +293,7 @@ static int pm_connect(struct serio *serio, struct serio_driver *drv)
293 * The serio driver structure. 293 * The serio driver structure.
294 */ 294 */
295 295
296static struct serio_device_id pm_serio_ids[] = { 296static const struct serio_device_id pm_serio_ids[] = {
297 { 297 {
298 .type = SERIO_RS232, 298 .type = SERIO_RS232,
299 .proto = SERIO_PENMOUNT, 299 .proto = SERIO_PENMOUNT,
diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c
index 1252e49ccfa1..4f1d3fd5d412 100644
--- a/drivers/input/touchscreen/raydium_i2c_ts.c
+++ b/drivers/input/touchscreen/raydium_i2c_ts.c
@@ -939,7 +939,7 @@ static struct attribute *raydium_i2c_attributes[] = {
939 NULL 939 NULL
940}; 940};
941 941
942static struct attribute_group raydium_i2c_attribute_group = { 942static const struct attribute_group raydium_i2c_attribute_group = {
943 .attrs = raydium_i2c_attributes, 943 .attrs = raydium_i2c_attributes,
944}; 944};
945 945
diff --git a/drivers/input/touchscreen/sun4i-ts.c b/drivers/input/touchscreen/sun4i-ts.c
index d07dd29d4848..d2e14d9e5975 100644
--- a/drivers/input/touchscreen/sun4i-ts.c
+++ b/drivers/input/touchscreen/sun4i-ts.c
@@ -206,7 +206,7 @@ static int sun4i_get_tz_temp(void *data, int *temp)
206 return sun4i_get_temp(data, temp); 206 return sun4i_get_temp(data, temp);
207} 207}
208 208
209static struct thermal_zone_of_device_ops sun4i_ts_tz_ops = { 209static const struct thermal_zone_of_device_ops sun4i_ts_tz_ops = {
210 .get_temp = sun4i_get_tz_temp, 210 .get_temp = sun4i_get_tz_temp,
211}; 211};
212 212
diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
index 128e5bd74720..f16f8358c70a 100644
--- a/drivers/input/touchscreen/sur40.c
+++ b/drivers/input/touchscreen/sur40.c
@@ -59,7 +59,7 @@ struct sur40_blob {
59 __le16 blob_id; 59 __le16 blob_id;
60 60
61 u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */ 61 u8 action; /* 0x02 = enter/exit, 0x03 = update (?) */
62 u8 unknown; /* always 0x01 or 0x02 (no idea what this is?) */ 62 u8 type; /* bitmask (0x01 blob, 0x02 touch, 0x04 tag) */
63 63
64 __le16 bb_pos_x; /* upper left corner of bounding box */ 64 __le16 bb_pos_x; /* upper left corner of bounding box */
65 __le16 bb_pos_y; 65 __le16 bb_pos_y;
@@ -133,12 +133,19 @@ struct sur40_image_header {
133 133
134/* control commands */ 134/* control commands */
135#define SUR40_GET_VERSION 0xb0 /* 12 bytes string */ 135#define SUR40_GET_VERSION 0xb0 /* 12 bytes string */
136#define SUR40_UNKNOWN1 0xb3 /* 5 bytes */ 136#define SUR40_ACCEL_CAPS 0xb3 /* 5 bytes */
137#define SUR40_UNKNOWN2 0xc1 /* 24 bytes */ 137#define SUR40_SENSOR_CAPS 0xc1 /* 24 bytes */
138
139#define SUR40_POKE 0xc5 /* poke register byte */
140#define SUR40_PEEK 0xc4 /* 48 bytes registers */
138 141
139#define SUR40_GET_STATE 0xc5 /* 4 bytes state (?) */ 142#define SUR40_GET_STATE 0xc5 /* 4 bytes state (?) */
140#define SUR40_GET_SENSORS 0xb1 /* 8 bytes sensors */ 143#define SUR40_GET_SENSORS 0xb1 /* 8 bytes sensors */
141 144
145#define SUR40_BLOB 0x01
146#define SUR40_TOUCH 0x02
147#define SUR40_TAG 0x04
148
142static const struct v4l2_pix_format sur40_pix_format[] = { 149static const struct v4l2_pix_format sur40_pix_format[] = {
143 { 150 {
144 .pixelformat = V4L2_TCH_FMT_TU08, 151 .pixelformat = V4L2_TCH_FMT_TU08,
@@ -238,11 +245,11 @@ static int sur40_init(struct sur40_state *dev)
238 if (result < 0) 245 if (result < 0)
239 goto error; 246 goto error;
240 247
241 result = sur40_command(dev, SUR40_UNKNOWN2, 0x00, buffer, 24); 248 result = sur40_command(dev, SUR40_SENSOR_CAPS, 0x00, buffer, 24);
242 if (result < 0) 249 if (result < 0)
243 goto error; 250 goto error;
244 251
245 result = sur40_command(dev, SUR40_UNKNOWN1, 0x00, buffer, 5); 252 result = sur40_command(dev, SUR40_ACCEL_CAPS, 0x00, buffer, 5);
246 if (result < 0) 253 if (result < 0)
247 goto error; 254 goto error;
248 255
@@ -289,20 +296,24 @@ static void sur40_close(struct input_polled_dev *polldev)
289static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input) 296static void sur40_report_blob(struct sur40_blob *blob, struct input_dev *input)
290{ 297{
291 int wide, major, minor; 298 int wide, major, minor;
299 int bb_size_x, bb_size_y, pos_x, pos_y, ctr_x, ctr_y, slotnum;
292 300
293 int bb_size_x = le16_to_cpu(blob->bb_size_x); 301 if (blob->type != SUR40_TOUCH)
294 int bb_size_y = le16_to_cpu(blob->bb_size_y); 302 return;
295
296 int pos_x = le16_to_cpu(blob->pos_x);
297 int pos_y = le16_to_cpu(blob->pos_y);
298
299 int ctr_x = le16_to_cpu(blob->ctr_x);
300 int ctr_y = le16_to_cpu(blob->ctr_y);
301 303
302 int slotnum = input_mt_get_slot_by_key(input, blob->blob_id); 304 slotnum = input_mt_get_slot_by_key(input, blob->blob_id);
303 if (slotnum < 0 || slotnum >= MAX_CONTACTS) 305 if (slotnum < 0 || slotnum >= MAX_CONTACTS)
304 return; 306 return;
305 307
308 bb_size_x = le16_to_cpu(blob->bb_size_x);
309 bb_size_y = le16_to_cpu(blob->bb_size_y);
310
311 pos_x = le16_to_cpu(blob->pos_x);
312 pos_y = le16_to_cpu(blob->pos_y);
313
314 ctr_x = le16_to_cpu(blob->ctr_x);
315 ctr_y = le16_to_cpu(blob->ctr_y);
316
306 input_mt_slot(input, slotnum); 317 input_mt_slot(input, slotnum);
307 input_mt_report_slot_state(input, MT_TOOL_FINGER, 1); 318 input_mt_report_slot_state(input, MT_TOOL_FINGER, 1);
308 wide = (bb_size_x > bb_size_y); 319 wide = (bb_size_x > bb_size_y);
@@ -367,10 +378,13 @@ static void sur40_poll(struct input_polled_dev *polldev)
367 /* 378 /*
368 * Sanity check. when video data is also being retrieved, the 379 * Sanity check. when video data is also being retrieved, the
369 * packet ID will usually increase in the middle of a series 380 * packet ID will usually increase in the middle of a series
370 * instead of at the end. 381 * instead of at the end. However, the data is still consistent,
371 */ 382 * so the packet ID is probably just valid for the first packet
383 * in a series.
384
372 if (packet_id != le32_to_cpu(header->packet_id)) 385 if (packet_id != le32_to_cpu(header->packet_id))
373 dev_dbg(sur40->dev, "packet ID mismatch\n"); 386 dev_dbg(sur40->dev, "packet ID mismatch\n");
387 */
374 388
375 packet_blobs = result / sizeof(struct sur40_blob); 389 packet_blobs = result / sizeof(struct sur40_blob);
376 dev_dbg(sur40->dev, "received %d blobs\n", packet_blobs); 390 dev_dbg(sur40->dev, "received %d blobs\n", packet_blobs);
diff --git a/drivers/input/touchscreen/touchit213.c b/drivers/input/touchscreen/touchit213.c
index c27cf8f3d1ca..98a16698be8e 100644
--- a/drivers/input/touchscreen/touchit213.c
+++ b/drivers/input/touchscreen/touchit213.c
@@ -192,7 +192,7 @@ static int touchit213_connect(struct serio *serio, struct serio_driver *drv)
192 * The serio driver structure. 192 * The serio driver structure.
193 */ 193 */
194 194
195static struct serio_device_id touchit213_serio_ids[] = { 195static const struct serio_device_id touchit213_serio_ids[] = {
196 { 196 {
197 .type = SERIO_RS232, 197 .type = SERIO_RS232,
198 .proto = SERIO_TOUCHIT213, 198 .proto = SERIO_TOUCHIT213,
diff --git a/drivers/input/touchscreen/touchright.c b/drivers/input/touchscreen/touchright.c
index 4000e5205407..45c325c33f21 100644
--- a/drivers/input/touchscreen/touchright.c
+++ b/drivers/input/touchscreen/touchright.c
@@ -152,7 +152,7 @@ static int tr_connect(struct serio *serio, struct serio_driver *drv)
152 * The serio driver structure. 152 * The serio driver structure.
153 */ 153 */
154 154
155static struct serio_device_id tr_serio_ids[] = { 155static const struct serio_device_id tr_serio_ids[] = {
156 { 156 {
157 .type = SERIO_RS232, 157 .type = SERIO_RS232,
158 .proto = SERIO_TOUCHRIGHT, 158 .proto = SERIO_TOUCHRIGHT,
diff --git a/drivers/input/touchscreen/touchwin.c b/drivers/input/touchscreen/touchwin.c
index ba90f447df75..2ba6b4ca28cb 100644
--- a/drivers/input/touchscreen/touchwin.c
+++ b/drivers/input/touchscreen/touchwin.c
@@ -159,7 +159,7 @@ static int tw_connect(struct serio *serio, struct serio_driver *drv)
159 * The serio driver structure. 159 * The serio driver structure.
160 */ 160 */
161 161
162static struct serio_device_id tw_serio_ids[] = { 162static const struct serio_device_id tw_serio_ids[] = {
163 { 163 {
164 .type = SERIO_RS232, 164 .type = SERIO_RS232,
165 .proto = SERIO_TOUCHWIN, 165 .proto = SERIO_TOUCHWIN,
diff --git a/drivers/input/touchscreen/tsc40.c b/drivers/input/touchscreen/tsc40.c
index 29687872cb94..d4ae4ba84c1f 100644
--- a/drivers/input/touchscreen/tsc40.c
+++ b/drivers/input/touchscreen/tsc40.c
@@ -141,7 +141,7 @@ static void tsc_disconnect(struct serio *serio)
141 serio_set_drvdata(serio, NULL); 141 serio_set_drvdata(serio, NULL);
142} 142}
143 143
144static struct serio_device_id tsc_serio_ids[] = { 144static const struct serio_device_id tsc_serio_ids[] = {
145 { 145 {
146 .type = SERIO_RS232, 146 .type = SERIO_RS232,
147 .proto = SERIO_TSC40, 147 .proto = SERIO_TSC40,
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c
index 85e95725d0df..3715d1eace92 100644
--- a/drivers/input/touchscreen/wacom_w8001.c
+++ b/drivers/input/touchscreen/wacom_w8001.c
@@ -681,7 +681,7 @@ fail1:
681 return err; 681 return err;
682} 682}
683 683
684static struct serio_device_id w8001_serio_ids[] = { 684static const struct serio_device_id w8001_serio_ids[] = {
685 { 685 {
686 .type = SERIO_RS232, 686 .type = SERIO_RS232,
687 .proto = SERIO_W8001, 687 .proto = SERIO_W8001,