Merge tag 'arc-5.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/vgupta/arc
[linux-2.6-microblaze.git] / arch / arm / mach-imx / devices / platform-imx-keypad.c
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (C) 2010 Pengutronix
4  * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
5  */
6 #include "../hardware.h"
7 #include "devices-common.h"
8
9 #define imx_imx_keypad_data_entry_single(soc, _size)                    \
10         {                                                               \
11                 .iobase = soc ## _KPP_BASE_ADDR,                        \
12                 .iosize = _size,                                        \
13                 .irq = soc ## _INT_KPP,                                 \
14         }
15
16 #ifdef CONFIG_SOC_IMX21
17 const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst =
18         imx_imx_keypad_data_entry_single(MX21, SZ_16);
19 #endif /* ifdef CONFIG_SOC_IMX21 */
20
21 #ifdef CONFIG_SOC_IMX27
22 const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst =
23         imx_imx_keypad_data_entry_single(MX27, SZ_16);
24 #endif /* ifdef CONFIG_SOC_IMX27 */
25
26 #ifdef CONFIG_SOC_IMX31
27 const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst =
28         imx_imx_keypad_data_entry_single(MX31, SZ_16);
29 #endif /* ifdef CONFIG_SOC_IMX31 */
30
31 #ifdef CONFIG_SOC_IMX35
32 const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst =
33         imx_imx_keypad_data_entry_single(MX35, SZ_16);
34 #endif /* ifdef CONFIG_SOC_IMX35 */
35
36 struct platform_device *__init imx_add_imx_keypad(
37                 const struct imx_imx_keypad_data *data,
38                 const struct matrix_keymap_data *pdata)
39 {
40         struct resource res[] = {
41                 {
42                         .start = data->iobase,
43                         .end = data->iobase + data->iosize - 1,
44                         .flags = IORESOURCE_MEM,
45                 }, {
46                         .start = data->irq,
47                         .end = data->irq,
48                         .flags = IORESOURCE_IRQ,
49                 },
50         };
51
52         return imx_add_platform_device("imx-keypad", -1,
53                         res, ARRAY_SIZE(res), pdata, sizeof(*pdata));
54 }