blob: 371b1e6ec954e3ee03e09031c8d468e0d2bcbee5 [file] [log] [blame]
Uwe Kleine-König3f880142010-11-10 09:58:56 +01001/*
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>
Shawn Guoe0557c02012-09-13 15:51:15 +080010#include "devices-common.h"
Uwe Kleine-König3f880142010-11-10 09:58:56 +010011
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +010012#define imx_imx_keypad_data_entry_single(soc, _size) \
Uwe Kleine-König3f880142010-11-10 09:58:56 +010013 { \
14 .iobase = soc ## _KPP_BASE_ADDR, \
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +010015 .iosize = _size, \
Uwe Kleine-König3f880142010-11-10 09:58:56 +010016 .irq = soc ## _INT_KPP, \
17 }
18
19#ifdef CONFIG_SOC_IMX21
20const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +010021 imx_imx_keypad_data_entry_single(MX21, SZ_16);
Uwe Kleine-König3f880142010-11-10 09:58:56 +010022#endif /* ifdef CONFIG_SOC_IMX21 */
23
Uwe Kleine-König972cc482010-11-11 18:35:01 +010024#ifdef CONFIG_SOC_IMX25
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +010025const struct imx_imx_keypad_data imx25_imx_keypad_data __initconst =
26 imx_imx_keypad_data_entry_single(MX25, SZ_16K);
Uwe Kleine-König972cc482010-11-11 18:35:01 +010027#endif /* ifdef CONFIG_SOC_IMX25 */
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +010028
Uwe Kleine-König3f880142010-11-10 09:58:56 +010029#ifdef CONFIG_SOC_IMX27
30const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +010031 imx_imx_keypad_data_entry_single(MX27, SZ_16);
Uwe Kleine-König3f880142010-11-10 09:58:56 +010032#endif /* ifdef CONFIG_SOC_IMX27 */
33
Uwe Kleine-Königd690b4c2010-11-16 21:27:33 +010034#ifdef CONFIG_SOC_IMX31
35const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst =
36 imx_imx_keypad_data_entry_single(MX31, SZ_16);
37#endif /* ifdef CONFIG_SOC_IMX31 */
38
39#ifdef CONFIG_SOC_IMX35
40const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
41 imx_imx_keypad_data_entry_single(MX35, SZ_16);
42#endif /* ifdef CONFIG_SOC_IMX35 */
43
Fabio Estevama5fcfef2010-12-01 11:11:47 -020044#ifdef CONFIG_SOC_IMX51
45const struct imx_imx_keypad_data imx51_imx_keypad_data __initconst =
46 imx_imx_keypad_data_entry_single(MX51, SZ_16);
47#endif /* ifdef CONFIG_SOC_IMX51 */
48
Fabio Estevam22785de2011-06-27 17:12:11 -030049#ifdef CONFIG_SOC_IMX53
50const struct imx_imx_keypad_data imx53_imx_keypad_data __initconst =
51 imx_imx_keypad_data_entry_single(MX53, SZ_16);
52#endif /* ifdef CONFIG_SOC_IMX53 */
53
Uwe Kleine-König3f880142010-11-10 09:58:56 +010054struct platform_device *__init imx_add_imx_keypad(
55 const struct imx_imx_keypad_data *data,
56 const struct matrix_keymap_data *pdata)
57{
58 struct resource res[] = {
59 {
60 .start = data->iobase,
Uwe Kleine-Königab9cee4b2010-11-11 11:35:33 +010061 .end = data->iobase + data->iosize - 1,
Uwe Kleine-König3f880142010-11-10 09:58:56 +010062 .flags = IORESOURCE_MEM,
63 }, {
64 .start = data->irq,
65 .end = data->irq,
66 .flags = IORESOURCE_IRQ,
67 },
68 };
69
70 return imx_add_platform_device("imx-keypad", -1,
71 res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
72}