3 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 #include <linux/gpio.h>
10 #include <linux/gpio_keys.h>
11 #include <linux/input.h>
12 #include <linux/platform_device.h>
13 #include <linux/spi/spi.h>
15 #include <mach/common.h>
16 #include <mach/iomux-mx3.h>
19 #include <asm/mach-types.h>
23 #include "devices-imx31.h"
25 static unsigned int pcm037_eet_pins
[] = {
26 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
27 IOMUX_MODE(MX31_PIN_KEY_COL7
, IOMUX_CONFIG_GPIO
),
29 IOMUX_MODE(MX31_PIN_GPIO1_0
, IOMUX_CONFIG_GPIO
), /* 0 */
30 IOMUX_MODE(MX31_PIN_GPIO1_1
, IOMUX_CONFIG_GPIO
), /* 1 */
31 IOMUX_MODE(MX31_PIN_GPIO1_2
, IOMUX_CONFIG_GPIO
), /* 2 */
32 IOMUX_MODE(MX31_PIN_GPIO1_3
, IOMUX_CONFIG_GPIO
), /* 3 */
33 IOMUX_MODE(MX31_PIN_SVEN0
, IOMUX_CONFIG_GPIO
), /* 32 */
34 IOMUX_MODE(MX31_PIN_STX0
, IOMUX_CONFIG_GPIO
), /* 33 */
35 IOMUX_MODE(MX31_PIN_SRX0
, IOMUX_CONFIG_GPIO
), /* 34 */
36 IOMUX_MODE(MX31_PIN_SIMPD0
, IOMUX_CONFIG_GPIO
), /* 35 */
37 IOMUX_MODE(MX31_PIN_RTS1
, IOMUX_CONFIG_GPIO
), /* 38 */
38 IOMUX_MODE(MX31_PIN_CTS1
, IOMUX_CONFIG_GPIO
), /* 39 */
39 IOMUX_MODE(MX31_PIN_KEY_ROW4
, IOMUX_CONFIG_GPIO
), /* 50 */
40 IOMUX_MODE(MX31_PIN_KEY_ROW5
, IOMUX_CONFIG_GPIO
), /* 51 */
41 IOMUX_MODE(MX31_PIN_KEY_ROW6
, IOMUX_CONFIG_GPIO
), /* 52 */
42 IOMUX_MODE(MX31_PIN_KEY_ROW7
, IOMUX_CONFIG_GPIO
), /* 53 */
45 IOMUX_MODE(MX31_PIN_DTR_DTE1
, IOMUX_CONFIG_GPIO
), /* 44 */
46 IOMUX_MODE(MX31_PIN_DSR_DTE1
, IOMUX_CONFIG_GPIO
), /* 45 */
47 IOMUX_MODE(MX31_PIN_KEY_COL5
, IOMUX_CONFIG_GPIO
), /* 55 */
48 IOMUX_MODE(MX31_PIN_KEY_COL6
, IOMUX_CONFIG_GPIO
), /* 56 */
52 static struct spi_board_info pcm037_spi_dev
[] = {
54 .modalias
= "dac124s085",
55 .max_speed_hz
= 400000,
57 .chip_select
= 0, /* Index in pcm037_spi1_cs[] */
62 /* Platform Data for MXC CSPI */
63 static int pcm037_spi1_cs
[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7
)};
65 static const struct spi_imx_master pcm037_spi1_pdata __initconst
= {
66 .chipselect
= pcm037_spi1_cs
,
67 .num_chipselect
= ARRAY_SIZE(pcm037_spi1_cs
),
70 /* GPIO-keys input device */
71 static struct gpio_keys_button pcm037_gpio_keys
[] = {
76 .desc
= "Wheel Manual",
100 .desc
= "Nav Pad Up",
106 .desc
= "Nav Pad Right",
112 .desc
= "Nav Pad Down",
118 .desc
= "Nav Pad Left",
124 .desc
= "Nav Pad Ok",
136 .desc
= "Focus Forward",
142 .desc
= "Focus Backward",
148 .desc
= "Release Half",
154 .desc
= "Release Full",
159 static struct gpio_keys_platform_data pcm037_gpio_keys_platform_data
= {
160 .buttons
= pcm037_gpio_keys
,
161 .nbuttons
= ARRAY_SIZE(pcm037_gpio_keys
),
162 .rep
= 0, /* No auto-repeat */
165 static struct platform_device pcm037_gpio_keys_device
= {
169 .platform_data
= &pcm037_gpio_keys_platform_data
,
173 static int __init
eet_init_devices(void)
175 if (!machine_is_pcm037() || pcm037_variant() != PCM037_EET
)
178 mxc_iomux_setup_multiple_pins(pcm037_eet_pins
,
179 ARRAY_SIZE(pcm037_eet_pins
), "pcm037_eet");
182 spi_register_board_info(pcm037_spi_dev
, ARRAY_SIZE(pcm037_spi_dev
));
183 #if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
184 imx31_add_spi_imx0(&pcm037_spi1_pdata
);
187 platform_device_register(&pcm037_gpio_keys_device
);
192 late_initcall(eet_init_devices
);