OMAP: AM3517: Enable DSS2 for AM3517EVM board
authorVaibhav Hiremath <hvaibhav@ti.com>
Wed, 13 Jan 2010 11:47:10 +0000 (17:17 +0530)
committerTomi Valkeinen <tomi.valkeinen@nokia.com>
Fri, 12 Feb 2010 10:29:31 +0000 (12:29 +0200)
Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
[tomi.valkeinen@nokia.com: removed defconfig changes]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
arch/arm/mach-omap2/board-am3517evm.c

index b4e6eca0e8a9b373d2744f1a3be78f4bcb3262d9..54af5f8d818484e3b3f07d5609cc73ba9bc5e0dd 100644 (file)
 #include <plat/board.h>
 #include <plat/common.h>
 #include <plat/usb.h>
+#include <plat/display.h>
 
 #include "mux.h"
 
+#define LCD_PANEL_PWR          176
+#define LCD_PANEL_BKLIGHT_PWR  182
+#define LCD_PANEL_PWM          181
+
+static int lcd_enabled;
+static int dvi_enabled;
+
+static void __init am3517_evm_display_init(void)
+{
+       int r;
+
+       omap_mux_init_gpio(LCD_PANEL_PWR, OMAP_PIN_INPUT_PULLUP);
+       omap_mux_init_gpio(LCD_PANEL_BKLIGHT_PWR, OMAP_PIN_INPUT_PULLDOWN);
+       omap_mux_init_gpio(LCD_PANEL_PWM, OMAP_PIN_INPUT_PULLDOWN);
+       /*
+        * Enable GPIO 182 = LCD Backlight Power
+        */
+       r = gpio_request(LCD_PANEL_BKLIGHT_PWR, "lcd_backlight_pwr");
+       if (r) {
+               printk(KERN_ERR "failed to get lcd_backlight_pwr\n");
+               return;
+       }
+       gpio_direction_output(LCD_PANEL_BKLIGHT_PWR, 1);
+       /*
+        * Enable GPIO 181 = LCD Panel PWM
+        */
+       r = gpio_request(LCD_PANEL_PWM, "lcd_pwm");
+       if (r) {
+               printk(KERN_ERR "failed to get lcd_pwm\n");
+               goto err_1;
+       }
+       gpio_direction_output(LCD_PANEL_PWM, 1);
+       /*
+        * Enable GPIO 176 = LCD Panel Power enable pin
+        */
+       r = gpio_request(LCD_PANEL_PWR, "lcd_panel_pwr");
+       if (r) {
+               printk(KERN_ERR "failed to get lcd_panel_pwr\n");
+               goto err_2;
+       }
+       gpio_direction_output(LCD_PANEL_PWR, 1);
+
+       printk(KERN_INFO "Display initialized successfully\n");
+       return;
+
+err_2:
+       gpio_free(LCD_PANEL_PWM);
+err_1:
+       gpio_free(LCD_PANEL_BKLIGHT_PWR);
+}
+
+static int am3517_evm_panel_enable_lcd(struct omap_dss_device *dssdev)
+{
+       if (dvi_enabled) {
+               printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
+               return -EINVAL;
+       }
+       gpio_set_value(LCD_PANEL_PWR, 1);
+       lcd_enabled = 1;
+
+       return 0;
+}
+
+static void am3517_evm_panel_disable_lcd(struct omap_dss_device *dssdev)
+{
+       gpio_set_value(LCD_PANEL_PWR, 0);
+       lcd_enabled = 0;
+}
+
+static struct omap_dss_device am3517_evm_lcd_device = {
+       .type                   = OMAP_DISPLAY_TYPE_DPI,
+       .name                   = "lcd",
+       .driver_name            = "sharp_lq_panel",
+       .phy.dpi.data_lines     = 16,
+       .platform_enable        = am3517_evm_panel_enable_lcd,
+       .platform_disable       = am3517_evm_panel_disable_lcd,
+};
+
+static int am3517_evm_panel_enable_tv(struct omap_dss_device *dssdev)
+{
+       return 0;
+}
+
+static void am3517_evm_panel_disable_tv(struct omap_dss_device *dssdev)
+{
+}
+
+static struct omap_dss_device am3517_evm_tv_device = {
+       .type                   = OMAP_DISPLAY_TYPE_VENC,
+       .name                   = "tv",
+       .driver_name            = "venc",
+       .phy.venc.type          = OMAP_DSS_VENC_TYPE_SVIDEO,
+       .platform_enable        = am3517_evm_panel_enable_tv,
+       .platform_disable       = am3517_evm_panel_disable_tv,
+};
+
+static int am3517_evm_panel_enable_dvi(struct omap_dss_device *dssdev)
+{
+       if (lcd_enabled) {
+               printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
+               return -EINVAL;
+       }
+       dvi_enabled = 1;
+
+       return 0;
+}
+
+static void am3517_evm_panel_disable_dvi(struct omap_dss_device *dssdev)
+{
+       dvi_enabled = 0;
+}
+
+static struct omap_dss_device am3517_evm_dvi_device = {
+       .type                   = OMAP_DISPLAY_TYPE_DPI,
+       .name                   = "dvi",
+       .driver_name            = "generic_panel",
+       .phy.dpi.data_lines     = 24,
+       .platform_enable        = am3517_evm_panel_enable_dvi,
+       .platform_disable       = am3517_evm_panel_disable_dvi,
+};
+
+static struct omap_dss_device *am3517_evm_dss_devices[] = {
+       &am3517_evm_lcd_device,
+       &am3517_evm_tv_device,
+       &am3517_evm_dvi_device,
+};
+
+static struct omap_dss_board_info am3517_evm_dss_data = {
+       .num_devices    = ARRAY_SIZE(am3517_evm_dss_devices),
+       .devices        = am3517_evm_dss_devices,
+       .default_device = &am3517_evm_lcd_device,
+};
+
+struct platform_device am3517_evm_dss_device = {
+       .name           = "omapdss",
+       .id             = -1,
+       .dev            = {
+               .platform_data  = &am3517_evm_dss_data,
+       },
+};
+
 /*
  * Board initialization
  */
@@ -39,6 +181,7 @@ static struct omap_board_config_kernel am3517_evm_config[] __initdata = {
 };
 
 static struct platform_device *am3517_evm_devices[] __initdata = {
+       &am3517_evm_dss_device,
 };
 
 static void __init am3517_evm_init_irq(void)
@@ -78,6 +221,8 @@ static void __init am3517_evm_init(void)
 
        omap_serial_init();
        usb_ehci_init(&ehci_pdata);
+       /* DSS */
+       am3517_evm_display_init();
 }
 
 static void __init am3517_evm_map_io(void)