]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
ARM: mx5: dynamically allocate imx-keypad devices
authorFabio Estevam <fabio.estevam@freescale.com>
Wed, 1 Dec 2010 13:11:47 +0000 (11:11 -0200)
committerSascha Hauer <s.hauer@pengutronix.de>
Wed, 12 Jan 2011 13:50:45 +0000 (14:50 +0100)
Add support for dynamical allocation of imx-keypad on mx5 platform.

After moving to dynamically registration of the keypad, the keypad clock
name needs to change accordingly.

The reason is that the original mx5 keypad platform_device id was 0,
now we use id=-1 as per arch/arm/plat-mxc/devices/platform-imx-keypad.c.

Tested keypad successfully on a MX51_3DS board.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
arch/arm/mach-mx5/Kconfig
arch/arm/mach-mx5/board-mx51_3ds.c
arch/arm/mach-mx5/clock-mx51-mx53.c
arch/arm/mach-mx5/devices-imx51.h
arch/arm/mach-mx5/devices.c
arch/arm/mach-mx5/devices.h
arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
arch/arm/plat-mxc/devices/platform-imx-keypad.c
arch/arm/plat-mxc/include/mach/mx51.h

index 777740b9ffdd0e7a719569b96f482dd63106b4ef..f2f07315fd35577148c8412b3cae869cf17dbd73 100644 (file)
@@ -50,6 +50,7 @@ config MACH_MX51_BABBAGE
 config MACH_MX51_3DS
        bool "Support MX51PDK (3DS)"
        select SOC_IMX51
+       select IMX_HAVE_PLATFORM_IMX_KEYPAD
        select IMX_HAVE_PLATFORM_IMX_UART
        select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
        select IMX_HAVE_PLATFORM_SPI_IMX
@@ -77,6 +78,7 @@ choice
 config MACH_EUKREA_MBIMX51_BASEBOARD
        prompt "Eukrea MBIMX51 development board"
        bool
+       select IMX_HAVE_PLATFORM_IMX_KEYPAD
        select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX
        help
          This adds board specific devices that can be found on Eukrea's
index e42bd2eb034e38128adc52b021f8584a54862f18..49d644842379c1e7c6deec4257354b85ad74422d 100644 (file)
@@ -12,7 +12,6 @@
 
 #include <linux/irq.h>
 #include <linux/platform_device.h>
-#include <linux/input/matrix_keypad.h>
 #include <linux/spi/spi.h>
 
 #include <asm/mach-types.h>
@@ -120,14 +119,14 @@ static int mx51_3ds_board_keymap[] = {
        KEY(3, 5, KEY_BACK)
 };
 
-static struct matrix_keymap_data mx51_3ds_map_data = {
+static const struct matrix_keymap_data mx51_3ds_map_data __initconst = {
        .keymap         = mx51_3ds_board_keymap,
        .keymap_size    = ARRAY_SIZE(mx51_3ds_board_keymap),
 };
 
 static void mxc_init_keypad(void)
 {
-       mxc_register_device(&mxc_keypad_device, &mx51_3ds_map_data);
+       imx51_add_imx_keypad(&mx51_3ds_map_data);
 }
 #else
 static inline void mxc_init_keypad(void)
index 8f142294e10eb0c6e3bb0547e1567c9a2180394f..f1f45b63f4551d84f63a43cb62f669e8fc584583 100644 (file)
@@ -1295,7 +1295,7 @@ static struct clk_lookup mx51_lookups[] = {
        _REGISTER_CLOCK("mxc-ehci.2", "usb_ahb", usb_ahb_clk)
        _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk)
        _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk)
-       _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk)
+       _REGISTER_CLOCK("imx-keypad", NULL, kpp_clk)
        _REGISTER_CLOCK("mxc_nand", NULL, nfc_clk)
        _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
        _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
index 39183ee56dd660909e74084215c8e79fa46f5cc9..531f4544dc95538ff84797efcf40b313111675b7 100644 (file)
@@ -51,3 +51,7 @@ extern const struct imx_imx2_wdt_data imx51_imx2_wdt_data[] __initconst;
 extern const struct imx_mxc_pwm_data imx51_mxc_pwm_data[] __initconst;
 #define imx51_add_mxc_pwm(id, pdata)   \
        imx_add_mxc_pwm(&imx51_mxc_pwm_data[id], pdata)
