diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/input/input-mt.c | 2 | ||||
-rw-r--r-- | drivers/input/input.c | 5 | ||||
-rw-r--r-- | drivers/input/joystick/as5011.c | 19 | ||||
-rw-r--r-- | drivers/input/keyboard/Kconfig | 2 | ||||
-rw-r--r-- | drivers/input/keyboard/qt2160.c | 19 | ||||
-rw-r--r-- | drivers/input/misc/Kconfig | 19 | ||||
-rw-r--r-- | drivers/input/misc/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/misc/da9055_onkey.c | 171 | ||||
-rw-r--r-- | drivers/input/misc/pwm-beeper.c | 14 | ||||
-rw-r--r-- | drivers/input/misc/wm831x-on.c | 5 | ||||
-rw-r--r-- | drivers/input/mouse/alps.c | 10 | ||||
-rw-r--r-- | drivers/input/serio/Kconfig | 9 | ||||
-rw-r--r-- | drivers/input/serio/Makefile | 1 | ||||
-rw-r--r-- | drivers/input/serio/arc_ps2.c | 274 | ||||
-rw-r--r-- | drivers/input/serio/i8042-io.h | 2 | ||||
-rw-r--r-- | drivers/input/touchscreen/cy8ctmg110_ts.c | 13 | ||||
-rw-r--r-- | drivers/input/touchscreen/edt-ft5x06.c | 10 | ||||
-rw-r--r-- | drivers/input/touchscreen/mms114.c | 62 | ||||
-rw-r--r-- | drivers/input/touchscreen/wm831x-ts.c | 6 |
19 files changed, 590 insertions, 54 deletions
diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index c0ec7d42c3b..bf2f30c0258 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c | |||
@@ -190,7 +190,7 @@ void input_mt_report_pointer_emulation(struct input_dev *dev, bool use_count) | |||
190 | if (!mt) | 190 | if (!mt) |
191 | return; | 191 | return; |
192 | 192 | ||
193 | oldest = 0; | 193 | oldest = NULL; |
194 | oldid = mt->trkid; | 194 | oldid = mt->trkid; |
195 | count = 0; | 195 | count = 0; |
196 | 196 | ||
diff --git a/drivers/input/input.c b/drivers/input/input.c index 53a0ddee787..f1be1a77edf 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -534,8 +534,11 @@ EXPORT_SYMBOL(input_grab_device); | |||
534 | static void __input_release_device(struct input_handle *handle) | 534 | static void __input_release_device(struct input_handle *handle) |
535 | { | 535 | { |
536 | struct input_dev *dev = handle->dev; | 536 | struct input_dev *dev = handle->dev; |
537 | struct input_handle *grabber; | ||
537 | 538 | ||
538 | if (dev->grab == handle) { | 539 | grabber = rcu_dereference_protected(dev->grab, |
540 | lockdep_is_held(&dev->mutex)); | ||
541 | if (grabber == handle) { | ||
539 | rcu_assign_pointer(dev->grab, NULL); | 542 | rcu_assign_pointer(dev->grab, NULL); |
540 | /* Make sure input_pass_event() notices that grab is gone */ | 543 | /* Make sure input_pass_event() notices that grab is gone */ |
541 | synchronize_rcu(); | 544 | synchronize_rcu(); |
diff --git a/drivers/input/joystick/as5011.c b/drivers/input/joystick/as5011.c index c96653b5886..9d869e202b8 100644 --- a/drivers/input/joystick/as5011.c +++ b/drivers/input/joystick/as5011.c | |||
@@ -85,7 +85,10 @@ static int as5011_i2c_write(struct i2c_client *client, | |||
85 | { | 85 | { |
86 | uint8_t data[2] = { aregaddr, avalue }; | 86 | uint8_t data[2] = { aregaddr, avalue }; |
87 | struct i2c_msg msg = { | 87 | struct i2c_msg msg = { |
88 | client->addr, I2C_M_IGNORE_NAK, 2, (uint8_t *)data | 88 | .addr = client->addr, |
89 | .flags = I2C_M_IGNORE_NAK, | ||
90 | .len = 2, | ||
91 | .buf = (uint8_t *)data | ||
89 | }; | 92 | }; |
90 | int error; | 93 | int error; |
91 | 94 | ||
@@ -98,8 +101,18 @@ static int as5011_i2c_read(struct i2c_client *client, | |||
98 | { | 101 | { |
99 | uint8_t data[2] = { aregaddr }; | 102 | uint8_t data[2] = { aregaddr }; |
100 | struct i2c_msg msg_set[2] = { | 103 | struct i2c_msg msg_set[2] = { |
101 | { client->addr, I2C_M_REV_DIR_ADDR, 1, (uint8_t *)data }, | 104 | { |
102 | { client->addr, I2C_M_RD | I2C_M_NOSTART, 1, (uint8_t *)data } | 105 | .addr = client->addr, |
106 | .flags = I2C_M_REV_DIR_ADDR, | ||
107 | .len = 1, | ||
108 | .buf = (uint8_t *)data | ||
109 | }, | ||
110 | { | ||
111 | .addr = client->addr, | ||
112 | .flags = I2C_M_RD | I2C_M_NOSTART, | ||
113 | .len = 1, | ||
114 | .buf = (uint8_t *)data | ||
115 | } | ||
103 | }; | 116 | }; |
104 | int error; | 117 | int error; |
105 | 118 | ||
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index de0874054e9..48309641b1b 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -134,7 +134,7 @@ config KEYBOARD_QT1070 | |||
134 | 134 | ||
135 | config KEYBOARD_QT2160 | 135 | config KEYBOARD_QT2160 |
136 | tristate "Atmel AT42QT2160 Touch Sensor Chip" | 136 | tristate "Atmel AT42QT2160 Touch Sensor Chip" |
137 | depends on I2C && EXPERIMENTAL | 137 | depends on I2C |
138 | help | 138 | help |
139 | If you say yes here you get support for Atmel AT42QT2160 Touch | 139 | If you say yes here you get support for Atmel AT42QT2160 Touch |
140 | Sensor chip as a keyboard input. | 140 | Sensor chip as a keyboard input. |
diff --git a/drivers/input/keyboard/qt2160.c b/drivers/input/keyboard/qt2160.c index 76b7d430d03..031eed73990 100644 --- a/drivers/input/keyboard/qt2160.c +++ b/drivers/input/keyboard/qt2160.c | |||
@@ -206,23 +206,14 @@ static int __devinit qt2160_read(struct i2c_client *client, u8 reg) | |||
206 | 206 | ||
207 | static int __devinit qt2160_write(struct i2c_client *client, u8 reg, u8 data) | 207 | static int __devinit qt2160_write(struct i2c_client *client, u8 reg, u8 data) |
208 | { | 208 | { |
209 | int error; | 209 | int ret; |
210 | |||
211 | error = i2c_smbus_write_byte(client, reg); | ||
212 | if (error) { | ||
213 | dev_err(&client->dev, | ||
214 | "couldn't send request. Returned %d\n", error); | ||
215 | return error; | ||
216 | } | ||
217 | 210 | ||
218 | error = i2c_smbus_write_byte(client, data); | 211 | ret = i2c_smbus_write_byte_data(client, reg, data); |
219 | if (error) { | 212 | if (ret < 0) |
220 | dev_err(&client->dev, | 213 | dev_err(&client->dev, |
221 | "couldn't write data. Returned %d\n", error); | 214 | "couldn't write data. Returned %d\n", ret); |
222 | return error; | ||
223 | } | ||
224 | 215 | ||
225 | return error; | 216 | return ret; |
226 | } | 217 | } |
227 | 218 | ||
228 | 219 | ||
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index 7c0f1ecfdd7..0f959d744e7 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig | |||
@@ -290,8 +290,7 @@ config INPUT_ATI_REMOTE2 | |||
290 | called ati_remote2. | 290 | called ati_remote2. |
291 | 291 | ||
292 | config INPUT_KEYSPAN_REMOTE | 292 | config INPUT_KEYSPAN_REMOTE |
293 | tristate "Keyspan DMR USB remote control (EXPERIMENTAL)" | 293 | tristate "Keyspan DMR USB remote control" |
294 | depends on EXPERIMENTAL | ||
295 | depends on USB_ARCH_HAS_HCD | 294 | depends on USB_ARCH_HAS_HCD |
296 | select USB | 295 | select USB |
297 | help | 296 | help |
@@ -340,7 +339,6 @@ config INPUT_POWERMATE | |||
340 | 339 | ||
341 | config INPUT_YEALINK | 340 | config INPUT_YEALINK |
342 | tristate "Yealink usb-p1k voip phone" | 341 | tristate "Yealink usb-p1k voip phone" |
343 | depends on EXPERIMENTAL | ||
344 | depends on USB_ARCH_HAS_HCD | 342 | depends on USB_ARCH_HAS_HCD |
345 | select USB | 343 | select USB |
346 | help | 344 | help |
@@ -356,7 +354,6 @@ config INPUT_YEALINK | |||
356 | 354 | ||
357 | config INPUT_CM109 | 355 | config INPUT_CM109 |
358 | tristate "C-Media CM109 USB I/O Controller" | 356 | tristate "C-Media CM109 USB I/O Controller" |
359 | depends on EXPERIMENTAL | ||
360 | depends on USB_ARCH_HAS_HCD | 357 | depends on USB_ARCH_HAS_HCD |
361 | select USB | 358 | select USB |
362 | help | 359 | help |
@@ -434,7 +431,7 @@ config INPUT_PCF50633_PMU | |||
434 | 431 | ||
435 | config INPUT_PCF8574 | 432 | config INPUT_PCF8574 |
436 | tristate "PCF8574 Keypad input device" | 433 | tristate "PCF8574 Keypad input device" |
437 | depends on I2C && EXPERIMENTAL | 434 | depends on I2C |
438 | help | 435 | help |
439 | Say Y here if you want to support a keypad connected via I2C | 436 | Say Y here if you want to support a keypad connected via I2C |
440 | with a PCF8574. | 437 | with a PCF8574. |
@@ -444,7 +441,7 @@ config INPUT_PCF8574 | |||
444 | 441 | ||
445 | config INPUT_PWM_BEEPER | 442 | config INPUT_PWM_BEEPER |
446 | tristate "PWM beeper support" | 443 | tristate "PWM beeper support" |
447 | depends on HAVE_PWM | 444 | depends on HAVE_PWM || PWM |
448 | help | 445 | help |
449 | Say Y here to get support for PWM based beeper devices. | 446 | Say Y here to get support for PWM based beeper devices. |
450 | 447 | ||
@@ -486,6 +483,16 @@ config INPUT_DA9052_ONKEY | |||
486 | To compile this driver as a module, choose M here: the | 483 | To compile this driver as a module, choose M here: the |
487 | module will be called da9052_onkey. | 484 | module will be called da9052_onkey. |
488 | 485 | ||
486 | config INPUT_DA9055_ONKEY | ||
487 | tristate "Dialog Semiconductor DA9055 ONKEY" | ||
488 | depends on MFD_DA9055 | ||
489 | help | ||
490 | Support the ONKEY of DA9055 PMICs as an input device | ||
491 | reporting power button status. | ||
492 | |||
493 | To compile this driver as a module, choose M here: the module | ||
494 | will be called da9055_onkey. | ||
495 | |||
489 | config INPUT_DM355EVM | 496 | config INPUT_DM355EVM |
490 | tristate "TI DaVinci DM355 EVM Keypad and IR Remote" | 497 | tristate "TI DaVinci DM355 EVM Keypad and IR Remote" |
491 | depends on MFD_DM355EVM_MSP | 498 | depends on MFD_DM355EVM_MSP |
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 83fe6f5b77d..23347e3f7e9 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_INPUT_CMA3000) += cma3000_d0x.o | |||
23 | obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o | 23 | obj-$(CONFIG_INPUT_CMA3000_I2C) += cma3000_d0x_i2c.o |
24 | obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o | 24 | obj-$(CONFIG_INPUT_COBALT_BTNS) += cobalt_btns.o |
25 | obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o | 25 | obj-$(CONFIG_INPUT_DA9052_ONKEY) += da9052_onkey.o |
26 | obj-$(CONFIG_INPUT_DA9055_ONKEY) += da9055_onkey.o | ||
26 | obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o | 27 | obj-$(CONFIG_INPUT_DM355EVM) += dm355evm_keys.o |
27 | obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o | 28 | obj-$(CONFIG_INPUT_GP2A) += gp2ap002a00f.o |
28 | obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o | 29 | obj-$(CONFIG_INPUT_GPIO_TILT_POLLED) += gpio_tilt_polled.o |
diff --git a/drivers/input/misc/da9055_onkey.c b/drivers/input/misc/da9055_onkey.c new file mode 100644 index 00000000000..10ebf15070d --- /dev/null +++ b/drivers/input/misc/da9055_onkey.c | |||
@@ -0,0 +1,171 @@ | |||
1 | /* | ||
2 | * ON pin driver for Dialog DA9055 PMICs | ||
3 | * | ||
4 | * Copyright(c) 2012 Dialog Semiconductor Ltd. | ||
5 | * | ||
6 | * Author: David Dajun Chen <dchen@diasemi.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/init.h> | ||
15 | #include <linux/input.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | |||
19 | #include <linux/mfd/da9055/core.h> | ||
20 | #include <linux/mfd/da9055/reg.h> | ||
21 | |||
22 | struct da9055_onkey { | ||
23 | struct da9055 *da9055; | ||
24 | struct input_dev *input; | ||
25 | struct delayed_work work; | ||
26 | }; | ||
27 | |||
28 | static void da9055_onkey_query(struct da9055_onkey *onkey) | ||
29 | { | ||
30 | int key_stat; | ||
31 | |||
32 | key_stat = da9055_reg_read(onkey->da9055, DA9055_REG_STATUS_A); | ||
33 | if (key_stat < 0) { | ||
34 | dev_err(onkey->da9055->dev, | ||
35 | "Failed to read onkey event %d\n", key_stat); | ||
36 | } else { | ||
37 | key_stat &= DA9055_NOKEY_STS; | ||
38 | /* | ||
39 | * Onkey status bit is cleared when onkey button is relased. | ||
40 | */ | ||
41 | if (!key_stat) { | ||
42 | input_report_key(onkey->input, KEY_POWER, 0); | ||
43 | input_sync(onkey->input); | ||
44 | } | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | * Interrupt is generated only when the ONKEY pin is asserted. | ||
49 | * Hence the deassertion of the pin is simulated through work queue. | ||
50 | */ | ||
51 | if (key_stat) | ||
52 | schedule_delayed_work(&onkey->work, msecs_to_jiffies(10)); | ||
53 | |||
54 | } | ||
55 | |||
56 | static void da9055_onkey_work(struct work_struct *work) | ||
57 | { | ||
58 | struct da9055_onkey *onkey = container_of(work, struct da9055_onkey, | ||
59 | work.work); | ||
60 | |||
61 | da9055_onkey_query(onkey); | ||
62 | } | ||
63 | |||
64 | static irqreturn_t da9055_onkey_irq(int irq, void *data) | ||
65 | { | ||
66 | struct da9055_onkey *onkey = data; | ||
67 | |||
68 | input_report_key(onkey->input, KEY_POWER, 1); | ||
69 | input_sync(onkey->input); | ||
70 | |||
71 | da9055_onkey_query(onkey); | ||
72 | |||
73 | return IRQ_HANDLED; | ||
74 | } | ||
75 | |||
76 | static int __devinit da9055_onkey_probe(struct platform_device *pdev) | ||
77 | { | ||
78 | struct da9055 *da9055 = dev_get_drvdata(pdev->dev.parent); | ||
79 | struct da9055_onkey *onkey; | ||
80 | struct input_dev *input_dev; | ||
81 | int irq, err; | ||
82 | |||
83 | irq = platform_get_irq_byname(pdev, "ONKEY"); | ||
84 | if (irq < 0) { | ||
85 | dev_err(&pdev->dev, | ||
86 | "Failed to get an IRQ for input device, %d\n", irq); | ||
87 | return -EINVAL; | ||
88 | } | ||
89 | |||
90 | onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL); | ||
91 | if (!onkey) { | ||
92 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | ||
93 | return -ENOMEM; | ||
94 | } | ||
95 | |||
96 | input_dev = input_allocate_device(); | ||
97 | if (!input_dev) { | ||
98 | dev_err(&pdev->dev, "Failed to allocate memory\n"); | ||
99 | return -ENOMEM; | ||
100 | } | ||
101 | |||
102 | onkey->input = input_dev; | ||
103 | onkey->da9055 = da9055; | ||
104 | input_dev->name = "da9055-onkey"; | ||
105 | input_dev->phys = "da9055-onkey/input0"; | ||
106 | input_dev->dev.parent = &pdev->dev; | ||
107 | |||
108 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | ||
109 | __set_bit(KEY_POWER, input_dev->keybit); | ||
110 | |||
111 | INIT_DELAYED_WORK(&onkey->work, da9055_onkey_work); | ||
112 | |||
113 | irq = regmap_irq_get_virq(da9055->irq_data, irq); | ||
114 | err = request_threaded_irq(irq, NULL, da9055_onkey_irq, | ||
115 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, | ||
116 | "ONKEY", onkey); | ||
117 | if (err < 0) { | ||
118 | dev_err(&pdev->dev, | ||
119 | "Failed to register ONKEY IRQ %d, error = %d\n", | ||
120 | irq, err); | ||
121 | goto err_free_input; | ||
122 | } | ||
123 | |||
124 | err = input_register_device(input_dev); | ||
125 | if (err) { | ||
126 | dev_err(&pdev->dev, "Unable to register input device, %d\n", | ||
127 | err); | ||
128 | goto err_free_irq; | ||
129 | } | ||
130 | |||
131 | platform_set_drvdata(pdev, onkey); | ||
132 | |||
133 | return 0; | ||
134 | |||
135 | err_free_irq: | ||
136 | free_irq(irq, onkey); | ||
137 | cancel_delayed_work_sync(&onkey->work); | ||
138 | err_free_input: | ||
139 | input_free_device(input_dev); | ||
140 | |||
141 | return err; | ||
142 | } | ||
143 | |||
144 | static int __devexit da9055_onkey_remove(struct platform_device *pdev) | ||
145 | { | ||
146 | struct da9055_onkey *onkey = platform_get_drvdata(pdev); | ||
147 | int irq = platform_get_irq_byname(pdev, "ONKEY"); | ||
148 | |||
149 | irq = regmap_irq_get_virq(onkey->da9055->irq_data, irq); | ||
150 | free_irq(irq, onkey); | ||
151 | cancel_delayed_work_sync(&onkey->work); | ||
152 | input_unregister_device(onkey->input); | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | static struct platform_driver da9055_onkey_driver = { | ||
158 | .probe = da9055_onkey_probe, | ||
159 | .remove = __devexit_p(da9055_onkey_remove), | ||
160 | .driver = { | ||
161 | .name = "da9055-onkey", | ||
162 | .owner = THIS_MODULE, | ||
163 | }, | ||
164 | }; | ||
165 | |||
166 | module_platform_driver(da9055_onkey_driver); | ||
167 | |||
168 | MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>"); | ||
169 | MODULE_DESCRIPTION("Onkey driver for DA9055"); | ||
170 | MODULE_LICENSE("GPL"); | ||
171 | MODULE_ALIAS("platform:da9055-onkey"); | ||
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c index fc84c8a5114..502544c7e0a 100644 --- a/drivers/input/misc/pwm-beeper.c +++ b/drivers/input/misc/pwm-beeper.c | |||
@@ -75,7 +75,11 @@ static int __devinit pwm_beeper_probe(struct platform_device *pdev) | |||
75 | if (!beeper) | 75 | if (!beeper) |
76 | return -ENOMEM; | 76 | return -ENOMEM; |
77 | 77 | ||
78 | beeper->pwm = pwm_request(pwm_id, "pwm beeper"); | 78 | beeper->pwm = pwm_get(&pdev->dev, NULL); |
79 | if (IS_ERR(beeper->pwm)) { | ||
80 | dev_dbg(&pdev->dev, "unable to request PWM, trying legacy API\n"); | ||
81 | beeper->pwm = pwm_request(pwm_id, "pwm beeper"); | ||
82 | } | ||
79 | 83 | ||
80 | if (IS_ERR(beeper->pwm)) { | 84 | if (IS_ERR(beeper->pwm)) { |
81 | error = PTR_ERR(beeper->pwm); | 85 | error = PTR_ERR(beeper->pwm); |
@@ -171,6 +175,13 @@ static SIMPLE_DEV_PM_OPS(pwm_beeper_pm_ops, | |||
171 | #define PWM_BEEPER_PM_OPS NULL | 175 | #define PWM_BEEPER_PM_OPS NULL |
172 | #endif | 176 | #endif |
173 | 177 | ||
178 | #ifdef CONFIG_OF | ||
179 | static const struct of_device_id pwm_beeper_match[] = { | ||
180 | { .compatible = "pwm-beeper", }, | ||
181 | { }, | ||
182 | }; | ||
183 | #endif | ||
184 | |||
174 | static struct platform_driver pwm_beeper_driver = { | 185 | static struct platform_driver pwm_beeper_driver = { |
175 | .probe = pwm_beeper_probe, | 186 | .probe = pwm_beeper_probe, |
176 | .remove = __devexit_p(pwm_beeper_remove), | 187 | .remove = __devexit_p(pwm_beeper_remove), |
@@ -178,6 +189,7 @@ static struct platform_driver pwm_beeper_driver = { | |||
178 | .name = "pwm-beeper", | 189 | .name = "pwm-beeper", |
179 | .owner = THIS_MODULE, | 190 | .owner = THIS_MODULE, |
180 | .pm = PWM_BEEPER_PM_OPS, | 191 | .pm = PWM_BEEPER_PM_OPS, |
192 | .of_match_table = of_match_ptr(pwm_beeper_match), | ||
181 | }, | 193 | }, |
182 | }; | 194 | }; |
183 | module_platform_driver(pwm_beeper_driver); | 195 | module_platform_driver(pwm_beeper_driver); |
diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c index 6790a812a1d..fa8b3900d98 100644 --- a/drivers/input/misc/wm831x-on.c +++ b/drivers/input/misc/wm831x-on.c | |||
@@ -76,7 +76,8 @@ static int __devinit wm831x_on_probe(struct platform_device *pdev) | |||
76 | int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); | 76 | int irq = wm831x_irq(wm831x, platform_get_irq(pdev, 0)); |
77 | int ret; | 77 | int ret; |
78 | 78 | ||
79 | wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); | 79 | wm831x_on = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_on), |
80 | GFP_KERNEL); | ||
80 | if (!wm831x_on) { | 81 | if (!wm831x_on) { |
81 | dev_err(&pdev->dev, "Can't allocate data\n"); | 82 | dev_err(&pdev->dev, "Can't allocate data\n"); |
82 | return -ENOMEM; | 83 | return -ENOMEM; |
@@ -120,7 +121,6 @@ err_irq: | |||
120 | err_input_dev: | 121 | err_input_dev: |
121 | input_free_device(wm831x_on->dev); | 122 | input_free_device(wm831x_on->dev); |
122 | err: | 123 | err: |
123 | kfree(wm831x_on); | ||
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
126 | 126 | ||
@@ -132,7 +132,6 @@ static int __devexit wm831x_on_remove(struct platform_device *pdev) | |||
132 | free_irq(irq, wm831x_on); | 132 | free_irq(irq, wm831x_on); |
133 | cancel_delayed_work_sync(&wm831x_on->work); | 133 | cancel_delayed_work_sync(&wm831x_on->work); |
134 | input_unregister_device(wm831x_on->dev); | 134 | input_unregister_device(wm831x_on->dev); |
135 | kfree(wm831x_on); | ||
136 | 135 | ||
137 | return 0; | 136 | return 0; |
138 | } | 137 | } |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index cf5af1f495e..e229fa3cad9 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -767,9 +767,8 @@ static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse) | |||
767 | psmouse->packet[5]) & 0x80) || | 767 | psmouse->packet[5]) & 0x80) || |
768 | (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) { | 768 | (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) { |
769 | psmouse_dbg(psmouse, | 769 | psmouse_dbg(psmouse, |
770 | "refusing packet %x %x %x %x (suspected interleaved ps/2)\n", | 770 | "refusing packet %4ph (suspected interleaved ps/2)\n", |
771 | psmouse->packet[3], psmouse->packet[4], | 771 | psmouse->packet + 3); |
772 | psmouse->packet[5], psmouse->packet[6]); | ||
773 | return PSMOUSE_BAD_DATA; | 772 | return PSMOUSE_BAD_DATA; |
774 | } | 773 | } |
775 | 774 | ||
@@ -831,9 +830,8 @@ static void alps_flush_packet(unsigned long data) | |||
831 | psmouse->packet[4] | | 830 | psmouse->packet[4] | |
832 | psmouse->packet[5]) & 0x80) { | 831 | psmouse->packet[5]) & 0x80) { |
833 | psmouse_dbg(psmouse, | 832 | psmouse_dbg(psmouse, |
834 | "refusing packet %x %x %x (suspected interleaved ps/2)\n", | 833 | "refusing packet %3ph (suspected interleaved ps/2)\n", |
835 | psmouse->packet[3], psmouse->packet[4], | 834 | psmouse->packet + 3); |
836 | psmouse->packet[5]); | ||
837 | } else { | 835 | } else { |
838 | alps_process_packet(psmouse); | 836 | alps_process_packet(psmouse); |
839 | } | 837 | } |
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index 55f2c2293ec..4a4e182c33e 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
@@ -234,4 +234,13 @@ config SERIO_PS2MULT | |||
234 | To compile this driver as a module, choose M here: the | 234 | To compile this driver as a module, choose M here: the |
235 | module will be called ps2mult. | 235 | module will be called ps2mult. |
236 | 236 | ||
237 | config SERIO_ARC_PS2 | ||
238 | tristate "ARC PS/2 support" | ||
239 | help | ||
240 | Say Y here if you have an ARC FPGA platform with a PS/2 | ||
241 | controller in it. | ||
242 | |||
243 | To compile this driver as a module, choose M here; the module | ||
244 | will be called arc_ps2. | ||
245 | |||
237 | endif | 246 | endif |
diff --git a/drivers/input/serio/Makefile b/drivers/input/serio/Makefile index dbbe37616c9..4b0c8f84f1c 100644 --- a/drivers/input/serio/Makefile +++ b/drivers/input/serio/Makefile | |||
@@ -25,3 +25,4 @@ obj-$(CONFIG_SERIO_RAW) += serio_raw.o | |||
25 | obj-$(CONFIG_SERIO_AMS_DELTA) += ams_delta_serio.o | 25 | obj-$(CONFIG_SERIO_AMS_DELTA) += ams_delta_serio.o |
26 | obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o | 26 | obj-$(CONFIG_SERIO_XILINX_XPS_PS2) += xilinx_ps2.o |
27 | obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o | 27 | obj-$(CONFIG_SERIO_ALTERA_PS2) += altera_ps2.o |
28 | obj-$(CONFIG_SERIO_ARC_PS2) += arc_ps2.o | ||
diff --git a/drivers/input/serio/arc_ps2.c b/drivers/input/serio/arc_ps2.c new file mode 100644 index 00000000000..89ad7631848 --- /dev/null +++ b/drivers/input/serio/arc_ps2.c | |||
@@ -0,0 +1,274 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License version 2 as | ||
6 | * published by the Free Software Foundation. | ||
7 | * | ||
8 | * Driver is originally developed by Pavel Sokolov <psokolov@synopsys.com> | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/interrupt.h> | ||
13 | #include <linux/input.h> | ||
14 | #include <linux/serio.h> | ||
15 | #include <linux/platform_device.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/kernel.h> | ||
18 | #include <linux/slab.h> | ||
19 | |||
20 | #define ARC_PS2_PORTS 2 | ||
21 | |||
22 | #define ARC_ARC_PS2_ID 0x0001f609 | ||
23 | |||
24 | #define STAT_TIMEOUT 128 | ||
25 | |||
26 | #define PS2_STAT_RX_FRM_ERR (1) | ||
27 | #define PS2_STAT_RX_BUF_OVER (1 << 1) | ||
28 | #define PS2_STAT_RX_INT_EN (1 << 2) | ||
29 | #define PS2_STAT_RX_VAL (1 << 3) | ||
30 | #define PS2_STAT_TX_ISNOT_FUL (1 << 4) | ||
31 | #define PS2_STAT_TX_INT_EN (1 << 5) | ||
32 | |||
33 | struct arc_ps2_port { | ||
34 | void __iomem *data_addr; | ||
35 | void __iomem *status_addr; | ||
36 | struct serio *io; | ||
37 | }; | ||
38 | |||
39 | struct arc_ps2_data { | ||
40 | struct arc_ps2_port port[ARC_PS2_PORTS]; | ||
41 | void __iomem *addr; | ||
42 | unsigned int frame_error; | ||
43 | unsigned int buf_overflow; | ||
44 | unsigned int total_int; | ||
45 | }; | ||
46 | |||
47 | static void arc_ps2_check_rx(struct arc_ps2_data *arc_ps2, | ||
48 | struct arc_ps2_port *port) | ||
49 | { | ||
50 | unsigned int timeout = 1000; | ||
51 | unsigned int flag, status; | ||
52 | unsigned char data; | ||
53 | |||
54 | do { | ||
55 | status = ioread32(port->status_addr); | ||
56 | if (!(status & PS2_STAT_RX_VAL)) | ||
57 | return; | ||
58 | |||
59 | data = ioread32(port->data_addr) & 0xff; | ||
60 | |||
61 | flag = 0; | ||
62 | arc_ps2->total_int++; | ||
63 | if (status & PS2_STAT_RX_FRM_ERR) { | ||
64 | arc_ps2->frame_error++; | ||
65 | flag |= SERIO_PARITY; | ||
66 | } else if (status & PS2_STAT_RX_BUF_OVER) { | ||
67 | arc_ps2->buf_overflow++; | ||
68 | flag |= SERIO_FRAME; | ||
69 | } | ||
70 | |||
71 | serio_interrupt(port->io, data, flag); | ||
72 | } while (--timeout); | ||
73 | |||
74 | dev_err(&port->io->dev, "PS/2 hardware stuck\n"); | ||
75 | } | ||
76 | |||
77 | static irqreturn_t arc_ps2_interrupt(int irq, void *dev) | ||
78 | { | ||
79 | struct arc_ps2_data *arc_ps2 = dev; | ||
80 | int i; | ||
81 | |||
82 | for (i = 0; i < ARC_PS2_PORTS; i++) | ||
83 | arc_ps2_check_rx(arc_ps2, &arc_ps2->port[i]); | ||
84 | |||
85 | return IRQ_HANDLED; | ||
86 | } | ||
87 | |||
88 | static int arc_ps2_write(struct serio *io, unsigned char val) | ||
89 | { | ||
90 | unsigned status; | ||
91 | struct arc_ps2_port *port = io->port_data; | ||
92 | int timeout = STAT_TIMEOUT; | ||
93 | |||
94 | do { | ||
95 | status = ioread32(port->status_addr); | ||
96 | cpu_relax(); | ||
97 | |||
98 | if (status & PS2_STAT_TX_ISNOT_FUL) { | ||
99 | iowrite32(val & 0xff, port->data_addr); | ||
100 | return 0; | ||
101 | } | ||
102 | |||
103 | } while (--timeout); | ||
104 | |||
105 | dev_err(&io->dev, "write timeout\n"); | ||
106 | return -ETIMEDOUT; | ||
107 | } | ||
108 | |||
109 | static int arc_ps2_open(struct serio *io) | ||
110 | { | ||
111 | struct arc_ps2_port *port = io->port_data; | ||
112 | |||
113 | iowrite32(PS2_STAT_RX_INT_EN, port->status_addr); | ||
114 | |||
115 | return 0; | ||
116 | } | ||
117 | |||
118 | static void arc_ps2_close(struct serio *io) | ||
119 | { | ||
120 | struct arc_ps2_port *port = io->port_data; | ||
121 | |||
122 | iowrite32(ioread32(port->status_addr) & ~PS2_STAT_RX_INT_EN, | ||
123 | port->status_addr); | ||
124 | } | ||
125 | |||
126 | static void __iomem * __devinit arc_ps2_calc_addr(struct arc_ps2_data *arc_ps2, | ||
127 | int index, bool status) | ||
128 | { | ||
129 | void __iomem *addr; | ||
130 | |||
131 | addr = arc_ps2->addr + 4 + 4 * index; | ||
132 | if (status) | ||
133 | addr += ARC_PS2_PORTS * 4; | ||
134 | |||
135 | return addr; | ||
136 | } | ||
137 | |||
138 | static void __devinit arc_ps2_inhibit_ports(struct arc_ps2_data *arc_ps2) | ||
139 | { | ||
140 | void __iomem *addr; | ||
141 | u32 val; | ||
142 | int i; | ||
143 | |||
144 | for (i = 0; i < ARC_PS2_PORTS; i++) { | ||
145 | addr = arc_ps2_calc_addr(arc_ps2, i, true); | ||
146 | val = ioread32(addr); | ||
147 | val &= ~(PS2_STAT_RX_INT_EN | PS2_STAT_TX_INT_EN); | ||
148 | iowrite32(val, addr); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | static int __devinit arc_ps2_create_port(struct platform_device *pdev, | ||
153 | struct arc_ps2_data *arc_ps2, | ||
154 | int index) | ||
155 | { | ||
156 | struct arc_ps2_port *port = &arc_ps2->port[index]; | ||
157 | struct serio *io; | ||
158 | |||
159 | io = kzalloc(sizeof(struct serio), GFP_KERNEL); | ||
160 | if (!io) | ||
161 | return -ENOMEM; | ||
162 | |||
163 | io->id.type = SERIO_8042; | ||
164 | io->write = arc_ps2_write; | ||
165 | io->open = arc_ps2_open; | ||
166 | io->close = arc_ps2_close; | ||
167 | snprintf(io->name, sizeof(io->name), "ARC PS/2 port%d", index); | ||
168 | snprintf(io->phys, sizeof(io->phys), "arc/serio%d", index); | ||
169 | io->port_data = port; | ||
170 | |||
171 | port->io = io; | ||
172 | |||
173 | port->data_addr = arc_ps2_calc_addr(arc_ps2, index, false); | ||
174 | port->status_addr = arc_ps2_calc_addr(arc_ps2, index, true); | ||
175 | |||
176 | dev_dbg(&pdev->dev, "port%d is allocated (data = 0x%p, status = 0x%p)\n", | ||
177 | index, port->data_addr, port->status_addr); | ||
178 | |||
179 | serio_register_port(port->io); | ||
180 | return 0; | ||
181 | } | ||
182 | |||
183 | static int __devinit arc_ps2_probe(struct platform_device *pdev) | ||
184 | { | ||
185 | struct arc_ps2_data *arc_ps2; | ||
186 | struct resource *res; | ||
187 | int irq; | ||
188 | int error, id, i; | ||
189 | |||
190 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
191 | if (!res) { | ||
192 | dev_err(&pdev->dev, "no IO memory defined\n"); | ||
193 | return -EINVAL; | ||
194 | } | ||
195 | |||
196 | irq = platform_get_irq_byname(pdev, "arc_ps2_irq"); | ||
197 | if (irq < 0) { | ||
198 | dev_err(&pdev->dev, "no IRQ defined\n"); | ||
199 | return -EINVAL; | ||
200 | } | ||
201 | |||
202 | arc_ps2 = devm_kzalloc(&pdev->dev, sizeof(struct arc_ps2_data), | ||
203 | GFP_KERNEL); | ||
204 | if (!arc_ps2) { | ||
205 | dev_err(&pdev->dev, "out of memory\n"); | ||
206 | return -ENOMEM; | ||
207 | } | ||
208 | |||
209 | arc_ps2->addr = devm_request_and_ioremap(&pdev->dev, res); | ||
210 | if (!arc_ps2->addr) | ||
211 | return -EBUSY; | ||
212 | |||
213 | dev_info(&pdev->dev, "irq = %d, address = 0x%p, ports = %i\n", | ||
214 | irq, arc_ps2->addr, ARC_PS2_PORTS); | ||
215 | |||
216 | id = ioread32(arc_ps2->addr); | ||
217 | if (id != ARC_ARC_PS2_ID) { | ||
218 | dev_err(&pdev->dev, "device id does not match\n"); | ||
219 | return -ENXIO; | ||
220 | } | ||
221 | |||
222 | arc_ps2_inhibit_ports(arc_ps2); | ||
223 | |||
224 | error = devm_request_irq(&pdev->dev, irq, arc_ps2_interrupt, | ||
225 | 0, "arc_ps2", arc_ps2); | ||
226 | if (error) { | ||
227 | dev_err(&pdev->dev, "Could not allocate IRQ\n"); | ||
228 | return error; | ||
229 | } | ||
230 | |||
231 | for (i = 0; i < ARC_PS2_PORTS; i++) { | ||
232 | error = arc_ps2_create_port(pdev, arc_ps2, i); | ||
233 | if (error) { | ||
234 | while (--i >= 0) | ||
235 | serio_unregister_port(arc_ps2->port[i].io); | ||
236 | return error; | ||
237 | } | ||
238 | } | ||
239 | |||
240 | platform_set_drvdata(pdev, arc_ps2); | ||
241 | |||
242 | return 0; | ||
243 | } | ||
244 | |||
245 | static int __devexit arc_ps2_remove(struct platform_device *pdev) | ||
246 | { | ||
247 | struct arc_ps2_data *arc_ps2 = platform_get_drvdata(pdev); | ||
248 | int i; | ||
249 | |||
250 | for (i = 0; i < ARC_PS2_PORTS; i++) | ||
251 | serio_unregister_port(arc_ps2->port[i].io); | ||
252 | |||
253 | dev_dbg(&pdev->dev, "interrupt count = %i\n", arc_ps2->total_int); | ||
254 | dev_dbg(&pdev->dev, "frame error count = %i\n", arc_ps2->frame_error); | ||
255 | dev_dbg(&pdev->dev, "buffer overflow count = %i\n", | ||
256 | arc_ps2->buf_overflow); | ||
257 | |||
258 | return 0; | ||
259 | } | ||
260 | |||
261 | static struct platform_driver arc_ps2_driver = { | ||
262 | .driver = { | ||
263 | .name = "arc_ps2", | ||
264 | .owner = THIS_MODULE, | ||
265 | }, | ||
266 | .probe = arc_ps2_probe, | ||
267 | .remove = __devexit_p(arc_ps2_remove), | ||
268 | }; | ||
269 | |||
270 | module_platform_driver(arc_ps2_driver); | ||
271 | |||
272 | MODULE_LICENSE("GPL"); | ||
273 | MODULE_AUTHOR("Pavel Sokolov <psokolov@synopsys.com>"); | ||
274 | MODULE_DESCRIPTION("ARC PS/2 Driver"); | ||
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h index 5d48bb66aa7..a5eed2ade53 100644 --- a/drivers/input/serio/i8042-io.h +++ b/drivers/input/serio/i8042-io.h | |||
@@ -76,7 +76,7 @@ static inline int i8042_platform_init(void) | |||
76 | if (check_legacy_ioport(I8042_DATA_REG)) | 76 | if (check_legacy_ioport(I8042_DATA_REG)) |
77 | return -ENODEV; | 77 | return -ENODEV; |
78 | #endif | 78 | #endif |
79 | #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) | 79 | #if !defined(__sh__) && !defined(__alpha__) |
80 | if (!request_region(I8042_DATA_REG, 16, "i8042")) | 80 | if (!request_region(I8042_DATA_REG, 16, "i8042")) |
81 | return -EBUSY; | 81 | return -EBUSY; |
82 | #endif | 82 | #endif |
diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 464f1bf4b61..ad6a6640f38 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c | |||
@@ -99,9 +99,18 @@ static int cy8ctmg110_read_regs(struct cy8ctmg110 *tsc, | |||
99 | int ret; | 99 | int ret; |
100 | struct i2c_msg msg[2] = { | 100 | struct i2c_msg msg[2] = { |
101 | /* first write slave position to i2c devices */ | 101 | /* first write slave position to i2c devices */ |
102 | { client->addr, 0, 1, &cmd }, | 102 | { |
103 | .addr = client->addr, | ||
104 | .len = 1, | ||
105 | .buf = &cmd | ||
106 | }, | ||
103 | /* Second read data from position */ | 107 | /* Second read data from position */ |
104 | { client->addr, I2C_M_RD, len, data } | 108 | { |
109 | .addr = client->addr, | ||
110 | .flags = I2C_M_RD, | ||
111 | .len = len, | ||
112 | .buf = data | ||
113 | } | ||
105 | }; | 114 | }; |
106 | 115 | ||
107 | ret = i2c_transfer(client->adapter, msg, 2); | 116 | ret = i2c_transfer(client->adapter, msg, 2); |
diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 099d144ab7c..d9c6007e445 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c | |||
@@ -491,14 +491,6 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode) | |||
491 | DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get, | 491 | DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get, |
492 | edt_ft5x06_debugfs_mode_set, "%llu\n"); | 492 | edt_ft5x06_debugfs_mode_set, "%llu\n"); |
493 | 493 | ||
494 | static int edt_ft5x06_debugfs_raw_data_open(struct inode *inode, | ||
495 | struct file *file) | ||
496 | { | ||
497 | file->private_data = inode->i_private; | ||
498 | |||
499 | return 0; | ||
500 | } | ||
501 | |||
502 | static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, | 494 | static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, |
503 | char __user *buf, size_t count, loff_t *off) | 495 | char __user *buf, size_t count, loff_t *off) |
504 | { | 496 | { |
@@ -579,7 +571,7 @@ out: | |||
579 | 571 | ||
580 | 572 | ||
581 | static const struct file_operations debugfs_raw_data_fops = { | 573 | static const struct file_operations debugfs_raw_data_fops = { |
582 | .open = edt_ft5x06_debugfs_raw_data_open, | 574 | .open = simple_open, |
583 | .read = edt_ft5x06_debugfs_raw_data_read, | 575 | .read = edt_ft5x06_debugfs_raw_data_read, |
584 | }; | 576 | }; |
585 | 577 | ||
diff --git a/drivers/input/touchscreen/mms114.c b/drivers/input/touchscreen/mms114.c index 560cf09d1c5..3426d2e11a3 100644 --- a/drivers/input/touchscreen/mms114.c +++ b/drivers/input/touchscreen/mms114.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/module.h> | 10 | #include <linux/module.h> |
11 | #include <linux/init.h> | 11 | #include <linux/init.h> |
12 | #include <linux/delay.h> | 12 | #include <linux/delay.h> |
13 | #include <linux/of.h> | ||
13 | #include <linux/i2c.h> | 14 | #include <linux/i2c.h> |
14 | #include <linux/i2c/mms114.h> | 15 | #include <linux/i2c/mms114.h> |
15 | #include <linux/input/mt.h> | 16 | #include <linux/input/mt.h> |
@@ -360,14 +361,63 @@ static void mms114_input_close(struct input_dev *dev) | |||
360 | mms114_stop(data); | 361 | mms114_stop(data); |
361 | } | 362 | } |
362 | 363 | ||
364 | #ifdef CONFIG_OF | ||
365 | static struct mms114_platform_data * __devinit mms114_parse_dt(struct device *dev) | ||
366 | { | ||
367 | struct mms114_platform_data *pdata; | ||
368 | struct device_node *np = dev->of_node; | ||
369 | |||
370 | if (!np) | ||
371 | return NULL; | ||
372 | |||
373 | pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); | ||
374 | if (!pdata) { | ||
375 | dev_err(dev, "failed to allocate platform data\n"); | ||
376 | return NULL; | ||
377 | } | ||
378 | |||
379 | if (of_property_read_u32(np, "x-size", &pdata->x_size)) { | ||
380 | dev_err(dev, "failed to get x-size property\n"); | ||
381 | return NULL; | ||
382 | }; | ||
383 | |||
384 | if (of_property_read_u32(np, "y-size", &pdata->y_size)) { | ||
385 | dev_err(dev, "failed to get y-size property\n"); | ||
386 | return NULL; | ||
387 | }; | ||
388 | |||
389 | of_property_read_u32(np, "contact-threshold", | ||
390 | &pdata->contact_threshold); | ||
391 | of_property_read_u32(np, "moving-threshold", | ||
392 | &pdata->moving_threshold); | ||
393 | |||
394 | if (of_find_property(np, "x-invert", NULL)) | ||
395 | pdata->x_invert = true; | ||
396 | if (of_find_property(np, "y-invert", NULL)) | ||
397 | pdata->y_invert = true; | ||
398 | |||
399 | return pdata; | ||
400 | } | ||
401 | #else | ||
402 | static inline struct mms114_platform_data *mms114_parse_dt(struct device *dev) | ||
403 | { | ||
404 | return NULL; | ||
405 | } | ||
406 | #endif | ||
407 | |||
363 | static int __devinit mms114_probe(struct i2c_client *client, | 408 | static int __devinit mms114_probe(struct i2c_client *client, |
364 | const struct i2c_device_id *id) | 409 | const struct i2c_device_id *id) |
365 | { | 410 | { |
411 | const struct mms114_platform_data *pdata; | ||
366 | struct mms114_data *data; | 412 | struct mms114_data *data; |
367 | struct input_dev *input_dev; | 413 | struct input_dev *input_dev; |
368 | int error; | 414 | int error; |
369 | 415 | ||
370 | if (!client->dev.platform_data) { | 416 | pdata = dev_get_platdata(&client->dev); |
417 | if (!pdata) | ||
418 | pdata = mms114_parse_dt(&client->dev); | ||
419 | |||
420 | if (!pdata) { | ||
371 | dev_err(&client->dev, "Need platform data\n"); | 421 | dev_err(&client->dev, "Need platform data\n"); |
372 | return -EINVAL; | 422 | return -EINVAL; |
373 | } | 423 | } |
@@ -389,7 +439,7 @@ static int __devinit mms114_probe(struct i2c_client *client, | |||
389 | 439 | ||
390 | data->client = client; | 440 | data->client = client; |
391 | data->input_dev = input_dev; | 441 | data->input_dev = input_dev; |
392 | data->pdata = client->dev.platform_data; | 442 | data->pdata = pdata; |
393 | 443 | ||
394 | input_dev->name = "MELPAS MMS114 Touchscreen"; | 444 | input_dev->name = "MELPAS MMS114 Touchscreen"; |
395 | input_dev->id.bustype = BUS_I2C; | 445 | input_dev->id.bustype = BUS_I2C; |
@@ -525,11 +575,19 @@ static const struct i2c_device_id mms114_id[] = { | |||
525 | }; | 575 | }; |
526 | MODULE_DEVICE_TABLE(i2c, mms114_id); | 576 | MODULE_DEVICE_TABLE(i2c, mms114_id); |
527 | 577 | ||
578 | #ifdef CONFIG_OF | ||
579 | static struct of_device_id __devinitdata mms114_dt_match[] = { | ||
580 | { .compatible = "melfas,mms114" }, | ||
581 | { } | ||
582 | }; | ||
583 | #endif | ||
584 | |||
528 | static struct i2c_driver mms114_driver = { | 585 | static struct i2c_driver mms114_driver = { |
529 | .driver = { | 586 | .driver = { |
530 | .name = "mms114", | 587 | .name = "mms114", |
531 | .owner = THIS_MODULE, | 588 | .owner = THIS_MODULE, |
532 | .pm = &mms114_pm_ops, | 589 | .pm = &mms114_pm_ops, |
590 | .of_match_table = of_match_ptr(mms114_dt_match), | ||
533 | }, | 591 | }, |
534 | .probe = mms114_probe, | 592 | .probe = mms114_probe, |
535 | .remove = __devexit_p(mms114_remove), | 593 | .remove = __devexit_p(mms114_remove), |
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index 52abb98a8ae..c7eee56d008 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c | |||
@@ -245,7 +245,8 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev) | |||
245 | if (core_pdata) | 245 | if (core_pdata) |
246 | pdata = core_pdata->touch; | 246 | pdata = core_pdata->touch; |
247 | 247 | ||
248 | wm831x_ts = kzalloc(sizeof(struct wm831x_ts), GFP_KERNEL); | 248 | wm831x_ts = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ts), |
249 | GFP_KERNEL); | ||
249 | input_dev = input_allocate_device(); | 250 | input_dev = input_allocate_device(); |
250 | if (!wm831x_ts || !input_dev) { | 251 | if (!wm831x_ts || !input_dev) { |
251 | error = -ENOMEM; | 252 | error = -ENOMEM; |
@@ -376,7 +377,6 @@ err_data_irq: | |||
376 | free_irq(wm831x_ts->data_irq, wm831x_ts); | 377 | free_irq(wm831x_ts->data_irq, wm831x_ts); |
377 | err_alloc: | 378 | err_alloc: |
378 | input_free_device(input_dev); | 379 | input_free_device(input_dev); |
379 | kfree(wm831x_ts); | ||
380 | 380 | ||
381 | return error; | 381 | return error; |
382 | } | 382 | } |
@@ -388,9 +388,7 @@ static __devexit int wm831x_ts_remove(struct platform_device *pdev) | |||
388 | free_irq(wm831x_ts->pd_irq, wm831x_ts); | 388 | free_irq(wm831x_ts->pd_irq, wm831x_ts); |
389 | free_irq(wm831x_ts->data_irq, wm831x_ts); | 389 | free_irq(wm831x_ts->data_irq, wm831x_ts); |
390 | input_unregister_device(wm831x_ts->input_dev); | 390 | input_unregister_device(wm831x_ts->input_dev); |
391 | kfree(wm831x_ts); | ||
392 | 391 | ||
393 | platform_set_drvdata(pdev, NULL); | ||
394 | return 0; | 392 | return 0; |
395 | } | 393 | } |
396 | 394 | ||