ocfs2: Make the left masklogs compat.
[taoma-kernel.git] / arch / arm / mach-mx3 / mach-pcm037_eet.c
blobfda56545d2fd0e49de9b733477efff7d936593c0
1 /*
2 * Copyright (C) 2009
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.
8 */
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>
17 #include <mach/spi.h>
19 #include <asm/mach-types.h>
21 #include "pcm037.h"
22 #include "devices.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),
28 /* GPIO keys */
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 */
44 /* LEDs */
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 */
51 /* SPI */
52 static struct spi_board_info pcm037_spi_dev[] = {
54 .modalias = "dac124s085",
55 .max_speed_hz = 400000,
56 .bus_num = 0,
57 .chip_select = 0, /* Index in pcm037_spi1_cs[] */
58 .mode = SPI_CPHA,
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[] = {
73 .type = EV_KEY,
74 .code = KEY_L,
75 .gpio = 0,
76 .desc = "Wheel Manual",
77 .wakeup = 0,
78 }, {
79 .type = EV_KEY,
80 .code = KEY_A,
81 .gpio = 1,
82 .desc = "Wheel AF",
83 .wakeup = 0,
84 }, {
85 .type = EV_KEY,
86 .code = KEY_V,
87 .gpio = 2,
88 .desc = "Wheel View",
89 .wakeup = 0,
90 }, {
91 .type = EV_KEY,
92 .code = KEY_M,
93 .gpio = 3,
94 .desc = "Wheel Menu",
95 .wakeup = 0,
96 }, {
97 .type = EV_KEY,
98 .code = KEY_UP,
99 .gpio = 32,
100 .desc = "Nav Pad Up",
101 .wakeup = 0,
102 }, {
103 .type = EV_KEY,
104 .code = KEY_RIGHT,
105 .gpio = 33,
106 .desc = "Nav Pad Right",
107 .wakeup = 0,
108 }, {
109 .type = EV_KEY,
110 .code = KEY_DOWN,
111 .gpio = 34,
112 .desc = "Nav Pad Down",
113 .wakeup = 0,
114 }, {
115 .type = EV_KEY,
116 .code = KEY_LEFT,
117 .gpio = 35,
118 .desc = "Nav Pad Left",
119 .wakeup = 0,
120 }, {
121 .type = EV_KEY,
122 .code = KEY_ENTER,
123 .gpio = 38,
124 .desc = "Nav Pad Ok",
125 .wakeup = 0,
126 }, {
127 .type = EV_KEY,
128 .code = KEY_O,
129 .gpio = 39,
130 .desc = "Wheel Off",
131 .wakeup = 0,
132 }, {
133 .type = EV_KEY,
134 .code = BTN_FORWARD,
135 .gpio = 50,
136 .desc = "Focus Forward",
137 .wakeup = 0,
138 }, {
139 .type = EV_KEY,
140 .code = BTN_BACK,
141 .gpio = 51,
142 .desc = "Focus Backward",
143 .wakeup = 0,
144 }, {
145 .type = EV_KEY,
146 .code = BTN_MIDDLE,
147 .gpio = 52,
148 .desc = "Release Half",
149 .wakeup = 0,
150 }, {
151 .type = EV_KEY,
152 .code = BTN_EXTRA,
153 .gpio = 53,
154 .desc = "Release Full",
155 .wakeup = 0,
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 = {
166 .name = "gpio-keys",
167 .id = -1,
168 .dev = {
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)
176 return 0;
178 mxc_iomux_setup_multiple_pins(pcm037_eet_pins,
179 ARRAY_SIZE(pcm037_eet_pins), "pcm037_eet");
181 /* SPI */
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);
185 #endif
187 platform_device_register(&pcm037_gpio_keys_device);
189 return 0;
192 late_initcall(eet_init_devices);