at91-sama5d2_adc.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. /*
  2. * Atmel ADC driver for SAMA5D2 devices and compatible.
  3. *
  4. * Copyright (C) 2015 Atmel,
  5. * 2015 Ludovic Desroches <ludovic.desroches@atmel.com>
  6. *
  7. * This software is licensed under the terms of the GNU General Public
  8. * License version 2, as published by the Free Software Foundation, and
  9. * may be copied, distributed, and modified under those terms.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #include <linux/bitops.h>
  17. #include <linux/clk.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/io.h>
  20. #include <linux/module.h>
  21. #include <linux/of_device.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/sched.h>
  24. #include <linux/wait.h>
  25. #include <linux/iio/iio.h>
  26. #include <linux/iio/sysfs.h>
  27. #include <linux/regulator/consumer.h>
  28. /* Control Register */
  29. #define AT91_SAMA5D2_CR 0x00
  30. /* Software Reset */
  31. #define AT91_SAMA5D2_CR_SWRST BIT(0)
  32. /* Start Conversion */
  33. #define AT91_SAMA5D2_CR_START BIT(1)
  34. /* Touchscreen Calibration */
  35. #define AT91_SAMA5D2_CR_TSCALIB BIT(2)
  36. /* Comparison Restart */
  37. #define AT91_SAMA5D2_CR_CMPRST BIT(4)
  38. /* Mode Register */
  39. #define AT91_SAMA5D2_MR 0x04
  40. /* Trigger Selection */
  41. #define AT91_SAMA5D2_MR_TRGSEL(v) ((v) << 1)
  42. /* ADTRG */
  43. #define AT91_SAMA5D2_MR_TRGSEL_TRIG0 0
  44. /* TIOA0 */
  45. #define AT91_SAMA5D2_MR_TRGSEL_TRIG1 1
  46. /* TIOA1 */
  47. #define AT91_SAMA5D2_MR_TRGSEL_TRIG2 2
  48. /* TIOA2 */
  49. #define AT91_SAMA5D2_MR_TRGSEL_TRIG3 3
  50. /* PWM event line 0 */
  51. #define AT91_SAMA5D2_MR_TRGSEL_TRIG4 4
  52. /* PWM event line 1 */
  53. #define AT91_SAMA5D2_MR_TRGSEL_TRIG5 5
  54. /* TIOA3 */
  55. #define AT91_SAMA5D2_MR_TRGSEL_TRIG6 6
  56. /* RTCOUT0 */
  57. #define AT91_SAMA5D2_MR_TRGSEL_TRIG7 7
  58. /* Sleep Mode */
  59. #define AT91_SAMA5D2_MR_SLEEP BIT(5)
  60. /* Fast Wake Up */
  61. #define AT91_SAMA5D2_MR_FWUP BIT(6)
  62. /* Prescaler Rate Selection */
  63. #define AT91_SAMA5D2_MR_PRESCAL(v) ((v) << AT91_SAMA5D2_MR_PRESCAL_OFFSET)
  64. #define AT91_SAMA5D2_MR_PRESCAL_OFFSET 8
  65. #define AT91_SAMA5D2_MR_PRESCAL_MAX 0xff
  66. #define AT91_SAMA5D2_MR_PRESCAL_MASK GENMASK(15, 8)
  67. /* Startup Time */
  68. #define AT91_SAMA5D2_MR_STARTUP(v) ((v) << 16)
  69. #define AT91_SAMA5D2_MR_STARTUP_MASK GENMASK(19, 16)
  70. /* Analog Change */
  71. #define AT91_SAMA5D2_MR_ANACH BIT(23)
  72. /* Tracking Time */
  73. #define AT91_SAMA5D2_MR_TRACKTIM(v) ((v) << 24)
  74. #define AT91_SAMA5D2_MR_TRACKTIM_MAX 0xff
  75. /* Transfer Time */
  76. #define AT91_SAMA5D2_MR_TRANSFER(v) ((v) << 28)
  77. #define AT91_SAMA5D2_MR_TRANSFER_MAX 0x3
  78. /* Use Sequence Enable */
  79. #define AT91_SAMA5D2_MR_USEQ BIT(31)
  80. /* Channel Sequence Register 1 */
  81. #define AT91_SAMA5D2_SEQR1 0x08
  82. /* Channel Sequence Register 2 */
  83. #define AT91_SAMA5D2_SEQR2 0x0c
  84. /* Channel Enable Register */
  85. #define AT91_SAMA5D2_CHER 0x10
  86. /* Channel Disable Register */
  87. #define AT91_SAMA5D2_CHDR 0x14
  88. /* Channel Status Register */
  89. #define AT91_SAMA5D2_CHSR 0x18
  90. /* Last Converted Data Register */
  91. #define AT91_SAMA5D2_LCDR 0x20
  92. /* Interrupt Enable Register */
  93. #define AT91_SAMA5D2_IER 0x24
  94. /* Interrupt Disable Register */
  95. #define AT91_SAMA5D2_IDR 0x28
  96. /* Interrupt Mask Register */
  97. #define AT91_SAMA5D2_IMR 0x2c
  98. /* Interrupt Status Register */
  99. #define AT91_SAMA5D2_ISR 0x30
  100. /* Last Channel Trigger Mode Register */
  101. #define AT91_SAMA5D2_LCTMR 0x34
  102. /* Last Channel Compare Window Register */
  103. #define AT91_SAMA5D2_LCCWR 0x38
  104. /* Overrun Status Register */
  105. #define AT91_SAMA5D2_OVER 0x3c
  106. /* Extended Mode Register */
  107. #define AT91_SAMA5D2_EMR 0x40
  108. /* Compare Window Register */
  109. #define AT91_SAMA5D2_CWR 0x44
  110. /* Channel Gain Register */
  111. #define AT91_SAMA5D2_CGR 0x48
  112. /* Channel Offset Register */
  113. #define AT91_SAMA5D2_COR 0x4c
  114. #define AT91_SAMA5D2_COR_DIFF_OFFSET 16
  115. /* Channel Data Register 0 */
  116. #define AT91_SAMA5D2_CDR0 0x50
  117. /* Analog Control Register */
  118. #define AT91_SAMA5D2_ACR 0x94
  119. /* Touchscreen Mode Register */
  120. #define AT91_SAMA5D2_TSMR 0xb0
  121. /* Touchscreen X Position Register */
  122. #define AT91_SAMA5D2_XPOSR 0xb4
  123. /* Touchscreen Y Position Register */
  124. #define AT91_SAMA5D2_YPOSR 0xb8
  125. /* Touchscreen Pressure Register */
  126. #define AT91_SAMA5D2_PRESSR 0xbc
  127. /* Trigger Register */
  128. #define AT91_SAMA5D2_TRGR 0xc0
  129. /* Correction Select Register */
  130. #define AT91_SAMA5D2_COSR 0xd0
  131. /* Correction Value Register */
  132. #define AT91_SAMA5D2_CVR 0xd4
  133. /* Channel Error Correction Register */
  134. #define AT91_SAMA5D2_CECR 0xd8
  135. /* Write Protection Mode Register */
  136. #define AT91_SAMA5D2_WPMR 0xe4
  137. /* Write Protection Status Register */
  138. #define AT91_SAMA5D2_WPSR 0xe8
  139. /* Version Register */
  140. #define AT91_SAMA5D2_VERSION 0xfc
  141. #define AT91_SAMA5D2_CHAN_SINGLE(num, addr) \
  142. { \
  143. .type = IIO_VOLTAGE, \
  144. .channel = num, \
  145. .address = addr, \
  146. .scan_type = { \
  147. .sign = 'u', \
  148. .realbits = 12, \
  149. }, \
  150. .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
  151. .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
  152. .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),\
  153. .datasheet_name = "CH"#num, \
  154. .indexed = 1, \
  155. }
  156. #define AT91_SAMA5D2_CHAN_DIFF(num, num2, addr) \
  157. { \
  158. .type = IIO_VOLTAGE, \
  159. .differential = 1, \
  160. .channel = num, \
  161. .channel2 = num2, \
  162. .address = addr, \
  163. .scan_type = { \
  164. .sign = 's', \
  165. .realbits = 12, \
  166. }, \
  167. .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
  168. .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
  169. .info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),\
  170. .datasheet_name = "CH"#num"-CH"#num2, \
  171. .indexed = 1, \
  172. }
  173. #define at91_adc_readl(st, reg) readl_relaxed(st->base + reg)
  174. #define at91_adc_writel(st, reg, val) writel_relaxed(val, st->base + reg)
  175. struct at91_adc_soc_info {
  176. unsigned startup_time;
  177. unsigned min_sample_rate;
  178. unsigned max_sample_rate;
  179. };
  180. struct at91_adc_state {
  181. void __iomem *base;
  182. int irq;
  183. struct clk *per_clk;
  184. struct regulator *reg;
  185. struct regulator *vref;
  186. int vref_uv;
  187. const struct iio_chan_spec *chan;
  188. bool conversion_done;
  189. u32 conversion_value;
  190. struct at91_adc_soc_info soc_info;
  191. wait_queue_head_t wq_data_available;
  192. /*
  193. * lock to prevent concurrent 'single conversion' requests through
  194. * sysfs.
  195. */
  196. struct mutex lock;
  197. };
  198. static const struct iio_chan_spec at91_adc_channels[] = {
  199. AT91_SAMA5D2_CHAN_SINGLE(0, 0x50),
  200. AT91_SAMA5D2_CHAN_SINGLE(1, 0x54),
  201. AT91_SAMA5D2_CHAN_SINGLE(2, 0x58),
  202. AT91_SAMA5D2_CHAN_SINGLE(3, 0x5c),
  203. AT91_SAMA5D2_CHAN_SINGLE(4, 0x60),
  204. AT91_SAMA5D2_CHAN_SINGLE(5, 0x64),
  205. AT91_SAMA5D2_CHAN_SINGLE(6, 0x68),
  206. AT91_SAMA5D2_CHAN_SINGLE(7, 0x6c),
  207. AT91_SAMA5D2_CHAN_SINGLE(8, 0x70),
  208. AT91_SAMA5D2_CHAN_SINGLE(9, 0x74),
  209. AT91_SAMA5D2_CHAN_SINGLE(10, 0x78),
  210. AT91_SAMA5D2_CHAN_SINGLE(11, 0x7c),
  211. AT91_SAMA5D2_CHAN_DIFF(0, 1, 0x50),
  212. AT91_SAMA5D2_CHAN_DIFF(2, 3, 0x58),
  213. AT91_SAMA5D2_CHAN_DIFF(4, 5, 0x60),
  214. AT91_SAMA5D2_CHAN_DIFF(6, 7, 0x68),
  215. AT91_SAMA5D2_CHAN_DIFF(8, 9, 0x70),
  216. AT91_SAMA5D2_CHAN_DIFF(10, 11, 0x78),
  217. };
  218. static unsigned at91_adc_startup_time(unsigned startup_time_min,
  219. unsigned adc_clk_khz)
  220. {
  221. const unsigned startup_lookup[] = {
  222. 0, 8, 16, 24,
  223. 64, 80, 96, 112,
  224. 512, 576, 640, 704,
  225. 768, 832, 896, 960
  226. };
  227. unsigned ticks_min, i;
  228. /*
  229. * Since the adc frequency is checked before, there is no reason
  230. * to not meet the startup time constraint.
  231. */
  232. ticks_min = startup_time_min * adc_clk_khz / 1000;
  233. for (i = 0; i < ARRAY_SIZE(startup_lookup); i++)
  234. if (startup_lookup[i] > ticks_min)
  235. break;
  236. return i;
  237. }
  238. static void at91_adc_setup_samp_freq(struct at91_adc_state *st, unsigned freq)
  239. {
  240. struct iio_dev *indio_dev = iio_priv_to_dev(st);
  241. unsigned f_per, prescal, startup, mr;
  242. f_per = clk_get_rate(st->per_clk);
  243. prescal = (f_per / (2 * freq)) - 1;
  244. startup = at91_adc_startup_time(st->soc_info.startup_time,
  245. freq / 1000);
  246. mr = at91_adc_readl(st, AT91_SAMA5D2_MR);
  247. mr &= ~(AT91_SAMA5D2_MR_STARTUP_MASK | AT91_SAMA5D2_MR_PRESCAL_MASK);
  248. mr |= AT91_SAMA5D2_MR_STARTUP(startup);
  249. mr |= AT91_SAMA5D2_MR_PRESCAL(prescal);
  250. at91_adc_writel(st, AT91_SAMA5D2_MR, mr);
  251. dev_dbg(&indio_dev->dev, "freq: %u, startup: %u, prescal: %u\n",
  252. freq, startup, prescal);
  253. }
  254. static unsigned at91_adc_get_sample_freq(struct at91_adc_state *st)
  255. {
  256. unsigned f_adc, f_per = clk_get_rate(st->per_clk);
  257. unsigned mr, prescal;
  258. mr = at91_adc_readl(st, AT91_SAMA5D2_MR);
  259. prescal = (mr >> AT91_SAMA5D2_MR_PRESCAL_OFFSET)
  260. & AT91_SAMA5D2_MR_PRESCAL_MAX;
  261. f_adc = f_per / (2 * (prescal + 1));
  262. return f_adc;
  263. }
  264. static irqreturn_t at91_adc_interrupt(int irq, void *private)
  265. {
  266. struct iio_dev *indio = private;
  267. struct at91_adc_state *st = iio_priv(indio);
  268. u32 status = at91_adc_readl(st, AT91_SAMA5D2_ISR);
  269. u32 imr = at91_adc_readl(st, AT91_SAMA5D2_IMR);
  270. if (status & imr) {
  271. st->conversion_value = at91_adc_readl(st, st->chan->address);
  272. st->conversion_done = true;
  273. wake_up_interruptible(&st->wq_data_available);
  274. return IRQ_HANDLED;
  275. }
  276. return IRQ_NONE;
  277. }
  278. static int at91_adc_read_raw(struct iio_dev *indio_dev,
  279. struct iio_chan_spec const *chan,
  280. int *val, int *val2, long mask)
  281. {
  282. struct at91_adc_state *st = iio_priv(indio_dev);
  283. u32 cor = 0;
  284. int ret;
  285. switch (mask) {
  286. case IIO_CHAN_INFO_RAW:
  287. mutex_lock(&st->lock);
  288. st->chan = chan;
  289. if (chan->differential)
  290. cor = (BIT(chan->channel) | BIT(chan->channel2)) <<
  291. AT91_SAMA5D2_COR_DIFF_OFFSET;
  292. at91_adc_writel(st, AT91_SAMA5D2_COR, cor);
  293. at91_adc_writel(st, AT91_SAMA5D2_CHER, BIT(chan->channel));
  294. at91_adc_writel(st, AT91_SAMA5D2_IER, BIT(chan->channel));
  295. at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_START);
  296. ret = wait_event_interruptible_timeout(st->wq_data_available,
  297. st->conversion_done,
  298. msecs_to_jiffies(1000));
  299. if (ret == 0)
  300. ret = -ETIMEDOUT;
  301. if (ret > 0) {
  302. *val = st->conversion_value;
  303. if (chan->scan_type.sign == 's')
  304. *val = sign_extend32(*val, 11);
  305. ret = IIO_VAL_INT;
  306. st->conversion_done = false;
  307. }
  308. at91_adc_writel(st, AT91_SAMA5D2_IDR, BIT(chan->channel));
  309. at91_adc_writel(st, AT91_SAMA5D2_CHDR, BIT(chan->channel));
  310. mutex_unlock(&st->lock);
  311. return ret;
  312. case IIO_CHAN_INFO_SCALE:
  313. *val = st->vref_uv / 1000;
  314. if (chan->differential)
  315. *val *= 2;
  316. *val2 = chan->scan_type.realbits;
  317. return IIO_VAL_FRACTIONAL_LOG2;
  318. case IIO_CHAN_INFO_SAMP_FREQ:
  319. *val = at91_adc_get_sample_freq(st);
  320. return IIO_VAL_INT;
  321. default:
  322. return -EINVAL;
  323. }
  324. }
  325. static int at91_adc_write_raw(struct iio_dev *indio_dev,
  326. struct iio_chan_spec const *chan,
  327. int val, int val2, long mask)
  328. {
  329. struct at91_adc_state *st = iio_priv(indio_dev);
  330. if (mask != IIO_CHAN_INFO_SAMP_FREQ)
  331. return -EINVAL;
  332. if (val < st->soc_info.min_sample_rate ||
  333. val > st->soc_info.max_sample_rate)
  334. return -EINVAL;
  335. at91_adc_setup_samp_freq(st, val);
  336. return 0;
  337. }
  338. static const struct iio_info at91_adc_info = {
  339. .read_raw = &at91_adc_read_raw,
  340. .write_raw = &at91_adc_write_raw,
  341. .driver_module = THIS_MODULE,
  342. };
  343. static int at91_adc_probe(struct platform_device *pdev)
  344. {
  345. struct iio_dev *indio_dev;
  346. struct at91_adc_state *st;
  347. struct resource *res;
  348. int ret;
  349. indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*st));
  350. if (!indio_dev)
  351. return -ENOMEM;
  352. indio_dev->dev.parent = &pdev->dev;
  353. indio_dev->name = dev_name(&pdev->dev);
  354. indio_dev->modes = INDIO_DIRECT_MODE;
  355. indio_dev->info = &at91_adc_info;
  356. indio_dev->channels = at91_adc_channels;
  357. indio_dev->num_channels = ARRAY_SIZE(at91_adc_channels);
  358. st = iio_priv(indio_dev);
  359. ret = of_property_read_u32(pdev->dev.of_node,
  360. "atmel,min-sample-rate-hz",
  361. &st->soc_info.min_sample_rate);
  362. if (ret) {
  363. dev_err(&pdev->dev,
  364. "invalid or missing value for atmel,min-sample-rate-hz\n");
  365. return ret;
  366. }
  367. ret = of_property_read_u32(pdev->dev.of_node,
  368. "atmel,max-sample-rate-hz",
  369. &st->soc_info.max_sample_rate);
  370. if (ret) {
  371. dev_err(&pdev->dev,
  372. "invalid or missing value for atmel,max-sample-rate-hz\n");
  373. return ret;
  374. }
  375. ret = of_property_read_u32(pdev->dev.of_node, "atmel,startup-time-ms",
  376. &st->soc_info.startup_time);
  377. if (ret) {
  378. dev_err(&pdev->dev,
  379. "invalid or missing value for atmel,startup-time-ms\n");
  380. return ret;
  381. }
  382. init_waitqueue_head(&st->wq_data_available);
  383. mutex_init(&st->lock);
  384. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  385. if (!res)
  386. return -EINVAL;
  387. st->base = devm_ioremap_resource(&pdev->dev, res);
  388. if (IS_ERR(st->base))
  389. return PTR_ERR(st->base);
  390. st->irq = platform_get_irq(pdev, 0);
  391. if (st->irq <= 0) {
  392. if (!st->irq)
  393. st->irq = -ENXIO;
  394. return st->irq;
  395. }
  396. st->per_clk = devm_clk_get(&pdev->dev, "adc_clk");
  397. if (IS_ERR(st->per_clk))
  398. return PTR_ERR(st->per_clk);
  399. st->reg = devm_regulator_get(&pdev->dev, "vddana");
  400. if (IS_ERR(st->reg))
  401. return PTR_ERR(st->reg);
  402. st->vref = devm_regulator_get(&pdev->dev, "vref");
  403. if (IS_ERR(st->vref))
  404. return PTR_ERR(st->vref);
  405. ret = devm_request_irq(&pdev->dev, st->irq, at91_adc_interrupt, 0,
  406. pdev->dev.driver->name, indio_dev);
  407. if (ret)
  408. return ret;
  409. ret = regulator_enable(st->reg);
  410. if (ret)
  411. return ret;
  412. ret = regulator_enable(st->vref);
  413. if (ret)
  414. goto reg_disable;
  415. st->vref_uv = regulator_get_voltage(st->vref);
  416. if (st->vref_uv <= 0) {
  417. ret = -EINVAL;
  418. goto vref_disable;
  419. }
  420. at91_adc_writel(st, AT91_SAMA5D2_CR, AT91_SAMA5D2_CR_SWRST);
  421. at91_adc_writel(st, AT91_SAMA5D2_IDR, 0xffffffff);
  422. /*
  423. * Transfer field must be set to 2 according to the datasheet and
  424. * allows different analog settings for each channel.
  425. */
  426. at91_adc_writel(st, AT91_SAMA5D2_MR,
  427. AT91_SAMA5D2_MR_TRANSFER(2) | AT91_SAMA5D2_MR_ANACH);
  428. at91_adc_setup_samp_freq(st, st->soc_info.min_sample_rate);
  429. ret = clk_prepare_enable(st->per_clk);
  430. if (ret)
  431. goto vref_disable;
  432. platform_set_drvdata(pdev, indio_dev);
  433. ret = iio_device_register(indio_dev);
  434. if (ret < 0)
  435. goto per_clk_disable_unprepare;
  436. dev_info(&pdev->dev, "version: %x\n",
  437. readl_relaxed(st->base + AT91_SAMA5D2_VERSION));
  438. return 0;
  439. per_clk_disable_unprepare:
  440. clk_disable_unprepare(st->per_clk);
  441. vref_disable:
  442. regulator_disable(st->vref);
  443. reg_disable:
  444. regulator_disable(st->reg);
  445. return ret;
  446. }
  447. static int at91_adc_remove(struct platform_device *pdev)
  448. {
  449. struct iio_dev *indio_dev = platform_get_drvdata(pdev);
  450. struct at91_adc_state *st = iio_priv(indio_dev);
  451. iio_device_unregister(indio_dev);
  452. clk_disable_unprepare(st->per_clk);
  453. regulator_disable(st->vref);
  454. regulator_disable(st->reg);
  455. return 0;
  456. }
  457. static const struct of_device_id at91_adc_dt_match[] = {
  458. {
  459. .compatible = "atmel,sama5d2-adc",
  460. }, {
  461. /* sentinel */
  462. }
  463. };
  464. MODULE_DEVICE_TABLE(of, at91_adc_dt_match);
  465. static struct platform_driver at91_adc_driver = {
  466. .probe = at91_adc_probe,
  467. .remove = at91_adc_remove,
  468. .driver = {
  469. .name = "at91-sama5d2_adc",
  470. .of_match_table = at91_adc_dt_match,
  471. },
  472. };
  473. module_platform_driver(at91_adc_driver)
  474. MODULE_AUTHOR("Ludovic Desroches <ludovic.desroches@atmel.com>");
  475. MODULE_DESCRIPTION("Atmel AT91 SAMA5D2 ADC");
  476. MODULE_LICENSE("GPL v2");