1 // SPDX-License-Identifier: GPL-2.0-only
4 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
6 #include <linux/gpio.h>
7 #include <linux/input.h>
8 #include <linux/platform_device.h>
9 #include <linux/spi/spi.h>
11 #include <asm/mach-types.h>
15 #include "devices-imx31.h"
16 #include "iomux-mx3.h"
18 static unsigned int pcm037_eet_pins
[] = {
19 /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
20 IOMUX_MODE(MX31_PIN_KEY_COL7
, IOMUX_CONFIG_GPIO
),
22 IOMUX_MODE(MX31_PIN_GPIO1_0
, IOMUX_CONFIG_GPIO
), /* 0 */
23 IOMUX_MODE(MX31_PIN_GPIO1_1
, IOMUX_CONFIG_GPIO
), /* 1 */
24 IOMUX_MODE(MX31_PIN_GPIO1_2
, IOMUX_CONFIG_GPIO
), /* 2 */
25 IOMUX_MODE(MX31_PIN_GPIO1_3
, IOMUX_CONFIG_GPIO
), /* 3 */
26 IOMUX_MODE(MX31_PIN_SVEN0
, IOMUX_CONFIG_GPIO
), /* 32 */
27 IOMUX_MODE(MX31_PIN_STX0
, IOMUX_CONFIG_GPIO
), /* 33 */
28 IOMUX_MODE(MX31_PIN_SRX0
, IOMUX_CONFIG_GPIO
), /* 34 */
29 IOMUX_MODE(MX31_PIN_SIMPD0
, IOMUX_CONFIG_GPIO
), /* 35 */
30 IOMUX_MODE(MX31_PIN_RTS1
, IOMUX_CONFIG_GPIO
), /* 38 */
31 IOMUX_MODE(MX31_PIN_CTS1
, IOMUX_CONFIG_GPIO
), /* 39 */
32 IOMUX_MODE(MX31_PIN_KEY_ROW4
, IOMUX_CONFIG_GPIO
), /* 50 */
33 IOMUX_MODE(MX31_PIN_KEY_ROW5
, IOMUX_CONFIG_GPIO
), /* 51 */
34 IOMUX_MODE(MX31_PIN_KEY_ROW6
, IOMUX_CONFIG_GPIO
), /* 52 */
35 IOMUX_MODE(MX31_PIN_KEY_ROW7
, IOMUX_CONFIG_GPIO
), /* 53 */
38 IOMUX_MODE(MX31_PIN_DTR_DTE1
, IOMUX_CONFIG_GPIO
), /* 44 */
39 IOMUX_MODE(MX31_PIN_DSR_DTE1
, IOMUX_CONFIG_GPIO
), /* 45 */
40 IOMUX_MODE(MX31_PIN_KEY_COL5
, IOMUX_CONFIG_GPIO
), /* 55 */
41 IOMUX_MODE(MX31_PIN_KEY_COL6
, IOMUX_CONFIG_GPIO
), /* 56 */
45 static struct spi_board_info pcm037_spi_dev
[] = {
47 .modalias
= "dac124s085",
48 .max_speed_hz
= 400000,
50 .chip_select
= 1, /* Index in pcm037_spi1_cs[] */
55 /* Platform Data for MXC CSPI */
56 static const struct spi_imx_master pcm037_spi1_pdata __initconst
= {
60 /* GPIO-keys input device */
61 static struct gpio_keys_button pcm037_gpio_keys
[] = {
66 .desc
= "Wheel Manual",
96 .desc
= "Nav Pad Right",
102 .desc
= "Nav Pad Down",
108 .desc
= "Nav Pad Left",
114 .desc
= "Nav Pad Ok",
126 .desc
= "Focus Forward",
132 .desc
= "Focus Backward",
138 .desc
= "Release Half",
144 .desc
= "Release Full",
149 static const struct gpio_keys_platform_data
150 pcm037_gpio_keys_platform_data __initconst
= {
151 .buttons
= pcm037_gpio_keys
,
152 .nbuttons
= ARRAY_SIZE(pcm037_gpio_keys
),
153 .rep
= 0, /* No auto-repeat */
156 int __init
pcm037_eet_init_devices(void)
158 if (pcm037_variant() != PCM037_EET
)
161 mxc_iomux_setup_multiple_pins(pcm037_eet_pins
,
162 ARRAY_SIZE(pcm037_eet_pins
), "pcm037_eet");
165 spi_register_board_info(pcm037_spi_dev
, ARRAY_SIZE(pcm037_spi_dev
));
166 imx31_add_spi_imx0(&pcm037_spi1_pdata
);
168 imx_add_gpio_keys(&pcm037_gpio_keys_platform_data
);