Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
eukrea_mbimxsd51-baseboard.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2010 Eric Benard - [email protected]
3  *
4  * Based on pcm970-baseboard.c which is :
5  * Copyright (C) 2008 Juergen Beisert ([email protected])
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  */
21 
22 #include <linux/types.h>
23 #include <linux/init.h>
24 
25 #include <linux/gpio.h>
26 #include <linux/interrupt.h>
27 #include <linux/leds.h>
28 #include <linux/platform_device.h>
29 #include <linux/input.h>
30 #include <linux/i2c.h>
31 #include <video/platform_lcd.h>
32 #include <linux/backlight.h>
33 
34 #include <asm/mach-types.h>
35 #include <asm/mach/arch.h>
36 #include <asm/mach/time.h>
37 #include <asm/mach/map.h>
38 
39 #include <mach/hardware.h>
40 #include <mach/common.h>
41 #include <mach/iomux-mx51.h>
42 
43 #include "devices-imx51.h"
44 
45 static iomux_v3_cfg_t eukrea_mbimxsd51_pads[] = {
46  /* LED */
48  /* SWITCH */
52  /* UART2 */
55  /* UART 3 */
60  /* SD */
67  /* SD1 CD */
71  /* SSI */
76  /* LCD Backlight */
78  /* LCD RST */
80 };
81 
82 #define GPIO_LED1 IMX_GPIO_NR(3, 30)
83 #define GPIO_SWITCH1 IMX_GPIO_NR(3, 31)
84 #define GPIO_LCDRST IMX_GPIO_NR(3, 13)
85 #define GPIO_LCDBL IMX_GPIO_NR(3, 4)
86 
87 static void eukrea_mbimxsd51_lcd_power_set(struct plat_lcd_data *pd,
88  unsigned int power)
89 {
90  if (power)
92  else
94 }
95 
96 static struct plat_lcd_data eukrea_mbimxsd51_lcd_power_data = {
97  .set_power = eukrea_mbimxsd51_lcd_power_set,
98 };
99 
100 static struct platform_device eukrea_mbimxsd51_lcd_powerdev = {
101  .name = "platform-lcd",
102  .dev.platform_data = &eukrea_mbimxsd51_lcd_power_data,
103 };
104 
105 static void eukrea_mbimxsd51_bl_set_intensity(int intensity)
106 {
107  if (intensity)
109  else
111 }
112 
113 static struct generic_bl_info eukrea_mbimxsd51_bl_info = {
114  .name = "eukrea_mbimxsd51-bl",
115  .max_intensity = 0xff,
116  .default_intensity = 0xff,
117  .set_bl_intensity = eukrea_mbimxsd51_bl_set_intensity,
118 };
119 
120 static struct platform_device eukrea_mbimxsd51_bl_dev = {
121  .name = "generic-bl",
122  .id = 1,
123  .dev = {
124  .platform_data = &eukrea_mbimxsd51_bl_info,
125  },
126 };
127 
128 static const struct gpio_led eukrea_mbimxsd51_leds[] __initconst = {
129  {
130  .name = "led1",
131  .default_trigger = "heartbeat",
132  .active_low = 1,
133  .gpio = GPIO_LED1,
134  },
135 };
136 
137 static const struct gpio_led_platform_data
138  eukrea_mbimxsd51_led_info __initconst = {
139  .leds = eukrea_mbimxsd51_leds,
140  .num_leds = ARRAY_SIZE(eukrea_mbimxsd51_leds),
141 };
142 
143 static struct gpio_keys_button eukrea_mbimxsd51_gpio_buttons[] = {
144  {
145  .gpio = GPIO_SWITCH1,
146  .code = BTN_0,
147  .desc = "BP1",
148  .active_low = 1,
149  .wakeup = 1,
150  },
151 };
152 
153 static const struct gpio_keys_platform_data
154  eukrea_mbimxsd51_button_data __initconst = {
155  .buttons = eukrea_mbimxsd51_gpio_buttons,
156  .nbuttons = ARRAY_SIZE(eukrea_mbimxsd51_gpio_buttons),
157 };
158 
159 static const struct imxuart_platform_data uart_pdata __initconst = {
160  .flags = IMXUART_HAVE_RTSCTS,
161 };
162 
163 static struct i2c_board_info eukrea_mbimxsd51_i2c_devices[] = {
164  {
165  I2C_BOARD_INFO("tlv320aic23", 0x1a),
166  },
167 };
168 
169 static const
170 struct imx_ssi_platform_data eukrea_mbimxsd51_ssi_pdata __initconst = {
172 };
173 
174 static int screen_type;
175 
176 static int __init eukrea_mbimxsd51_screen_type(char *options)
177 {
178  if (!strcmp(options, "dvi"))
179  screen_type = 1;
180  else if (!strcmp(options, "tft"))
181  screen_type = 0;
182 
183  return 0;
184 }
185 __setup("screen_type=", eukrea_mbimxsd51_screen_type);
186 
187 /*
188  * system init for baseboard usage. Will be called by cpuimx51sd init.
189  *
190  * Add platform devices present on this baseboard and init
191  * them from CPU side as far as required to use them later on
192  */
194 {
195  if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd51_pads,
196  ARRAY_SIZE(eukrea_mbimxsd51_pads)))
197  printk(KERN_ERR "error setting mbimxsd pads !\n");
198 
200  imx51_add_imx_uart(2, &uart_pdata);
201 
203 
204  imx51_add_imx_ssi(0, &eukrea_mbimxsd51_ssi_pdata);
205 
206  gpio_request(GPIO_LED1, "LED1");
209 
210  gpio_request(GPIO_SWITCH1, "SWITCH1");
213 
214  gpio_request(GPIO_LCDRST, "LCDRST");
216  gpio_request(GPIO_LCDBL, "LCDBL");
218  if (!screen_type) {
219  platform_device_register(&eukrea_mbimxsd51_bl_dev);
220  platform_device_register(&eukrea_mbimxsd51_lcd_powerdev);
221  } else {
224  }
225 
226  i2c_register_board_info(0, eukrea_mbimxsd51_i2c_devices,
227  ARRAY_SIZE(eukrea_mbimxsd51_i2c_devices));
228 
229  gpio_led_register_device(-1, &eukrea_mbimxsd51_led_info);
230  imx_add_gpio_keys(&eukrea_mbimxsd51_button_data);
231  imx_add_platform_device("eukrea_tlv320", 0, NULL, 0, NULL, 0);
232 }