[PATCH 4/4] ARM: OMAP3: framebuffer support for 3430SDP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The 3430SDP uses the same panel as the 2430SDP.  The main difference
are in the GPIO lines used for panel enable and backlight, and the
VAUX register/commands sent to the TWL4030 power subsystem.

Also, some misc. whitespace cleanups.

Signed-off-by: Kevin Hilman <khilman@xxxxxxxxxx>
---
 arch/arm/mach-omap2/board-3430sdp.c |   13 +++++++
 drivers/video/omap/Makefile         |    2 +
 drivers/video/omap/lcd_2430sdp.c    |   66 ++++++++++++++++++++++++++---------
 3 files changed, 64 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 55691b5..ba410bf 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -254,10 +254,17 @@ static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
 		.platform_data		= &tsc2046_config,
 	},
 };
+
+static struct platform_device sdp3430_lcd_device = {
+	.name		= "sdp2430_lcd",
+	.id		= -1,
+};
+
 static struct platform_device *sdp3430_devices[] __initdata = {
 	&sdp3430_smc91x_device,
 	&sdp3430_flash_device,
 	&sdp3430_kp_device,
+	&sdp3430_lcd_device,
 };
 
 static inline void __init sdp3430_init_smc91x(void)
@@ -296,9 +303,15 @@ static struct omap_uart_config sdp3430_uart_config __initdata = {
 	.enabled_uarts	= ((1 << 0) | (1 << 1) | (1 << 2)),
 };
 
+static struct omap_lcd_config sdp3430_lcd_config __initdata = {
+	.ctrl_name	= "internal",
+};
+
 static struct omap_board_config_kernel sdp3430_config[] = {
 	{ OMAP_TAG_UART,	&sdp3430_uart_config },
+	{OMAP_TAG_LCD,		&sdp3430_lcd_config},
 };
