From: <cri...@us...> - 2006-10-23 21:52:46
|
Revision: 645 http://svn.sourceforge.net/hackndev/?rev=645&view=rev Author: cristianop Date: 2006-10-23 14:52:29 -0700 (Mon, 23 Oct 2006) Log Message: ----------- palmtx: adedd (experimental) support for backlight and for LCD Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtx-gpio.h Added Paths: ----------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_lcd.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig 2006-10-23 21:46:19 UTC (rev 644) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Kconfig 2006-10-23 21:52:29 UTC (rev 645) @@ -14,6 +14,15 @@ Enable support for WM9712 touchscreen and battery for the Palm TX PDA +config PALMTX_LCD + tristate "Palm TX LCD driver" + select BACKLIGHT_LCD_SUPPORT + depends on MACH_XSCALE_PALMTX + default y if MACH_XSCALE_PALMTX + help + LCD driver for Palm TX. + Enable support for switching the Palm TX LCD on/off + config PALMTX_PCMCIA tristate "Palm TX PCMCIA driver" depends on MACH_XSCALE_PALMTX Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile 2006-10-23 21:46:19 UTC (rev 644) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/Makefile 2006-10-23 21:52:29 UTC (rev 645) @@ -4,4 +4,5 @@ # obj-$(CONFIG_MACH_XSCALE_PALMTX) += palmtx.o obj-$(CONFIG_PALMTX_AC97) += palmld_ac97.o +obj-$(CONFIG_PALMTX_LCD) += palmtx_lcd.o #obj-$(CONFIG_PALMTX_PCMCIA) += palmtx_pcmcia.o Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c 2006-10-23 21:46:19 UTC (rev 644) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx.c 2006-10-23 21:52:29 UTC (rev 645) @@ -23,6 +23,7 @@ #include <linux/platform_device.h> #include <linux/fb.h> #include <linux/input.h> +#include <linux/delay.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> @@ -148,6 +149,20 @@ // backlight +static void palmtx_bl_on(void){ + //printk("palmtx: turning backlight on\n"); + SET_GPIO(GPIO_NR_PALMTX_BL_POWER, 1); + //printk("GPIO_NR_PALMTX_BL_POWER: %d\n",GET_GPIO(GPIO_NR_PALMTX_BL_POWER)); + mdelay(50); +} + +static void palmtx_bl_off(void){ + //printk("palmtx: turning backlight off\n"); + SET_GPIO(GPIO_NR_PALMTX_BL_POWER, 0); + //printk("GPIO_NR_PALMTX_BL_POWER: %d\n",GET_GPIO(GPIO_NR_PALMTX_BL_POWER)); + mdelay(50); +} + static struct pxapwmbl_platform_data palmtx_backlight_data = { .pwm = 0, .max_intensity = 0x16c, @@ -155,6 +170,8 @@ .limit_mask = 0x6d, .prescaler = 7, .period = 0x16c, + .turn_bl_on = palmtx_bl_on, + .turn_bl_off = palmtx_bl_off, }; static struct platform_device palmtx_backlight = { @@ -164,7 +181,12 @@ }, }; +// LCD +static struct platform_device palmtx_lcd = { + .name = "palmtx-lcd", +}; + /** * IRDA */ @@ -298,6 +320,7 @@ &palmtx_keypad, &palmtx_ac97, &palmtx_backlight, + &palmtx_lcd, }; @@ -312,7 +335,7 @@ * */ -static struct pxafb_mach_info palmtx_lcd __initdata = { +static struct pxafb_mach_info palmtx_fb __initdata = { .pixclock = 80000, .xres = 320, // PPL + 1 .yres = 480, // LPP + 1 @@ -390,7 +413,7 @@ pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD); pxa_gpio_mode(GPIO31_SYNC_AC97_MD); - set_pxa_fb_info(&palmtx_lcd); + set_pxa_fb_info(&palmtx_fb); pxa_set_mci_info( &palmtx_mci_platform_data ); pxa_set_udc_info(&palmtx_udc_mach_info); Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_lcd.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_lcd.c (rev 0) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_lcd.c 2006-10-23 21:52:29 UTC (rev 645) @@ -0,0 +1,154 @@ +/* + * Palm TX LCD driver + * + * Based on Asus MyPal 716 LCD and Backlight driver + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/notifier.h> +#include <linux/lcd.h> +#include <linux/fb.h> +#include <linux/delay.h> +#include <linux/platform_device.h> + +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/mach-types.h> + +#include <asm/hardware.h> +#include <asm/arch/pxa-regs.h> +#include <asm/arch/pxafb.h> + +#include <asm/arch/palmtx-gpio.h> +#include <asm/arch/palmtx-init.h> + +static int lcd_power; + +int palmtx_lcd_set_power(struct lcd_device *lm, int level) +{ + switch (level) { + case FB_BLANK_UNBLANK: + case FB_BLANK_NORMAL: + // this is very likely incomplete !!! + printk("palmtx_lcd: turning LCD on\n"); + SET_GPIO(GPIO_NR_PALMTX_LCD_POWER, 1); + mdelay(70); + break; + case FB_BLANK_VSYNC_SUSPEND: + case FB_BLANK_HSYNC_SUSPEND: + break; + case FB_BLANK_POWERDOWN: + // this is very likely incomplete !!! + printk("palmtx_lcd: turning LCD off\n"); + SET_GPIO(GPIO_NR_PALMTX_LCD_POWER, 0); + mdelay(65); + break; + } + + lcd_power = level; + + return 0; +} + +static int palmtx_lcd_get_power(struct lcd_device *lm) +{ + printk("palmtx_lcd: power is set to %d", lcd_power); + return lcd_power; +} + +struct lcd_properties palmtx_lcd_properties = +{ + .owner = THIS_MODULE, + .set_power = palmtx_lcd_set_power, + .get_power = palmtx_lcd_get_power, +}; + +static struct lcd_device *pxafb_lcd_device; + + +int palmtx_lcd_probe(struct device *dev) +{ + if (!machine_is_xscale_palmtx()) + return -ENODEV; + + pxafb_lcd_device = lcd_device_register("pxafb", NULL, &palmtx_lcd_properties); + + if (IS_ERR(pxafb_lcd_device)){ + printk("palmtx_lcd_probe: cannot register LCD device\n"); + return -ENOMEM; + } + + printk ("palmtx LCD driver registered\n"); + + return 0; +} + +static int palmtx_lcd_remove(struct device *dev) +{ + lcd_device_unregister(pxafb_lcd_device); + printk ("palmtx LCD driver unregistered\n"); + return 0; +} + +#ifdef CONFIG_PM + +static int palmtx_lcd_suspend(struct device *dev, pm_message_t state) +{ + struct pm_save_data *save; + + if (!dev->power.saved_state) + dev->power.saved_state = kmalloc(sizeof(struct pm_save_data), GFP_KERNEL); + if (!dev->power.saved_state) + return -ENOMEM; + save = dev->power.saved_state; + return 0; +} + +static int palmtx_lcd_resume(struct device *dev) +{ + if (dev->power.saved_state) { + struct pm_save_data *save = dev->power.saved_state; + kfree(dev->power.saved_state); + dev->power.saved_state = NULL; + } + + return 0; +} +#endif + +static struct device_driver palmtx_lcd_driver = { + .name = "palmtx-lcd", + .bus = &platform_bus_type, + .probe = palmtx_lcd_probe, + .remove = palmtx_lcd_remove, +#ifdef CONFIG_PM + .suspend = palmtx_lcd_suspend, + .resume = palmtx_lcd_resume, +#endif +}; + +static int palmtx_lcd_init(void) +{ + if (!machine_is_xscale_palmtx()) + return -ENODEV; + + return driver_register(&palmtx_lcd_driver); +} + +static void palmtx_lcd_exit(void) +{ + lcd_device_unregister(pxafb_lcd_device); + driver_unregister(&palmtx_lcd_driver); +} + +module_init(palmtx_lcd_init); +module_exit(palmtx_lcd_exit); + +MODULE_DESCRIPTION("LCD driver for Palm TX"); +MODULE_LICENSE("GPL"); Property changes on: linux4palm/linux/trunk/arch/arm/mach-pxa/palmtx/palmtx_lcd.c ___________________________________________________________________ Name: svn:executable + * Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtx-gpio.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtx-gpio.h 2006-10-23 21:46:19 UTC (rev 644) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmtx-gpio.h 2006-10-23 21:52:29 UTC (rev 645) @@ -64,6 +64,9 @@ #define GPIO_NR_PALMTX_USB_POWER 95 #define GPIO_NR_PALMTX_USB_PULLUP 93 +#define GPIO_NR_PALMTX_BL_POWER 84 +#define GPIO_NR_PALMTX_LCD_POWER 96 + /* INTERRUPTS */ #define IRQ_GPIO_PALMTX_SD_DETECT_N IRQ_GPIO(GPIO_NR_PALMTX_SD_DETECT_N) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |