diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-10 03:58:56 -0500 |
---|---|---|
committer | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2010-11-17 04:01:32 -0500 |
commit | 3f880141b8d12cdbb5faf0b9941ee50ac515ea1e (patch) | |
tree | ad50ed7f31b47c4375d48df0a4c54e655423adc1 /arch/arm | |
parent | bd455ed36c487b949068182bfee478b785ee090b (diff) |
ARM: imx: dynamically allocate imx-keypad devices
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-imx/Kconfig | 2 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx21.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices-imx27.h | 4 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-imx/devices.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-imx/mach-mx27_3ds.c | 5 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Kconfig | 3 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-mxc/devices/platform-imx-keypad.c | 46 | ||||
-rw-r--r-- | arch/arm/plat-mxc/include/mach/devices-common.h | 9 |
11 files changed, 74 insertions, 26 deletions
diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index e50a164d08f7..86bab49798c6 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig | |||
@@ -163,6 +163,7 @@ choice | |||
163 | config MACH_EUKREA_MBIMX27_BASEBOARD | 163 | config MACH_EUKREA_MBIMX27_BASEBOARD |
164 | bool "Eukrea MBIMX27 development board" | 164 | bool "Eukrea MBIMX27 development board" |
165 | select IMX_HAVE_PLATFORM_IMX_FB | 165 | select IMX_HAVE_PLATFORM_IMX_FB |
166 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | ||
166 | select IMX_HAVE_PLATFORM_IMX_SSI | 167 | select IMX_HAVE_PLATFORM_IMX_SSI |
167 | select IMX_HAVE_PLATFORM_IMX_UART | 168 | select IMX_HAVE_PLATFORM_IMX_UART |
168 | select IMX_HAVE_PLATFORM_MXC_MMC | 169 | select IMX_HAVE_PLATFORM_MXC_MMC |
@@ -175,6 +176,7 @@ endchoice | |||
175 | 176 | ||
176 | config MACH_MX27_3DS | 177 | config MACH_MX27_3DS |
177 | bool "MX27PDK platform" | 178 | bool "MX27PDK platform" |
179 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | ||
178 | select IMX_HAVE_PLATFORM_IMX_UART | 180 | select IMX_HAVE_PLATFORM_IMX_UART |
179 | select IMX_HAVE_PLATFORM_MXC_MMC | 181 | select IMX_HAVE_PLATFORM_MXC_MMC |
180 | help | 182 | help |
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h index a97e921bc225..0c0eab17ccfd 100644 --- a/arch/arm/mach-imx/devices-imx21.h +++ b/arch/arm/mach-imx/devices-imx21.h | |||
@@ -21,6 +21,10 @@ extern const struct imx_imx_i2c_data imx21_imx_i2c_data __initconst; | |||
21 | #define imx21_add_imx_i2c(pdata) \ | 21 | #define imx21_add_imx_i2c(pdata) \ |
22 | imx_add_imx_i2c(&imx21_imx_i2c_data, pdata) | 22 | imx_add_imx_i2c(&imx21_imx_i2c_data, pdata) |
23 | 23 | ||
24 | extern const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst; | ||
25 | #define imx21_add_imx_keypad(pdata) \ | ||
26 | imx_add_imx_keypad(&imx21_imx_keypad_data, pdata) | ||
27 | |||
24 | extern const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst; | 28 | extern const struct imx_imx_ssi_data imx21_imx_ssi_data[] __initconst; |
25 | #define imx21_add_imx_ssi(id, pdata) \ | 29 | #define imx21_add_imx_ssi(id, pdata) \ |
26 | imx_add_imx_ssi(&imx21_imx_ssi_data[id], pdata) | 30 | imx_add_imx_ssi(&imx21_imx_ssi_data[id], pdata) |
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index 51bb42d8536e..f1272d4b5a33 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h | |||
@@ -29,6 +29,10 @@ extern const struct imx_imx_i2c_data imx27_imx_i2c_data[] __initconst; | |||
29 | #define imx27_add_imx_i2c(id, pdata) \ | 29 | #define imx27_add_imx_i2c(id, pdata) \ |
30 | imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata) | 30 | imx_add_imx_i2c(&imx27_imx_i2c_data[id], pdata) |
31 | 31 | ||
32 | extern const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst; | ||
33 | #define imx27_add_imx_keypad(pdata) \ | ||
34 | imx_add_imx_keypad(&imx27_imx_keypad_data, pdata) | ||
35 | |||
32 | extern const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst; | 36 | extern const struct imx_imx_ssi_data imx27_imx_ssi_data[] __initconst; |
33 | #define imx27_add_imx_ssi(id, pdata) \ | 37 | #define imx27_add_imx_ssi(id, pdata) \ |
34 | imx_add_imx_ssi(&imx27_imx_ssi_data[id], pdata) | 38 | imx_add_imx_ssi(&imx27_imx_ssi_data[id], pdata) |
diff --git a/arch/arm/mach-imx/devices.c b/arch/arm/mach-imx/devices.c index d026cfbe6130..4360b9c8f893 100644 --- a/arch/arm/mach-imx/devices.c +++ b/arch/arm/mach-imx/devices.c | |||
@@ -149,23 +149,4 @@ struct platform_device mx21_usbhc_device = { | |||
149 | }; | 149 | }; |
150 | #endif | 150 | #endif |
151 | 151 | ||
152 | static struct resource imx_kpp_resources[] = { | ||
153 | { | ||
154 | .start = MX2x_KPP_BASE_ADDR, | ||
155 | .end = MX2x_KPP_BASE_ADDR + 0xf, | ||
156 | .flags = IORESOURCE_MEM | ||
157 | }, { | ||
158 | .start = MX2x_INT_KPP, | ||
159 | .end = MX2x_INT_KPP, | ||
160 | .flags = IORESOURCE_IRQ, | ||
161 | }, | ||
162 | }; | ||
163 | |||
164 | struct platform_device imx_kpp_device = { | ||
165 | .name = "imx-keypad", | ||
166 | .id = -1, | ||
167 | .num_resources = ARRAY_SIZE(imx_kpp_resources), | ||
168 | .resource = imx_kpp_resources, | ||
169 | }; | ||
170 | |||
171 | #endif | 152 | #endif |
diff --git a/arch/arm/mach-imx/devices.h b/arch/arm/mach-imx/devices.h index a788566c1938..d1e7f48f7d52 100644 --- a/arch/arm/mach-imx/devices.h +++ b/arch/arm/mach-imx/devices.h | |||
@@ -1,4 +1,3 @@ | |||
1 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) | 1 | #if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27) |
2 | extern struct platform_device mx21_usbhc_device; | 2 | extern struct platform_device mx21_usbhc_device; |
3 | extern struct platform_device imx_kpp_device; | ||
4 | #endif | 3 | #endif |
diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c index fa5aaded7c2e..3aaa3b9b604c 100644 --- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/spi/ads7846.h> | 26 | #include <linux/spi/ads7846.h> |
27 | #include <linux/backlight.h> | 27 | #include <linux/backlight.h> |
28 | #include <video/platform_lcd.h> | 28 | #include <video/platform_lcd.h> |
29 | #include <linux/input/matrix_keypad.h> | ||
30 | 29 | ||
31 | #include <asm/mach/arch.h> | 30 | #include <asm/mach/arch.h> |
32 | 31 | ||
@@ -109,7 +108,8 @@ static const uint32_t eukrea_mbimx27_keymap[] = { | |||
109 | KEY(1, 1, KEY_LEFT), | 108 | KEY(1, 1, KEY_LEFT), |
110 | }; | 109 | }; |
111 | 110 | ||
112 | static struct matrix_keymap_data eukrea_mbimx27_keymap_data = { | 111 | static const struct matrix_keymap_data |
112 | eukrea_mbimx27_keymap_data __initconst = { | ||
113 | .keymap = eukrea_mbimx27_keymap, | 113 | .keymap = eukrea_mbimx27_keymap, |
114 | .keymap_size = ARRAY_SIZE(eukrea_mbimx27_keymap), | 114 | .keymap_size = ARRAY_SIZE(eukrea_mbimx27_keymap), |
115 | }; | 115 | }; |
@@ -384,7 +384,7 @@ void __init eukrea_mbimx27_baseboard_init(void) | |||
384 | gpio_request(GPIO_PORTA | 25, "lcd_enable"); | 384 | gpio_request(GPIO_PORTA | 25, "lcd_enable"); |
385 | platform_device_register(&eukrea_mbimx27_lcd_powerdev); | 385 | platform_device_register(&eukrea_mbimx27_lcd_powerdev); |
386 | 386 | ||
387 | mxc_register_device(&imx_kpp_device, &eukrea_mbimx27_keymap_data); | 387 | imx27_add_imx_keypad(&eukrea_mbimx27_keymap_data); |
388 | 388 | ||
389 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 389 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); |
390 | } | 390 | } |
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c index e6212c3d53b5..80399b268052 100644 --- a/arch/arm/mach-imx/mach-mx27_3ds.c +++ b/arch/arm/mach-imx/mach-mx27_3ds.c | |||
@@ -22,7 +22,6 @@ | |||
22 | 22 | ||
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/gpio.h> | 24 | #include <linux/gpio.h> |
25 | #include <linux/input/matrix_keypad.h> | ||
26 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
27 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
28 | #include <asm/mach/arch.h> | 27 | #include <asm/mach/arch.h> |
@@ -91,7 +90,7 @@ static const uint32_t mx27_3ds_keymap[] = { | |||
91 | KEY(2, 3, KEY_F10), | 90 | KEY(2, 3, KEY_F10), |
92 | }; | 91 | }; |
93 | 92 | ||
94 | static struct matrix_keymap_data mx27_3ds_keymap_data = { | 93 | static const struct matrix_keymap_data mx27_3ds_keymap_data __initconst = { |
95 | .keymap = mx27_3ds_keymap, | 94 | .keymap = mx27_3ds_keymap, |
96 | .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), | 95 | .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), |
97 | }; | 96 | }; |
@@ -127,7 +126,7 @@ static void __init mx27pdk_init(void) | |||
127 | mx27_3ds_sdhc1_enable_level_translator(); | 126 | mx27_3ds_sdhc1_enable_level_translator(); |
128 | imx27_add_imx_uart0(&uart_pdata); | 127 | imx27_add_imx_uart0(&uart_pdata); |
129 | imx27_add_fec(NULL); | 128 | imx27_add_fec(NULL); |
130 | mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); | 129 | imx27_add_imx_keypad(&mx27_3ds_keymap_data); |
131 | imx27_add_mxc_mmc(0, &sdhc1_pdata); | 130 | imx27_add_mxc_mmc(0, &sdhc1_pdata); |
132 | } | 131 | } |
133 | 132 | ||
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 26196d9c04e9..212f380d7642 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -25,6 +25,9 @@ config IMX_HAVE_PLATFORM_IMX_FB | |||
25 | config IMX_HAVE_PLATFORM_IMX_I2C | 25 | config IMX_HAVE_PLATFORM_IMX_I2C |
26 | bool | 26 | bool |
27 | 27 | ||
28 | config IMX_HAVE_PLATFORM_IMX_KEYPAD | ||
29 | bool | ||
30 | |||
28 | config IMX_HAVE_PLATFORM_IMX_SSI | 31 | config IMX_HAVE_PLATFORM_IMX_SSI |
29 | bool | 32 | bool |
30 | 33 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index e40897ee445f..dd23baba32e9 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o | |||
7 | obj-y += platform-imx-dma.o | 7 | obj-y += platform-imx-dma.o |
8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o | 8 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o |
9 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o | 9 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o |
10 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o | ||
10 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o | 11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o |
11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o | 12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o |
12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o | 13 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o |
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 @@ | |||
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 | |||
12 | #define imx_imx_keypad_data_entry_single(soc) \ | ||
13 | { \ | ||
14 | .iobase = soc ## _KPP_BASE_ADDR, \ | ||
15 | .irq = soc ## _INT_KPP, \ | ||
16 | } | ||
17 | |||
18 | #ifdef CONFIG_SOC_IMX21 | ||
19 | const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst = | ||
20 | imx_imx_keypad_data_entry_single(MX21); | ||
21 | #endif /* ifdef CONFIG_SOC_IMX21 */ | ||
22 | |||
23 | #ifdef CONFIG_SOC_IMX27 | ||
24 | const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst = | ||
25 | imx_imx_keypad_data_entry_single(MX27); | ||
26 | #endif /* ifdef CONFIG_SOC_IMX27 */ | ||
27 | |||
28 | struct platform_device *__init imx_add_imx_keypad( | ||
29 | const struct imx_imx_keypad_data *data, | ||
30 | const struct matrix_keymap_data *pdata) | ||
31 | { | ||
32 | struct resource res[] = { | ||
33 | { | ||
34 | .start = data->iobase, | ||
35 | .end = data->iobase + SZ_16 - 1, | ||
36 | .flags = IORESOURCE_MEM, | ||
37 | }, { | ||
38 | .start = data->irq, | ||
39 | .end = data->irq, | ||
40 | .flags = IORESOURCE_IRQ, | ||
41 | }, | ||
42 | }; | ||
43 | |||
44 | return imx_add_platform_device("imx-keypad", -1, | ||
45 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); | ||
46 | } | ||
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index f01fd28dd4f6..1a672999d838 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -83,6 +83,15 @@ struct platform_device *__init imx_add_imx_i2c( | |||
83 | const struct imx_imx_i2c_data *data, | 83 | const struct imx_imx_i2c_data *data, |
84 | const struct imxi2c_platform_data *pdata); | 84 | const struct imxi2c_platform_data *pdata); |
85 | 85 | ||
86 | #include <linux/input/matrix_keypad.h> | ||
87 | struct imx_imx_keypad_data { | ||
88 | resource_size_t iobase; | ||
89 | resource_size_t irq; | ||
90 | }; | ||
91 | struct platform_device *__init imx_add_imx_keypad( | ||
92 | const struct imx_imx_keypad_data *data, | ||
93 | const struct matrix_keymap_data *pdata); | ||
94 | |||
86 | #include <mach/ssi.h> | 95 | #include <mach/ssi.h> |
87 | struct imx_imx_ssi_data { | 96 | struct imx_imx_ssi_data { |
88 | int id; | 97 | int id; |