aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/via-pmu-backlight.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2008-03-03 01:27:46 -0500
committerPaul Mackerras <paulus@samba.org>2008-03-12 19:09:27 -0400
commitfa19d63488bd108a308f575064779bb69123efbc (patch)
tree97dc8f59e050fd39ac141e0b5e0ddac889ed5580 /drivers/macintosh/via-pmu-backlight.c
parent7f172890a8f8744c4005c267ae9e228411ab173f (diff)
[POWERPC] Fix sleep on some powerbooks
The PMU backlight code would kick in during sleep/resume even on machines that use a different backlight method. This breaks sleep on some PowerBooks. This fixes it by adding a flag to indicate whether the backlight is controlled by the PMU, and testing that before trying to use the PMU to turn off the backlight during sleep. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/macintosh/via-pmu-backlight.c')
-rw-r--r--drivers/macintosh/via-pmu-backlight.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c
index 741a2e3f4fc6..a348bb0791d3 100644
--- a/drivers/macintosh/via-pmu-backlight.c
+++ b/drivers/macintosh/via-pmu-backlight.c
@@ -17,7 +17,7 @@
17 17
18static struct backlight_ops pmu_backlight_data; 18static struct backlight_ops pmu_backlight_data;
19static DEFINE_SPINLOCK(pmu_backlight_lock); 19static DEFINE_SPINLOCK(pmu_backlight_lock);
20static int sleeping; 20static int sleeping, uses_pmu_bl;
21static u8 bl_curve[FB_BACKLIGHT_LEVELS]; 21static u8 bl_curve[FB_BACKLIGHT_LEVELS];
22 22
23static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) 23static void pmu_backlight_init_curve(u8 off, u8 min, u8 max)
@@ -128,7 +128,7 @@ void pmu_backlight_set_sleep(int sleep)
128 128
129 spin_lock_irqsave(&pmu_backlight_lock, flags); 129 spin_lock_irqsave(&pmu_backlight_lock, flags);
130 sleeping = sleep; 130 sleeping = sleep;
131 if (pmac_backlight) { 131 if (pmac_backlight && uses_pmu_bl) {
132 if (sleep) { 132 if (sleep) {
133 struct adb_request req; 133 struct adb_request req;
134 134
@@ -166,6 +166,7 @@ void __init pmu_backlight_init()
166 printk(KERN_ERR "PMU Backlight registration failed\n"); 166 printk(KERN_ERR "PMU Backlight registration failed\n");
167 return; 167 return;
168 } 168 }
169 uses_pmu_bl = 1;
169 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; 170 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
170 pmu_backlight_init_curve(0x7F, 0x46, 0x0E); 171 pmu_backlight_init_curve(0x7F, 0x46, 0x0E);
171 172