platform-imx-keypad.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Copyright (C) 2010 Pengutronix
  3. * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify it under
  6. * the terms of the GNU General Public License version 2 as published by the
  7. * Free Software Foundation.
  8. */
  9. #include <mach/hardware.h>
  10. #include <mach/devices-common.h>
  11. #define imx_imx_keypad_data_entry_single(soc, _size) \
  12. { \
  13. .iobase = soc ## _KPP_BASE_ADDR, \
  14. .iosize = _size, \
  15. .irq = soc ## _INT_KPP, \
  16. }
  17. #ifdef CONFIG_SOC_IMX21
  18. const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
  19. imx_imx_keypad_data_entry_single(MX21, SZ_16);
  20. #endif /* ifdef CONFIG_SOC_IMX21 */
  21. #ifdef CONFIG_SOC_IMX25
  22. const struct imx_imx_keypad_data imx25_imx_keypad_data __initconst =
  23. imx_imx_keypad_data_entry_single(MX25, SZ_16K);
  24. #endif /* ifdef CONFIG_SOC_IMX25 */
  25. #ifdef CONFIG_SOC_IMX27
  26. const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
  27. imx_imx_keypad_data_entry_single(MX27, SZ_16);
  28. #endif /* ifdef CONFIG_SOC_IMX27 */
  29. #ifdef CONFIG_SOC_IMX31
  30. const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst =
  31. imx_imx_keypad_data_entry_single(MX31, SZ_16);
  32. #endif /* ifdef CONFIG_SOC_IMX31 */
  33. #ifdef CONFIG_SOC_IMX35
  34. const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
  35. imx_imx_keypad_data_entry_single(MX35, SZ_16);
  36. #endif /* ifdef CONFIG_SOC_IMX35 */
  37. #ifdef CONFIG_SOC_IMX51
  38. const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst =
  39. imx_imx_keypad_data_entry_single(MX51, SZ_16);
  40. #endif /* ifdef CONFIG_SOC_IMX51 */
  41. struct platform_device *__init imx_add_imx_keypad(
  42. const struct imx_imx_keypad_data *data,
  43. const struct matrix_keymap_data *pdata)
  44. {
  45. struct resource res[] = {
  46. {
  47. .start = data->iobase,
  48. .end = data->iobase + data->iosize - 1,
  49. .flags = IORESOURCE_MEM,
  50. }, {
  51. .start = data->irq,
  52. .end = data->irq,
  53. .flags = IORESOURCE_IRQ,
  54. },
  55. };
  56. return imx_add_platform_device("imx-keypad", -1,
  57. res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
  58. }