ad7879.c 15 KB

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