diff options
author | Mike Rapoport <mike@compulab.co.il> | 2009-12-14 03:01:08 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2010-02-12 05:29:57 -0500 |
commit | 7f049ad15ece7f63b59ad438b51629434cdc0198 (patch) | |
tree | 80ffadf905047c77db4228afd2654fb212849d37 /arch/arm/mach-omap2/board-cm-t35.c | |
parent | c3d33329f400587976613c0224ffa2e266677cfb (diff) |
omap3: cm-t35: add DSS2 display support
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'arch/arm/mach-omap2/board-cm-t35.c')
-rw-r--r-- | arch/arm/mach-omap2/board-cm-t35.c | 239 |
1 files changed, 238 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index 2626a9f8a73a..85b45437d51a 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
@@ -32,6 +32,9 @@ | |||
32 | #include <linux/i2c/twl.h> | 32 | #include <linux/i2c/twl.h> |
33 | #include <linux/regulator/machine.h> | 33 | #include <linux/regulator/machine.h> |
34 | 34 | ||
35 | #include <linux/spi/spi.h> | ||
36 | #include <linux/spi/tdo24m.h> | ||
37 | |||
35 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
36 | #include <asm/mach/arch.h> | 39 | #include <asm/mach/arch.h> |
37 | #include <asm/mach/map.h> | 40 | #include <asm/mach/map.h> |
@@ -41,6 +44,7 @@ | |||
41 | #include <plat/nand.h> | 44 | #include <plat/nand.h> |
42 | #include <plat/gpmc.h> | 45 | #include <plat/gpmc.h> |
43 | #include <plat/usb.h> | 46 | #include <plat/usb.h> |
47 | #include <plat/display.h> | ||
44 | 48 | ||
45 | #include <mach/hardware.h> | 49 | #include <mach/hardware.h> |
46 | 50 | ||
@@ -248,7 +252,6 @@ static inline void cm_t35_init_nand(void) {} | |||
248 | 252 | ||
249 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ | 253 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ |
250 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) | 254 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
251 | #include <linux/spi/spi.h> | ||
252 | #include <linux/spi/ads7846.h> | 255 | #include <linux/spi/ads7846.h> |
253 | 256 | ||
254 | #include <plat/mcspi.h> | 257 | #include <plat/mcspi.h> |
@@ -304,6 +307,193 @@ static void __init cm_t35_init_ads7846(void) | |||
304 | static inline void cm_t35_init_ads7846(void) {} | 307 | static inline void cm_t35_init_ads7846(void) {} |
305 | #endif | 308 | #endif |
306 | 309 | ||
310 | #define CM_T35_LCD_EN_GPIO 157 | ||
311 | #define CM_T35_LCD_BL_GPIO 58 | ||
312 | #define CM_T35_DVI_EN_GPIO 54 | ||
313 | |||
314 | static int lcd_bl_gpio; | ||
315 | static int lcd_en_gpio; | ||
316 | static int dvi_en_gpio; | ||
317 | |||
318 | static int lcd_enabled; | ||
319 | static int dvi_enabled; | ||
320 | |||
321 | static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev) | ||
322 | { | ||
323 | if (dvi_enabled) { | ||
324 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); | ||
325 | return -EINVAL; | ||
326 | } | ||
327 | |||
328 | gpio_set_value(lcd_en_gpio, 1); | ||
329 | gpio_set_value(lcd_bl_gpio, 1); | ||
330 | |||
331 | lcd_enabled = 1; | ||
332 | |||
333 | return 0; | ||
334 | } | ||
335 | |||
336 | static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev) | ||
337 | { | ||
338 | lcd_enabled = 0; | ||
339 | |||
340 | gpio_set_value(lcd_bl_gpio, 0); | ||
341 | gpio_set_value(lcd_en_gpio, 0); | ||
342 | } | ||
343 | |||
344 | static int cm_t35_panel_enable_dvi(struct omap_dss_device *dssdev) | ||
345 | { | ||
346 | if (lcd_enabled) { | ||
347 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); | ||
348 | return -EINVAL; | ||
349 | } | ||
350 | |||
351 | gpio_set_value(dvi_en_gpio, 0); | ||
352 | dvi_enabled = 1; | ||
353 | |||
354 | return 0; | ||
355 | } | ||
356 | |||
357 | static void cm_t35_panel_disable_dvi(struct omap_dss_device *dssdev) | ||
358 | { | ||
359 | gpio_set_value(dvi_en_gpio, 1); | ||
360 | dvi_enabled = 0; | ||
361 | } | ||
362 | |||
363 | static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev) | ||
364 | { | ||
365 | return 0; | ||
366 | } | ||
367 | |||
368 | static void cm_t35_panel_disable_tv(struct omap_dss_device *dssdev) | ||
369 | { | ||
370 | } | ||
371 | |||
372 | static struct omap_dss_device cm_t35_lcd_device = { | ||
373 | .name = "lcd", | ||
374 | .driver_name = "toppoly_tdo35s_panel", | ||
375 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
376 | .phy.dpi.data_lines = 18, | ||
377 | .platform_enable = cm_t35_panel_enable_lcd, | ||
378 | .platform_disable = cm_t35_panel_disable_lcd, | ||
379 | }; | ||
380 | |||
381 | static struct omap_dss_device cm_t35_dvi_device = { | ||
382 | .name = "dvi", | ||
383 | .driver_name = "generic_panel", | ||
384 | .type = OMAP_DISPLAY_TYPE_DPI, | ||
385 | .phy.dpi.data_lines = 24, | ||
386 | .platform_enable = cm_t35_panel_enable_dvi, | ||
387 | .platform_disable = cm_t35_panel_disable_dvi, | ||
388 | }; | ||
389 | |||
390 | static struct omap_dss_device cm_t35_tv_device = { | ||
391 | .name = "tv", | ||
392 | .driver_name = "venc", | ||
393 | .type = OMAP_DISPLAY_TYPE_VENC, | ||
394 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, | ||
395 | .platform_enable = cm_t35_panel_enable_tv, | ||
396 | .platform_disable = cm_t35_panel_disable_tv, | ||
397 | }; | ||
398 | |||
399 | static struct omap_dss_device *cm_t35_dss_devices[] = { | ||
400 | &cm_t35_lcd_device, | ||
401 | &cm_t35_dvi_device, | ||
402 | &cm_t35_tv_device, | ||
403 | }; | ||
404 | |||
405 | static struct omap_dss_board_info cm_t35_dss_data = { | ||
406 | .num_devices = ARRAY_SIZE(cm_t35_dss_devices), | ||
407 | .devices = cm_t35_dss_devices, | ||
408 | .default_device = &cm_t35_dvi_device, | ||
409 | }; | ||
410 | |||
411 | static struct platform_device cm_t35_dss_device = { | ||
412 | .name = "omapdss", | ||
413 | .id = -1, | ||
414 | .dev = { | ||
415 | .platform_data = &cm_t35_dss_data, | ||
416 | }, | ||
417 | }; | ||
418 | |||
419 | static struct omap2_mcspi_device_config tdo24m_mcspi_config = { | ||
420 | .turbo_mode = 0, | ||
421 | .single_channel = 1, /* 0: slave, 1: master */ | ||
422 | }; | ||
423 | |||
424 | static struct tdo24m_platform_data tdo24m_config = { | ||
425 | .model = TDO35S, | ||
426 | }; | ||
427 | |||
428 | static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = { | ||
429 | { | ||
430 | .modalias = "tdo24m", | ||
431 | .bus_num = 4, | ||
432 | .chip_select = 0, | ||
433 | .max_speed_hz = 1000000, | ||
434 | .controller_data = &tdo24m_mcspi_config, | ||
435 | .platform_data = &tdo24m_config, | ||
436 | }, | ||
437 | }; | ||
438 | |||
439 | static void __init cm_t35_init_display(void) | ||
440 | { | ||
441 | int err; | ||
442 | |||
443 | lcd_en_gpio = CM_T35_LCD_EN_GPIO; | ||
444 | lcd_bl_gpio = CM_T35_LCD_BL_GPIO; | ||
445 | dvi_en_gpio = CM_T35_DVI_EN_GPIO; | ||
446 | |||
447 | spi_register_board_info(cm_t35_lcd_spi_board_info, | ||
448 | ARRAY_SIZE(cm_t35_lcd_spi_board_info)); | ||
449 | |||
450 | err = gpio_request(lcd_en_gpio, "LCD RST"); | ||
451 | if (err) { | ||
452 | pr_err("CM-T35: failed to get LCD reset GPIO\n"); | ||
453 | goto out; | ||
454 | } | ||
455 | |||
456 | err = gpio_request(lcd_bl_gpio, "LCD BL"); | ||
457 | if (err) { | ||
458 | pr_err("CM-T35: failed to get LCD backlight control GPIO\n"); | ||
459 | goto err_lcd_bl; | ||
460 | } | ||
461 | |||
462 | err = gpio_request(dvi_en_gpio, "DVI EN"); | ||
463 | if (err) { | ||
464 | pr_err("CM-T35: failed to get DVI reset GPIO\n"); | ||
465 | goto err_dvi_en; | ||
466 | } | ||
467 | |||
468 | gpio_export(lcd_en_gpio, 0); | ||
469 | gpio_export(lcd_bl_gpio, 0); | ||
470 | gpio_export(dvi_en_gpio, 0); | ||
471 | gpio_direction_output(lcd_en_gpio, 0); | ||
472 | gpio_direction_output(lcd_bl_gpio, 0); | ||
473 | gpio_direction_output(dvi_en_gpio, 1); | ||
474 | |||
475 | msleep(50); | ||
476 | gpio_set_value(lcd_en_gpio, 1); | ||
477 | |||
478 | err = platform_device_register(&cm_t35_dss_device); | ||
479 | if (err) { | ||
480 | pr_err("CM-T35: failed to register DSS device\n"); | ||
481 | goto err_dev_reg; | ||
482 | } | ||
483 | |||
484 | return; | ||
485 | |||
486 | err_dev_reg: | ||
487 | gpio_free(dvi_en_gpio); | ||
488 | err_dvi_en: | ||
489 | gpio_free(lcd_bl_gpio); | ||
490 | err_lcd_bl: | ||
491 | gpio_free(lcd_en_gpio); | ||
492 | out: | ||
493 | |||
494 | return; | ||
495 | } | ||
496 | |||
307 | static struct regulator_consumer_supply cm_t35_vmmc1_supply = { | 497 | static struct regulator_consumer_supply cm_t35_vmmc1_supply = { |
308 | .supply = "vmmc", | 498 | .supply = "vmmc", |
309 | }; | 499 | }; |
@@ -312,6 +502,16 @@ static struct regulator_consumer_supply cm_t35_vsim_supply = { | |||
312 | .supply = "vmmc_aux", | 502 | .supply = "vmmc_aux", |
313 | }; | 503 | }; |
314 | 504 | ||
505 | static struct regulator_consumer_supply cm_t35_vdac_supply = { | ||
506 | .supply = "vdda_dac", | ||
507 | .dev = &cm_t35_dss_device.dev, | ||
508 | }; | ||
509 | |||
510 | static struct regulator_consumer_supply cm_t35_vdvi_supply = { | ||
511 | .supply = "vdvi", | ||
512 | .dev = &cm_t35_dss_device.dev, | ||
513 | }; | ||
514 | |||
315 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ | 515 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
316 | static struct regulator_init_data cm_t35_vmmc1 = { | 516 | static struct regulator_init_data cm_t35_vmmc1 = { |
317 | .constraints = { | 517 | .constraints = { |
@@ -342,6 +542,35 @@ static struct regulator_init_data cm_t35_vsim = { | |||
342 | .consumer_supplies = &cm_t35_vsim_supply, | 542 | .consumer_supplies = &cm_t35_vsim_supply, |
343 | }; | 543 | }; |
344 | 544 | ||
545 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ | ||
546 | static struct regulator_init_data cm_t35_vdac = { | ||
547 | .constraints = { | ||
548 | .min_uV = 1800000, | ||
549 | .max_uV = 1800000, | ||
550 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
551 | | REGULATOR_MODE_STANDBY, | ||
552 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
553 | | REGULATOR_CHANGE_STATUS, | ||
554 | }, | ||
555 | .num_consumer_supplies = 1, | ||
556 | .consumer_supplies = &cm_t35_vdac_supply, | ||
557 | }; | ||
558 | |||
559 | /* VPLL2 for digital video outputs */ | ||
560 | static struct regulator_init_data cm_t35_vpll2 = { | ||
561 | .constraints = { | ||
562 | .name = "VDVI", | ||
563 | .min_uV = 1800000, | ||
564 | .max_uV = 1800000, | ||
565 | .valid_modes_mask = REGULATOR_MODE_NORMAL | ||
566 | | REGULATOR_MODE_STANDBY, | ||
567 | .valid_ops_mask = REGULATOR_CHANGE_MODE | ||
568 | | REGULATOR_CHANGE_STATUS, | ||
569 | }, | ||
570 | .num_consumer_supplies = 1, | ||
571 | .consumer_supplies = &cm_t35_vdvi_supply, | ||
572 | }; | ||
573 | |||
345 | static struct twl4030_usb_data cm_t35_usb_data = { | 574 | static struct twl4030_usb_data cm_t35_usb_data = { |
346 | .usb_mode = T2_USB_MODE_ULPI, | 575 | .usb_mode = T2_USB_MODE_ULPI, |
347 | }; | 576 | }; |
@@ -445,6 +674,8 @@ static struct twl4030_platform_data cm_t35_twldata = { | |||
445 | .gpio = &cm_t35_gpio_data, | 674 | .gpio = &cm_t35_gpio_data, |
446 | .vmmc1 = &cm_t35_vmmc1, | 675 | .vmmc1 = &cm_t35_vmmc1, |
447 | .vsim = &cm_t35_vsim, | 676 | .vsim = &cm_t35_vsim, |
677 | .vdac = &cm_t35_vdac, | ||
678 | .vpll2 = &cm_t35_vpll2, | ||
448 | }; | 679 | }; |
449 | 680 | ||
450 | static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = { | 681 | static struct i2c_board_info __initdata cm_t35_i2c_boardinfo[] = { |
@@ -568,6 +799,11 @@ static struct omap_board_mux board_mux[] __initdata = { | |||
568 | OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | 799 | OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), |
569 | OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | 800 | OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), |
570 | 801 | ||
802 | /* display controls */ | ||
803 | OMAP3_MUX(MCBSP1_FSR, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | ||
804 | OMAP3_MUX(GPMC_NCS7, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | ||
805 | OMAP3_MUX(GPMC_NCS3, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | ||
806 | |||
571 | /* TPS IRQ */ | 807 | /* TPS IRQ */ |
572 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \ | 808 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \ |
573 | OMAP_PIN_INPUT_PULLUP), | 809 | OMAP_PIN_INPUT_PULLUP), |
@@ -584,6 +820,7 @@ static void __init cm_t35_init(void) | |||
584 | cm_t35_init_ads7846(); | 820 | cm_t35_init_ads7846(); |
585 | cm_t35_init_ethernet(); | 821 | cm_t35_init_ethernet(); |
586 | cm_t35_init_led(); | 822 | cm_t35_init_led(); |
823 | cm_t35_init_display(); | ||
587 | 824 | ||
588 | usb_musb_init(); | 825 | usb_musb_init(); |
589 | } | 826 | } |