From 026ceab45d93841cabd7a0fc734a919171543c46 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Thu, 28 May 2009 13:27:43 +0300 Subject: [PATCH 088/146] DSS2: Board file changes for new device model Changes to Beagle, SDP, Overo board files --- arch/arm/mach-omap2/board-3430sdp.c | 102 ++++++++-------- arch/arm/mach-omap2/board-omap3beagle.c | 195 ++++++++++++++++--------------- arch/arm/mach-omap2/board-overo.c | 43 ++++--- 3 files changed, 173 insertions(+), 167 deletions(-) diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c index 2ee6cbb..ec0c358 100644 --- a/arch/arm/mach-omap2/board-3430sdp.c +++ b/arch/arm/mach-omap2/board-3430sdp.c @@ -178,21 +178,6 @@ static unsigned enable_gpio; static int lcd_enabled; static int dvi_enabled; -static struct platform_device sdp3430_lcd_device = { - .name = "sdp2430_lcd", - .id = -1, -}; - -static struct regulator_consumer_supply sdp3430_vdac_supply = { - .supply = "vdac", - .dev = &sdp3430_lcd_device.dev, -}; - -static struct regulator_consumer_supply sdp3430_vdvi_supply = { - .supply = "vdvi", - .dev = &sdp3430_lcd_device.dev, -}; - static void enable_vpll2(int enable) { u8 ded_val, grp_val; @@ -253,7 +238,7 @@ err0: return; } -static int sdp3430_panel_enable_lcd(struct omap_display *display) +static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev) { u8 ded_val, ded_reg; u8 grp_val, grp_reg; @@ -283,7 +268,7 @@ static int sdp3430_panel_enable_lcd(struct omap_display *display) return 0; } -static void sdp3430_panel_disable_lcd(struct omap_display *display) +static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev) { lcd_enabled = 0; @@ -293,16 +278,7 @@ static void sdp3430_panel_disable_lcd(struct omap_display *display) gpio_direction_output(backlight_gpio, 0); } -static struct omap_dss_display_config sdp3430_display_data = { - .type = OMAP_DISPLAY_TYPE_DPI, - .name = "lcd", - .panel_name = "sharp-ls037v7dw01", - .u.dpi.data_lines = 16, - .panel_enable = sdp3430_panel_enable_lcd, - .panel_disable = sdp3430_panel_disable_lcd, -}; - -static int sdp3430_panel_enable_dvi(struct omap_display *display) +static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev) { if (lcd_enabled) { printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); @@ -316,24 +292,14 @@ static int sdp3430_panel_enable_dvi(struct omap_display *display) return 0; } -static void sdp3430_panel_disable_dvi(struct omap_display *display) +static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev) { sdp3430_dsi_power_down(); dvi_enabled = 0; } - -static struct omap_dss_display_config sdp3430_display_data_dvi = { - .type = OMAP_DISPLAY_TYPE_DPI, - .name = "dvi", - .panel_name = "panel-generic", - .u.dpi.data_lines = 24, - .panel_enable = sdp3430_panel_enable_dvi, - .panel_disable = sdp3430_panel_disable_dvi, -}; - -static int sdp3430_panel_enable_tv(struct omap_display *display) +static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev) { #define ENABLE_VDAC_DEDICATED 0x03 #define ENABLE_VDAC_DEV_GRP 0x20 @@ -347,7 +313,7 @@ static int sdp3430_panel_enable_tv(struct omap_display *display) return 0; } -static void sdp3430_panel_disable_tv(struct omap_display *display) +static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev) { twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00, TWL4030_VDAC_DEDICATED); @@ -355,23 +321,47 @@ static void sdp3430_panel_disable_tv(struct omap_display *display) TWL4030_VDAC_DEV_GRP); } -static struct omap_dss_display_config sdp3430_display_data_tv = { - .type = OMAP_DISPLAY_TYPE_VENC, + +static struct omap_dss_device sdp3430_lcd_device = { + .name = "lcd", + .driver_name = "sharp_ls_panel", + .type = OMAP_DISPLAY_TYPE_DPI, + .phy.dpi.data_lines = 16, + .platform_enable = sdp3430_panel_enable_lcd, + .platform_disable = sdp3430_panel_disable_lcd, +}; + +static struct omap_dss_device sdp3430_dvi_device = { + .name = "dvi", + .driver_name = "generic_panel", + .type = OMAP_DISPLAY_TYPE_DPI, + .phy.dpi.data_lines = 24, + .platform_enable = sdp3430_panel_enable_dvi, + .platform_disable = sdp3430_panel_disable_dvi, +}; + +static struct omap_dss_device sdp3430_tv_device = { .name = "tv", - .u.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, - .panel_enable = sdp3430_panel_enable_tv, - .panel_disable = sdp3430_panel_disable_tv, + .driver_name = "venc", + .type = OMAP_DISPLAY_TYPE_VENC, + .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, + .platform_enable = sdp3430_panel_enable_tv, + .platform_disable = sdp3430_panel_disable_tv, +}; + + +static struct omap_dss_device *sdp3430_dss_devices[] = { + &sdp3430_lcd_device, + &sdp3430_dvi_device, + &sdp3430_tv_device, }; static struct omap_dss_board_info sdp3430_dss_data = { + .num_devices = ARRAY_SIZE(sdp3430_dss_devices), + .devices = sdp3430_dss_devices, + .default_device = &sdp3430_lcd_device, .dsi_power_up = sdp3430_dsi_power_up, .dsi_power_down = sdp3430_dsi_power_down, - .num_displays = 3, - .displays = { - &sdp3430_display_data, - &sdp3430_display_data_dvi, - &sdp3430_display_data_tv, - } }; static struct platform_device sdp3430_dss_device = { @@ -382,6 +372,16 @@ static struct platform_device sdp3430_dss_device = { }, }; +static struct regulator_consumer_supply sdp3430_vdac_supply = { + .supply = "vdac", + .dev = &sdp3430_dss_device.dev, +}; + +static struct regulator_consumer_supply sdp3430_vdvi_supply = { + .supply = "vdvi", + .dev = &sdp3430_dss_device.dev, +}; + static struct platform_device *sdp3430_devices[] __initdata = { &sdp3430_dss_device, }; diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 4ab7396..67e1d5c 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -108,6 +108,105 @@ static struct platform_device omap3beagle_nand_device = { .resource = &omap3beagle_nand_resource, }; +/* DSS */ + +static int beagle_enable_dvi(struct omap_dss_device *dssdev) +{ + if (dssdev->reset_gpio != -1) + gpio_set_value(dssdev->reset_gpio, 1); + + return 0; +} + +static void beagle_disable_dvi(struct omap_dss_device *dssdev) +{ + if (dssdev->reset_gpio != -1) + gpio_set_value(dssdev->reset_gpio, 0); +} + +static struct omap_dss_device beagle_dvi_device = { + .type = OMAP_DISPLAY_TYPE_DPI, + .name = "dvi", + .driver_name = "generic_panel", + .phy.dpi.data_lines = 24, + .reset_gpio = 170, + .platform_enable = beagle_enable_dvi, + .platform_disable = beagle_disable_dvi, +}; + +static int beagle_panel_enable_tv(struct omap_dss_device *dssdev) +{ +#define ENABLE_VDAC_DEDICATED 0x03 +#define ENABLE_VDAC_DEV_GRP 0x20 + + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, + ENABLE_VDAC_DEDICATED, + TWL4030_VDAC_DEDICATED); + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, + ENABLE_VDAC_DEV_GRP, TWL4030_VDAC_DEV_GRP); + + return 0; +} + +static void beagle_panel_disable_tv(struct omap_dss_device *dssdev) +{ + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00, + TWL4030_VDAC_DEDICATED); + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00, + TWL4030_VDAC_DEV_GRP); +} + +static struct omap_dss_device beagle_tv_device = { + .name = "tv", + .driver_name = "venc", + .type = OMAP_DISPLAY_TYPE_VENC, + .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, + .platform_enable = beagle_panel_enable_tv, + .platform_disable = beagle_panel_disable_tv, +}; + +static struct omap_dss_device *beagle_dss_devices[] = { + &beagle_dvi_device, + &beagle_tv_device, +}; + +static struct omap_dss_board_info beagle_dss_data = { + .num_devices = ARRAY_SIZE(beagle_dss_devices), + .devices = beagle_dss_devices, + .default_device = &beagle_dvi_device, +}; + +static struct platform_device beagle_dss_device = { + .name = "omapdss", + .id = -1, + .dev = { + .platform_data = &beagle_dss_data, + }, +}; + +static struct regulator_consumer_supply beagle_vdac_supply = { + .supply = "vdac", + .dev = &beagle_dss_device.dev, +}; + +static struct regulator_consumer_supply beagle_vdvi_supply = { + .supply = "vdvi", + .dev = &beagle_dss_device.dev, +}; + +static void __init beagle_display_init(void) +{ + int r; + + r = gpio_request(beagle_dvi_device.reset_gpio, "DVI reset"); + if (r < 0) { + printk(KERN_ERR "Unable to get DVI reset GPIO\n"); + return; + } + + gpio_direction_output(beagle_dvi_device.reset_gpio, 0); +} + #include "sdram-micron-mt46h32m32lf-6.h" static struct omap_uart_config omap3_beagle_uart_config __initdata = { @@ -182,16 +281,6 @@ static struct twl4030_gpio_platform_data beagle_gpio_data = { .setup = beagle_twl_gpio_setup, }; -static struct regulator_consumer_supply beagle_vdac_supply = { - .supply = "vdac", - .dev = &omap3_beagle_lcd_device.dev, -}; - -static struct regulator_consumer_supply beagle_vdvi_supply = { - .supply = "vdvi", - .dev = &omap3_beagle_lcd_device.dev, -}; - /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ static struct regulator_init_data beagle_vmmc1 = { .constraints = { @@ -345,92 +434,6 @@ static struct platform_device keys_gpio = { }, }; -/* DSS */ - -static int beagle_enable_dvi(struct omap_display *display) -{ - if (display->hw_config.panel_reset_gpio != -1) - gpio_set_value(display->hw_config.panel_reset_gpio, 1); - - return 0; -} - -static void beagle_disable_dvi(struct omap_display *display) -{ - if (display->hw_config.panel_reset_gpio != -1) - gpio_set_value(display->hw_config.panel_reset_gpio, 0); -} - -static struct omap_dss_display_config beagle_display_data_dvi = { - .type = OMAP_DISPLAY_TYPE_DPI, - .name = "dvi", - .panel_name = "panel-generic", - .u.dpi.data_lines = 24, - .panel_reset_gpio = 170, - .panel_enable = beagle_enable_dvi, - .panel_disable = beagle_disable_dvi, -}; - - -static int beagle_panel_enable_tv(struct omap_display *display) -{ -#define ENABLE_VDAC_DEDICATED 0x03 -#define ENABLE_VDAC_DEV_GRP 0x20 - - twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, - ENABLE_VDAC_DEDICATED, - TWL4030_VDAC_DEDICATED); - twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, - ENABLE_VDAC_DEV_GRP, TWL4030_VDAC_DEV_GRP); - - return 0; -} - -static void beagle_panel_disable_tv(struct omap_display *display) -{ - twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00, - TWL4030_VDAC_DEDICATED); - twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x00, - TWL4030_VDAC_DEV_GRP); -} - -static struct omap_dss_display_config beagle_display_data_tv = { - .type = OMAP_DISPLAY_TYPE_VENC, - .name = "tv", - .u.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, - .panel_enable = beagle_panel_enable_tv, - .panel_disable = beagle_panel_disable_tv, -}; - -static struct omap_dss_board_info beagle_dss_data = { - .num_displays = 2, - .displays = { - &beagle_display_data_dvi, - &beagle_display_data_tv, - } -}; - -static struct platform_device beagle_dss_device = { - .name = "omapdss", - .id = -1, - .dev = { - .platform_data = &beagle_dss_data, - }, -}; - -static void __init beagle_display_init(void) -{ - int r; - - r = gpio_request(beagle_display_data_dvi.panel_reset_gpio, "DVI reset"); - if (r < 0) { - printk(KERN_ERR "Unable to get DVI reset GPIO\n"); - return; - } - - gpio_direction_output(beagle_display_data_dvi.panel_reset_gpio, 0); -} - static struct omap_board_config_kernel omap3_beagle_config[] __initdata = { { OMAP_TAG_UART, &omap3_beagle_uart_config }, }; diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c index 7bcac03..39f95f5 100644 --- a/arch/arm/mach-omap2/board-overo.c +++ b/arch/arm/mach-omap2/board-overo.c @@ -386,7 +386,7 @@ static void __init overo_display_init(void) gpio_export(OVERO_GPIO_LCD_EN, 0); } -static int overo_panel_enable_dvi(struct omap_display *display) +static int overo_panel_enable_dvi(struct omap_dss_device *dssdev) { if (lcd_enabled) { printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); @@ -399,23 +399,23 @@ static int overo_panel_enable_dvi(struct omap_display *display) return 0; } -static void overo_panel_disable_dvi(struct omap_display *display) +static void overo_panel_disable_dvi(struct omap_dss_device *dssdev) { gpio_set_value(OVERO_GPIO_LCD_EN, 0); dvi_enabled = 0; } -static struct omap_dss_display_config overo_display_data_dvi = { +static struct omap_dss_device overo_dvi_device = { .type = OMAP_DISPLAY_TYPE_DPI, .name = "dvi", - .panel_name = "panel-generic", - .u.dpi.data_lines = 24, - .panel_enable = overo_panel_enable_dvi, - .panel_disable = overo_panel_disable_dvi, + .driver_name = "panel_generic", + .phy.dpi.data_lines = 24, + .platform_enable = overo_panel_enable_dvi, + .platform_disable = overo_panel_disable_dvi, }; -static int overo_panel_enable_lcd(struct omap_display *display) +static int overo_panel_enable_lcd(struct omap_dss_device *dssdev) { if (dvi_enabled) { printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); @@ -427,27 +427,30 @@ static int overo_panel_enable_lcd(struct omap_display *display) return 0; } -static void overo_panel_disable_lcd(struct omap_display *display) +static void overo_panel_disable_lcd(struct omap_dss_device *dssdev) { gpio_set_value(OVERO_GPIO_LCD_EN, 0); lcd_enabled = 0; } -static struct omap_dss_display_config overo_display_data_lcd = { +static struct omap_dss_device overo_lcd_device = { .type = OMAP_DISPLAY_TYPE_DPI, .name = "lcd", - .panel_name = "samsung-lte430wq-f0c", - .u.dpi.data_lines = 24, - .panel_enable = overo_panel_enable_lcd, - .panel_disable = overo_panel_disable_lcd, - }; + .driver_name = "samsung-lte430wq-f0c", + .phy.dpi.data_lines = 24, + .platform_enable = overo_panel_enable_lcd, + .platform_disable = overo_panel_disable_lcd, +}; + +static struct omap_dss_device *overo_dss_devices[] = { + &overo_dvi_device, + &overo_lcd_device, +}; static struct omap_dss_board_info overo_dss_data = { - .num_displays = 2, - .displays = { - &overo_display_data_dvi, - &overo_display_data_lcd, - } + .num_devices = ARRAY_SIZE(overo_dss_devices), + .devices = overo_dss_devices, + .default_device = &overo_dvi_device, }; static struct platform_device overo_dss_device = { -- 1.6.2.4