imx_keypad.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. * Driver for the IMX keypad port.
  3. * Copyright (C) 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * <<Power management needs to be implemented>>.
  10. */
  11. #include <linux/clk.h>
  12. #include <linux/delay.h>
  13. #include <linux/device.h>
  14. #include <linux/err.h>
  15. #include <linux/init.h>
  16. #include <linux/input/matrix_keypad.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/io.h>
  19. #include <linux/jiffies.h>
  20. #include <linux/kernel.h>
  21. #include <linux/module.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/slab.h>
  24. #include <linux/timer.h>
  25. /*
  26. * Keypad Controller registers (halfword)
  27. */
  28. #define KPCR 0x00 /* Keypad Control Register */
  29. #define KPSR 0x02 /* Keypad Status Register */
  30. #define KBD_STAT_KPKD (0x1 << 0) /* Key Press Interrupt Status bit (w1c) */
  31. #define KBD_STAT_KPKR (0x1 << 1) /* Key Release Interrupt Status bit (w1c) */
  32. #define KBD_STAT_KDSC (0x1 << 2) /* Key Depress Synch Chain Status bit (w1c)*/
  33. #define KBD_STAT_KRSS (0x1 << 3) /* Key Release Synch Status bit (w1c)*/
  34. #define KBD_STAT_KDIE (0x1 << 8) /* Key Depress Interrupt Enable Status bit */
  35. #define KBD_STAT_KRIE (0x1 << 9) /* Key Release Interrupt Enable */
  36. #define KBD_STAT_KPPEN (0x1 << 10) /* Keypad Clock Enable */
  37. #define KDDR 0x04 /* Keypad Data Direction Register */
  38. #define KPDR 0x06 /* Keypad Data Register */
  39. #define MAX_MATRIX_KEY_ROWS 8
  40. #define MAX_MATRIX_KEY_COLS 8
  41. #define MATRIX_ROW_SHIFT 3
  42. #define MAX_MATRIX_KEY_NUM (MAX_MATRIX_KEY_ROWS * MAX_MATRIX_KEY_COLS)
  43. struct imx_keypad {
  44. struct clk *clk;
  45. struct input_dev *input_dev;
  46. void __iomem *mmio_base;
  47. int irq;
  48. struct timer_list check_matrix_timer;
  49. /*
  50. * The matrix is stable only if no changes are detected after
  51. * IMX_KEYPAD_SCANS_FOR_STABILITY scans
  52. */
  53. #define IMX_KEYPAD_SCANS_FOR_STABILITY 3
  54. int stable_count;
  55. bool enabled;
  56. /* Masks for enabled rows/cols */
  57. unsigned short rows_en_mask;
  58. unsigned short cols_en_mask;
  59. unsigned short keycodes[MAX_MATRIX_KEY_NUM];
  60. /*
  61. * Matrix states:
  62. * -stable: achieved after a complete debounce process.
  63. * -unstable: used in the debouncing process.
  64. */
  65. unsigned short matrix_stable_state[MAX_MATRIX_KEY_COLS];
  66. unsigned short matrix_unstable_state[MAX_MATRIX_KEY_COLS];
  67. };
  68. /* Scan the matrix and return the new state in *matrix_volatile_state. */
  69. static void imx_keypad_scan_matrix(struct imx_keypad *keypad,
  70. unsigned short *matrix_volatile_state)
  71. {
  72. int col;
  73. unsigned short reg_val;
  74. for (col = 0; col < MAX_MATRIX_KEY_COLS; col++) {
  75. if ((keypad->cols_en_mask & (1 << col)) == 0)
  76. continue;
  77. /*
  78. * Discharge keypad capacitance:
  79. * 2. write 1s on column data.
  80. * 3. configure columns as totem-pole to discharge capacitance.
  81. * 4. configure columns as open-drain.
  82. */
  83. reg_val = readw(keypad->mmio_base + KPDR);
  84. reg_val |= 0xff00;
  85. writew(reg_val, keypad->mmio_base + KPDR);
  86. reg_val = readw(keypad->mmio_base + KPCR);
  87. reg_val &= ~((keypad->cols_en_mask & 0xff) << 8);
  88. writew(reg_val, keypad->mmio_base + KPCR);
  89. udelay(2);
  90. reg_val = readw(keypad->mmio_base + KPCR);
  91. reg_val |= (keypad->cols_en_mask & 0xff) << 8;
  92. writew(reg_val, keypad->mmio_base + KPCR);
  93. /*
  94. * 5. Write a single column to 0, others to 1.
  95. * 6. Sample row inputs and save data.
  96. * 7. Repeat steps 2 - 6 for remaining columns.
  97. */
  98. reg_val = readw(keypad->mmio_base + KPDR);
  99. reg_val &= ~(1 << (8 + col));
  100. writew(reg_val, keypad->mmio_base + KPDR);
  101. /*
  102. * Delay added to avoid propagating the 0 from column to row
  103. * when scanning.
  104. */
  105. udelay(5);
  106. /*
  107. * 1s in matrix_volatile_state[col] means key pressures
  108. * throw data from non enabled rows.
  109. */
  110. reg_val = readw(keypad->mmio_base + KPDR);
  111. matrix_volatile_state[col] = (~reg_val) & keypad->rows_en_mask;
  112. }
  113. /*
  114. * Return in standby mode:
  115. * 9. write 0s to columns
  116. */
  117. reg_val = readw(keypad->mmio_base + KPDR);
  118. reg_val &= 0x00ff;
  119. writew(reg_val, keypad->mmio_base + KPDR);
  120. }
  121. /*
  122. * Compare the new matrix state (volatile) with the stable one stored in
  123. * keypad->matrix_stable_state and fire events if changes are detected.
  124. */
  125. static void imx_keypad_fire_events(struct imx_keypad *keypad,
  126. unsigned short *matrix_volatile_state)
  127. {
  128. struct input_dev *input_dev = keypad->input_dev;
  129. int row, col;
  130. for (col = 0; col < MAX_MATRIX_KEY_COLS; col++) {
  131. unsigned short bits_changed;
  132. int code;
  133. if ((keypad->cols_en_mask & (1 << col)) == 0)
  134. continue; /* Column is not enabled */
  135. bits_changed = keypad->matrix_stable_state[col] ^
  136. matrix_volatile_state[col];
  137. if (bits_changed == 0)
  138. continue; /* Column does not contain changes */
  139. for (row = 0; row < MAX_MATRIX_KEY_ROWS; row++) {
  140. if ((keypad->rows_en_mask & (1 << row)) == 0)
  141. continue; /* Row is not enabled */
  142. if ((bits_changed & (1 << row)) == 0)
  143. continue; /* Row does not contain changes */
  144. code = MATRIX_SCAN_CODE(row, col, MATRIX_ROW_SHIFT);
  145. input_event(input_dev, EV_MSC, MSC_SCAN, code);
  146. input_report_key(input_dev, keypad->keycodes[code],
  147. matrix_volatile_state[col] & (1 << row));
  148. dev_dbg(&input_dev->dev, "Event code: %d, val: %d",
  149. keypad->keycodes[code],
  150. matrix_volatile_state[col] & (1 << row));
  151. }
  152. }
  153. input_sync(input_dev);
  154. }
  155. /*
  156. * imx_keypad_check_for_events is the timer handler.
  157. */
  158. static void imx_keypad_check_for_events(unsigned long data)
  159. {
  160. struct imx_keypad *keypad = (struct imx_keypad *) data;
  161. unsigned short matrix_volatile_state[MAX_MATRIX_KEY_COLS];
  162. unsigned short reg_val;
  163. bool state_changed, is_zero_matrix;
  164. int i;
  165. memset(matrix_volatile_state, 0, sizeof(matrix_volatile_state));
  166. imx_keypad_scan_matrix(keypad, matrix_volatile_state);
  167. state_changed = false;
  168. for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) {
  169. if ((keypad->cols_en_mask & (1 << i)) == 0)
  170. continue;
  171. if (keypad->matrix_unstable_state[i] ^ matrix_volatile_state[i]) {
  172. state_changed = true;
  173. break;
  174. }
  175. }
  176. /*
  177. * If the matrix state is changed from the previous scan
  178. * (Re)Begin the debouncing process, saving the new state in
  179. * keypad->matrix_unstable_state.
  180. * else
  181. * Increase the count of number of scans with a stable state.
  182. */
  183. if (state_changed) {
  184. memcpy(keypad->matrix_unstable_state, matrix_volatile_state,
  185. sizeof(matrix_volatile_state));
  186. keypad->stable_count = 0;
  187. } else
  188. keypad->stable_count++;
  189. /*
  190. * If the matrix is not as stable as we want reschedule scan
  191. * in the near future.
  192. */
  193. if (keypad->stable_count < IMX_KEYPAD_SCANS_FOR_STABILITY) {
  194. mod_timer(&keypad->check_matrix_timer,
  195. jiffies + msecs_to_jiffies(10));
  196. return;
  197. }
  198. /*
  199. * If the matrix state is stable, fire the events and save the new
  200. * stable state. Note, if the matrix is kept stable for longer
  201. * (keypad->stable_count > IMX_KEYPAD_SCANS_FOR_STABILITY) all
  202. * events have already been generated.
  203. */
  204. if (keypad->stable_count == IMX_KEYPAD_SCANS_FOR_STABILITY) {
  205. imx_keypad_fire_events(keypad, matrix_volatile_state);
  206. memcpy(keypad->matrix_stable_state, matrix_volatile_state,
  207. sizeof(matrix_volatile_state));
  208. }
  209. is_zero_matrix = true;
  210. for (i = 0; i < MAX_MATRIX_KEY_COLS; i++) {
  211. if (matrix_volatile_state[i] != 0) {
  212. is_zero_matrix = false;
  213. break;
  214. }
  215. }
  216. if (is_zero_matrix) {
  217. /*
  218. * All keys have been released. Enable only the KDI
  219. * interrupt for future key presses (clear the KDI
  220. * status bit and its sync chain before that).
  221. */
  222. reg_val = readw(keypad->mmio_base + KPSR);
  223. reg_val |= KBD_STAT_KPKD | KBD_STAT_KDSC;
  224. writew(reg_val, keypad->mmio_base + KPSR);
  225. reg_val = readw(keypad->mmio_base + KPSR);
  226. reg_val |= KBD_STAT_KDIE;
  227. reg_val &= ~KBD_STAT_KRIE;
  228. writew(reg_val, keypad->mmio_base + KPSR);
  229. } else {
  230. /*
  231. * Some keys are still pressed. Schedule a rescan in
  232. * attempt to detect multiple key presses and enable
  233. * the KRI interrupt to react quickly to key release
  234. * event.
  235. */
  236. mod_timer(&keypad->check_matrix_timer,
  237. jiffies + msecs_to_jiffies(60));
  238. reg_val = readw(keypad->mmio_base + KPSR);
  239. reg_val |= KBD_STAT_KPKR | KBD_STAT_KRSS;
  240. writew(reg_val, keypad->mmio_base + KPSR);
  241. reg_val = readw(keypad->mmio_base + KPSR);
  242. reg_val |= KBD_STAT_KRIE;
  243. reg_val &= ~KBD_STAT_KDIE;
  244. writew(reg_val, keypad->mmio_base + KPSR);
  245. }
  246. }
  247. static irqreturn_t imx_keypad_irq_handler(int irq, void *dev_id)
  248. {
  249. struct imx_keypad *keypad = dev_id;
  250. unsigned short reg_val;
  251. reg_val = readw(keypad->mmio_base + KPSR);
  252. /* Disable both interrupt types */
  253. reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
  254. /* Clear interrupts status bits */
  255. reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD;
  256. writew(reg_val, keypad->mmio_base + KPSR);
  257. if (keypad->enabled) {
  258. /* The matrix is supposed to be changed */
  259. keypad->stable_count = 0;
  260. /* Schedule the scanning procedure near in the future */
  261. mod_timer(&keypad->check_matrix_timer,
  262. jiffies + msecs_to_jiffies(2));
  263. }
  264. return IRQ_HANDLED;
  265. }
  266. static void imx_keypad_config(struct imx_keypad *keypad)
  267. {
  268. unsigned short reg_val;
  269. /*
  270. * Include enabled rows in interrupt generation (KPCR[7:0])
  271. * Configure keypad columns as open-drain (KPCR[15:8])
  272. */
  273. reg_val = readw(keypad->mmio_base + KPCR);
  274. reg_val |= keypad->rows_en_mask & 0xff; /* rows */
  275. reg_val |= (keypad->cols_en_mask & 0xff) << 8; /* cols */
  276. writew(reg_val, keypad->mmio_base + KPCR);
  277. /* Write 0's to KPDR[15:8] (Colums) */
  278. reg_val = readw(keypad->mmio_base + KPDR);
  279. reg_val &= 0x00ff;
  280. writew(reg_val, keypad->mmio_base + KPDR);
  281. /* Configure columns as output, rows as input (KDDR[15:0]) */
  282. writew(0xff00, keypad->mmio_base + KDDR);
  283. /*
  284. * Clear Key Depress and Key Release status bit.
  285. * Clear both synchronizer chain.
  286. */
  287. reg_val = readw(keypad->mmio_base + KPSR);
  288. reg_val |= KBD_STAT_KPKR | KBD_STAT_KPKD |
  289. KBD_STAT_KDSC | KBD_STAT_KRSS;
  290. writew(reg_val, keypad->mmio_base + KPSR);
  291. /* Enable KDI and disable KRI (avoid false release events). */
  292. reg_val |= KBD_STAT_KDIE;
  293. reg_val &= ~KBD_STAT_KRIE;
  294. writew(reg_val, keypad->mmio_base + KPSR);
  295. }
  296. static void imx_keypad_inhibit(struct imx_keypad *keypad)
  297. {
  298. unsigned short reg_val;
  299. /* Inhibit KDI and KRI interrupts. */
  300. reg_val = readw(keypad->mmio_base + KPSR);
  301. reg_val &= ~(KBD_STAT_KRIE | KBD_STAT_KDIE);
  302. writew(reg_val, keypad->mmio_base + KPSR);
  303. /* Colums as open drain and disable all rows */
  304. writew(0xff00, keypad->mmio_base + KPCR);
  305. }
  306. static void imx_keypad_close(struct input_dev *dev)
  307. {
  308. struct imx_keypad *keypad = input_get_drvdata(dev);
  309. dev_dbg(&dev->dev, ">%s\n", __func__);
  310. /* Mark keypad as being inactive */
  311. keypad->enabled = false;
  312. synchronize_irq(keypad->irq);
  313. del_timer_sync(&keypad->check_matrix_timer);
  314. imx_keypad_inhibit(keypad);
  315. /* Disable clock unit */
  316. clk_disable(keypad->clk);
  317. }
  318. static int imx_keypad_open(struct input_dev *dev)
  319. {
  320. struct imx_keypad *keypad = input_get_drvdata(dev);
  321. dev_dbg(&dev->dev, ">%s\n", __func__);
  322. /* We became active from now */
  323. keypad->enabled = true;
  324. /* Enable the kpp clock */
  325. clk_enable(keypad->clk);
  326. imx_keypad_config(keypad);
  327. /* Sanity control, not all the rows must be actived now. */
  328. if ((readw(keypad->mmio_base + KPDR) & keypad->rows_en_mask) == 0) {
  329. dev_err(&dev->dev,
  330. "too many keys pressed, control pins initialisation\n");
  331. goto open_err;
  332. }
  333. return 0;
  334. open_err:
  335. imx_keypad_close(dev);
  336. return -EIO;
  337. }
  338. static int __devinit imx_keypad_probe(struct platform_device *pdev)
  339. {
  340. const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data;
  341. struct imx_keypad *keypad;
  342. struct input_dev *input_dev;
  343. struct resource *res;
  344. int irq, error, i;
  345. if (keymap_data == NULL) {
  346. dev_err(&pdev->dev, "no keymap defined\n");
  347. return -EINVAL;
  348. }
  349. irq = platform_get_irq(pdev, 0);
  350. if (irq < 0) {
  351. dev_err(&pdev->dev, "no irq defined in platform data\n");
  352. return -EINVAL;
  353. }
  354. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  355. if (res == NULL) {
  356. dev_err(&pdev->dev, "no I/O memory defined in platform data\n");
  357. return -EINVAL;
  358. }
  359. res = request_mem_region(res->start, resource_size(res), pdev->name);
  360. if (res == NULL) {
  361. dev_err(&pdev->dev, "failed to request I/O memory\n");
  362. return -EBUSY;
  363. }
  364. input_dev = input_allocate_device();
  365. if (!input_dev) {
  366. dev_err(&pdev->dev, "failed to allocate the input device\n");
  367. error = -ENOMEM;
  368. goto failed_rel_mem;
  369. }
  370. keypad = kzalloc(sizeof(struct imx_keypad), GFP_KERNEL);
  371. if (!keypad) {
  372. dev_err(&pdev->dev, "not enough memory for driver data\n");
  373. error = -ENOMEM;
  374. goto failed_free_input;
  375. }
  376. keypad->input_dev = input_dev;
  377. keypad->irq = irq;
  378. keypad->stable_count = 0;
  379. setup_timer(&keypad->check_matrix_timer,
  380. imx_keypad_check_for_events, (unsigned long) keypad);
  381. keypad->mmio_base = ioremap(res->start, resource_size(res));
  382. if (keypad->mmio_base == NULL) {
  383. dev_err(&pdev->dev, "failed to remap I/O memory\n");
  384. error = -ENOMEM;
  385. goto failed_free_priv;
  386. }
  387. keypad->clk = clk_get(&pdev->dev, "kpp");
  388. if (IS_ERR(keypad->clk)) {
  389. dev_err(&pdev->dev, "failed to get keypad clock\n");
  390. error = PTR_ERR(keypad->clk);
  391. goto failed_unmap;
  392. }
  393. /* Search for rows and cols enabled */
  394. for (i = 0; i < keymap_data->keymap_size; i++) {
  395. keypad->rows_en_mask |= 1 << KEY_ROW(keymap_data->keymap[i]);
  396. keypad->cols_en_mask |= 1 << KEY_COL(keymap_data->keymap[i]);
  397. }
  398. if (keypad->rows_en_mask > ((1 << MAX_MATRIX_KEY_ROWS) - 1) ||
  399. keypad->cols_en_mask > ((1 << MAX_MATRIX_KEY_COLS) - 1)) {
  400. dev_err(&pdev->dev,
  401. "invalid key data (too many rows or colums)\n");
  402. error = -EINVAL;
  403. goto failed_clock_put;
  404. }
  405. dev_dbg(&pdev->dev, "enabled rows mask: %x\n", keypad->rows_en_mask);
  406. dev_dbg(&pdev->dev, "enabled cols mask: %x\n", keypad->cols_en_mask);
  407. /* Init the Input device */
  408. input_dev->name = pdev->name;
  409. input_dev->id.bustype = BUS_HOST;
  410. input_dev->dev.parent = &pdev->dev;
  411. input_dev->open = imx_keypad_open;
  412. input_dev->close = imx_keypad_close;
  413. input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
  414. input_dev->keycode = keypad->keycodes;
  415. input_dev->keycodesize = sizeof(keypad->keycodes[0]);
  416. input_dev->keycodemax = ARRAY_SIZE(keypad->keycodes);
  417. matrix_keypad_build_keymap(keymap_data, MATRIX_ROW_SHIFT,
  418. keypad->keycodes, input_dev->keybit);
  419. input_set_capability(input_dev, EV_MSC, MSC_SCAN);
  420. input_set_drvdata(input_dev, keypad);
  421. /* Ensure that the keypad will stay dormant until opened */
  422. imx_keypad_inhibit(keypad);
  423. error = request_irq(irq, imx_keypad_irq_handler, 0,
  424. pdev->name, keypad);
  425. if (error) {
  426. dev_err(&pdev->dev, "failed to request IRQ\n");
  427. goto failed_clock_put;
  428. }
  429. /* Register the input device */
  430. error = input_register_device(input_dev);
  431. if (error) {
  432. dev_err(&pdev->dev, "failed to register input device\n");
  433. goto failed_free_irq;
  434. }
  435. platform_set_drvdata(pdev, keypad);
  436. device_init_wakeup(&pdev->dev, 1);
  437. return 0;
  438. failed_free_irq:
  439. free_irq(irq, pdev);
  440. failed_clock_put:
  441. clk_put(keypad->clk);
  442. failed_unmap:
  443. iounmap(keypad->mmio_base);
  444. failed_free_priv:
  445. kfree(keypad);
  446. failed_free_input:
  447. input_free_device(input_dev);
  448. failed_rel_mem:
  449. release_mem_region(res->start, resource_size(res));
  450. return error;
  451. }
  452. static int __devexit imx_keypad_remove(struct platform_device *pdev)
  453. {
  454. struct imx_keypad *keypad = platform_get_drvdata(pdev);
  455. struct resource *res;
  456. dev_dbg(&pdev->dev, ">%s\n", __func__);
  457. platform_set_drvdata(pdev, NULL);
  458. input_unregister_device(keypad->input_dev);
  459. free_irq(keypad->irq, keypad);
  460. clk_put(keypad->clk);
  461. iounmap(keypad->mmio_base);
  462. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  463. release_mem_region(res->start, resource_size(res));
  464. kfree(keypad);
  465. return 0;
  466. }
  467. #ifdef CONFIG_PM_SLEEP
  468. static int imx_kbd_suspend(struct device *dev)
  469. {
  470. struct platform_device *pdev = to_platform_device(dev);
  471. struct imx_keypad *kbd = platform_get_drvdata(pdev);
  472. struct input_dev *input_dev = kbd->input_dev;
  473. /* imx kbd can wake up system even clock is disabled */
  474. mutex_lock(&input_dev->mutex);
  475. if (input_dev->users)
  476. clk_disable(kbd->clk);
  477. mutex_unlock(&input_dev->mutex);
  478. if (device_may_wakeup(&pdev->dev))
  479. enable_irq_wake(kbd->irq);
  480. return 0;
  481. }
  482. static int imx_kbd_resume(struct device *dev)
  483. {
  484. struct platform_device *pdev = to_platform_device(dev);
  485. struct imx_keypad *kbd = platform_get_drvdata(pdev);
  486. struct input_dev *input_dev = kbd->input_dev;
  487. if (device_may_wakeup(&pdev->dev))
  488. disable_irq_wake(kbd->irq);
  489. mutex_lock(&input_dev->mutex);
  490. if (input_dev->users)
  491. clk_enable(kbd->clk);
  492. mutex_unlock(&input_dev->mutex);
  493. return 0;
  494. }
  495. #endif
  496. static SIMPLE_DEV_PM_OPS(imx_kbd_pm_ops, imx_kbd_suspend, imx_kbd_resume);
  497. static struct platform_driver imx_keypad_driver = {
  498. .driver = {
  499. .name = "imx-keypad",
  500. .owner = THIS_MODULE,
  501. .pm = &imx_kbd_pm_ops,
  502. },
  503. .probe = imx_keypad_probe,
  504. .remove = __devexit_p(imx_keypad_remove),
  505. };
  506. module_platform_driver(imx_keypad_driver);
  507. MODULE_AUTHOR("Alberto Panizzo <maramaopercheseimorto@gmail.com>");
  508. MODULE_DESCRIPTION("IMX Keypad Port Driver");
  509. MODULE_LICENSE("GPL v2");
  510. MODULE_ALIAS("platform:imx-keypad");