summaryrefslogtreecommitdiff
path: root/drivers/macintosh/via-pmu.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-20 15:00:21 +1100
committerPaul Mackerras <paulus@samba.org>2007-12-21 22:14:07 +1100
commit0094f2cdcfb6f2132b2ea3b4e85e0f6899c8595b (patch)
tree4e537bbfc3bcba2e3a0d93457009052190136078 /drivers/macintosh/via-pmu.c
parent7ac5dde99eb9fefdb526973c600075b7c5703a86 (diff)
[POWERPC] Fix for via-pmu based backlight control
This fixes a few issues with via-pmu based backlight control. First, it fixes a sign problem with the setup of the backlight curve since the `range' value there -can- (and will) go negative. Then, it reworks the interaction between this and the via-pmu sleep code to properly restore backlight on wakeup from 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.c')
-rw-r--r--drivers/macintosh/via-pmu.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 7e77ac7e3705..82ec12e0edd2 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -1748,8 +1748,6 @@ restore_via_state(void)
out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
}
-extern void pmu_backlight_set_sleep(int sleep);
-
#define GRACKLE_PM (1<<7)
#define GRACKLE_DOZE (1<<5)
#define GRACKLE_NAP (1<<4)
@@ -2160,11 +2158,6 @@ pmu_release(struct inode *inode, struct file *file)
#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
static void pmac_suspend_disable_irqs(void)
{
-#ifdef CONFIG_PMAC_BACKLIGHT
- /* Tell backlight code not to muck around with the chip anymore */
- pmu_backlight_set_sleep(1);
-#endif
-
/* Call platform functions marked "on sleep" */
pmac_pfunc_i2c_suspend();
pmac_pfunc_base_suspend();
@@ -2208,11 +2201,6 @@ static int powerbook_sleep(suspend_state_t state)
mdelay(100);
-#ifdef CONFIG_PMAC_BACKLIGHT
- /* Tell backlight code it can use the chip again */
- pmu_backlight_set_sleep(0);
-#endif
-
return 0;
}
@@ -2457,10 +2445,15 @@ static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state)
if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended)
return 0;
- /* Suspend PMU event interrupts */
+ /* Suspend PMU event interrupts */\
pmu_suspend();
-
pmu_sys_suspended = 1;
+
+#ifdef CONFIG_PMAC_BACKLIGHT
+ /* Tell backlight code not to muck around with the chip anymore */
+ pmu_backlight_set_sleep(1);
+#endif
+
return 0;
}
@@ -2475,9 +2468,12 @@ static int pmu_sys_resume(struct sys_device *sysdev)
pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2);
pmu_wait_complete(&req);
+#ifdef CONFIG_PMAC_BACKLIGHT
+ /* Tell backlight code it can use the chip again */
+ pmu_backlight_set_sleep(0);
+#endif
/* Resume PMU event interrupts */
pmu_resume();
-
pmu_sys_suspended = 0;
return 0;