Linux 5.7.7
[linux/fpc-iii.git] / arch / arm / mach-imx / mach-pcm037_eet.c
blob51f5142920cf5d2ae58754edecac190d14c91504
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Copyright (C) 2009
4 * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
5 */
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>
13 #include "pcm037.h"
14 #include "common.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),
21 /* GPIO keys */
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 */
37 /* LEDs */
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 */
44 /* SPI */
45 static struct spi_board_info pcm037_spi_dev[] = {
47 .modalias = "dac124s085",
48 .max_speed_hz = 400000,
49 .bus_num = 0,
50 .chip_select = 1, /* Index in pcm037_spi1_cs[] */
51 .mode = SPI_CPHA,
55 /* Platform Data for MXC CSPI */
56 static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
57 .num_chipselect = 2,
60 /* GPIO-keys input device */
61 static struct gpio_keys_button pcm037_gpio_keys[] = {
63 .type = EV_KEY,
64 .code = KEY_L,
65 .gpio = 0,
66 .desc = "Wheel Manual",
67 .wakeup = 0,
68 }, {
69 .type = EV_KEY,
70 .code = KEY_A,
71 .gpio = 1,
72 .desc = "Wheel AF",
73 .wakeup = 0,
74 }, {
75 .type = EV_KEY,
76 .code = KEY_V,
77 .gpio = 2,
78 .desc = "Wheel View",
79 .wakeup = 0,
80 }, {
81 .type = EV_KEY,
82 .code = KEY_M,
83 .gpio = 3,
84 .desc = "Wheel Menu",
85 .wakeup = 0,
86 }, {
87 .type = EV_KEY,
88 .code = KEY_UP,
89 .gpio = 32,
90 .desc = "Nav Pad Up",
91 .wakeup = 0,
92 }, {
93 .type = EV_KEY,
94 .code = KEY_RIGHT,
95 .gpio = 33,
96 .desc = "Nav Pad Right",
97 .wakeup = 0,
98 }, {
99 .type = EV_KEY,
100 .code = KEY_DOWN,
101 .gpio = 34,
102 .desc = "Nav Pad Down",
103 .wakeup = 0,
104 }, {
105 .type = EV_KEY,
106 .code = KEY_LEFT,
107 .gpio = 35,
108 .desc = "Nav Pad Left",
109 .wakeup = 0,
110 }, {
111 .type = EV_KEY,
112 .code = KEY_ENTER,
113 .gpio = 38,
114 .desc = "Nav Pad Ok",
115 .wakeup = 0,
116 }, {
117 .type = EV_KEY,
118 .code = KEY_O,
119 .gpio = 39,
120 .desc = "Wheel Off",
121 .wakeup = 0,
122 }, {
123 .type = EV_KEY,
124 .code = BTN_FORWARD,
125 .gpio = 50,
126 .desc = "Focus Forward",
127 .wakeup = 0,
128 }, {
129 .type = EV_KEY,
130 .code = BTN_BACK,
131 .gpio = 51,
132 .desc = "Focus Backward",
133 .wakeup = 0,
134 }, {
135 .type = EV_KEY,
136 .code = BTN_MIDDLE,
137 .gpio = 52,
138 .desc = "Release Half",
139 .wakeup = 0,
140 }, {
141 .type = EV_KEY,
142 .code = BTN_EXTRA,
143 .gpio = 53,
144 .desc = "Release Full",
145 .wakeup = 0,
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)
159 return 0;
161 mxc_iomux_setup_multiple_pins(pcm037_eet_pins,
162 ARRAY_SIZE(pcm037_eet_pins), "pcm037_eet");
164 /* SPI */
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);
170 return 0;