From: <cri...@us...> - 2006-10-23 21:46:32
|
Revision: 644 http://svn.sourceforge.net/hackndev/?rev=644&view=rev Author: cristianop Date: 2006-10-23 14:46:19 -0700 (Mon, 23 Oct 2006) Log Message: ----------- l4p: added (experimental) bl power handling Modified Paths: -------------- linux4palm/linux/trunk/drivers/video/backlight/pxapwm_bl.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxapwm-bl.h Modified: linux4palm/linux/trunk/drivers/video/backlight/pxapwm_bl.c =================================================================== --- linux4palm/linux/trunk/drivers/video/backlight/pxapwm_bl.c 2006-10-23 19:38:29 UTC (rev 643) +++ linux4palm/linux/trunk/drivers/video/backlight/pxapwm_bl.c 2006-10-23 21:46:19 UTC (rev 644) @@ -19,6 +19,8 @@ #include <asm/arch/pxapwm-bl.h> static struct backlight_properties pxapwmbl_data; +static void (*pxapwmbl_mach_turn_bl_on)(void); +static void (*pxapwmbl_mach_turn_bl_off)(void); static void pxapwmbl_send_intensity(struct pxapwmbl_platform_data *bl, int intensity) { @@ -28,6 +30,12 @@ if (bl->limit) intensity &= bl->limit_mask; + // set intensity to 0 if in power saving or fb is blanked + if (bl->power != FB_BLANK_UNBLANK) + intensity = 0; + if (bl->fb_blank != FB_BLANK_UNBLANK) + intensity = 0; + /* Does the backlight frequency need to be configured on a per device basis? * What are sensible defaults? Farcaller had prescaler 2, period 0x12bi (~6.1khz). * LD is configured for 1.2khz. @@ -41,9 +49,17 @@ period = 0; prescaler=0; } - + + //printk("pxapwmbl: setting intensity to %d [bl->intensity=%d]\n", intensity, bl->intensity); spin_lock_irqsave(&bl->lock, flags); + // poweron backlight if possible and needed + if (pxapwmbl_mach_turn_bl_on){ + if ((bl->intensity <= bl->off_threshold) && (intensity > bl->off_threshold)){ + pxapwmbl_mach_turn_bl_on(); + } + } + switch (bl->pwm) { case 0: PWM_CTRL0 = prescaler; @@ -66,6 +82,13 @@ " platform data.\n"); } + // poweroff backlight if possible and needed + if (pxapwmbl_mach_turn_bl_off){ + if ((bl->intensity > bl->off_threshold) && (intensity <= bl->off_threshold)){ + pxapwmbl_mach_turn_bl_off(); + } + } + spin_unlock_irqrestore(&bl->lock, flags); } @@ -139,10 +162,16 @@ pxapwmbl_data.max_brightness = bl->max_intensity; + pxapwmbl_mach_turn_bl_on = bl->turn_bl_on; + pxapwmbl_mach_turn_bl_off = bl->turn_bl_off; + bl->intensity = 0; bl->limit = 0; bl->lock = SPIN_LOCK_UNLOCKED; + bl->power = FB_BLANK_UNBLANK; + bl->off_threshold = 5; + bl->dev = backlight_device_register ("pxapwm-bl", bl, &pxapwmbl_data); if (IS_ERR (bl->dev)) return PTR_ERR (bl->dev); Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxapwm-bl.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxapwm-bl.h 2006-10-23 19:38:29 UTC (rev 643) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxapwm-bl.h 2006-10-23 21:46:19 UTC (rev 644) @@ -29,10 +29,16 @@ int prescaler; int intensity; - int powermode; + int power; + int fb_blank; int limit; + int off_threshold; + spinlock_t lock; struct backlight_device *dev; + void (*turn_bl_on)(void); + void (*turn_bl_off)(void); + }; #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |