platform-imx-keypad.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 "../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_IMX27
  22. const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
  23. imx_imx_keypad_data_entry_single(MX27, SZ_16);
  24. #endif /* ifdef CONFIG_SOC_IMX27 */
  25. #ifdef CONFIG_SOC_IMX31
  26. const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst =
  27. imx_imx_keypad_data_entry_single(MX31, SZ_16);
  28. #endif /* ifdef CONFIG_SOC_IMX31 */
  29. #ifdef CONFIG_SOC_IMX35
  30. const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
  31. imx_imx_keypad_data_entry_single(MX35, SZ_16);
  32. #endif /* ifdef CONFIG_SOC_IMX35 */
  33. struct platform_device *__init imx_add_imx_keypad(
  34. const struct imx_imx_keypad_data *data,
  35. const struct matrix_keymap_data *pdata)
  36. {
  37. struct resource res[] = {
  38. {
  39. .start = data->iobase,
  40. .end = data->iobase + data->iosize - 1,
  41. .flags = IORESOURCE_MEM,
  42. }, {
  43. .start = data->irq,
  44. .end = data->irq,
  45. .flags = IORESOURCE_IRQ,
  46. },
  47. };
  48. return imx_add_platform_device("imx-keypad", -1,
  49. res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
  50. }