aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/touchscreen/egalax_ts.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/touchscreen/egalax_ts.c')
-rw-r--r--drivers/input/touchscreen/egalax_ts.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/egalax_ts.c b/drivers/input/touchscreen/egalax_ts.c
index c1e3460f119..13fa62fdfb0 100644
--- a/drivers/input/touchscreen/egalax_ts.c
+++ b/drivers/input/touchscreen/egalax_ts.c
@@ -28,6 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/bitops.h> 29#include <linux/bitops.h>
30#include <linux/input/mt.h> 30#include <linux/input/mt.h>
31#include <linux/of_gpio.h>
31 32
32/* 33/*
33 * Mouse Mode: some panel may configure the controller to mouse mode, 34 * Mouse Mode: some panel may configure the controller to mouse mode,
@@ -122,9 +123,17 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id)
122/* wake up controller by an falling edge of interrupt gpio. */ 123/* wake up controller by an falling edge of interrupt gpio. */
123static int egalax_wake_up_device(struct i2c_client *client) 124static int egalax_wake_up_device(struct i2c_client *client)
124{ 125{
125 int gpio = irq_to_gpio(client->irq); 126 struct device_node *np = client->dev.of_node;
127 int gpio;
126 int ret; 128 int ret;
127 129
130 if (!np)
131 return -ENODEV;
132
133 gpio = of_get_named_gpio(np, "wakeup-gpios", 0);
134 if (!gpio_is_valid(gpio))
135 return -ENODEV;
136
128 ret = gpio_request(gpio, "egalax_irq"); 137 ret = gpio_request(gpio, "egalax_irq");
129 if (ret < 0) { 138 if (ret < 0) {
130 dev_err(&client->dev, 139 dev_err(&client->dev,
@@ -181,7 +190,11 @@ static int __devinit egalax_ts_probe(struct i2c_client *client,
181 ts->input_dev = input_dev; 190 ts->input_dev = input_dev;
182 191
183 /* controller may be in sleep, wake it up. */ 192 /* controller may be in sleep, wake it up. */
184 egalax_wake_up_device(client); 193 error = egalax_wake_up_device(client);
194 if (error) {
195 dev_err(&client->dev, "Failed to wake up the controller\n");
196 goto err_free_dev;
197 }
185 198
186 ret = egalax_firmware_version(client); 199 ret = egalax_firmware_version(client);
187 if (ret < 0) { 200 if (ret < 0) {
@@ -274,11 +287,17 @@ static int egalax_ts_resume(struct device *dev)
274 287
275static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); 288static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume);
276 289
290static struct of_device_id egalax_ts_dt_ids[] = {
291 { .compatible = "eeti,egalax_ts" },
292 { /* sentinel */ }
293};
294
277static struct i2c_driver egalax_ts_driver = { 295static struct i2c_driver egalax_ts_driver = {
278 .driver = { 296 .driver = {
279 .name = "egalax_ts", 297 .name = "egalax_ts",
280 .owner = THIS_MODULE, 298 .owner = THIS_MODULE,
281 .pm = &egalax_ts_pm_ops, 299 .pm = &egalax_ts_pm_ops,
300 .of_match_table = of_match_ptr(egalax_ts_dt_ids),
282 }, 301 },
283 .id_table = egalax_ts_id, 302 .id_table = egalax_ts_id,
284 .probe = egalax_ts_probe, 303 .probe = egalax_ts_probe,