linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: OMAP3LOGIC: Adding DSS support
@ 2011-12-08 12:05 Alex
  2011-12-09 21:08 ` Tony Lindgren
  2011-12-12 11:10 ` Tomi Valkeinen
  0 siblings, 2 replies; 7+ messages in thread
From: Alex @ 2011-12-08 12:05 UTC (permalink / raw)
  Cc: linux-omap, linux-arm-kernel, tim.nordell, baruch, Alex

This patch adds DSS2 support to the LogicPD OMAP 35x Torpedo boardfile. LCD and
TV-out are supported.

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
---
 arch/arm/mach-omap2/board-omap3logic.c |  151 ++++++++++++++++++++++++++++++++
 1 files changed, 151 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 7c0f193..86175fa 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -7,6 +7,9 @@
  * Copyright (C) 2010 Logic Product Development, Inc.
  * Peter Barada <peter.barada@logicpd.com>
  *
+ * Copyright (C) 2011 Meprolight, Ltd.
+ * Alex Gershgorin <alexg@meprolight.com>
+ *
  * Modified from Beagle, EVM, and RX51
  *
  * This program is free software; you can redistribute it and/or modify
@@ -44,6 +47,10 @@
 #include <plat/gpmc-smsc911x.h>
 #include <plat/gpmc.h>
 #include <plat/sdrc.h>
+#include <plat/vram.h>
+
+#include <video/omapdss.h>
+#include <video/omap-panel-generic-dpi.h>
 
 #define OMAP3LOGIC_SMSC911X_CS			1
 
@@ -58,6 +65,14 @@ static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
 	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
 };
 
