Skip to contentSkip to conversation

Add backlight support for Amstrad Delta

PATCH In review Jonathan McDowell 2 participants 8 messages Apr 2, 2006 – May 15, 2006

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 Add backlight support for Amstrad Delta

This patch adds support for the Amstrad Delta LCD backlight. It's the first patch in a series of 3 enabling full LCD support for the Delta and is the least intrusive, allowing control of the backlight through the existing backlight class infrastructure.

arch/arm/configs/ams_delta_defconfig +33 -2
index 03f02dd..7cc0727 100644
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.16-omap1
-# Wed Mar 22 10:53:48 2006
+# Sun Apr  2 16:00:11 2006
 #
 CONFIG_ARM=y
 CONFIG_MMU=y
@@ -623,13 +623,44 @@ CONFIG_I2C_OMAP=y
 #
 # Graphics support
 #
-# CONFIG_FB is not set
+CONFIG_FB=y
+# CONFIG_FB_CFB_FILLRECT is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+# CONFIG_FB_S1D13XXX is not set
+CONFIG_FB_OMAP=y
+# CONFIG_FB_OMAP_LCDC_EXTERNAL is not set
+# CONFIG_FB_OMAP_LCD_LPH8923 is not set
+# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
+# CONFIG_FB_OMAP_DMA_TUNE is not set
+# CONFIG_FB_VIRTUAL is not set
 
 #
 # Console display driver support
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+
+#
+# Logo configuration
+#
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
+CONFIG_LOGO_LINUX_CLUT224=y
+CONFIG_BACKLIGHT_LCD_SUPPORT=y
+CONFIG_BACKLIGHT_CLASS_DEVICE=y
+CONFIG_BACKLIGHT_DEVICE=y
+# CONFIG_LCD_CLASS_DEVICE is not set
+CONFIG_BACKLIGHT_AMS_DELTA=y
 
 #
 # Sound
arch/arm/mach-omap1/board-ams-delta.c +11 -0
index 6178f04..7475587 100644
@@ -84,6 +84,15 @@ static struct omap_board_config_kernel a
 	{ OMAP_TAG_UART,	&ams_delta_uart_config },
 };
 
+static struct platform_device ams_delta_bl_device = {
+	.name	= "ams-delta-bl",
+	.id	= -1,
+};
+
+static struct platform_device *ams_delta_devices[] __initdata = {
+	&ams_delta_bl_device,
+};
+
 static void __init ams_delta_init(void)
 {
 	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
@@ -94,6 +103,8 @@ static void __init ams_delta_init(void)
 
 	/* Clear latch2 (NAND, LCD, modem enable) */
 	ams_delta_latch2_write(~0, 0);
+
+	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 }
 
 static void __init ams_delta_map_io(void)
drivers/video/backlight/Kconfig +8 -0
index 9d996f2..5f02b00 100644
@@ -42,6 +42,14 @@ config LCD_DEVICE
 	depends on LCD_CLASS_DEVICE
 	default y
 
+config BACKLIGHT_AMS_DELTA
+	tristate "Amstrad Delta (E3) backlight driver"
+	depends on BACKLIGHT_DEVICE && MACH_AMS_DELTA
+	default y
+	help
+	  If you have an Amstrad Delta (E3) videophone, say y to enable
+	  the backlight driver.
+
 config BACKLIGHT_CORGI
 	tristate "Sharp Corgi Backlight Driver (SL-C7xx Series)"
 	depends on BACKLIGHT_DEVICE && PXA_SHARPSL
drivers/video/backlight/Makefile +1 -0
index 744210c..2a793ea 100644
@@ -1,6 +1,7 @@
 # Backlight & LCD drivers
 
 obj-$(CONFIG_LCD_CLASS_DEVICE)     += lcd.o
+obj-$(CONFIG_BACKLIGHT_AMS_DELTA) += ams_delta_bl.o
 obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o
 obj-$(CONFIG_BACKLIGHT_CORGI)	+= corgi_bl.o
 obj-$(CONFIG_BACKLIGHT_HP680)	+= hp680_bl.o
