All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
To: linux-fbdev-devel@lists.sourceforge.net
Cc: linux-omap@vger.kernel.org
Subject: [PATCH 11/12] DSS: Support for OMAP3 EVM board
Date: Mon, 12 Jan 2009 13:48:31 +0200	[thread overview]
Message-ID: <20090112114831.1003.71495.stgit@tubuntu> (raw)
In-Reply-To: <20090112114718.1003.23643.stgit@tubuntu>

Coded by Vaibhav Hiremath <hvaibhav@ti.com>

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
---

 arch/arm/mach-omap2/board-omap3evm.c |  203 +++++++++++++++++++++++++++++++++-
 1 files changed, 196 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index e4e60e2..e7ec9e6 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -36,6 +36,7 @@
 #include <mach/usb-ehci.h>
 #include <mach/common.h>
 #include <mach/mcspi.h>
+#include <mach/display.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "twl4030-generic-scripts.h"
@@ -160,13 +161,201 @@ static int __init omap3_evm_i2c_init(void)
 	return 0;
 }
 
-static struct platform_device omap3_evm_lcd_device = {
-	.name		= "omap3evm_lcd",
-	.id		= -1,
+#define LCD_PANEL_LR		2
+#define LCD_PANEL_UD		3
+#define LCD_PANEL_INI		152
+#define LCD_PANEL_ENABLE_GPIO	153
+#define LCD_PANEL_QVGA		154
+#define LCD_PANEL_RESB		155
+
+#define ENABLE_VDAC_DEDICATED	0x03
+#define ENABLE_VDAC_DEV_GRP	0x20
+#define ENABLE_VPLL2_DEDICATED	0x05
+#define ENABLE_VPLL2_DEV_GRP	0xE0
+
+#define TWL4030_GPIODATA_IN3	0x03
+#define TWL4030_GPIODATA_DIR3	0x06
+#define TWL4030_VPLL2_DEV_GRP	0x33
+#define TWL4030_VPLL2_DEDICATED	0x36
+
+static int lcd_enabled;
+static int dvi_enabled;
+
+static void __init omap3_evm_display_init(void)
+{
+	int r;
+	r = gpio_request(LCD_PANEL_LR, "lcd_panel_lr");
+	if (r) {
+		printk(KERN_ERR "failed to get LCD_PANEL_LR\n");
+		return;
+	}
+	r = gpio_request(LCD_PANEL_UD, "lcd_panel_ud");
+	if (r) {
+		printk(KERN_ERR "failed to get LCD_PANEL_UD\n");
+		goto err_1;
+	}
+
+	r = gpio_request(LCD_PANEL_INI, "lcd_panel_ini");
+	if (r) {
+		printk(KERN_ERR "failed to get LCD_PANEL_INI\n");
+		goto err_2;
+	}
+	r = gpio_request(LCD_PANEL_RESB, "lcd_panel_resb");
+	if (r) {
+		printk(KERN_ERR "failed to get LCD_PANEL_RESB\n");
+		goto err_3;
+	}
+	r = gpio_request(LCD_PANEL_QVGA, "lcd_panel_qvga");
+	if (r) {
+		printk(KERN_ERR "failed to get LCD_PANEL_QVGA\n");
+		goto err_4;
+	}
+
+	gpio_direction_output(LCD_PANEL_LR, 0);
+	gpio_direction_output(LCD_PANEL_UD, 0);
+	gpio_direction_output(LCD_PANEL_INI, 0);
+	gpio_direction_output(LCD_PANEL_RESB, 0);
+	gpio_direction_output(LCD_PANEL_QVGA, 0);
+
+#define TWL_LED_LEDEN           0x00
+#define TWL_PWMA_PWMAON         0x00
+#define TWL_PWMA_PWMAOFF        0x01
+
+	twl4030_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_LEDEN);
+	twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x01, TWL_PWMA_PWMAON);
+	twl4030_i2c_write_u8(TWL4030_MODULE_PWMA, 0x02, TWL_PWMA_PWMAOFF);
+
+	gpio_direction_output(LCD_PANEL_RESB, 1);
+	gpio_direction_output(LCD_PANEL_INI, 1);
+	gpio_direction_output(LCD_PANEL_QVGA, 0);
+	gpio_direction_output(LCD_PANEL_LR, 1);
+	gpio_direction_output(LCD_PANEL_UD, 1);
+
+	return;
+
+err_4:
+	gpio_free(LCD_PANEL_RESB);
+err_3:
+	gpio_free(LCD_PANEL_INI);
+err_2:
+	gpio_free(LCD_PANEL_UD);
+err_1:
+	gpio_free(LCD_PANEL_LR);
+
+}
+
+static int omap3_evm_panel_enable_lcd(struct omap_display *display)
+{
+	if (dvi_enabled) {
+		printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
+		return -EINVAL;
+	}
+	if (omap_rev() > OMAP3430_REV_ES1_0) {
+		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+			ENABLE_VPLL2_DEDICATED, TWL4030_VPLL2_DEDICATED);
+		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+			ENABLE_VPLL2_DEV_GRP, TWL4030_VPLL2_DEV_GRP);
+	}
+	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 0);
+	lcd_enabled = 1;
+	return 0;
+}
+
+static void omap3_evm_panel_disable_lcd(struct omap_display *display)
+{
+	if (omap_rev() > OMAP3430_REV_ES1_0) {
+		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
+				TWL4030_VPLL2_DEDICATED);
+		twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x0,
+				TWL4030_VPLL2_DEV_GRP);
+	}
+	gpio_direction_output(LCD_PANEL_ENABLE_GPIO, 1);
+	lcd_enabled = 0;
+}
+
+static struct omap_display_data omap3_evm_display_data = {
+	.type = OMAP_DISPLAY_TYPE_DPI,
+	.name = "lcd",
+	.panel_name = "sharp-ls037v7dw01",
+	.u.dpi.data_lines = 18,
+	.panel_enable = omap3_evm_panel_enable_lcd,
+	.panel_disable = omap3_evm_panel_disable_lcd,
 };
 
