
#
# Patch managed by http://www.holgerschurig.de/patcher.html
#

--- linux2/arch/arm/mach-pxa/poodle.c~poodle_fb
+++ linux2/arch/arm/mach-pxa/poodle.c
@@ -25,6 +25,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/device.h>
+#include <linux/fb.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -40,6 +41,7 @@
 #include <asm/arch/pxa-regs.h>
 #include <asm/arch/irq.h>
 #include <asm/arch/poodle.h>
+#include <asm/arch/pxafb.h>
 
 #include <asm/hardware/locomo.h>
 
@@ -106,6 +108,53 @@
 }
 #endif
 
+/* LCD power functions */
+static struct locomo_dev *locomo_lcd_device = NULL;
+
+static void poodle_lcd_power(int on) {
+	int comadj = 118;
+	
+	if (!locomo_lcd_device) return;
+
+	/* read comadj */
+	/*if (FLASH_DATA(FLASH_COMADJ_MAGIC_ADR) == FLASH_COMADJ_MAJIC) {
+		comadj = FLASH_DATA(FLASH_COMADJ_DATA_ADR);
+	} else {
+		comadj = 118;
+	}*/
+	locomo_lcd_power(locomo_lcd_device, on, comadj);
+}
+
+static int poodle_lcd_probe(struct locomo_dev *dev) {
+	locomo_lcd_device = dev;
+
+	/* the poodle_lcd_power function is called for the first time
+	 * from fs_initcall, which is before locomo is activated.
+	 * We need to recall poodle_lcd_power here*/
+	poodle_lcd_power(1);
+
+	return 0;
+}
+static int poodle_lcd_remove(struct locomo_dev *dev) {
+	locomo_lcd_device = NULL;
+	return 0;
+}
+
+static struct locomo_driver poodle_lcd_driver = {
+	.drv = {
+		.name = "poodle_lcd",
+	},
+	.devid	= LOCOMO_DEVID_LCD,
+	.probe	= poodle_lcd_probe,
+	.remove	= poodle_lcd_remove,
+};
+
+static int __init poodle_lcd_init(void) {
+	return locomo_driver_register(&poodle_lcd_driver);
+}
+device_initcall(poodle_lcd_init);
+
+/* LoCoMo device */
 static struct resource locomo_resources[] = {
 	[0] = {
 		.start		= 0x10000000,
@@ -126,6 +175,30 @@
 	.resource	= locomo_resources,
 };
 
+/* PXAFB device */
+static struct pxafb_mach_info poodle_fb_info __initdata = {
+	.pixclock	= 144700,
+	
+	.xres		= 320,
+	.yres		= 240,
+	.bpp		= 16,
+
+	.hsync_len	= 7,
+	.left_margin	= 11,
+	.right_margin	= 30,
+
+	.vsync_len	= 2,
+	.upper_margin	= 2,
+	.lower_margin	= 0,
+	.sync		= FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+
+	.lccr0		= LCCR0_Act | LCCR0_Sngl | LCCR0_Color,
+	.lccr3		= 0,
+
+	.pxafb_backlight_power	= NULL,
+	.pxafb_lcd_power	= poodle_lcd_power,
+};
+
 static struct platform_device *devices[] __initdata = {
 	&locomo_device,
 };
@@ -171,6 +244,8 @@
 	/* initialize SSP & CS */
 	/*pxa_ssp_init();*/
 
+	set_pxa_fb_info(&poodle_fb_info);
+
 	ret = platform_add_devices(devices, ARRAY_SIZE(devices));
 	if (ret) {
 		printk(KERN_WARNING "poodle: Unable to register LoCoMo device\n");