drivers/video/backlight/ams_delta_bl.c new file +172 -0

172 lines not on this page · raw message

#1 lore raw

PATCH 2/3 Add LCD support for Amstrad Delta

Add support for the Amstrad Delta LCD, which is a 12 bit DSTN panel. This patch treats it as a 16 bit panel; in reality it's in 0444 mode and will ignore the top 4 bits, but the next patch adds support for that in the OMAP FB driver.

arch/arm/mach-omap1/board-ams-delta.c +11 -0
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap/arch/arm/mach-omap1/board-ams-delta.c linux-omap-lcd/arch/arm/mach-omap1/board-ams-delta.c
@@ -76,11 +76,16 @@ static struct map_desc ams_delta_io_desc
 	}
 };
 
+static struct omap_lcd_config ams_delta_lcd_config __initdata = {
+	.ctrl_name	= "internal",
+};
+
 static struct omap_uart_config ams_delta_uart_config __initdata = {
 	.enabled_uarts = 1,
 };
 
 static struct omap_board_config_kernel ams_delta_config[] = {
+	{ OMAP_TAG_LCD,		&ams_delta_lcd_config },
 	{ OMAP_TAG_UART,	&ams_delta_uart_config },
 };
 
@@ -89,8 +94,14 @@ static struct platform_device ams_delta_
 	.id	= -1,
 };
 
+static struct platform_device ams_delta_lcd_device = {
+	.name	= "lcd_ams_delta",
+	.id	= "-1",
+};
+
 static struct platform_device *ams_delta_devices[] __initdata = {
 	&ams_delta_bl_device,
+	&ams_delta_lcd_device,
 };
 
 static void __init ams_delta_init(void)
arch/arm/mach-omap1/clock.c +9 -0
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap/arch/arm/mach-omap1/clock.c linux-omap-lcd/arch/arm/mach-omap1/clock.c
@@ -19,6 +19,7 @@
 #include <linux/clk.h>
 
 #include <asm/io.h>
+#include <asm/mach-types.h>
 
 #include <asm/arch/usb.h>
 #include <asm/arch/clock.h>
@@ -766,6 +767,14 @@ int __init omap1_clk_init(void)
 	omap_writew(omap_readw(OMAP730_PCC_UPLD_CTRL) & ~0x1, OMAP730_PCC_UPLD_CTRL);
 #endif
 
+#ifdef CONFIG_MACH_AMS_DELTA
+	/* Amstrad Delta wants BCLK high when inactive */
+	if (machine_is_ams_delta())
+		omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
+				(1 << SDW_MCLK_INV_BIT),
+				ULPD_CLOCK_CTRL);
+#endif
+
 	/* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
 	omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
 
arch/arm/mach-omap1/clock.h +1 -0
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap/arch/arm/mach-omap1/clock.h linux-omap-lcd/arch/arm/mach-omap1/clock.h
@@ -89,6 +89,7 @@ struct arm_idlect1_clk {
 #define EN_DSPTIMCK	5
 
 /* Various register defines for clock controls scattered around OMAP chip */
+#define SDW_MCLK_INV_BIT	2	/* In ULPD_CLKC_CTRL */
 #define USB_MCLK_EN_BIT		4	/* In ULPD_CLKC_CTRL */
 #define USB_HOST_HHC_UHOST_EN	9	/* In MOD_CONF_CTRL_0 */
 #define SWD_ULPD_PLL_CLK_REQ	1	/* In SWD_CLK_DIV_CTRL_SEL */
drivers/video/omap/lcd_ams_delta.c +148 -0

148 lines not on this page · raw message

