ad7879.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  1. /*
  2. * AD7879/AD7889 based touchscreen and GPIO driver
  3. *
  4. * Copyright (C) 2008-2010 Michael Hennerich, Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. *
  8. * History:
  9. * Copyright (c) 2005 David Brownell
  10. * Copyright (c) 2006 Nokia Corporation
  11. * Various changes: Imre Deak <imre.deak@nokia.com>
  12. *
  13. * Using code from:
  14. * - corgi_ts.c
  15. * Copyright (C) 2004-2005 Richard Purdie
  16. * - omap_ts.[hc], ads7846.h, ts_osk.c
  17. * Copyright (C) 2002 MontaVista Software
  18. * Copyright (C) 2004 Texas Instruments
  19. * Copyright (C) 2005 Dirk Behme
  20. * - ad7877.c
  21. * Copyright (C) 2006-2008 Analog Devices Inc.
  22. */
  23. #include <linux/device.h>
  24. #include <linux/init.h>
  25. #include <linux/delay.h>
  26. #include <linux/input.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/irq.h>
  29. #include <linux/slab.h>
  30. #include <linux/spi/spi.h>
  31. #include <linux/i2c.h>
  32. #include <linux/gpio.h>
  33. #include <linux/spi/ad7879.h>
  34. #include "ad7879.h"
  35. #define AD7879_REG_ZEROS 0
  36. #define AD7879_REG_CTRL1 1
  37. #define AD7879_REG_CTRL2 2
  38. #define AD7879_REG_CTRL3 3
  39. #define AD7879_REG_AUX1HIGH 4
  40. #define AD7879_REG_AUX1LOW 5
  41. #define AD7879_REG_TEMP1HIGH 6
  42. #define AD7879_REG_TEMP1LOW 7
  43. #define AD7879_REG_XPLUS 8
  44. #define AD7879_REG_YPLUS 9
  45. #define AD7879_REG_Z1 10
  46. #define AD7879_REG_Z2 11
  47. #define AD7879_REG_AUXVBAT 12
  48. #define AD7879_REG_TEMP 13
  49. #define AD7879_REG_REVID 14
  50. /* Control REG 1 */
  51. #define AD7879_TMR(x) ((x & 0xFF) << 0)
  52. #define AD7879_ACQ(x) ((x & 0x3) << 8)
  53. #define AD7879_MODE_NOC (0 << 10) /* Do not convert */
  54. #define AD7879_MODE_SCC (1 << 10) /* Single channel conversion */
  55. #define AD7879_MODE_SEQ0 (2 << 10) /* Sequence 0 in Slave Mode */
  56. #define AD7879_MODE_SEQ1 (3 << 10) /* Sequence 1 in Master Mode */
  57. #define AD7879_MODE_INT (1 << 15) /* PENIRQ disabled INT enabled */
  58. /* Control REG 2 */
  59. #define AD7879_FCD(x) ((x & 0x3) << 0)
  60. #define AD7879_RESET (1 << 4)
  61. #define AD7879_MFS(x) ((x & 0x3) << 5)
  62. #define AD7879_AVG(x) ((x & 0x3) << 7)
  63. #define AD7879_SER (1 << 9) /* non-differential */
  64. #define AD7879_DFR (0 << 9) /* differential */
  65. #define AD7879_GPIOPOL (1 << 10)
  66. #define AD7879_GPIODIR (1 << 11)
  67. #define AD7879_GPIO_DATA (1 << 12)
  68. #define AD7879_GPIO_EN (1 << 13)
  69. #define AD7879_PM(x) ((x & 0x3) << 14)
  70. #define AD7879_PM_SHUTDOWN (0)
  71. #define AD7879_PM_DYN (1)
  72. #define AD7879_PM_FULLON (2)
  73. /* Control REG 3 */
  74. #define AD7879_TEMPMASK_BIT (1<<15)
  75. #define AD7879_AUXVBATMASK_BIT (1<<14)
  76. #define AD7879_INTMODE_BIT (1<<13)
  77. #define AD7879_GPIOALERTMASK_BIT (1<<12)
  78. #define AD7879_AUXLOW_BIT (1<<11)
  79. #define AD7879_AUXHIGH_BIT (1<<10)
  80. #define AD7879_TEMPLOW_BIT (1<<9)
  81. #define AD7879_TEMPHIGH_BIT (1<<8)
  82. #define AD7879_YPLUS_BIT (1<<7)
  83. #define AD7879_XPLUS_BIT (1<<6)
  84. #define AD7879_Z1_BIT (1<<5)
  85. #define AD7879_Z2_BIT (1<<4)
  86. #define AD7879_AUX_BIT (1<<3)
  87. #define AD7879_VBAT_BIT (1<<2)
  88. #define AD7879_TEMP_BIT (1<<1)
  89. enum {
  90. AD7879_SEQ_XPOS = 0,
  91. AD7879_SEQ_YPOS = 1,
  92. AD7879_SEQ_Z1 = 2,
  93. AD7879_SEQ_Z2 = 3,
  94. AD7879_NR_SENSE = 4,
  95. };
  96. #define MAX_12BIT ((1<<12)-1)
  97. #define TS_PEN_UP_TIMEOUT msecs_to_jiffies(50)
  98. struct ad7879 {
  99. const struct ad7879_bus_ops *bops;
  100. struct device *dev;
  101. struct input_dev *input;
  102. struct timer_list timer;
  103. #ifdef CONFIG_GPIOLIB
  104. struct gpio_chip gc;
  105. struct mutex mutex;
  106. #endif
  107. unsigned int irq;
  108. bool disabled; /* P: input->mutex */
  109. bool suspended; /* P: input->mutex */
  110. u16 conversion_data[AD7879_NR_SENSE];
  111. char phys[32];
  112. u8 first_conversion_delay;
  113. u8 acquisition_time;
  114. u8 averaging;
  115. u8 pen_down_acc_interval;
  116. u8 median;
  117. u16 x_plate_ohms;
  118. u16 pressure_max;
  119. u16 cmd_crtl1;
  120. u16 cmd_crtl2;
  121. u16 cmd_crtl3;
  122. int x;
  123. int y;
  124. int Rt;
  125. };
  126. static int ad7879_read(struct ad7879 *ts, u8 reg)
  127. {
  128. return ts->bops->read(ts->dev, reg);
  129. }
  130. static int ad7879_multi_read(struct ad7879 *ts, u8 first_reg, u8 count, u16 *buf)
  131. {
  132. return ts->bops->multi_read(ts->dev, first_reg, count, buf);
  133. }
  134. static int ad7879_write(struct ad7879 *ts, u8 reg, u16 val)
  135. {
  136. return ts->bops->write(ts->dev, reg, val);
  137. }
  138. static int ad7879_report(struct ad7879 *ts)
  139. {
  140. struct input_dev *input_dev = ts->input;
  141. unsigned Rt;
  142. u16 x, y, z1, z2;
  143. x = ts->conversion_data[AD7879_SEQ_XPOS] & MAX_12BIT;
  144. y = ts->conversion_data[AD7879_SEQ_YPOS] & MAX_12BIT;
  145. z1 = ts->conversion_data[AD7879_SEQ_Z1] & MAX_12BIT;
  146. z2 = ts->conversion_data[AD7879_SEQ_Z2] & MAX_12BIT;
  147. /*
  148. * The samples processed here are already preprocessed by the AD7879.
  149. * The preprocessing function consists of a median and an averaging
  150. * filter. The combination of these two techniques provides a robust
  151. * solution, discarding the spurious noise in the signal and keeping
  152. * only the data of interest. The size of both filters is
  153. * programmable. (dev.platform_data, see linux/spi/ad7879.h) Other
  154. * user-programmable conversion controls include variable acquisition
  155. * time, and first conversion delay. Up to 16 averages can be taken
  156. * per conversion.
  157. */
  158. if (likely(x && z1)) {
  159. /* compute touch pressure resistance using equation #1 */
  160. Rt = (z2 - z1) * x * ts->x_plate_ohms;
  161. Rt /= z1;
  162. Rt = (Rt + 2047) >> 12;
  163. /*
  164. * Sample found inconsistent, pressure is beyond
  165. * the maximum. Don't report it to user space.
  166. */
  167. if (Rt > ts->pressure_max)
  168. return -EINVAL;
  169. /*
  170. * Note that we delay reporting events by one sample.
  171. * This is done to avoid reporting last sample of the
  172. * touch sequence, which may be incomplete if finger
  173. * leaves the surface before last reading is taken.
  174. */
  175. if (timer_pending(&ts->timer)) {
  176. /* Touch continues */
  177. input_report_key(input_dev, BTN_TOUCH, 1);
  178. input_report_abs(input_dev, ABS_X, ts->x);
  179. input_report_abs(input_dev, ABS_Y, ts->y);
  180. input_report_abs(input_dev, ABS_PRESSURE, ts->Rt);
  181. input_sync(input_dev);
  182. }
  183. ts->x = x;
  184. ts->y = y;
  185. ts->Rt = Rt;
  186. return 0;
  187. }
  188. return -EINVAL;
  189. }
  190. static void ad7879_ts_event_release(struct ad7879 *ts)
  191. {
  192. struct input_dev *input_dev = ts->input;
  193. input_report_abs(input_dev, ABS_PRESSURE, 0);
  194. input_report_key(input_dev, BTN_TOUCH, 0);
  195. input_sync(input_dev);
  196. }
  197. static void ad7879_timer(unsigned long handle)
  198. {
  199. struct ad7879 *ts = (void *)handle;
  200. ad7879_ts_event_release(ts);
  201. }
  202. static irqreturn_t ad7879_irq(int irq, void *handle)
  203. {
  204. struct ad7879 *ts = handle;
  205. ad7879_multi_read(ts, AD7879_REG_XPLUS, AD7879_NR_SENSE, ts->conversion_data);
  206. if (!ad7879_report(ts))
  207. mod_timer(&ts->timer, jiffies + TS_PEN_UP_TIMEOUT);
  208. return IRQ_HANDLED;
  209. }
  210. static void __ad7879_enable(struct ad7879 *ts)
  211. {
  212. ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2);
  213. ad7879_write(ts, AD7879_REG_CTRL3, ts->cmd_crtl3);
  214. ad7879_write(ts, AD7879_REG_CTRL1, ts->cmd_crtl1);
  215. enable_irq(ts->irq);
  216. }
  217. static void __ad7879_disable(struct ad7879 *ts)
  218. {
  219. disable_irq(ts->irq);
  220. if (del_timer_sync(&ts->timer))
  221. ad7879_ts_event_release(ts);
  222. ad7879_write(ts, AD7879_REG_CTRL2, AD7879_PM(AD7879_PM_SHUTDOWN));
  223. }
  224. static int ad7879_open(struct input_dev *input)
  225. {
  226. struct ad7879 *ts = input_get_drvdata(input);
  227. /* protected by input->mutex */
  228. if (!ts->disabled && !ts->suspended)
  229. __ad7879_enable(ts);
  230. return 0;
  231. }
  232. static void ad7879_close(struct input_dev* input)
  233. {
  234. struct ad7879 *ts = input_get_drvdata(input);
  235. /* protected by input->mutex */
  236. if (!ts->disabled && !ts->suspended)
  237. __ad7879_disable(ts);
  238. }
  239. void ad7879_suspend(struct ad7879 *ts)
  240. {
  241. mutex_lock(&ts->input->mutex);
  242. if (!ts->suspended && !ts->disabled && ts->input->users)
  243. __ad7879_disable(ts);
  244. ts->suspended = true;
  245. mutex_unlock(&ts->input->mutex);
  246. }
  247. EXPORT_SYMBOL(ad7879_suspend);
  248. void ad7879_resume(struct ad7879 *ts)
  249. {
  250. mutex_lock(&ts->input->mutex);
  251. if (ts->suspended && !ts->disabled && ts->input->users)
  252. __ad7879_enable(ts);
  253. ts->suspended = false;
  254. mutex_unlock(&ts->input->mutex);
  255. }
  256. EXPORT_SYMBOL(ad7879_resume);
  257. static void ad7879_toggle(struct ad7879 *ts, bool disable)
  258. {
  259. mutex_lock(&ts->input->mutex);
  260. if (!ts->suspended && ts->input->users != 0) {
  261. if (disable) {
  262. if (ts->disabled)
  263. __ad7879_enable(ts);
  264. } else {
  265. if (!ts->disabled)
  266. __ad7879_disable(ts);
  267. }
  268. }
  269. ts->disabled = disable;
  270. mutex_unlock(&ts->input->mutex);
  271. }
  272. static ssize_t ad7879_disable_show(struct device *dev,
  273. struct device_attribute *attr, char *buf)
  274. {
  275. struct ad7879 *ts = dev_get_drvdata(dev);
  276. return sprintf(buf, "%u\n", ts->disabled);
  277. }
  278. static ssize_t ad7879_disable_store(struct device *dev,
  279. struct device_attribute *attr,
  280. const char *buf, size_t count)
  281. {
  282. struct ad7879 *ts = dev_get_drvdata(dev);
  283. unsigned long val;
  284. int error;
  285. error = strict_strtoul(buf, 10, &val);
  286. if (error)
  287. return error;
  288. ad7879_toggle(ts, val);
  289. return count;
  290. }
  291. static DEVICE_ATTR(disable, 0664, ad7879_disable_show, ad7879_disable_store);
  292. static struct attribute *ad7879_attributes[] = {
  293. &dev_attr_disable.attr,
  294. NULL
  295. };
  296. static const struct attribute_group ad7879_attr_group = {
  297. .attrs = ad7879_attributes,
  298. };
  299. #ifdef CONFIG_GPIOLIB
  300. static int ad7879_gpio_direction_input(struct gpio_chip *chip,
  301. unsigned gpio)
  302. {
  303. struct ad7879 *ts = container_of(chip, struct ad7879, gc);
  304. int err;
  305. mutex_lock(&ts->mutex);
  306. ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIODIR | AD7879_GPIOPOL;
  307. err = ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2);
  308. mutex_unlock(&ts->mutex);
  309. return err;
  310. }
  311. static int ad7879_gpio_direction_output(struct gpio_chip *chip,
  312. unsigned gpio, int level)
  313. {
  314. struct ad7879 *ts = container_of(chip, struct ad7879, gc);
  315. int err;
  316. mutex_lock(&ts->mutex);
  317. ts->cmd_crtl2 &= ~AD7879_GPIODIR;
  318. ts->cmd_crtl2 |= AD7879_GPIO_EN | AD7879_GPIOPOL;
  319. if (level)
  320. ts->cmd_crtl2 |= AD7879_GPIO_DATA;
  321. else
  322. ts->cmd_crtl2 &= ~AD7879_GPIO_DATA;
  323. err = ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2);
  324. mutex_unlock(&ts->mutex);
  325. return err;
  326. }
  327. static int ad7879_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
  328. {
  329. struct ad7879 *ts = container_of(chip, struct ad7879, gc);
  330. u16 val;
  331. mutex_lock(&ts->mutex);
  332. val = ad7879_read(ts, AD7879_REG_CTRL2);
  333. mutex_unlock(&ts->mutex);
  334. return !!(val & AD7879_GPIO_DATA);
  335. }
  336. static void ad7879_gpio_set_value(struct gpio_chip *chip,
  337. unsigned gpio, int value)
  338. {
  339. struct ad7879 *ts = container_of(chip, struct ad7879, gc);
  340. mutex_lock(&ts->mutex);
  341. if (value)
  342. ts->cmd_crtl2 |= AD7879_GPIO_DATA;
  343. else
  344. ts->cmd_crtl2 &= ~AD7879_GPIO_DATA;
  345. ad7879_write(ts, AD7879_REG_CTRL2, ts->cmd_crtl2);
  346. mutex_unlock(&ts->mutex);
  347. }
  348. static int ad7879_gpio_add(struct ad7879 *ts,
  349. const struct ad7879_platform_data *pdata)
  350. {
  351. int ret = 0;
  352. mutex_init(&ts->mutex);
  353. if (pdata->gpio_export) {
  354. ts->gc.direction_input = ad7879_gpio_direction_input;
  355. ts->gc.direction_output = ad7879_gpio_direction_output;
  356. ts->gc.get = ad7879_gpio_get_value;
  357. ts->gc.set = ad7879_gpio_set_value;
  358. ts->gc.can_sleep = 1;
  359. ts->gc.base = pdata->gpio_base;
  360. ts->gc.ngpio = 1;
  361. ts->gc.label = "AD7879-GPIO";
  362. ts->gc.owner = THIS_MODULE;
  363. ts->gc.dev = ts->dev;
  364. ret = gpiochip_add(&ts->gc);
  365. if (ret)
  366. dev_err(ts->dev, "failed to register gpio %d\n",
  367. ts->gc.base);
  368. }
  369. return ret;
  370. }
  371. static void ad7879_gpio_remove(struct ad7879 *ts)
  372. {
  373. const struct ad7879_platform_data *pdata = ts->dev->platform_data;
  374. int ret;
  375. if (pdata->gpio_export) {
  376. ret = gpiochip_remove(&ts->gc);
  377. if (ret)
  378. dev_err(ts->dev, "failed to remove gpio %d\n",
  379. ts->gc.base);
  380. }
  381. }
  382. #else
  383. static inline int ad7879_gpio_add(struct ad7879 *ts,
  384. const struct ad7879_platform_data *pdata)
  385. {
  386. return 0;
  387. }
  388. static inline void ad7879_gpio_remove(struct ad7879 *ts)
  389. {
  390. }
  391. #endif
  392. struct ad7879 *ad7879_probe(struct device *dev, u8 devid, unsigned int irq,
  393. const struct ad7879_bus_ops *bops)
  394. {
  395. struct ad7879_platform_data *pdata = dev->platform_data;
  396. struct ad7879 *ts;
  397. struct input_dev *input_dev;
  398. int err;
  399. u16 revid;
  400. if (!irq) {
  401. dev_err(dev, "no IRQ?\n");
  402. err = -EINVAL;
  403. goto err_out;
  404. }
  405. if (!pdata) {
  406. dev_err(dev, "no platform data?\n");
  407. err = -EINVAL;
  408. goto err_out;
  409. }
  410. ts = kzalloc(sizeof(*ts), GFP_KERNEL);
  411. input_dev = input_allocate_device();
  412. if (!ts || !input_dev) {
  413. err = -ENOMEM;
  414. goto err_free_mem;
  415. }
  416. ts->bops = bops;
  417. ts->dev = dev;
  418. ts->input = input_dev;
  419. ts->irq = irq;
  420. setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts);
  421. ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
  422. ts->pressure_max = pdata->pressure_max ? : ~0;
  423. ts->first_conversion_delay = pdata->first_conversion_delay;
  424. ts->acquisition_time = pdata->acquisition_time;
  425. ts->averaging = pdata->averaging;
  426. ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
  427. ts->median = pdata->median;
  428. snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(dev));
  429. input_dev->name = "AD7879 Touchscreen";
  430. input_dev->phys = ts->phys;
  431. input_dev->dev.parent = dev;
  432. input_dev->id.bustype = bops->bustype;
  433. input_dev->open = ad7879_open;
  434. input_dev->close = ad7879_close;
  435. input_set_drvdata(input_dev, ts);
  436. __set_bit(EV_ABS, input_dev->evbit);
  437. __set_bit(ABS_X, input_dev->absbit);
  438. __set_bit(ABS_Y, input_dev->absbit);
  439. __set_bit(ABS_PRESSURE, input_dev->absbit);
  440. __set_bit(EV_KEY, input_dev->evbit);
  441. __set_bit(BTN_TOUCH, input_dev->keybit);
  442. input_set_abs_params(input_dev, ABS_X,
  443. pdata->x_min ? : 0,
  444. pdata->x_max ? : MAX_12BIT,
  445. 0, 0);
  446. input_set_abs_params(input_dev, ABS_Y,
  447. pdata->y_min ? : 0,
  448. pdata->y_max ? : MAX_12BIT,
  449. 0, 0);
  450. input_set_abs_params(input_dev, ABS_PRESSURE,
  451. pdata->pressure_min, pdata->pressure_max, 0, 0);
  452. err = ad7879_write(ts, AD7879_REG_CTRL2, AD7879_RESET);
  453. if (err < 0) {
  454. dev_err(dev, "Failed to write %s\n", input_dev->name);
  455. goto err_free_mem;
  456. }
  457. revid = ad7879_read(ts, AD7879_REG_REVID);
  458. input_dev->id.product = (revid & 0xff);
  459. input_dev->id.version = revid >> 8;
  460. if (input_dev->id.product != devid) {
  461. dev_err(dev, "Failed to probe %s (%x vs %x)\n",
  462. input_dev->name, devid, revid);
  463. err = -ENODEV;
  464. goto err_free_mem;
  465. }
  466. ts->cmd_crtl3 = AD7879_YPLUS_BIT |
  467. AD7879_XPLUS_BIT |
  468. AD7879_Z2_BIT |
  469. AD7879_Z1_BIT |
  470. AD7879_TEMPMASK_BIT |
  471. AD7879_AUXVBATMASK_BIT |
  472. AD7879_GPIOALERTMASK_BIT;
  473. ts->cmd_crtl2 = AD7879_PM(AD7879_PM_DYN) | AD7879_DFR |
  474. AD7879_AVG(ts->averaging) |
  475. AD7879_MFS(ts->median) |
  476. AD7879_FCD(ts->first_conversion_delay);
  477. ts->cmd_crtl1 = AD7879_MODE_INT | AD7879_MODE_SEQ1 |
  478. AD7879_ACQ(ts->acquisition_time) |
  479. AD7879_TMR(ts->pen_down_acc_interval);
  480. err = request_threaded_irq(ts->irq, NULL, ad7879_irq,
  481. IRQF_TRIGGER_FALLING,
  482. dev_name(dev), ts);
  483. if (err) {
  484. dev_err(dev, "irq %d busy?\n", ts->irq);
  485. goto err_free_mem;
  486. }
  487. __ad7879_disable(ts);
  488. err = sysfs_create_group(&dev->kobj, &ad7879_attr_group);
  489. if (err)
  490. goto err_free_irq;
  491. err = ad7879_gpio_add(ts, pdata);
  492. if (err)
  493. goto err_remove_attr;
  494. err = input_register_device(input_dev);
  495. if (err)
  496. goto err_remove_gpio;
  497. return ts;
  498. err_remove_gpio:
  499. ad7879_gpio_remove(ts);
  500. err_remove_attr:
  501. sysfs_remove_group(&dev->kobj, &ad7879_attr_group);
  502. err_free_irq:
  503. free_irq(ts->irq, ts);
  504. err_free_mem:
  505. input_free_device(input_dev);
  506. kfree(ts);
  507. err_out:
  508. return ERR_PTR(err);
  509. }
  510. EXPORT_SYMBOL(ad7879_probe);
  511. void ad7879_remove(struct ad7879 *ts)
  512. {
  513. ad7879_gpio_remove(ts);
  514. sysfs_remove_group(&ts->dev->kobj, &ad7879_attr_group);
  515. free_irq(ts->irq, ts);
  516. input_unregister_device(ts->input);
  517. kfree(ts);
  518. }
  519. EXPORT_SYMBOL(ad7879_remove);
  520. MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
  521. MODULE_DESCRIPTION("AD7879(-1) touchscreen Driver");
  522. MODULE_LICENSE("GPL");