+static struct regulator_consumer_supply omap3logic_vdds_supplies[] = {
+	REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
+	REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
+};
+
+static struct regulator_consumer_supply omap3logic_vdac_supply =
+	REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
+
 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
 static struct regulator_init_data omap3logic_vmmc1 = {
 	.constraints = {
@@ -74,6 +89,34 @@ static struct regulator_init_data omap3logic_vmmc1 = {
 	.consumer_supplies      = omap3logic_vmmc1_supply,
 };
 
+static struct regulator_init_data omap3logic_vpll2 = {
+	.constraints = {
+		.name			= "VDDS_DSI",
+		.min_uV			= 1800000,
+		.max_uV			= 1800000,
+		.apply_uV		= true,
+		.always_on		= true,
+		.valid_modes_mask	= REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask		= REGULATOR_CHANGE_MODE,
+	},
+	.num_consumer_supplies  = ARRAY_SIZE(omap3logic_vdds_supplies),
+	.consumer_supplies      = omap3logic_vdds_supplies,
+};
+
+static struct regulator_init_data omap3logic_vdac = {
+	.constraints = {
+		.min_uV			= 1800000,
+		.max_uV			= 1800000,
+		.valid_modes_mask	= REGULATOR_MODE_NORMAL
+					| REGULATOR_MODE_STANDBY,
+		.valid_ops_mask		= REGULATOR_CHANGE_MODE
+					| REGULATOR_CHANGE_STATUS,
+	},
+	.num_consumer_supplies	= 1,
+	.consumer_supplies	= &omap3logic_vdac_supply,
+};
+
 static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
 	.gpio_base	= OMAP_MAX_GPIO_LINES,
 	.irq_base	= TWL4030_GPIO_IRQ_BASE,
@@ -91,6 +134,8 @@ static struct twl4030_platform_data omap3logic_twldata = {
 	/* platform_data for children goes here */
 	.gpio		= &omap3logic_gpio_data,
 	.vmmc1		= &omap3logic_vmmc1,
+	.vpll2		= &omap3logic_vpll2,
+	.vdac		= &omap3logic_vdac,
 };
 
 static int __init omap3logic_i2c_init(void)
@@ -182,6 +227,110 @@ static inline void __init board_smsc911x_init(void)
 	gpmc_smsc911x_init(&board_smsc911x_data);
 }
 
+#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
+
+#define OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO	154
+#define OMAP3_TORPEDO_LCD_ENABLE_GPIO		155
+#define OMAP3_TORPEDO_LCD_PWM_GPIO		56
+
+static struct gpio omap3logic_dss_gpios[] __initdata = {
+	{OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "lcd_bl_pwr"},
+	{OMAP3_TORPEDO_LCD_PWM_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable"},
+	{OMAP3_TORPEDO_LCD_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable"},
+};
+
+static int omap3logic_enable_lcd(struct omap_dss_device *dssdev)
+{
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 1);
+	msleep(20);
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 1);
+
+	return 0;
+}
+
+static void omap3logic_disable_lcd(struct omap_dss_device *dssdev)
+{
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
+	msleep(20);
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
+}
+
+static struct panel_generic_dpi_data lcd_panel = {
+	.name			= "sharp_lq",
+	.platform_enable	= omap3logic_enable_lcd,
+	.platform_disable	= omap3logic_disable_lcd,
+};
+
+static struct omap_dss_device omap3logic_lcd_device = {
+	.name			= "lcd",
+	.driver_name		= "generic_dpi_panel",
+	.type			= OMAP_DISPLAY_TYPE_DPI,
+	.data			= &lcd_panel,
+	.phy.dpi.data_lines	= 16,
+};
+
+static struct omap_dss_device omap3logic_tv_device = {
+	.name			= "tv",
+	.driver_name		= "venc",
+	.type			= OMAP_DISPLAY_TYPE_VENC,
+	.phy.venc.type		= OMAP_DSS_VENC_TYPE_SVIDEO,
+};
+
+static struct omap_dss_device *omap3logic_dss_devices[] = {
+	&omap3logic_lcd_device,
+	&omap3logic_tv_device,
+};
+
+static struct omap_dss_board_info omap3logic_dss_data = {
+	.num_devices		= ARRAY_SIZE(omap3logic_dss_devices),
+	.devices		= omap3logic_dss_devices,
+	.default_device		= &omap3logic_lcd_device,
+};
+
+static void __init omap3logic_display_init(void)
+{
+	int r;
+
+	r = gpio_request_array(omap3logic_dss_gpios,
+			       ARRAY_SIZE(omap3logic_dss_gpios));
+	if (r) {
+		printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
+		return;
+	}
+
+	gpio_export(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
+	gpio_export(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
+	gpio_export(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
+
+	r = omap_display_init(&omap3logic_dss_data);
+	if (r) {
+		pr_err("OMAP3LOGIC: failed to register DSS device\n");
+		gpio_free_array(omap3logic_dss_gpios,
+				ARRAY_SIZE(omap3logic_dss_gpios));
+	}
+}
+
+static void __init omap3logic_video_mem_init(void)
+{
+	/*
+	 * GFX 480x272x32bpp
+	 * VID1/2 480x272x32bpp double buffered
+	 */
+	omap_vram_set_sdram_vram(PAGE_ALIGN(480 * 272 * 4) +
+			2 * PAGE_ALIGN(480 * 272 * 4 * 2), 0);
+}
+
+#else
+static void __init omap3logic_display_init(void) { }
+static void __init omap3logic_video_mem_init(void){ }
+#endif /* defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) */
+
+static void __init omap3logic_reserve(void)
+{
+	omap3logic_video_mem_init();
+	omap_reserve();
+}
+
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
 	{ .reg_offset = OMAP_MUX_TERMINATOR },
@@ -197,6 +346,7 @@ static void __init omap3logic_init(void)
 	omap_sdrc_init(NULL, NULL);
 	board_mmc_init();
 	board_smsc911x_init();
+	omap3logic_display_init();
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
 	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
@@ -205,6 +355,7 @@ static void __init omap3logic_init(void)
 
 MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
 	.atag_offset	= 0x100,
+	.reserve	= omap3logic_reserve,
 	.map_io		= omap3_map_io,
 	.init_early	= omap35xx_init_early,
 	.init_irq	= omap3_init_irq,
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: OMAP3LOGIC: Adding DSS support
  2011-12-08 12:05 Alex
@ 2011-12-09 21:08 ` Tony Lindgren
  2011-12-09 23:55   ` Alex Gershgorin
  2011-12-12 11:10 ` Tomi Valkeinen
  1 sibling, 1 reply; 7+ messages in thread
From: Tony Lindgren @ 2011-12-09 21:08 UTC (permalink / raw)
  To: Alex, Tomi Valkeinen; +Cc: linux-omap, linux-arm-kernel, tim.nordell, baruch

Tomi,

* Alex <alexg@meprolight.com> [111208 03:46]:
> This patch adds DSS2 support to the LogicPD OMAP 35x Torpedo boardfile. LCD and
> TV-out are supported.

Want to take this one? Looks OK to me:

Acked-by: Tony Lindgren <tony@atomide.com>
 
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-omap2/board-omap3logic.c |  151 ++++++++++++++++++++++++++++++++
>  1 files changed, 151 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
> index 7c0f193..86175fa 100644
> --- a/arch/arm/mach-omap2/board-omap3logic.c
> +++ b/arch/arm/mach-omap2/board-omap3logic.c
> @@ -7,6 +7,9 @@
>   * Copyright (C) 2010 Logic Product Development, Inc.
>   * Peter Barada <peter.barada@logicpd.com>
>   *
> + * Copyright (C) 2011 Meprolight, Ltd.
> + * Alex Gershgorin <alexg@meprolight.com>
> + *
>   * Modified from Beagle, EVM, and RX51
>   *
>   * This program is free software; you can redistribute it and/or modify
> @@ -44,6 +47,10 @@
>  #include <plat/gpmc-smsc911x.h>
>  #include <plat/gpmc.h>
>  #include <plat/sdrc.h>
> +#include <plat/vram.h>
> +
> +#include <video/omapdss.h>
> +#include <video/omap-panel-generic-dpi.h>
>  
>  #define OMAP3LOGIC_SMSC911X_CS			1
>  
> @@ -58,6 +65,14 @@ static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
>  	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
>  };
>  
> +static struct regulator_consumer_supply omap3logic_vdds_supplies[] = {
> +	REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
> +	REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
> +};
> +
> +static struct regulator_consumer_supply omap3logic_vdac_supply =
> +	REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
> +
>  /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
>  static struct regulator_init_data omap3logic_vmmc1 = {
>  	.constraints = {
> @@ -74,6 +89,34 @@ static struct regulator_init_data omap3logic_vmmc1 = {
>  	.consumer_supplies      = omap3logic_vmmc1_supply,
>  };
>  
> +static struct regulator_init_data omap3logic_vpll2 = {
> +	.constraints = {
> +		.name			= "VDDS_DSI",
> +		.min_uV			= 1800000,
> +		.max_uV			= 1800000,
> +		.apply_uV		= true,
> +		.always_on		= true,
> +		.valid_modes_mask	= REGULATOR_MODE_NORMAL
> +					| REGULATOR_MODE_STANDBY,
> +		.valid_ops_mask		= REGULATOR_CHANGE_MODE,
> +	},
> +	.num_consumer_supplies  = ARRAY_SIZE(omap3logic_vdds_supplies),
> +	.consumer_supplies      = omap3logic_vdds_supplies,
> +};
> +
> +static struct regulator_init_data omap3logic_vdac = {
> +	.constraints = {
> +		.min_uV			= 1800000,
> +		.max_uV			= 1800000,
> +		.valid_modes_mask	= REGULATOR_MODE_NORMAL
> +					| REGULATOR_MODE_STANDBY,
> +		.valid_ops_mask		= REGULATOR_CHANGE_MODE
> +					| REGULATOR_CHANGE_STATUS,
> +	},
> +	.num_consumer_supplies	= 1,
> +	.consumer_supplies	= &omap3logic_vdac_supply,
> +};
> +
>  static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
>  	.gpio_base	= OMAP_MAX_GPIO_LINES,
>  	.irq_base	= TWL4030_GPIO_IRQ_BASE,
> @@ -91,6 +134,8 @@ static struct twl4030_platform_data omap3logic_twldata = {
>  	/* platform_data for children goes here */
>  	.gpio		= &omap3logic_gpio_data,
>  	.vmmc1		= &omap3logic_vmmc1,
> +	.vpll2		= &omap3logic_vpll2,
> +	.vdac		= &omap3logic_vdac,
>  };
>  
>  static int __init omap3logic_i2c_init(void)
> @@ -182,6 +227,110 @@ static inline void __init board_smsc911x_init(void)
>  	gpmc_smsc911x_init(&board_smsc911x_data);
>  }
>  
> +#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
> +
> +#define OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO	154
> +#define OMAP3_TORPEDO_LCD_ENABLE_GPIO		155
> +#define OMAP3_TORPEDO_LCD_PWM_GPIO		56
> +
> +static struct gpio omap3logic_dss_gpios[] __initdata = {
> +	{OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "lcd_bl_pwr"},
> +	{OMAP3_TORPEDO_LCD_PWM_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable"},
> +	{OMAP3_TORPEDO_LCD_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable"},
> +};
> +
> +static int omap3logic_enable_lcd(struct omap_dss_device *dssdev)
> +{
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 1);
> +	msleep(20);
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 1);
> +
> +	return 0;
> +}
> +
> +static void omap3logic_disable_lcd(struct omap_dss_device *dssdev)
> +{
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +	msleep(20);
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +}
> +
> +static struct panel_generic_dpi_data lcd_panel = {
> +	.name			= "sharp_lq",
> +	.platform_enable	= omap3logic_enable_lcd,
> +	.platform_disable	= omap3logic_disable_lcd,
> +};
> +
> +static struct omap_dss_device omap3logic_lcd_device = {
> +	.name			= "lcd",
> +	.driver_name		= "generic_dpi_panel",
> +	.type			= OMAP_DISPLAY_TYPE_DPI,
> +	.data			= &lcd_panel,
> +	.phy.dpi.data_lines	= 16,
> +};
> +
> +static struct omap_dss_device omap3logic_tv_device = {
> +	.name			= "tv",
> +	.driver_name		= "venc",
> +	.type			= OMAP_DISPLAY_TYPE_VENC,
> +	.phy.venc.type		= OMAP_DSS_VENC_TYPE_SVIDEO,
> +};
> +
> +static struct omap_dss_device *omap3logic_dss_devices[] = {
> +	&omap3logic_lcd_device,
> +	&omap3logic_tv_device,
> +};
> +
> +static struct omap_dss_board_info omap3logic_dss_data = {
> +	.num_devices		= ARRAY_SIZE(omap3logic_dss_devices),
> +	.devices		= omap3logic_dss_devices,
> +	.default_device		= &omap3logic_lcd_device,
> +};
> +
> +static void __init omap3logic_display_init(void)
> +{
> +	int r;
> +
> +	r = gpio_request_array(omap3logic_dss_gpios,
> +			       ARRAY_SIZE(omap3logic_dss_gpios));
> +	if (r) {
> +		printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
> +		return;
> +	}
> +
> +	gpio_export(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +	gpio_export(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +	gpio_export(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
> +
> +	r = omap_display_init(&omap3logic_dss_data);
> +	if (r) {
> +		pr_err("OMAP3LOGIC: failed to register DSS device\n");
> +		gpio_free_array(omap3logic_dss_gpios,
> +				ARRAY_SIZE(omap3logic_dss_gpios));
> +	}
> +}
> +
> +static void __init omap3logic_video_mem_init(void)
> +{
> +	/*
> +	 * GFX 480x272x32bpp
> +	 * VID1/2 480x272x32bpp double buffered
> +	 */
> +	omap_vram_set_sdram_vram(PAGE_ALIGN(480 * 272 * 4) +
> +			2 * PAGE_ALIGN(480 * 272 * 4 * 2), 0);
> +}
> +
> +#else
> +static void __init omap3logic_display_init(void) { }
> +static void __init omap3logic_video_mem_init(void){ }
> +#endif /* defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) */
> +
> +static void __init omap3logic_reserve(void)
> +{
> +	omap3logic_video_mem_init();
> +	omap_reserve();
> +}
> +
>  #ifdef CONFIG_OMAP_MUX
>  static struct omap_board_mux board_mux[] __initdata = {
>  	{ .reg_offset = OMAP_MUX_TERMINATOR },
> @@ -197,6 +346,7 @@ static void __init omap3logic_init(void)
>  	omap_sdrc_init(NULL, NULL);
>  	board_mmc_init();
>  	board_smsc911x_init();
> +	omap3logic_display_init();
>  
>  	/* Ensure SDRC pins are mux'd for self-refresh */
>  	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
> @@ -205,6 +355,7 @@ static void __init omap3logic_init(void)
>  
>  MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
>  	.atag_offset	= 0x100,
> +	.reserve	= omap3logic_reserve,
>  	.map_io		= omap3_map_io,
>  	.init_early	= omap35xx_init_early,
>  	.init_irq	= omap3_init_irq,
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] ARM: OMAP3LOGIC: Adding DSS support
  2011-12-09 21:08 ` Tony Lindgren
@ 2011-12-09 23:55   ` Alex Gershgorin
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Gershgorin @ 2011-12-09 23:55 UTC (permalink / raw)
  To: Tony Lindgren, Tomi Valkeinen
  Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	tim.nordell@logicpd.com, baruch@tkos.co.il

Hi Tomi,

Yes of course :-)

Regards
Alex Gershgorin
_______________________________
From: Tony Lindgren [tony@atomide.com]
Sent: Friday, December 09, 2011 11:08 PM
To: Alex Gershgorin; Tomi Valkeinen
Cc: linux-omap@vger.kernel.org; linux-arm-kernel@lists.infradead.org; tim.nordell@logicpd.com; baruch@tkos.co.il
Subject: Re: [PATCH] ARM: OMAP3LOGIC: Adding DSS support

Tomi,

* Alex <alexg@meprolight.com> [111208 03:46]:
> This patch adds DSS2 support to the LogicPD OMAP 35x Torpedo boardfile. LCD and
> TV-out are supported.

Want to take this one? Looks OK to me:

Acked-by: Tony Lindgren <tony@atomide.com>

> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-omap2/board-omap3logic.c |  151 ++++++++++++++++++++++++++++++++
>  1 files changed, 151 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
> index 7c0f193..86175fa 100644
> --- a/arch/arm/mach-omap2/board-omap3logic.c
> +++ b/arch/arm/mach-omap2/board-omap3logic.c
> @@ -7,6 +7,9 @@
>   * Copyright (C) 2010 Logic Product Development, Inc.
>   * Peter Barada <peter.barada@logicpd.com>
>   *
> + * Copyright (C) 2011 Meprolight, Ltd.
> + * Alex Gershgorin <alexg@meprolight.com>
> + *
>   * Modified from Beagle, EVM, and RX51
>   *
>   * This program is free software; you can redistribute it and/or modify
> @@ -44,6 +47,10 @@
>  #include <plat/gpmc-smsc911x.h>
>  #include <plat/gpmc.h>
>  #include <plat/sdrc.h>
> +#include <plat/vram.h>
> +
> +#include <video/omapdss.h>
> +#include <video/omap-panel-generic-dpi.h>
>
>  #define OMAP3LOGIC_SMSC911X_CS                       1
>
> @@ -58,6 +65,14 @@ static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
>       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
>  };
>
> +static struct regulator_consumer_supply omap3logic_vdds_supplies[] = {
> +     REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
> +     REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
> +};
> +
> +static struct regulator_consumer_supply omap3logic_vdac_supply =
> +     REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
> +
>  /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
>  static struct regulator_init_data omap3logic_vmmc1 = {
>       .constraints = {
> @@ -74,6 +89,34 @@ static struct regulator_init_data omap3logic_vmmc1 = {
>       .consumer_supplies      = omap3logic_vmmc1_supply,
>  };
>
> +static struct regulator_init_data omap3logic_vpll2 = {
> +     .constraints = {
> +             .name                   = "VDDS_DSI",
> +             .min_uV                 = 1800000,
> +             .max_uV                 = 1800000,
> +             .apply_uV               = true,
> +             .always_on              = true,
> +             .valid_modes_mask       = REGULATOR_MODE_NORMAL
> +                                     | REGULATOR_MODE_STANDBY,
> +             .valid_ops_mask         = REGULATOR_CHANGE_MODE,
> +     },
> +     .num_consumer_supplies  = ARRAY_SIZE(omap3logic_vdds_supplies),
> +     .consumer_supplies      = omap3logic_vdds_supplies,
> +};
> +
> +static struct regulator_init_data omap3logic_vdac = {
> +     .constraints = {
> +             .min_uV                 = 1800000,
> +             .max_uV                 = 1800000,
> +             .valid_modes_mask       = REGULATOR_MODE_NORMAL
> +                                     | REGULATOR_MODE_STANDBY,
> +             .valid_ops_mask         = REGULATOR_CHANGE_MODE
> +                                     | REGULATOR_CHANGE_STATUS,
> +     },
> +     .num_consumer_supplies  = 1,
> +     .consumer_supplies      = &omap3logic_vdac_supply,
> +};
> +
>  static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
>       .gpio_base      = OMAP_MAX_GPIO_LINES,
>       .irq_base       = TWL4030_GPIO_IRQ_BASE,
> @@ -91,6 +134,8 @@ static struct twl4030_platform_data omap3logic_twldata = {
>       /* platform_data for children goes here */
>       .gpio           = &omap3logic_gpio_data,
>       .vmmc1          = &omap3logic_vmmc1,
> +     .vpll2          = &omap3logic_vpll2,
> +     .vdac           = &omap3logic_vdac,
>  };
>
>  static int __init omap3logic_i2c_init(void)
> @@ -182,6 +227,110 @@ static inline void __init board_smsc911x_init(void)
>       gpmc_smsc911x_init(&board_smsc911x_data);
>  }
>
> +#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
> +
> +#define OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO     154
> +#define OMAP3_TORPEDO_LCD_ENABLE_GPIO                155
> +#define OMAP3_TORPEDO_LCD_PWM_GPIO           56
> +
> +static struct gpio omap3logic_dss_gpios[] __initdata = {
> +     {OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "lcd_bl_pwr"},
> +     {OMAP3_TORPEDO_LCD_PWM_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable"},
> +     {OMAP3_TORPEDO_LCD_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable"},
> +};
> +
> +static int omap3logic_enable_lcd(struct omap_dss_device *dssdev)
> +{
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 1);
> +     msleep(20);
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 1);
> +
> +     return 0;
> +}
> +
> +static void omap3logic_disable_lcd(struct omap_dss_device *dssdev)
> +{
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +     msleep(20);
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +}
> +
> +static struct panel_generic_dpi_data lcd_panel = {
> +     .name                   = "sharp_lq",
> +     .platform_enable        = omap3logic_enable_lcd,
> +     .platform_disable       = omap3logic_disable_lcd,
> +};
> +
> +static struct omap_dss_device omap3logic_lcd_device = {
> +     .name                   = "lcd",
> +     .driver_name            = "generic_dpi_panel",
> +     .type                   = OMAP_DISPLAY_TYPE_DPI,
> +     .data                   = &lcd_panel,
> +     .phy.dpi.data_lines     = 16,
> +};
> +
> +static struct omap_dss_device omap3logic_tv_device = {
> +     .name                   = "tv",
> +     .driver_name            = "venc",
> +     .type                   = OMAP_DISPLAY_TYPE_VENC,
> +     .phy.venc.type          = OMAP_DSS_VENC_TYPE_SVIDEO,
> +};
> +
> +static struct omap_dss_device *omap3logic_dss_devices[] = {
> +     &omap3logic_lcd_device,
> +     &omap3logic_tv_device,
> +};
> +
> +static struct omap_dss_board_info omap3logic_dss_data = {
> +     .num_devices            = ARRAY_SIZE(omap3logic_dss_devices),
> +     .devices                = omap3logic_dss_devices,
> +     .default_device         = &omap3logic_lcd_device,
> +};
> +
> +static void __init omap3logic_display_init(void)
> +{
> +     int r;
> +
> +     r = gpio_request_array(omap3logic_dss_gpios,
> +                            ARRAY_SIZE(omap3logic_dss_gpios));
> +     if (r) {
> +             printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
> +             return;
> +     }
> +
> +     gpio_export(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +     gpio_export(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +     gpio_export(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
> +
> +     r = omap_display_init(&omap3logic_dss_data);
> +     if (r) {
> +             pr_err("OMAP3LOGIC: failed to register DSS device\n");
> +             gpio_free_array(omap3logic_dss_gpios,
> +                             ARRAY_SIZE(omap3logic_dss_gpios));
> +     }
> +}
> +
> +static void __init omap3logic_video_mem_init(void)
> +{
> +     /*
> +      * GFX 480x272x32bpp
> +      * VID1/2 480x272x32bpp double buffered
> +      */
> +     omap_vram_set_sdram_vram(PAGE_ALIGN(480 * 272 * 4) +
> +                     2 * PAGE_ALIGN(480 * 272 * 4 * 2), 0);
> +}
> +
> +#else
> +static void __init omap3logic_display_init(void) { }
> +static void __init omap3logic_video_mem_init(void){ }
> +#endif /* defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) */
> +
> +static void __init omap3logic_reserve(void)
> +{
> +     omap3logic_video_mem_init();
> +     omap_reserve();
> +}
> +
>  #ifdef CONFIG_OMAP_MUX
>  static struct omap_board_mux board_mux[] __initdata = {
>       { .reg_offset = OMAP_MUX_TERMINATOR },
> @@ -197,6 +346,7 @@ static void __init omap3logic_init(void)
>       omap_sdrc_init(NULL, NULL);
>       board_mmc_init();
>       board_smsc911x_init();
> +     omap3logic_display_init();
>
>       /* Ensure SDRC pins are mux'd for self-refresh */
>       omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
> @@ -205,6 +355,7 @@ static void __init omap3logic_init(void)
>
>  MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
>       .atag_offset    = 0x100,
> +     .reserve        = omap3logic_reserve,
>       .map_io         = omap3_map_io,
>       .init_early     = omap35xx_init_early,
>       .init_irq       = omap3_init_irq,
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: OMAP3LOGIC: Adding DSS support
  2011-12-08 12:05 Alex
  2011-12-09 21:08 ` Tony Lindgren
@ 2011-12-12 11:10 ` Tomi Valkeinen
  2011-12-12 14:20   ` Alex Gershgorin
  1 sibling, 1 reply; 7+ messages in thread
From: Tomi Valkeinen @ 2011-12-12 11:10 UTC (permalink / raw)
  To: Alex; +Cc: linux-omap, linux-arm-kernel, tim.nordell, baruch

[-- Attachment #1: Type: text/plain, Size: 6797 bytes --]

Hi,

On Thu, 2011-12-08 at 14:05 +0200, Alex wrote:
> This patch adds DSS2 support to the LogicPD OMAP 35x Torpedo boardfile. LCD and
> TV-out are supported.
> 
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-omap2/board-omap3logic.c |  151 ++++++++++++++++++++++++++++++++
>  1 files changed, 151 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
> index 7c0f193..86175fa 100644
> --- a/arch/arm/mach-omap2/board-omap3logic.c
> +++ b/arch/arm/mach-omap2/board-omap3logic.c
> @@ -7,6 +7,9 @@
>   * Copyright (C) 2010 Logic Product Development, Inc.
>   * Peter Barada <peter.barada@logicpd.com>
>   *
> + * Copyright (C) 2011 Meprolight, Ltd.
> + * Alex Gershgorin <alexg@meprolight.com>
> + *
>   * Modified from Beagle, EVM, and RX51
>   *
>   * This program is free software; you can redistribute it and/or modify
> @@ -44,6 +47,10 @@
>  #include <plat/gpmc-smsc911x.h>
>  #include <plat/gpmc.h>
>  #include <plat/sdrc.h>
> +#include <plat/vram.h>
> +
> +#include <video/omapdss.h>
> +#include <video/omap-panel-generic-dpi.h>
>  
>  #define OMAP3LOGIC_SMSC911X_CS			1
>  
> @@ -58,6 +65,14 @@ static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
>  	REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
>  };
>  
> +static struct regulator_consumer_supply omap3logic_vdds_supplies[] = {
> +	REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
> +	REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
> +};
> +
> +static struct regulator_consumer_supply omap3logic_vdac_supply =
> +	REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
> +
>  /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
>  static struct regulator_init_data omap3logic_vmmc1 = {
>  	.constraints = {
> @@ -74,6 +89,34 @@ static struct regulator_init_data omap3logic_vmmc1 = {
>  	.consumer_supplies      = omap3logic_vmmc1_supply,
>  };
>  
> +static struct regulator_init_data omap3logic_vpll2 = {
> +	.constraints = {
> +		.name			= "VDDS_DSI",
> +		.min_uV			= 1800000,
> +		.max_uV			= 1800000,
> +		.apply_uV		= true,
> +		.always_on		= true,
> +		.valid_modes_mask	= REGULATOR_MODE_NORMAL
> +					| REGULATOR_MODE_STANDBY,
> +		.valid_ops_mask		= REGULATOR_CHANGE_MODE,
> +	},
> +	.num_consumer_supplies  = ARRAY_SIZE(omap3logic_vdds_supplies),
> +	.consumer_supplies      = omap3logic_vdds_supplies,
> +};
> +
> +static struct regulator_init_data omap3logic_vdac = {
> +	.constraints = {
> +		.min_uV			= 1800000,
> +		.max_uV			= 1800000,
> +		.valid_modes_mask	= REGULATOR_MODE_NORMAL
> +					| REGULATOR_MODE_STANDBY,
> +		.valid_ops_mask		= REGULATOR_CHANGE_MODE
> +					| REGULATOR_CHANGE_STATUS,
> +	},
> +	.num_consumer_supplies	= 1,
> +	.consumer_supplies	= &omap3logic_vdac_supply,
> +};
> +
>  static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
>  	.gpio_base	= OMAP_MAX_GPIO_LINES,
>  	.irq_base	= TWL4030_GPIO_IRQ_BASE,
> @@ -91,6 +134,8 @@ static struct twl4030_platform_data omap3logic_twldata = {
>  	/* platform_data for children goes here */
>  	.gpio		= &omap3logic_gpio_data,
>  	.vmmc1		= &omap3logic_vmmc1,
> +	.vpll2		= &omap3logic_vpll2,
> +	.vdac		= &omap3logic_vdac,
>  };

The regulators are already set up in twl-common.c, so there shouldn't be
need for the code above.

>  
>  static int __init omap3logic_i2c_init(void)
> @@ -182,6 +227,110 @@ static inline void __init board_smsc911x_init(void)
>  	gpmc_smsc911x_init(&board_smsc911x_data);
>  }
>  
> +#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
> +
> +#define OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO	154
> +#define OMAP3_TORPEDO_LCD_ENABLE_GPIO		155
> +#define OMAP3_TORPEDO_LCD_PWM_GPIO		56

The PWM gpio doesn't seem to be used. Is it needed for something?

> +static struct gpio omap3logic_dss_gpios[] __initdata = {
> +	{OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "lcd_bl_pwr"},
> +	{OMAP3_TORPEDO_LCD_PWM_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable"},
> +	{OMAP3_TORPEDO_LCD_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable"},
> +};
> +
> +static int omap3logic_enable_lcd(struct omap_dss_device *dssdev)
> +{
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 1);
> +	msleep(20);
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 1);
> +
> +	return 0;
> +}
> +
> +static void omap3logic_disable_lcd(struct omap_dss_device *dssdev)
> +{
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +	msleep(20);
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +}

Is there a particular reason for msleep(20) in the enable and disable
function?

> +
> +static struct panel_generic_dpi_data lcd_panel = {
> +	.name			= "sharp_lq",
> +	.platform_enable	= omap3logic_enable_lcd,
> +	.platform_disable	= omap3logic_disable_lcd,
> +};
> +
> +static struct omap_dss_device omap3logic_lcd_device = {
> +	.name			= "lcd",
> +	.driver_name		= "generic_dpi_panel",
> +	.type			= OMAP_DISPLAY_TYPE_DPI,
> +	.data			= &lcd_panel,
> +	.phy.dpi.data_lines	= 16,
> +};
> +
> +static struct omap_dss_device omap3logic_tv_device = {
> +	.name			= "tv",
> +	.driver_name		= "venc",
> +	.type			= OMAP_DISPLAY_TYPE_VENC,
> +	.phy.venc.type		= OMAP_DSS_VENC_TYPE_SVIDEO,
> +};
> +
> +static struct omap_dss_device *omap3logic_dss_devices[] = {
> +	&omap3logic_lcd_device,
> +	&omap3logic_tv_device,
> +};
> +
> +static struct omap_dss_board_info omap3logic_dss_data = {
> +	.num_devices		= ARRAY_SIZE(omap3logic_dss_devices),
> +	.devices		= omap3logic_dss_devices,
> +	.default_device		= &omap3logic_lcd_device,
> +};
> +
> +static void __init omap3logic_display_init(void)
> +{
> +	int r;
> +
> +	r = gpio_request_array(omap3logic_dss_gpios,
> +			       ARRAY_SIZE(omap3logic_dss_gpios));
> +	if (r) {
> +		printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
> +		return;
> +	}
> +
> +	gpio_export(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +	gpio_export(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +	gpio_export(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
> +
> +	r = omap_display_init(&omap3logic_dss_data);
> +	if (r) {
> +		pr_err("OMAP3LOGIC: failed to register DSS device\n");
> +		gpio_free_array(omap3logic_dss_gpios,
> +				ARRAY_SIZE(omap3logic_dss_gpios));
> +	}
> +}
> +
> +static void __init omap3logic_video_mem_init(void)
> +{
> +	/*
> +	 * GFX 480x272x32bpp
> +	 * VID1/2 480x272x32bpp double buffered
> +	 */
> +	omap_vram_set_sdram_vram(PAGE_ALIGN(480 * 272 * 4) +
> +			2 * PAGE_ALIGN(480 * 272 * 4 * 2), 0);
> +}

You should normally let the bootloader or the user define the vram size
via boot parameters, not in the board file like this.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH] ARM: OMAP3LOGIC: Adding DSS support
  2011-12-12 11:10 ` Tomi Valkeinen
@ 2011-12-12 14:20   ` Alex Gershgorin
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Gershgorin @ 2011-12-12 14:20 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	tim.nordell@logicpd.com, baruch@tkos.co.il


________________________________________
From: Tomi Valkeinen [tomi.valkeinen@ti.com]
Sent: Monday, December 12, 2011 1:10 PM
To: Alex Gershgorin
Cc: linux-omap@vger.kernel.org; linux-arm-kernel@lists.infradead.org; tim.nordell@logicpd.com; baruch@tkos.co.il
Subject: Re: [PATCH] ARM: OMAP3LOGIC: Adding DSS support

Hi,

On Thu, 2011-12-08 at 14:05 +0200, Alex wrote:
> This patch adds DSS2 support to the LogicPD OMAP 35x Torpedo boardfile. LCD and
> TV-out are supported.
>
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
> ---
>  arch/arm/mach-omap2/board-omap3logic.c |  151 ++++++++++++++++++++++++++++++++
>  1 files changed, 151 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
> index 7c0f193..86175fa 100644
> --- a/arch/arm/mach-omap2/board-omap3logic.c
> +++ b/arch/arm/mach-omap2/board-omap3logic.c
> @@ -7,6 +7,9 @@
>   * Copyright (C) 2010 Logic Product Development, Inc.
>   * Peter Barada <peter.barada@logicpd.com>
>   *
> + * Copyright (C) 2011 Meprolight, Ltd.
> + * Alex Gershgorin <alexg@meprolight.com>
> + *
>   * Modified from Beagle, EVM, and RX51
>   *
>   * This program is free software; you can redistribute it and/or modify
> @@ -44,6 +47,10 @@
>  #include <plat/gpmc-smsc911x.h>
>  #include <plat/gpmc.h>
>  #include <plat/sdrc.h>
> +#include <plat/vram.h>
> +
> +#include <video/omapdss.h>
> +#include <video/omap-panel-generic-dpi.h>
>
>  #define OMAP3LOGIC_SMSC911X_CS                       1
>
> @@ -58,6 +65,14 @@ static struct regulator_consumer_supply omap3logic_vmmc1_supply[] = {
>       REGULATOR_SUPPLY("vmmc", "omap_hsmmc.0"),
>  };
>
> +static struct regulator_consumer_supply omap3logic_vdds_supplies[] = {
> +     REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
> +     REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
> +};
> +
> +static struct regulator_consumer_supply omap3logic_vdac_supply =
> +     REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
> +
>  /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
>  static struct regulator_init_data omap3logic_vmmc1 = {
>       .constraints = {
> @@ -74,6 +89,34 @@ static struct regulator_init_data omap3logic_vmmc1 = {
>       .consumer_supplies      = omap3logic_vmmc1_supply,
>  };
>
> +static struct regulator_init_data omap3logic_vpll2 = {
> +     .constraints = {
> +             .name                   = "VDDS_DSI",
> +             .min_uV                 = 1800000,
> +             .max_uV                 = 1800000,
> +             .apply_uV               = true,
> +             .always_on              = true,
> +             .valid_modes_mask       = REGULATOR_MODE_NORMAL
> +                                     | REGULATOR_MODE_STANDBY,
> +             .valid_ops_mask         = REGULATOR_CHANGE_MODE,
> +     },
> +     .num_consumer_supplies  = ARRAY_SIZE(omap3logic_vdds_supplies),
> +     .consumer_supplies      = omap3logic_vdds_supplies,
> +};
> +
> +static struct regulator_init_data omap3logic_vdac = {
> +     .constraints = {
> +             .min_uV                 = 1800000,
> +             .max_uV                 = 1800000,
> +             .valid_modes_mask       = REGULATOR_MODE_NORMAL
> +                                     | REGULATOR_MODE_STANDBY,
> +             .valid_ops_mask         = REGULATOR_CHANGE_MODE
> +                                     | REGULATOR_CHANGE_STATUS,
> +     },
> +     .num_consumer_supplies  = 1,
> +     .consumer_supplies      = &omap3logic_vdac_supply,
> +};
> +
>  static struct twl4030_gpio_platform_data omap3logic_gpio_data = {
>       .gpio_base      = OMAP_MAX_GPIO_LINES,
>       .irq_base       = TWL4030_GPIO_IRQ_BASE,
> @@ -91,6 +134,8 @@ static struct twl4030_platform_data omap3logic_twldata = {
>       /* platform_data for children goes here */
>       .gpio           = &omap3logic_gpio_data,
>       .vmmc1          = &omap3logic_vmmc1,
> +     .vpll2          = &omap3logic_vpll2,
> +     .vdac           = &omap3logic_vdac,
>  };

>The regulators are already set up in twl-common.c, so there shouldn't be
>need for the code above.

I will correct it .

>
>  static int __init omap3logic_i2c_init(void)
> @@ -182,6 +227,110 @@ static inline void __init board_smsc911x_init(void)
>       gpmc_smsc911x_init(&board_smsc911x_data);
>  }
>
> +#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
> +
> +#define OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO     154
> +#define OMAP3_TORPEDO_LCD_ENABLE_GPIO                155
> +#define OMAP3_TORPEDO_LCD_PWM_GPIO           56

>The PWM gpio doesn't seem to be used. Is it needed for something?

Excuse  me for  my neglect, I shall have it set to default in the function omap3logic_display_init.

> +static struct gpio omap3logic_dss_gpios[] __initdata = {
> +     {OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "lcd_bl_pwr"},
> +     {OMAP3_TORPEDO_LCD_PWM_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable"},
> +     {OMAP3_TORPEDO_LCD_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable"},
> +};
> +
> +static int omap3logic_enable_lcd(struct omap_dss_device *dssdev)
> +{
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 1);
> +     msleep(20);
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 1);
> +
> +     return 0;
> +}
> +
> +static void omap3logic_disable_lcd(struct omap_dss_device *dssdev)
> +{
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +     msleep(20);
> +     gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +}

>Is there a particular reason for msleep(20) in the enable and disable
>function?

No particular reason, it works now without delay.

> +
> +static struct panel_generic_dpi_data lcd_panel = {
> +     .name                   = "sharp_lq",
> +     .platform_enable        = omap3logic_enable_lcd,
> +     .platform_disable       = omap3logic_disable_lcd,
> +};
> +
> +static struct omap_dss_device omap3logic_lcd_device = {
> +     .name                   = "lcd",
> +     .driver_name            = "generic_dpi_panel",
> +     .type                   = OMAP_DISPLAY_TYPE_DPI,
> +     .data                   = &lcd_panel,
> +     .phy.dpi.data_lines     = 16,
> +};
> +
> +static struct omap_dss_device omap3logic_tv_device = {
> +     .name                   = "tv",
> +     .driver_name            = "venc",
> +     .type                   = OMAP_DISPLAY_TYPE_VENC,
> +     .phy.venc.type          = OMAP_DSS_VENC_TYPE_SVIDEO,
> +};
> +
> +static struct omap_dss_device *omap3logic_dss_devices[] = {
> +     &omap3logic_lcd_device,
> +     &omap3logic_tv_device,
> +};
> +
> +static struct omap_dss_board_info omap3logic_dss_data = {
> +     .num_devices            = ARRAY_SIZE(omap3logic_dss_devices),
> +     .devices                = omap3logic_dss_devices,
> +     .default_device         = &omap3logic_lcd_device,
> +};
> +
> +static void __init omap3logic_display_init(void)
> +{
> +     int r;
> +
> +     r = gpio_request_array(omap3logic_dss_gpios,
> +                            ARRAY_SIZE(omap3logic_dss_gpios));
> +     if (r) {
> +             printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
> +             return;
> +     }
> +
> +     gpio_export(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +     gpio_export(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +     gpio_export(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
> +
> +     r = omap_display_init(&omap3logic_dss_data);
> +     if (r) {
> +             pr_err("OMAP3LOGIC: failed to register DSS device\n");
> +             gpio_free_array(omap3logic_dss_gpios,
> +                             ARRAY_SIZE(omap3logic_dss_gpios));
> +     }
> +}
> +
> +static void __init omap3logic_video_mem_init(void)
> +{
> +     /*
> +      * GFX 480x272x32bpp
> +      * VID1/2 480x272x32bpp double buffered
> +      */
> +     omap_vram_set_sdram_vram(PAGE_ALIGN(480 * 272 * 4) +
> +                     2 * PAGE_ALIGN(480 * 272 * 4 * 2), 0);
> +}

>You should normally let the bootloader or the user define the vram size
>via boot parameters, not in the board file like this.

I will send the corrected patch.

Thanks,
Alex Gershgorin


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] ARM: OMAP3LOGIC: Adding DSS support
@ 2011-12-12 15:14 Alex
  2011-12-13 19:12 ` Tony Lindgren
  0 siblings, 1 reply; 7+ messages in thread
From: Alex @ 2011-12-12 15:14 UTC (permalink / raw)
  Cc: linux-omap, linux-kernel, tim.nordell, baruch, Alex

This patch adds DSS2 support to the LogicPD OMAP 35x Torpedo boardfile. LCD and
TV-out are supported.

Signed-off-by: Alex Gershgorin <alexg@meprolight.com>
---
 arch/arm/mach-omap2/board-omap3logic.c |  106 ++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index 7c0f193..e030c71 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -7,6 +7,9 @@
  * Copyright (C) 2010 Logic Product Development, Inc.
  * Peter Barada <peter.barada@logicpd.com>
  *
+ * Copyright (C) 2011 Meprolight, Ltd.
+ * Alex Gershgorin <alexg@meprolight.com>
+ *
  * Modified from Beagle, EVM, and RX51
  *
  * This program is free software; you can redistribute it and/or modify
@@ -44,6 +47,10 @@
 #include <plat/gpmc-smsc911x.h>
 #include <plat/gpmc.h>
 #include <plat/sdrc.h>
+#include <plat/vram.h>
+
+#include <video/omapdss.h>
+#include <video/omap-panel-generic-dpi.h>
 
 #define OMAP3LOGIC_SMSC911X_CS			1
 
@@ -95,6 +102,13 @@ static struct twl4030_platform_data omap3logic_twldata = {
 
 static int __init omap3logic_i2c_init(void)
 {
+	omap3_pmic_get_config(&omap3logic_twldata, TWL_COMMON_PDATA_USB,
+			TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
+
+	omap3logic_twldata.vdac->constraints.apply_uV = true;
+	omap3logic_twldata.vpll2->constraints.apply_uV = true;
+	omap3logic_twldata.vpll2->constraints.name = "VDSI";
+
 	omap3_pmic_init("twl4030", &omap3logic_twldata);
 	return 0;
 }
@@ -182,6 +196,97 @@ static inline void __init board_smsc911x_init(void)
 	gpmc_smsc911x_init(&board_smsc911x_data);
 }
 
+#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
+
+#define OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO	154
+#define OMAP3_TORPEDO_LCD_ENABLE_GPIO		155
+#define OMAP3_TORPEDO_LCD_PWM_GPIO		56
+
+static struct gpio omap3logic_dss_gpios[] __initdata = {
+	{OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "lcd_bl_pwr"},
+	{OMAP3_TORPEDO_LCD_PWM_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable"},
+	{OMAP3_TORPEDO_LCD_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable"},
+};
+
+static int omap3logic_enable_lcd(struct omap_dss_device *dssdev)
+{
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 1);
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 1);
+
+	return 0;
+}
+
+static void omap3logic_disable_lcd(struct omap_dss_device *dssdev)
+{
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
+	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
+}
+
+static struct panel_generic_dpi_data lcd_panel = {
+	.name			= "sharp_lq",
+	.platform_enable	= omap3logic_enable_lcd,
+	.platform_disable	= omap3logic_disable_lcd,
+};
+
+static struct omap_dss_device omap3logic_lcd_device = {
+	.name			= "lcd",
+	.driver_name		= "generic_dpi_panel",
+	.type			= OMAP_DISPLAY_TYPE_DPI,
+	.data			= &lcd_panel,
+	.phy.dpi.data_lines	= 16,
+};
+
+static struct omap_dss_device omap3logic_tv_device = {
+	.name			= "tv",
+	.driver_name		= "venc",
+	.type			= OMAP_DISPLAY_TYPE_VENC,
+	.phy.venc.type		= OMAP_DSS_VENC_TYPE_SVIDEO,
+};
+
+static struct omap_dss_device *omap3logic_dss_devices[] = {
+	&omap3logic_lcd_device,
+	&omap3logic_tv_device,
+};
+
+static struct omap_dss_board_info omap3logic_dss_data = {
+	.num_devices		= ARRAY_SIZE(omap3logic_dss_devices),
+	.devices		= omap3logic_dss_devices,
+	.default_device		= &omap3logic_lcd_device,
+};
+
+static void __init omap3logic_display_init(void)
+{
+	int r;
+
+	r = gpio_request_array(omap3logic_dss_gpios,
+			       ARRAY_SIZE(omap3logic_dss_gpios));
+	if (r) {
+		printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
+		return;
+	}
+
+	gpio_export(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
+	gpio_export(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
+	gpio_export(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
+
+	gpio_set_value(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
+	gpio_set_value(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
+	gpio_set_value(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
+
+	msleep(50);
+	gpio_set_value(OMAP3_TORPEDO_LCD_PWM_GPIO, 1);
+
+	r = omap_display_init(&omap3logic_dss_data);
+	if (r) {
+		pr_err("OMAP3LOGIC: failed to register DSS device\n");
+		gpio_free_array(omap3logic_dss_gpios,
+				ARRAY_SIZE(omap3logic_dss_gpios));
+	}
+}
+#else
+static void __init omap3logic_display_init(void) { }
+#endif /* defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) */
+
 #ifdef CONFIG_OMAP_MUX
 static struct omap_board_mux board_mux[] __initdata = {
 	{ .reg_offset = OMAP_MUX_TERMINATOR },
@@ -197,6 +302,7 @@ static void __init omap3logic_init(void)
 	omap_sdrc_init(NULL, NULL);
 	board_mmc_init();
 	board_smsc911x_init();
+	omap3logic_display_init();
 
 	/* Ensure SDRC pins are mux'd for self-refresh */
 	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
-- 
1.7.0.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] ARM: OMAP3LOGIC: Adding DSS support
  2011-12-12 15:14 [PATCH] ARM: OMAP3LOGIC: Adding DSS support Alex
@ 2011-12-13 19:12 ` Tony Lindgren
  0 siblings, 0 replies; 7+ messages in thread
From: Tony Lindgren @ 2011-12-13 19:12 UTC (permalink / raw)
  To: Alex, Tomi Valkeinen; +Cc: linux-omap, linux-kernel, tim.nordell, baruch

* Alex <alexg@meprolight.com> [111212 06:49]:
> This patch adds DSS2 support to the LogicPD OMAP 35x Torpedo boardfile. LCD and
> TV-out are supported.
> 
> Signed-off-by: Alex Gershgorin <alexg@meprolight.com>

This one should be OK to go via Tomi's DSS tree:

Acked-by: Tony Lindgren <tony@atomide.com>

> ---
>  arch/arm/mach-omap2/board-omap3logic.c |  106 ++++++++++++++++++++++++++++++++
>  1 files changed, 106 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
> index 7c0f193..e030c71 100644
> --- a/arch/arm/mach-omap2/board-omap3logic.c
> +++ b/arch/arm/mach-omap2/board-omap3logic.c
> @@ -7,6 +7,9 @@
>   * Copyright (C) 2010 Logic Product Development, Inc.
>   * Peter Barada <peter.barada@logicpd.com>
>   *
> + * Copyright (C) 2011 Meprolight, Ltd.
> + * Alex Gershgorin <alexg@meprolight.com>
> + *
>   * Modified from Beagle, EVM, and RX51
>   *
>   * This program is free software; you can redistribute it and/or modify
> @@ -44,6 +47,10 @@
>  #include <plat/gpmc-smsc911x.h>
>  #include <plat/gpmc.h>
>  #include <plat/sdrc.h>
> +#include <plat/vram.h>
> +
> +#include <video/omapdss.h>
> +#include <video/omap-panel-generic-dpi.h>
>  
>  #define OMAP3LOGIC_SMSC911X_CS			1
>  
> @@ -95,6 +102,13 @@ static struct twl4030_platform_data omap3logic_twldata = {
>  
>  static int __init omap3logic_i2c_init(void)
>  {
> +	omap3_pmic_get_config(&omap3logic_twldata, TWL_COMMON_PDATA_USB,
> +			TWL_COMMON_REGULATOR_VDAC | TWL_COMMON_REGULATOR_VPLL2);
> +
> +	omap3logic_twldata.vdac->constraints.apply_uV = true;
> +	omap3logic_twldata.vpll2->constraints.apply_uV = true;
> +	omap3logic_twldata.vpll2->constraints.name = "VDSI";
> +
>  	omap3_pmic_init("twl4030", &omap3logic_twldata);
>  	return 0;
>  }
> @@ -182,6 +196,97 @@ static inline void __init board_smsc911x_init(void)
>  	gpmc_smsc911x_init(&board_smsc911x_data);
>  }
>  
> +#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
> +
> +#define OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO	154
> +#define OMAP3_TORPEDO_LCD_ENABLE_GPIO		155
> +#define OMAP3_TORPEDO_LCD_PWM_GPIO		56
> +
> +static struct gpio omap3logic_dss_gpios[] __initdata = {
> +	{OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, GPIOF_OUT_INIT_LOW, "lcd_bl_pwr"},
> +	{OMAP3_TORPEDO_LCD_PWM_GPIO, GPIOF_OUT_INIT_LOW, "lcd bl enable"},
> +	{OMAP3_TORPEDO_LCD_ENABLE_GPIO, GPIOF_OUT_INIT_LOW, "lcd enable"},
> +};
> +
> +static int omap3logic_enable_lcd(struct omap_dss_device *dssdev)
> +{
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 1);
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 1);
> +
> +	return 0;
> +}
> +
> +static void omap3logic_disable_lcd(struct omap_dss_device *dssdev)
> +{
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +	gpio_set_value_cansleep(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +}
> +
> +static struct panel_generic_dpi_data lcd_panel = {
> +	.name			= "sharp_lq",
> +	.platform_enable	= omap3logic_enable_lcd,
> +	.platform_disable	= omap3logic_disable_lcd,
> +};
> +
> +static struct omap_dss_device omap3logic_lcd_device = {
> +	.name			= "lcd",
> +	.driver_name		= "generic_dpi_panel",
> +	.type			= OMAP_DISPLAY_TYPE_DPI,
> +	.data			= &lcd_panel,
> +	.phy.dpi.data_lines	= 16,
> +};
> +
> +static struct omap_dss_device omap3logic_tv_device = {
> +	.name			= "tv",
> +	.driver_name		= "venc",
> +	.type			= OMAP_DISPLAY_TYPE_VENC,
> +	.phy.venc.type		= OMAP_DSS_VENC_TYPE_SVIDEO,
> +};
> +
> +static struct omap_dss_device *omap3logic_dss_devices[] = {
> +	&omap3logic_lcd_device,
> +	&omap3logic_tv_device,
> +};
> +
> +static struct omap_dss_board_info omap3logic_dss_data = {
> +	.num_devices		= ARRAY_SIZE(omap3logic_dss_devices),
> +	.devices		= omap3logic_dss_devices,
> +	.default_device		= &omap3logic_lcd_device,
> +};
> +
> +static void __init omap3logic_display_init(void)
> +{
> +	int r;
> +
> +	r = gpio_request_array(omap3logic_dss_gpios,
> +			       ARRAY_SIZE(omap3logic_dss_gpios));
> +	if (r) {
> +		printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
> +		return;
> +	}
> +
> +	gpio_export(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +	gpio_export(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +	gpio_export(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
> +
> +	gpio_set_value(OMAP3_TORPEDO_LCD_BACKLIGHT_GPIO, 0);
> +	gpio_set_value(OMAP3_TORPEDO_LCD_ENABLE_GPIO, 0);
> +	gpio_set_value(OMAP3_TORPEDO_LCD_PWM_GPIO, 0);
> +
> +	msleep(50);
> +	gpio_set_value(OMAP3_TORPEDO_LCD_PWM_GPIO, 1);
> +
> +	r = omap_display_init(&omap3logic_dss_data);
> +	if (r) {
> +		pr_err("OMAP3LOGIC: failed to register DSS device\n");
> +		gpio_free_array(omap3logic_dss_gpios,
> +				ARRAY_SIZE(omap3logic_dss_gpios));
> +	}
> +}
> +#else
> +static void __init omap3logic_display_init(void) { }
> +#endif /* defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE) */
> +
>  #ifdef CONFIG_OMAP_MUX
>  static struct omap_board_mux board_mux[] __initdata = {
>  	{ .reg_offset = OMAP_MUX_TERMINATOR },
> @@ -197,6 +302,7 @@ static void __init omap3logic_init(void)
>  	omap_sdrc_init(NULL, NULL);
>  	board_mmc_init();
>  	board_smsc911x_init();
> +	omap3logic_display_init();
>  
>  	/* Ensure SDRC pins are mux'd for self-refresh */
>  	omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-12-13 19:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 15:14 [PATCH] ARM: OMAP3LOGIC: Adding DSS support Alex
2011-12-13 19:12 ` Tony Lindgren
  -- strict thread matches above, loose matches on Subject: below --
2011-12-08 12:05 Alex
2011-12-09 21:08 ` Tony Lindgren
2011-12-09 23:55   ` Alex Gershgorin
2011-12-12 11:10 ` Tomi Valkeinen
2011-12-12 14:20   ` Alex Gershgorin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).