Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mach-pcm037_eet.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009
3  * Guennadi Liakhovetski, DENX Software Engineering, <[email protected]>
4  *
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/input.h>
11 #include <linux/platform_device.h>
12 #include <linux/spi/spi.h>
13 
14 #include <mach/common.h>
15 #include <mach/iomux-mx3.h>
16 
17 #include <asm/mach-types.h>
18 
19 #include "pcm037.h"
20 #include "devices-imx31.h"
21 
22 static unsigned int pcm037_eet_pins[] = {
23  /* Reserve and hardwire GPIO 57 high - S6E63D6 chipselect */
25  /* GPIO keys */
40 
41  /* LEDs */
46 };
47 
48 /* SPI */
49 static struct spi_board_info pcm037_spi_dev[] = {
50  {
51  .modalias = "dac124s085",
52  .max_speed_hz = 400000,
53  .bus_num = 0,
54  .chip_select = 0, /* Index in pcm037_spi1_cs[] */
55  .mode = SPI_CPHA,
56  },
57 };
58 
59 /* Platform Data for MXC CSPI */
60 static int pcm037_spi1_cs[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7)};
61 
62 static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
63  .chipselect = pcm037_spi1_cs,
64  .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs),
65 };
66 
67 /* GPIO-keys input device */
68 static struct gpio_keys_button pcm037_gpio_keys[] = {
69  {
70  .type = EV_KEY,
71  .code = KEY_L,
72  .gpio = 0,
73  .desc = "Wheel Manual",
74  .wakeup = 0,
75  }, {
76  .type = EV_KEY,
77  .code = KEY_A,
78  .gpio = 1,
79  .desc = "Wheel AF",
80  .wakeup = 0,
81  }, {
82  .type = EV_KEY,
83  .code = KEY_V,
84  .gpio = 2,
85  .desc = "Wheel View",
86  .wakeup = 0,
87  }, {
88  .type = EV_KEY,
89  .code = KEY_M,
90  .gpio = 3,
91  .desc = "Wheel Menu",
92  .wakeup = 0,
93  }, {
94  .type = EV_KEY,
95  .code = KEY_UP,
96  .gpio = 32,
97  .desc = "Nav Pad Up",
98  .wakeup = 0,
99  }, {
100  .type = EV_KEY,
101  .code = KEY_RIGHT,
102  .gpio = 33,
103  .desc = "Nav Pad Right",
104  .wakeup = 0,
105  }, {
106  .type = EV_KEY,
107  .code = KEY_DOWN,
108  .gpio = 34,
109  .desc = "Nav Pad Down",
110  .wakeup = 0,
111  }, {
112  .type = EV_KEY,
113  .code = KEY_LEFT,
114  .gpio = 35,
115  .desc = "Nav Pad Left",
116  .wakeup = 0,
117  }, {
118  .type = EV_KEY,
119  .code = KEY_ENTER,
120  .gpio = 38,
121  .desc = "Nav Pad Ok",
122  .wakeup = 0,
123  }, {
124  .type = EV_KEY,
125  .code = KEY_O,
126  .gpio = 39,
127  .desc = "Wheel Off",
128  .wakeup = 0,
129  }, {
130  .type = EV_KEY,
131  .code = BTN_FORWARD,
132  .gpio = 50,
133  .desc = "Focus Forward",
134  .wakeup = 0,
135  }, {
136  .type = EV_KEY,
137  .code = BTN_BACK,
138  .gpio = 51,
139  .desc = "Focus Backward",
140  .wakeup = 0,
141  }, {
142  .type = EV_KEY,
143  .code = BTN_MIDDLE,
144  .gpio = 52,
145  .desc = "Release Half",
146  .wakeup = 0,
147  }, {
148  .type = EV_KEY,
149  .code = BTN_EXTRA,
150  .gpio = 53,
151  .desc = "Release Full",
152  .wakeup = 0,
153  },
154 };
155 
156 static const struct gpio_keys_platform_data
157  pcm037_gpio_keys_platform_data __initconst = {
158  .buttons = pcm037_gpio_keys,
159  .nbuttons = ARRAY_SIZE(pcm037_gpio_keys),
160  .rep = 0, /* No auto-repeat */
161 };
162 
164 {
165  if (pcm037_variant() != PCM037_EET)
166  return 0;
167 
168  mxc_iomux_setup_multiple_pins(pcm037_eet_pins,
169  ARRAY_SIZE(pcm037_eet_pins), "pcm037_eet");
170 
171  /* SPI */
172  spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev));
173  imx31_add_spi_imx0(&pcm037_spi1_pdata);
174 
175  imx_add_gpio_keys(&pcm037_gpio_keys_platform_data);
176 
177  return 0;
178 }