aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/via-pmu.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-12-19 23:00:21 -0500
committerPaul Mackerras <paulus@samba.org>2007-12-21 06:14:07 -0500
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)
1748 out_8(&via[IER], IER_SET | SR_INT | CB1_INT); 1748 out_8(&via[IER], IER_SET | SR_INT | CB1_INT);
1749} 1749}
1750 1750
1751extern void pmu_backlight_set_sleep(int sleep);
1752
1753#define GRACKLE_PM (1<<7) 1751#define GRACKLE_PM (1<<7)
1754#define GRACKLE_DOZE (1<<5) 1752#define GRACKLE_DOZE (1<<5)
1755#define GRACKLE_NAP (1<<4) 1753#define GRACKLE_NAP (1<<4)
@@ -2160,11 +2158,6 @@ pmu_release(struct inode *inode, struct file *file)
2160#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32) 2158#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC32)
2161static void pmac_suspend_disable_irqs(void) 2159static void pmac_suspend_disable_irqs(void)
2162{ 2160{
2163#ifdef CONFIG_PMAC_BACKLIGHT
2164 /* Tell backlight code not to muck around with the chip anymore */
2165 pmu_backlight_set_sleep(1);
2166#endif
2167
2168 /* Call platform functions marked "on sleep" */ 2161 /* Call platform functions marked "on sleep" */
2169 pmac_pfunc_i2c_suspend(); 2162 pmac_pfunc_i2c_suspend();
2170 pmac_pfunc_base_suspend(); 2163 pmac_pfunc_base_suspend();
@@ -2208,11 +2201,6 @@ static int powerbook_sleep(suspend_state_t state)
2208 2201
2209 mdelay(100); 2202 mdelay(100);
2210 2203
2211#ifdef CONFIG_PMAC_BACKLIGHT
2212 /* Tell backlight code it can use the chip again */
2213 pmu_backlight_set_sleep(0);
2214#endif
2215
2216 return 0; 2204 return 0;
2217} 2205}
2218 2206
@@ -2457,10 +2445,15 @@ static int pmu_sys_suspend(struct sys_device *sysdev, pm_message_t state)
2457 if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended) 2445 if (state.event != PM_EVENT_SUSPEND || pmu_sys_suspended)
2458 return 0; 2446 return 0;
2459 2447
2460 /* Suspend PMU event interrupts */ 2448 /* Suspend PMU event interrupts */\
2461 pmu_suspend(); 2449 pmu_suspend();
2462
2463 pmu_sys_suspended = 1; 2450 pmu_sys_suspended = 1;
2451
2452#ifdef CONFIG_PMAC_BACKLIGHT
2453 /* Tell backlight code not to muck around with the chip anymore */
2454 pmu_backlight_set_sleep(1);
2455#endif
2456
2464 return 0; 2457 return 0;
2465} 2458}
2466 2459
@@ -2475,9 +2468,12 @@ static int pmu_sys_resume(struct sys_device *sysdev)
2475 pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2); 2468 pmu_request(&req, NULL, 2, PMU_SYSTEM_READY, 2);
2476 pmu_wait_complete(&req); 2469 pmu_wait_complete(&req);
2477 2470
2471#ifdef CONFIG_PMAC_BACKLIGHT
2472 /* Tell backlight code it can use the chip again */
2473 pmu_backlight_set_sleep(0);
2474#endif
2478 /* Resume PMU event interrupts */ 2475 /* Resume PMU event interrupts */
2479 pmu_resume(); 2476 pmu_resume();
2480
2481 pmu_sys_suspended = 0; 2477 pmu_sys_suspended = 0;
2482 2478
2483 return 0; 2479 return 0;