+
+extern const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst;
+#define imx51_add_imx_keypad(pdata)    \
+       imx_add_imx_keypad(&imx51_imx_keypad_data, pdata)
index 1bda5cb339dca4a93485eaf2349bf5ca2c17c535..153ada53e575aaf37acef19c53776c519beb2916 100644 (file)
@@ -120,25 +120,6 @@ struct platform_device mxc_usbh2_device = {
        },
 };
 
-static struct resource mxc_kpp_resources[] = {
-       {
-               .start = MX51_MXC_INT_KPP,
-               .end = MX51_MXC_INT_KPP,
-               .flags = IORESOURCE_IRQ,
-       } , {
-               .start = MX51_KPP_BASE_ADDR,
-               .end = MX51_KPP_BASE_ADDR + 0x8 - 1,
-               .flags = IORESOURCE_MEM,
-       },
-};
-
-struct platform_device mxc_keypad_device = {
-       .name = "imx-keypad",
-       .id = 0,
-       .num_resources = ARRAY_SIZE(mxc_kpp_resources),
-       .resource = mxc_kpp_resources,
-};
-
 static struct mxc_gpio_port mxc_gpio_ports[] = {
        {
                .chip.label = "gpio-0",
index 16891aa3573c424acb36962d4411786c3fc193a2..55a5129bc29ff0bd3bf24c574b3d0f17007b207a 100644 (file)
@@ -3,4 +3,3 @@ extern struct platform_device mxc_usbh1_device;
 extern struct platform_device mxc_usbh2_device;
 extern struct platform_device mxc_usbdr_udc_device;
 extern struct platform_device mxc_hsi2c_device;
-extern struct platform_device mxc_keypad_device;
index c96d018ff8a27aca59c218cb6dd210eb0bf89c85..e83ffadb65f862934f39c6b5ee1b0cd94acbaff4 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/fsl_devices.h>
 #include <linux/i2c/tsc2007.h>
 #include <linux/leds.h>
-#include <linux/input/matrix_keypad.h>
 
 #include <mach/common.h>
 #include <mach/hardware.h>
@@ -157,7 +156,7 @@ static int mbimx51_keymap[] = {
        KEY(3, 3, KEY_ENTER),
 };
 
-static struct matrix_keymap_data mbimx51_map_data = {
+static const struct matrix_keymap_data mbimx51_map_data __initconst = {
        .keymap         = mbimx51_keymap,
        .keymap_size    = ARRAY_SIZE(mbimx51_keymap),
 };
@@ -209,7 +208,7 @@ void __init eukrea_mbimx51_baseboard_init(void)
 
        platform_add_devices(devices, ARRAY_SIZE(devices));
 
-       mxc_register_device(&mxc_keypad_device, &mbimx51_map_data);
+       imx51_add_imx_keypad(&mbimx51_map_data);
 
        gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq");
        gpio_direction_input(MBIMX51_TSC2007_GPIO);
index 40238f0b8643ab55de0bb0840907a2143a1f6fe0..26366114b021aadc9cb49173de6c70c0d4e6227c 100644 (file)
@@ -41,6 +41,11 @@ const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
        imx_imx_keypad_data_entry_single(MX35, SZ_16);
 #endif /* ifdef CONFIG_SOC_IMX35 */
 
+#ifdef CONFIG_SOC_IMX51
+const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst =
+       imx_imx_keypad_data_entry_single(MX51, SZ_16);
+#endif /* ifdef CONFIG_SOC_IMX51 */
+
 struct platform_device *__init imx_add_imx_keypad(
                const struct imx_imx_keypad_data *data,
                const struct matrix_keymap_data *pdata)
index ec9ae5afa09a5a919842236806c341d9cc32fdc4..1eb339e6c85772bd9339ffe7fef1971940f212ae 100644 (file)
 #define MX51_MXC_INT_GPIO4_HIGH                57
 #define MX51_MXC_INT_WDOG1             58
 #define MX51_MXC_INT_WDOG2             59
-#define MX51_MXC_INT_KPP               60
+#define MX51_INT_KPP                   60
 #define MX51_INT_PWM1                  61
 #define MX51_INT_I2C1                  62
 #define MX51_INT_I2C2                  63