drivers/video/omap/lcdc.c +2 -0
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap/drivers/video/omap/lcdc.c linux-omap-lcd/drivers/video/omap/lcdc.c
@@ -836,6 +836,8 @@ static int omap_lcdc_init(struct omapfb_
 	rate = clk_get_rate(tc_ck);
 	clk_put(tc_ck);
 
+	if (machine_is_ams_delta())
+		rate /= 4;
 	if (machine_is_omap_h3())
 		rate /= 3;
 	r = clk_set_rate(omap_lcdc.lcd_ck, rate);
drivers/video/omap/Makefile +1 -0
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap/drivers/video/omap/Makefile linux-omap-lcd/drivers/video/omap/Makefile
@@ -14,6 +14,7 @@ objs-$(CONFIG_ARCH_OMAP2)$(CONFIG_FB_OMA
 
 objs-y$(CONFIG_FB_OMAP_LCDC_HWA742) += hwa742.o
 
+objs-y$(CONFIG_MACH_AMS_DELTA) += lcd_ams_delta.o
 objs-y$(CONFIG_MACH_OMAP_H4) += lcd_h4.o
 objs-y$(CONFIG_MACH_OMAP_H3) += lcd_h3.o
 objs-y$(CONFIG_MACH_OMAP_H2) += lcd_h2.o
#2 lore raw

PATCH 3/3 Add RGB444 support to OMAP FB driver.

This patch adds support for an RGB444 mode to the OMAP FB driver; it's used by the Amstrad Delta which has a 12 bit DSTN screen setup in 444 mode.

Mark Underwood did the original work for this patch:

http://www.earth.li/pipermail/e3-hacking/2006-March/000376.html

I have simply updated to the latest git tree.

drivers/video/omap/lcd_ams_delta.c +1 -1
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap-lcd/drivers/video/omap/lcd_ams_delta.c linux-omap-lcd-444/drivers/video/omap/lcd_ams_delta.c
@@ -77,7 +77,7 @@ struct lcd_panel ams_delta_panel = {
 	.name		= "ams-delta",
 	.config		= 0,
 
-	.bpp		= 16,
+	.bpp		= 12,
 	.data_lines	= 16,
 	.x_res		= 480,
 	.y_res		= 320,
drivers/video/omap/lcdc.c +6 -1
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap-lcd/drivers/video/omap/lcdc.c linux-omap-lcd-444/drivers/video/omap/lcdc.c
@@ -353,6 +353,7 @@ static int omap_lcdc_setup_plane(int pla
 		omap_lcdc.palette_size = 512;
 		break;
 	case OMAPFB_COLOR_RGB565:
+	case OMAPFB_COLOR_RGB444:
 		omap_lcdc.bpp = 16;
 		omap_lcdc.palette_code = 0x4000;
 		omap_lcdc.palette_size = 32;
@@ -720,7 +721,11 @@ static int alloc_fbmem(int req_size)
 	int frame_size;
 	struct lcd_panel *panel = omap_lcdc.fbdev->panel;
 
-	frame_size = PAGE_ALIGN(panel->x_res * panel->bpp / 8 * panel->y_res);
+	if (panel->bpp == 12)
+		frame_size = PAGE_ALIGN(panel->x_res * 16 / 8 * panel->y_res);
+	else
+		frame_size = PAGE_ALIGN(panel->x_res * panel->bpp / 8 *
+				panel->y_res);
 	if (req_size > frame_size)
 		frame_size = req_size;
 	omap_lcdc.vram_size = frame_size;
drivers/video/omap/omapfb_main.c +33 -7
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap-lcd/drivers/video/omap/omapfb_main.c linux-omap-lcd-444/drivers/video/omap/omapfb_main.c
@@ -239,6 +239,7 @@ static int _setcolreg(struct fb_info *in
 							transp, update_hw_pal);
 		/* Fallthrough */
 	case OMAPFB_COLOR_RGB565:
+	case OMAPFB_COLOR_RGB444:
 		if (r != 0)
 			break;
 
@@ -249,8 +250,14 @@ static int _setcolreg(struct fb_info *in
 
 		if (regno < 16) {
 			u16 pal;
-			pal = ((red >> 11) << 11) | ((green >> 10) << 5) |
-				(blue >> 11);
+			if (fbdev->color_mode == OMAPFB_COLOR_RGB444)
+				pal = ((red >> 12) << 8) |
+					((green >> 12) << 4) |
+					(blue >> 12);
+			else
+				pal = ((red >> 11) << 11) |
+					((green >> 10) << 5) |
+					(blue >> 11);
 			((u32 *)(info->pseudo_palette))[regno] = pal;
 		}
 		break;
@@ -402,12 +409,19 @@ static int set_fb_var(struct omapfb_devi
 	unsigned long	line_size;
 	struct lcd_panel *panel = fbdev->panel;
 
-	bpp = var->bits_per_pixel = panel->bpp;
+	if (panel->bpp == 12)
+		/* 12-bpp mode stores colours in 16 bits and ignores top 4 */
+		bpp = var->bits_per_pixel = 16;
+	else
+		bpp = var->bits_per_pixel = panel->bpp;
 
-	switch (bpp) {
+	switch (panel->bpp) {
 	case 16:
 		fbdev->color_mode = OMAPFB_COLOR_RGB565;
 		break;
+	case 12:
+		fbdev->color_mode = OMAPFB_COLOR_RGB444;
+		break;
 	case 8:
 		fbdev->color_mode = OMAPFB_COLOR_CLUT_8BPP;
 		break;
@@ -453,9 +467,21 @@ static int set_fb_var(struct omapfb_devi
 		var->yoffset = var->yres_virtual - var->yres;
 	line_size = var->xres * bpp / 8;
 
-	var->red.offset	 = 11; var->red.length	 = 5; var->red.msb_right   = 0;
-	var->green.offset= 5;  var->green.length = 6; var->green.msb_right = 0;
-	var->blue.offset = 0;  var->blue.length  = 5; var->blue.msb_right  = 0;
+	if (fbdev->color_mode == OMAPFB_COLOR_RGB444) {
+		var->red.offset	 = 8; var->red.length	= 4;
+		var->red.msb_right   = 0;
+		var->green.offset= 4; var->green.length = 4;
+		var->green.msb_right = 0;
+		var->blue.offset = 0; var->blue.length  = 4;
+		var->blue.msb_right  = 0;
+	} else {
+		var->red.offset	 = 11; var->red.length	 = 5;
+		var->red.msb_right   = 0;
+		var->green.offset= 5;  var->green.length = 6;
+		var->green.msb_right = 0;
+		var->blue.offset = 0;  var->blue.length  = 5;
+		var->blue.msb_right  = 0;
+	}
 
 	var->height		= -1;
 	var->width		= -1;
include/asm-arm/arch/omapfb.h +1 -0
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap-lcd/include/asm-arm/arch/omapfb.h linux-omap-lcd-444/include/asm-arm/arch/omapfb.h
@@ -64,6 +64,7 @@ enum omapfb_color_format {
 	OMAPFB_COLOR_CLUT_4BPP,
 	OMAPFB_COLOR_CLUT_2BPP,
 	OMAPFB_COLOR_CLUT_1BPP,
+	OMAPFB_COLOR_RGB444,
 };
 
 struct omapfb_update_window {
include/asm-arm/arch-omap/omapfb.h +1 -0
diff -rupN -X linux-omap/Documentation/dontdiff linux-omap-lcd/include/asm-arm/arch-omap/omapfb.h linux-omap-lcd-444/include/asm-arm/arch-omap/omapfb.h
@@ -64,6 +64,7 @@ enum omapfb_color_format {
 	OMAPFB_COLOR_CLUT_4BPP,
 	OMAPFB_COLOR_CLUT_2BPP,
 	OMAPFB_COLOR_CLUT_1BPP,
+	OMAPFB_COLOR_RGB444,
 };
 
 struct omapfb_update_window {
#3 lore raw
In reply to Jonathan McDowell
Quoted 4 lines · Jonathan McDowell

This patch adds support for the Amstrad Delta LCD backlight. It's the first patch in a series of 3 enabling full LCD support for the Delta and is the least intrusive, allowing control of the backlight through the existing backlight class infrastructure.

Looks good. Can you please separate arch/arm/mach-omap1/board-ams-delta.c changes and other core omap changes into separate patch in this series?

See new http://www.muru.com/linux/omap/README_OMAP_PATCHES

Thanks,

Tony

#4 lore raw
Quoted 8 lines · On Fri, Apr 28, 2006 at 03:26:38AM -0700, [email protected] wrote:
Quoted 4 lines · Jonathan McDowell

This patch adds support for the Amstrad Delta LCD backlight. It's the first patch in a series of 3 enabling full LCD support for the Delta and is the least intrusive, allowing control of the backlight through the existing backlight class infrastructure.

Looks good. Can you please separate arch/arm/mach-omap1/board-ams-delta.c changes and other core omap changes into separate patch in this series?

Sure. So you'd want it as the following patches:

* Add the LCD support to drivers/video/omap/
* Add the support to arch/arm/mach-omap1/board-ams-delta.c for the above.
* Add the backlight driver to drivers/video/backlight/
* Add the support to arch/arm/mach-omap1/board-ams-delta.c for the above.

?

Or possibly only the one patch against arch/arm/mach-omap1/board-ams-delta.c pulling in both the LCD and backlight support? Or should I submit the backlight support to mainline given it doesn't touch OMAP specific code?

Also are you planning to add Mark Underwood's 444 patch, as having that there before I rebase my patches would be very useful.

J.

Signature · 3 lines
/-\                             |   noodles is completely different
|@/  Debian GNU/Linux Developer |     between japan and the west
\-                              |
reviewer
#5 lore raw

Hi,

Sorry for long delay replaying on this one too.

Quoted 19 lines · Jonathan McDowell
Quoted 8 lines · On Fri, Apr 28, 2006 at 03:26:38AM -0700, [email protected] wrote:
Quoted 4 lines · Jonathan McDowell

This patch adds support for the Amstrad Delta LCD backlight. It's the first patch in a series of 3 enabling full LCD support for the Delta and is the least intrusive, allowing control of the backlight through the existing backlight class infrastructure.

Looks good. Can you please separate arch/arm/mach-omap1/board-ams-delta.c changes and other core omap changes into separate patch in this series?

Sure. So you'd want it as the following patches:

* Add the LCD support to drivers/video/omap/
* Add the support to arch/arm/mach-omap1/board-ams-delta.c for the above.
* Add the backlight driver to drivers/video/backlight/
* Add the support to arch/arm/mach-omap1/board-ams-delta.c for the above.

Quoted 6 lines

?

Or possibly only the one patch against arch/arm/mach-omap1/board-ams-delta.c pulling in both the LCD and backlight support? Or should I submit the backlight support to mainline given it doesn't touch OMAP specific code?

Yes, please send backlight patches to mainline directly. Then one patch for drivers/video/omap, one for board-ams-delta, and one for your defconfig.

Quoted 2 lines

Also are you planning to add Mark Underwood's 444 patch, as having that there before I rebase my patches would be very useful.

Sorry, do you have a URL for that? Or maybe it's been already applied?

Regards,

Tony

#6 lore raw

Re: 444 framebuffer patch?

Quoted 4 lines · Tony Lindgren

* Jonathan McDowell <[email protected]> [060429 09:07]:
Yes, please send backlight patches to mainline directly. Then one patch for drivers/video/omap, one for board-ams-delta, and one for your defconfig.

Ok, will do.

Quoted 3 lines
Quoted 2 lines

Also are you planning to add Mark Underwood's 444 patch, as having that there before I rebase my patches would be very useful.

Sorry, do you have a URL for that? Or maybe it's been already applied?

http://linux.omap.com/pipermail/linux-omap-open-source/2006-April/006888.html

It hasn't been applied yet.

J.

Signature · 2 lines
 [          Been through Hell?? and what did you bring me??           ]
 [ http://www.blackcatnetworks.co.uk/ - IPv6 enabled ADSL/dialup/colo ]
reviewer
#7 lore raw
In reply to Tony Lindgren
Quoted 6 lines · Tony Lindgren
Quoted 2 lines · Jonathan McDowell

Also are you planning to add Mark Underwood's 444 patch, as having that there before I rebase my patches would be very useful.

Sorry, do you have a URL for that? Or maybe it's been already applied?

OK, found the 444 patch. Let's see what Imre says about it.

Tony