Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Benjamin Herrenschmidt and committed by
Paul Mackerras
fa19d634 7f172890

+3 -2
+3 -2
drivers/macintosh/via-pmu-backlight.c
··· 17 17 18 18 static struct backlight_ops pmu_backlight_data; 19 19 static DEFINE_SPINLOCK(pmu_backlight_lock); 20 - static int sleeping; 20 + static int sleeping, uses_pmu_bl; 21 21 static u8 bl_curve[FB_BACKLIGHT_LEVELS]; 22 22 23 23 static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) ··· 128 128 129 129 spin_lock_irqsave(&pmu_backlight_lock, flags); 130 130 sleeping = sleep; 131 - if (pmac_backlight) { 131 + if (pmac_backlight && uses_pmu_bl) { 132 132 if (sleep) { 133 133 struct adb_request req; 134 134 ··· 166 166 printk(KERN_ERR "PMU Backlight registration failed\n"); 167 167 return; 168 168 } 169 + uses_pmu_bl = 1; 169 170 bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; 170 171 pmu_backlight_init_curve(0x7F, 0x46, 0x0E); 171 172