Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 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 | */ |
Shawn Guo | 50f2de6 | 2012-09-14 14:14:45 +0800 | [diff] [blame] | 9 | #include "../hardware.h" |
Shawn Guo | e0557c0 | 2012-09-13 15:51:15 +0800 | [diff] [blame] | 10 | #include "devices-common.h" |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 11 | |
Uwe Kleine-König | ab9cee4b | 2010-11-11 11:35:33 +0100 | [diff] [blame] | 12 | #define imx_imx_keypad_data_entry_single(soc, _size) \ |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 13 | { \ |
| 14 | .iobase = soc ## _KPP_BASE_ADDR, \ |
Uwe Kleine-König | ab9cee4b | 2010-11-11 11:35:33 +0100 | [diff] [blame] | 15 | .iosize = _size, \ |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 16 | .irq = soc ## _INT_KPP, \ |
| 17 | } |
| 18 | |
| 19 | #ifdef CONFIG_SOC_IMX21 |
| 20 | const struct imx_imx_keypad_data imx21_imx_keypad_data __initconst = |
Uwe Kleine-König | ab9cee4b | 2010-11-11 11:35:33 +0100 | [diff] [blame] | 21 | imx_imx_keypad_data_entry_single(MX21, SZ_16); |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 22 | #endif /* ifdef CONFIG_SOC_IMX21 */ |
| 23 | |
| 24 | #ifdef CONFIG_SOC_IMX27 |
| 25 | const struct imx_imx_keypad_data imx27_imx_keypad_data __initconst = |
Uwe Kleine-König | ab9cee4b | 2010-11-11 11:35:33 +0100 | [diff] [blame] | 26 | imx_imx_keypad_data_entry_single(MX27, SZ_16); |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 27 | #endif /* ifdef CONFIG_SOC_IMX27 */ |
| 28 | |
Uwe Kleine-König | d690b4c | 2010-11-16 21:27:33 +0100 | [diff] [blame] | 29 | #ifdef CONFIG_SOC_IMX31 |
| 30 | const struct imx_imx_keypad_data imx31_imx_keypad_data __initconst = |
| 31 | imx_imx_keypad_data_entry_single(MX31, SZ_16); |
| 32 | #endif /* ifdef CONFIG_SOC_IMX31 */ |
| 33 | |
| 34 | #ifdef CONFIG_SOC_IMX35 |
| 35 | const struct imx_imx_keypad_data imx35_imx_keypad_data __initconst = |
| 36 | imx_imx_keypad_data_entry_single(MX35, SZ_16); |
| 37 | #endif /* ifdef CONFIG_SOC_IMX35 */ |
| 38 | |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 39 | struct platform_device *__init imx_add_imx_keypad( |
| 40 | const struct imx_imx_keypad_data *data, |
| 41 | const struct matrix_keymap_data *pdata) |
| 42 | { |
| 43 | struct resource res[] = { |
| 44 | { |
| 45 | .start = data->iobase, |
Uwe Kleine-König | ab9cee4b | 2010-11-11 11:35:33 +0100 | [diff] [blame] | 46 | .end = data->iobase + data->iosize - 1, |
Uwe Kleine-König | 3f88014 | 2010-11-10 09:58:56 +0100 | [diff] [blame] | 47 | .flags = IORESOURCE_MEM, |
| 48 | }, { |
| 49 | .start = data->irq, |
| 50 | .end = data->irq, |
| 51 | .flags = IORESOURCE_IRQ, |
| 52 | }, |
| 53 | }; |
| 54 | |
| 55 | return imx_add_platform_device("imx-keypad", -1, |
| 56 | res, ARRAY_SIZE(res), pdata, sizeof(*pdata)); |
| 57 | } |