-static struct omap_lcd_config omap3_evm_lcd_config __initdata = {
-	.ctrl_name	= "internal",
+static int omap3_evm_panel_enable_tv(struct omap_display *display)
+{
+	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 omap3_evm_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_display_data omap3_evm_display_data_tv = {
+	.type = OMAP_DISPLAY_TYPE_VENC,
+	.name = "tv",
+	.u.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
+	.panel_enable = omap3_evm_panel_enable_tv,
+	.panel_disable = omap3_evm_panel_disable_tv,
+};
+
+
+static int omap3_evm_panel_enable_dvi(struct omap_display *display)
+{
+	if (lcd_enabled) {
+		printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
+		return -EINVAL;
+	}
+	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80,
+			TWL4030_GPIODATA_IN3);
+	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80,
+			TWL4030_GPIODATA_DIR3);
+	dvi_enabled = 1;
+
+	return 0;
+}
+
+static void omap3_evm_panel_disable_dvi(struct omap_display *display)
+{
+	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x00,
+			TWL4030_GPIODATA_IN3);
+	twl4030_i2c_write_u8(TWL4030_MODULE_GPIO, 0x00,
+			TWL4030_GPIODATA_DIR3);
+	dvi_enabled = 0;
+}
+
+
+static struct omap_display_data omap3_evm_display_data_dvi = {
+	.type = OMAP_DISPLAY_TYPE_DPI,
+	.name = "dvi",
+	.panel_name = "panel-generic",
+	.u.dpi.data_lines = 24,
+	.panel_enable = omap3_evm_panel_enable_dvi,
+	.panel_disable = omap3_evm_panel_disable_dvi,
+};
+
+static struct omap_dss_platform_data omap3_evm_dss_data = {
+	.num_displays = 3,
+	.displays = {
+		&omap3_evm_display_data,
+		&omap3_evm_display_data_dvi,
+		&omap3_evm_display_data_tv,
+	}
+};
+static struct platform_device omap3_evm_dss_device = {
+	.name		= "omap-dss",
+	.id		= -1,
+	.dev            = {
+		.platform_data = &omap3_evm_dss_data,
+	},
 };
 
 static void ads7846_dev_init(void)
@@ -225,11 +414,10 @@ static void __init omap3_evm_init_irq(void)
 
 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
 	{ OMAP_TAG_UART,	&omap3_evm_uart_config },
-	{ OMAP_TAG_LCD,		&omap3_evm_lcd_config },
 };
 
 static struct platform_device *omap3_evm_devices[] __initdata = {
-	&omap3_evm_lcd_device,
+	&omap3_evm_dss_device,
 	&omap3evm_smc911x_device,
 };
 
@@ -260,6 +448,7 @@ static void __init omap3_evm_init(void)
 	usb_ehci_init();
 	omap3evm_flash_init();
 	ads7846_dev_init();
+	omap3_evm_display_init();
 }
 
 static void __init omap3_evm_map_io(void)


  parent reply	other threads:[~2009-01-12 11:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12 11:47 [PATCH 00/12] DSS: Series description Tomi Valkeinen
2009-01-12 11:47 ` [PATCH 01/12] DSS: Documentation for DSS2 Tomi Valkeinen
2009-01-12 11:47 ` [PATCH 02/12] DSS: Display subsystem for OMAP2/3 Tomi Valkeinen
2009-01-12 13:02   ` [Linux-fbdev-devel] " Tony Lindgren
2009-01-12 13:06     ` Shah, Hardik
2009-01-12 13:17       ` Tony Lindgren
2009-01-12 11:47 ` [PATCH 03/12] DSS: RFBI support Tomi Valkeinen
2009-01-12 13:03   ` Tony Lindgren
2009-01-12 11:47 ` [PATCH 04/12] DSS: VENC support Tomi Valkeinen
2009-01-12 11:47 ` [PATCH 05/12] DSS: DSI support Tomi Valkeinen
2009-01-12 11:47 ` [PATCH 06/12] DSS: OMAPFB: fb driver for new display subsystem Tomi Valkeinen
2009-01-12 11:48 ` [PATCH 07/12] DSS: Add generic DVI panel Tomi Valkeinen
2009-01-12 11:48 ` [PATCH 08/12] DSS: support for Beagle Board Tomi Valkeinen
2009-01-13 11:14   ` David Brownell
2009-01-13 11:37     ` Tomi Valkeinen
2009-01-12 11:48 ` [PATCH 09/12] DSS: Sharp LS037V7DW01 LCD Panel driver Tomi Valkeinen
2009-01-12 11:48 ` [PATCH 10/12] DSS: Support for OMAP3 SDP board Tomi Valkeinen
2009-01-13 11:15   ` David Brownell
2009-01-12 11:48 ` Tomi Valkeinen [this message]
2009-01-12 11:48 ` [PATCH 12/12] DSS: Hacked N810 support Tomi Valkeinen
2009-01-12 13:44 ` [PATCH 00/12] DSS: Series description Koen Kooi
2009-01-12 14:52   ` Hiremath, Vaibhav
2009-01-12 15:39     ` Koen Kooi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090112114831.1003.71495.stgit@tubuntu \
    --to=tomi.valkeinen@nokia.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.