egalax_ts.c (ef8c029fa793423439e67ef0416b220d3fa3321a) | egalax_ts.c (ae495e844a77344fdaedbb2ad97d925d096e9f0d) |
---|---|
1/* 2 * Driver for EETI eGalax Multiple Touch Controller 3 * 4 * Copyright (C) 2011 Freescale Semiconductor, Inc. 5 * 6 * based on max11801_ts.c 7 * 8 * This program is free software; you can redistribute it and/or modify --- 14 unchanged lines hidden (view full) --- 23#include <linux/interrupt.h> 24#include <linux/input.h> 25#include <linux/irq.h> 26#include <linux/gpio.h> 27#include <linux/delay.h> 28#include <linux/slab.h> 29#include <linux/bitops.h> 30#include <linux/input/mt.h> | 1/* 2 * Driver for EETI eGalax Multiple Touch Controller 3 * 4 * Copyright (C) 2011 Freescale Semiconductor, Inc. 5 * 6 * based on max11801_ts.c 7 * 8 * This program is free software; you can redistribute it and/or modify --- 14 unchanged lines hidden (view full) --- 23#include <linux/interrupt.h> 24#include <linux/input.h> 25#include <linux/irq.h> 26#include <linux/gpio.h> 27#include <linux/delay.h> 28#include <linux/slab.h> 29#include <linux/bitops.h> 30#include <linux/input/mt.h> |
31#include <linux/of_gpio.h> |
|
31 32/* 33 * Mouse Mode: some panel may configure the controller to mouse mode, 34 * which can only report one point at a given time. 35 * This driver will ignore events in this mode. 36 */ 37#define REPORT_MODE_MOUSE 0x1 38/* --- 78 unchanged lines hidden (view full) --- 117 input_sync(input_dev); 118 119 return IRQ_HANDLED; 120} 121 122/* wake up controller by an falling edge of interrupt gpio. */ 123static int egalax_wake_up_device(struct i2c_client *client) 124{ | 32 33/* 34 * Mouse Mode: some panel may configure the controller to mouse mode, 35 * which can only report one point at a given time. 36 * This driver will ignore events in this mode. 37 */ 38#define REPORT_MODE_MOUSE 0x1 39/* --- 78 unchanged lines hidden (view full) --- 118 input_sync(input_dev); 119 120 return IRQ_HANDLED; 121} 122 123/* wake up controller by an falling edge of interrupt gpio. */ 124static int egalax_wake_up_device(struct i2c_client *client) 125{ |
125 int gpio = irq_to_gpio(client->irq); | 126 struct device_node *np = client->dev.of_node; 127 int gpio; |
126 int ret; 127 | 128 int ret; 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"); 129 if (ret < 0) { 130 dev_err(&client->dev, 131 "request gpio failed, cannot wake up controller: %d\n", 132 ret); 133 return ret; 134 } 135 --- 40 unchanged lines hidden (view full) --- 176 error = -ENOMEM; 177 goto err_free_ts; 178 } 179 180 ts->client = client; 181 ts->input_dev = input_dev; 182 183 /* controller may be in sleep, wake it up. */ | 137 ret = gpio_request(gpio, "egalax_irq"); 138 if (ret < 0) { 139 dev_err(&client->dev, 140 "request gpio failed, cannot wake up controller: %d\n", 141 ret); 142 return ret; 143 } 144 --- 40 unchanged lines hidden (view full) --- 185 error = -ENOMEM; 186 goto err_free_ts; 187 } 188 189 ts->client = client; 190 ts->input_dev = input_dev; 191 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 186 ret = egalax_firmware_version(client); 187 if (ret < 0) { 188 dev_err(&client->dev, "Failed to read firmware version\n"); 189 error = -EIO; 190 goto err_free_dev; 191 } 192 --- 76 unchanged lines hidden (view full) --- 269 struct i2c_client *client = to_i2c_client(dev); 270 271 return egalax_wake_up_device(client); 272} 273#endif 274 275static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); 276 | 198 199 ret = egalax_firmware_version(client); 200 if (ret < 0) { 201 dev_err(&client->dev, "Failed to read firmware version\n"); 202 error = -EIO; 203 goto err_free_dev; 204 } 205 --- 76 unchanged lines hidden (view full) --- 282 struct i2c_client *client = to_i2c_client(dev); 283 284 return egalax_wake_up_device(client); 285} 286#endif 287 288static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume); 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 = { 278 .driver = { 279 .name = "egalax_ts", 280 .owner = THIS_MODULE, 281 .pm = &egalax_ts_pm_ops, | 295static struct i2c_driver egalax_ts_driver = { 296 .driver = { 297 .name = "egalax_ts", 298 .owner = THIS_MODULE, 299 .pm = &egalax_ts_pm_ops, |
300 .of_match_table = of_match_ptr(egalax_ts_dt_ids), |
|
282 }, 283 .id_table = egalax_ts_id, 284 .probe = egalax_ts_probe, 285 .remove = __devexit_p(egalax_ts_remove), 286}; 287 288module_i2c_driver(egalax_ts_driver); 289 290MODULE_AUTHOR("Freescale Semiconductor, Inc."); 291MODULE_DESCRIPTION("Touchscreen driver for EETI eGalax touch controller"); 292MODULE_LICENSE("GPL"); | 301 }, 302 .id_table = egalax_ts_id, 303 .probe = egalax_ts_probe, 304 .remove = __devexit_p(egalax_ts_remove), 305}; 306 307module_i2c_driver(egalax_ts_driver); 308 309MODULE_AUTHOR("Freescale Semiconductor, Inc."); 310MODULE_DESCRIPTION("Touchscreen driver for EETI eGalax touch controller"); 311MODULE_LICENSE("GPL"); |