c1dd6b9176234ee4fc22af24a865f2720bb72196
[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap / 0026-OMAP-DSS2-Add-DSS2-support-for-Overo.patch
1 From 21da1a248b7a19136bb53a32061989473bc79551 Mon Sep 17 00:00:00 2001
2 From: Steve Sakoman <steve@sakoman.com>
3 Date: Fri, 18 Dec 2009 06:39:24 -0800
4 Subject: [PATCH 26/29] OMAP: DSS2: Add DSS2 support for Overo
6 ---
7 arch/arm/mach-omap2/board-overo.c | 238 +++++++++++++++++++++++++++++++------
8 1 files changed, 204 insertions(+), 34 deletions(-)
10 diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
11 index b28a9d5..8a44c17 100644
12 --- a/arch/arm/mach-omap2/board-overo.c
13 +++ b/arch/arm/mach-omap2/board-overo.c
14 @@ -28,6 +28,7 @@
15 #include <linux/platform_device.h>
16 #include <linux/i2c/twl.h>
17 #include <linux/regulator/machine.h>
18 +#include <linux/spi/spi.h>
20 #include <linux/mtd/mtd.h>
21 #include <linux/mtd/nand.h>
22 @@ -41,10 +42,13 @@
24 #include <plat/board.h>
25 #include <plat/common.h>
26 +#include <plat/display.h>
27 #include <mach/gpio.h>
28 #include <plat/gpmc.h>
29 #include <mach/hardware.h>
30 #include <plat/nand.h>
31 +#include <plat/mcspi.h>
32 +#include <plat/mux.h>
33 #include <plat/usb.h>
35 #include "mux.h"
36 @@ -68,8 +72,6 @@
37 #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
38 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
40 -#include <plat/mcspi.h>
41 -#include <linux/spi/spi.h>
42 #include <linux/spi/ads7846.h>
44 static struct omap2_mcspi_device_config ads7846_mcspi_config = {
45 @@ -94,18 +96,6 @@ static struct ads7846_platform_data ads7846_config = {
46 .keep_vref_on = 1,
47 };
49 -static struct spi_board_info overo_spi_board_info[] __initdata = {
50 - {
51 - .modalias = "ads7846",
52 - .bus_num = 1,
53 - .chip_select = 0,
54 - .max_speed_hz = 1500000,
55 - .controller_data = &ads7846_mcspi_config,
56 - .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
57 - .platform_data = &ads7846_config,
58 - }
59 -};
60 -
61 static void __init overo_ads7846_init(void)
62 {
63 if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) &&
64 @@ -115,9 +105,6 @@ static void __init overo_ads7846_init(void)
65 printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n");
66 return;
67 }
68 -
69 - spi_register_board_info(overo_spi_board_info,
70 - ARRAY_SIZE(overo_spi_board_info));
71 }
73 #else
74 @@ -233,6 +220,139 @@ static inline void __init overo_init_smsc911x(void)
75 static inline void __init overo_init_smsc911x(void) { return; }
76 #endif
78 +/* DSS */
79 +static int lcd_enabled;
80 +static int dvi_enabled;
81 +
82 +#define OVERO_GPIO_LCD_EN 144
83 +#define OVERO_GPIO_LCD_BL 145
84 +
85 +static void __init overo_display_init(void)
86 +{
87 + if ((gpio_request(OVERO_GPIO_LCD_EN, "OVERO_GPIO_LCD_EN") == 0) &&
88 + (gpio_direction_output(OVERO_GPIO_LCD_EN, 1) == 0))
89 + gpio_export(OVERO_GPIO_LCD_EN, 0);
90 + else
91 + printk(KERN_ERR "could not obtain gpio for "
92 + "OVERO_GPIO_LCD_EN\n");
93 +
94 + if ((gpio_request(OVERO_GPIO_LCD_BL, "OVERO_GPIO_LCD_BL") == 0) &&
95 + (gpio_direction_output(OVERO_GPIO_LCD_BL, 1) == 0))
96 + gpio_export(OVERO_GPIO_LCD_BL, 0);
97 + else
98 + printk(KERN_ERR "could not obtain gpio for "
99 + "OVERO_GPIO_LCD_BL\n");
100 +}
101 +
102 +static int overo_panel_enable_dvi(struct omap_dss_device *dssdev)
103 +{
104 + if (lcd_enabled) {
105 + printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
106 + return -EINVAL;
107 + }
108 + dvi_enabled = 1;
109 +
110 + return 0;
111 +}
112 +
113 +static void overo_panel_disable_dvi(struct omap_dss_device *dssdev)
114 +{
115 + dvi_enabled = 0;
116 +}
117 +
118 +static struct omap_dss_device overo_dvi_device = {
119 + .type = OMAP_DISPLAY_TYPE_DPI,
120 + .name = "dvi",
121 + .driver_name = "generic_panel",
122 + .phy.dpi.data_lines = 24,
123 + .platform_enable = overo_panel_enable_dvi,
124 + .platform_disable = overo_panel_disable_dvi,
125 +};
126 +
127 +static struct omap_dss_device overo_tv_device = {
128 + .name = "tv",
129 + .driver_name = "venc",
130 + .type = OMAP_DISPLAY_TYPE_VENC,
131 + .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
132 +};
133 +
134 +static int overo_panel_enable_lcd(struct omap_dss_device *dssdev)
135 +{
136 + if (dvi_enabled) {
137 + printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
138 + return -EINVAL;
139 + }
140 +
141 + gpio_set_value(OVERO_GPIO_LCD_EN, 1);
142 + gpio_set_value(OVERO_GPIO_LCD_BL, 1);
143 + lcd_enabled = 1;
144 + return 0;
145 +}
146 +
147 +static void overo_panel_disable_lcd(struct omap_dss_device *dssdev)
148 +{
149 + gpio_set_value(OVERO_GPIO_LCD_EN, 0);
150 + gpio_set_value(OVERO_GPIO_LCD_BL, 0);
151 + lcd_enabled = 0;
152 +}
153 +
154 +#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
155 + defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
156 +static struct omap_dss_device overo_lcd35_device = {
157 + .type = OMAP_DISPLAY_TYPE_DPI,
158 + .name = "lcd35",
159 + .driver_name = "lgphilips_lb035q02_panel",
160 + .phy.dpi.data_lines = 24,
161 + .platform_enable = overo_panel_enable_lcd,
162 + .platform_disable = overo_panel_disable_lcd,
163 +};
164 +#endif
165 +
166 +#if defined(CONFIG_PANEL_SAMSUNG_LTE430WQ_F0C) || \
167 + defined(CONFIG_PANEL_SAMSUNG_LTE430WQ_F0C_MODULE)
168 +static struct omap_dss_device overo_lcd43_device = {
169 + .type = OMAP_DISPLAY_TYPE_DPI,
170 + .name = "lcd43",
171 + .driver_name = "samsung_lte_panel",
172 + .phy.dpi.data_lines = 24,
173 + .platform_enable = overo_panel_enable_lcd,
174 + .platform_disable = overo_panel_disable_lcd,
175 +};
176 +#endif
177 +
178 +static struct omap_dss_device *overo_dss_devices[] = {
179 + &overo_dvi_device,
180 + &overo_tv_device,
181 +#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
182 + defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
183 + &overo_lcd35_device,
184 +#endif
185 +#if defined(CONFIG_PANEL_SAMSUNG_LTE430WQ_F0C) || \
186 + defined(CONFIG_PANEL_SAMSUNG_LTE430WQ_F0C_MODULE)
187 + &overo_lcd43_device,
188 +#endif
189 +};
190 +
191 +static struct omap_dss_board_info overo_dss_data = {
192 + .num_devices = ARRAY_SIZE(overo_dss_devices),
193 + .devices = overo_dss_devices,
194 + .default_device = &overo_dvi_device,
195 +};
196 +
197 +static struct platform_device overo_dss_device = {
198 + .name = "omapdss",
199 + .id = -1,
200 + .dev = {
201 + .platform_data = &overo_dss_data,
202 + },
203 +};
204 +
205 +static struct regulator_consumer_supply overo_vdda_dac_supply =
206 + REGULATOR_SUPPLY("vdda_dac", "omapdss");
207 +
208 +static struct regulator_consumer_supply overo_vdds_dsi_supply =
209 + REGULATOR_SUPPLY("vdds_dsi", "omapdss");
210 +
211 static struct mtd_partition overo_nand_partitions[] = {
212 {
213 .name = "xloader",
214 @@ -358,6 +478,37 @@ static struct regulator_init_data overo_vmmc1 = {
215 .consumer_supplies = &overo_vmmc1_supply,
216 };
218 +/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
219 +static struct regulator_init_data overo_vdac = {
220 + .constraints = {
221 + .min_uV = 1800000,
222 + .max_uV = 1800000,
223 + .valid_modes_mask = REGULATOR_MODE_NORMAL
224 + | REGULATOR_MODE_STANDBY,
225 + .valid_ops_mask = REGULATOR_CHANGE_MODE
226 + | REGULATOR_CHANGE_STATUS,
227 + },
228 + .num_consumer_supplies = 1,
229 + .consumer_supplies = &overo_vdda_dac_supply,
230 +};
231 +
232 +/* VPLL2 for digital video outputs */
233 +static struct regulator_init_data overo_vpll2 = {
234 + .constraints = {
235 + .name = "VDVI",
236 + .min_uV = 1800000,
237 + .max_uV = 1800000,
238 + .valid_modes_mask = REGULATOR_MODE_NORMAL
239 + | REGULATOR_MODE_STANDBY,
240 + .valid_ops_mask = REGULATOR_CHANGE_MODE
241 + | REGULATOR_CHANGE_STATUS,
242 + },
243 + .num_consumer_supplies = 1,
244 + .consumer_supplies = &overo_vdds_dsi_supply,
245 +};
246 +
247 +/* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */
248 +
249 static struct twl4030_codec_audio_data overo_audio_data = {
250 .audio_mclk = 26000000,
251 };
252 @@ -367,8 +518,6 @@ static struct twl4030_codec_data overo_codec_data = {
253 .audio = &overo_audio_data,
254 };
256 -/* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */
257 -
258 static struct twl4030_madc_platform_data overo_madc_data = {
259 .irq_line = 1,
260 };
261 @@ -381,6 +530,8 @@ static struct twl4030_platform_data overo_twldata = {
262 .usb = &overo_usb_data,
263 .codec = &overo_codec_data,
264 .vmmc1 = &overo_vmmc1,
265 + .vdac = &overo_vdac,
266 + .vpll2 = &overo_vpll2,
267 };
269 static struct i2c_board_info __initdata overo_i2c_boardinfo[] = {
270 @@ -401,23 +552,41 @@ static int __init overo_i2c_init(void)
271 return 0;
272 }
274 -static struct platform_device overo_lcd_device = {
275 - .name = "overo_lcd",
276 - .id = -1,
277 -};
278 -
279 -static struct omap_lcd_config overo_lcd_config __initdata = {
280 - .ctrl_name = "internal",
281 +static struct spi_board_info overo_spi_board_info[] __initdata = {
282 +#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
283 + defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
284 + {
285 + .modalias = "ads7846",
286 + .bus_num = 1,
287 + .chip_select = 0,
288 + .max_speed_hz = 1500000,
289 + .controller_data = &ads7846_mcspi_config,
290 + .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN),
291 + .platform_data = &ads7846_config,
292 + },
293 +#endif
294 +#if defined(CONFIG_PANEL_LGPHILIPS_LB035Q02) || \
295 + defined(CONFIG_PANEL_LGPHILIPS_LB035Q02_MODULE)
296 + {
297 + .modalias = "lgphilips_lb035q02_panel-spi",
298 + .bus_num = 1,
299 + .chip_select = 1,
300 + .max_speed_hz = 500000,
301 + .mode = SPI_MODE_3,
302 + },
303 +#endif
304 };
306 -static struct omap_board_config_kernel overo_config[] __initdata = {
307 - { OMAP_TAG_LCD, &overo_lcd_config },
308 -};
309 +static int __init overo_spi_init(void)
310 +{
311 + overo_ads7846_init();
312 + spi_register_board_info(overo_spi_board_info,
313 + ARRAY_SIZE(overo_spi_board_info));
314 + return 0;
315 +}
317 static void __init overo_init_irq(void)
318 {
319 - omap_board_config = overo_config;
320 - omap_board_config_size = ARRAY_SIZE(overo_config);
321 omap2_init_common_infrastructure();
322 omap2_init_common_devices(mt46h32m32lf6_sdrc_params,
323 mt46h32m32lf6_sdrc_params);
324 @@ -425,7 +594,7 @@ static void __init overo_init_irq(void)
325 }
327 static struct platform_device *overo_devices[] __initdata = {
328 - &overo_lcd_device,
329 + &overo_dss_device,
330 };
332 static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
333 @@ -466,8 +635,9 @@ static void __init overo_init(void)
334 overo_flash_init();
335 usb_musb_init(&musb_board_data);
336 usb_ehci_init(&ehci_pdata);
337 - overo_ads7846_init();
338 + overo_spi_init();
339 overo_init_smsc911x();
340 + overo_display_init();
342 /* Ensure SDRC pins are mux'd for self-refresh */
343 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
344 @@ -510,7 +680,7 @@ static void __init overo_init(void)
345 "OVERO_GPIO_USBH_CPEN\n");
346 }
348 -MACHINE_START(OVERO, "Gumstix Overo")
349 +MACHINE_START(OVERO, "Gumstsix Overo")
350 .boot_params = 0x80000100,
351 .map_io = omap3_map_io,
352 .reserve = omap_reserve,
353 --
354 1.6.6.1