summaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-mxc/devices/platform-imx-keypad.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-10 09:58:56 +0100
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2010-11-17 10:01:32 +0100
commit3f880141b8d12cdbb5faf0b9941ee50ac515ea1e (patch)
treead50ed7f31b47c4375d48df0a4c54e655423adc1 /arch/arm/plat-mxc/devices/platform-imx-keypad.c
parentbd455ed36c487b949068182bfee478b785ee090b (diff)
downloadblackbird-op-linux-3f880141b8d12cdbb5faf0b9941ee50ac515ea1e.tar.gz
blackbird-op-linux-3f880141b8d12cdbb5faf0b9941ee50ac515ea1e.zip
ARM: imx: dynamically allocate imx-keypad devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm/plat-mxc/devices/platform-imx-keypad.c')
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-keypad.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/plat-mxc/devices/platform-imx-keypad.c b/arch/arm/plat-mxc/devices/platform-imx-keypad.c
new file mode 100644
index 000000000000..fdfee551a095
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx-keypad.c
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 Pengutronix
+ * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License version 2 as published by the
+ * Free Software Foundation.
+ */
+#include <mach/hardware.h>
+#include <mach/devices-common.h>
+
+#define imx_imx_keypad_data_entry_single(soc) \
+ { \
+ .iobase = soc ## _KPP_BASE_ADDR, \
+ .irq = soc ## _INT_KPP, \
+ }
+
+#ifdef CONFIG_SOC_IMX21
+const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
+ imx_imx_keypad_data_entry_single(MX21);
+#endif /* ifdef CONFIG_SOC_IMX21 */
+
+#ifdef CONFIG_SOC_IMX27
+const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
+ imx_imx_keypad_data_entry_single(MX27);
+#endif /* ifdef CONFIG_SOC_IMX27 */
+
+struct platform_device *__init imx_add_imx_keypad(
+ const struct imx_imx_keypad_data *data,
+ const struct matrix_keymap_data *pdata)
+{
+ struct resource res[] = {
+ {
+ .start = data->iobase,
+ .end = data->iobase + SZ_16 - 1,
+ .flags = IORESOURCE_MEM,
+ }, {
+ .start = data->irq,
+ .end = data->irq,
+ .flags = IORESOURCE_IRQ,
+ },
+ };
+
+ return imx_add_platform_device("imx-keypad", -1,
+ res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
+}
OpenPOWER on IntegriCloud