platform-imx-keypad.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 "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. #ifdef CONFIG_SOC_IMX53
  42. const struct imx_imx_keypad_data imx53_imx_keypad_data __initconst =
  43. imx_imx_keypad_data_entry_single(MX53, SZ_16);
  44. #endif /* ifdef CONFIG_SOC_IMX53 */
  45. struct platform_device *__init imx_add_imx_keypad(
  46. const struct imx_imx_keypad_data *data,
  47. const struct matrix_keymap_data *pdata)
  48. {
  49. struct resource res[] = {
  50. {
  51. .start = data->iobase,
  52. .end = data->iobase + data->iosize - 1,
  53. .flags = IORESOURCE_MEM,
  54. }, {
  55. .start = data->irq,
  56. .end = data->irq,
  57. .flags = IORESOURCE_IRQ,
  58. },
  59. };
  60. return imx_add_platform_device("imx-keypad", -1,
  61. res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
  62. }