Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5fcfef0 authored by Fabio Estevam's avatar Fabio Estevam Committed by Sascha Hauer
Browse files

ARM: mx5: dynamically allocate imx-keypad devices



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: default avatarFabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
parent 076762aa
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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
+2 −3
Original line number Diff line number Diff line
@@ -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)
+1 −1
Original line number Diff line number Diff line
@@ -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)
+4 −0
Original line number Diff line number Diff line
@@ -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)
+0 −19
Original line number Diff line number Diff line
@@ -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",
Loading