+
 static int __init omap3430_i2c_init(void)
 {
 	omap_register_i2c_bus(1, 2600, NULL, 0);
diff --git a/drivers/video/omap/Makefile b/drivers/video/omap/Makefile
index 9211128..fb6cb15 100644
--- a/drivers/video/omap/Makefile
+++ b/drivers/video/omap/Makefile
@@ -8,6 +8,7 @@ objs-yy := omapfb_main.o
 
 objs-y$(CONFIG_ARCH_OMAP1) += lcdc.o
 objs-y$(CONFIG_ARCH_OMAP2) += dispc.o
+objs-y$(CONFIG_ARCH_OMAP3) += dispc.o
 
 objs-$(CONFIG_ARCH_OMAP1)$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += sossi.o
 objs-$(CONFIG_ARCH_OMAP2)$(CONFIG_FB_OMAP_LCDC_EXTERNAL) += rfbi.o
@@ -29,6 +30,7 @@ objs-y$(CONFIG_MACH_SX1) += lcd_sx1.o
 
 objs-y$(CONFIG_MACH_OMAP_APOLLON) += lcd_apollon.o
 objs-y$(CONFIG_MACH_OMAP_2430SDP) += lcd_2430sdp.o
+objs-y$(CONFIG_MACH_OMAP_3430SDP) += lcd_2430sdp.o
 objs-y$(CONFIG_FB_OMAP_LCD_MIPID) += lcd_mipid.o
 
 omapfb-objs := $(objs-yy)
diff --git a/drivers/video/omap/lcd_2430sdp.c b/drivers/video/omap/lcd_2430sdp.c
index a252d82..2464e85 100644
--- a/drivers/video/omap/lcd_2430sdp.c
+++ b/drivers/video/omap/lcd_2430sdp.c
@@ -28,13 +28,22 @@
 #include <asm/arch/mux.h>
 #include <asm/arch/omapfb.h>
 #include <asm/arch/twl4030.h>
+#include <asm/mach-types.h>
+
+#define SDP2430_LCD_PANEL_BACKLIGHT_GPIO	91
+#define SDP2430_LCD_PANEL_ENABLE_GPIO		154
+#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 	24
+#define SDP3430_LCD_PANEL_ENABLE_GPIO 		28
+
+static unsigned backlight_gpio;
+static unsigned enable_gpio;
 
-#define LCD_PANEL_BACKLIGHT_GPIO	91
-#define LCD_PANEL_ENABLE_GPIO		154
 #define LCD_PIXCLOCK_MAX		5400 /* freq 5.4 MHz */
 #define PM_RECEIVER             TWL4030_MODULE_PM_RECEIVER
 #define ENABLE_VAUX2_DEDICATED  0x09
 #define ENABLE_VAUX2_DEV_GRP    0x20
+#define ENABLE_VAUX3_DEDICATED	0x03
+#define ENABLE_VAUX3_DEV_GRP	0x20
 
 
 #define t2_out(c, r, v) twl4030_i2c_write_u8(c, r, v)
@@ -43,10 +52,18 @@
 static int sdp2430_panel_init(struct lcd_panel *panel,
 				struct omapfb_device *fbdev)
 {
-	omap_request_gpio(LCD_PANEL_ENABLE_GPIO);	/* LCD panel */
-	omap_request_gpio(LCD_PANEL_BACKLIGHT_GPIO);	/* LCD backlight */
-	omap_set_gpio_direction(LCD_PANEL_ENABLE_GPIO, 0);	/* output */
-	omap_set_gpio_direction(LCD_PANEL_BACKLIGHT_GPIO, 0);	/* output */
+	if (machine_is_omap_3430sdp()) {
+		enable_gpio    = SDP3430_LCD_PANEL_ENABLE_GPIO;
+		backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
+	} else {
+		enable_gpio    = SDP2430_LCD_PANEL_ENABLE_GPIO;
+		backlight_gpio = SDP2430_LCD_PANEL_BACKLIGHT_GPIO;
+	}
+
+	omap_request_gpio(enable_gpio);			/* LCD panel */
+	omap_request_gpio(backlight_gpio);		/* LCD backlight */
+	omap_set_gpio_direction(enable_gpio, 0);	/* output */
+	omap_set_gpio_direction(backlight_gpio, 0);	/* output */
 
 	return 0;
 }
@@ -57,21 +74,36 @@ static void sdp2430_panel_cleanup(struct lcd_panel *panel)
 
 static int sdp2430_panel_enable(struct lcd_panel *panel)
 {
-	omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 1);
-	omap_set_gpio_dataout(LCD_PANEL_BACKLIGHT_GPIO, 1);
-
-	if(0!= t2_out(PM_RECEIVER, ENABLE_VAUX2_DEDICATED,
-                      TWL4030_VAUX2_DEDICATED)) return -EIO;
-	if(0!= t2_out(PM_RECEIVER, ENABLE_VAUX2_DEV_GRP,
-                      TWL4030_VAUX2_DEV_GRP)) return -EIO;
+	u8 ded_val, ded_reg;
+	u8 grp_val, grp_reg;
+
+	if (machine_is_omap_3430sdp()) {
+		ded_reg = TWL4030_VAUX3_DEDICATED;
+		ded_val = ENABLE_VAUX3_DEDICATED;
+		grp_reg = TWL4030_VAUX3_DEV_GRP;
+		grp_val = ENABLE_VAUX3_DEV_GRP;
+	} else {
+		ded_reg = TWL4030_VAUX2_DEDICATED;
+		ded_val = ENABLE_VAUX2_DEDICATED;
+		grp_reg = TWL4030_VAUX2_DEV_GRP;
+		grp_val = ENABLE_VAUX2_DEV_GRP;
+	}
+		
+	omap_set_gpio_dataout(enable_gpio, 1);
+	omap_set_gpio_dataout(backlight_gpio, 1);
+
+	if (0 != t2_out(PM_RECEIVER, ded_val, ded_reg))
+		return -EIO;
+	if (0 != t2_out(PM_RECEIVER, grp_val, grp_reg))
+		return -EIO;
 
 	return 0;
 }
 
 static void sdp2430_panel_disable(struct lcd_panel *panel)
 {
-	omap_set_gpio_dataout(LCD_PANEL_ENABLE_GPIO, 0);
-        omap_set_gpio_dataout(LCD_PANEL_BACKLIGHT_GPIO, 0);
+	omap_set_gpio_dataout(enable_gpio, 0);
+	omap_set_gpio_dataout(backlight_gpio, 0);
 }
 
 static unsigned long sdp2430_panel_get_caps(struct lcd_panel *panel)
@@ -99,7 +131,7 @@ struct lcd_panel sdp2430_panel = {
 
 	.init		= sdp2430_panel_init,
 	.cleanup	= sdp2430_panel_cleanup,
-	.enable	= sdp2430_panel_enable,
+	.enable		= sdp2430_panel_enable,
 	.disable	= sdp2430_panel_disable,
 	.get_caps	= sdp2430_panel_get_caps,
 };
@@ -128,7 +160,7 @@ static int sdp2430_panel_resume(struct platform_device *pdev)
 struct platform_driver sdp2430_panel_driver = {
 	.probe		= sdp2430_panel_probe,
 	.remove		= sdp2430_panel_remove,
-	.suspend		= sdp2430_panel_suspend,
+	.suspend	= sdp2430_panel_suspend,
 	.resume		= sdp2430_panel_resume,
 	.driver		= {
 		.name	= "sdp2430_lcd",
-- 
1.5.3.7

-
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux