diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 13:37:27 +1100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-31 13:37:27 +1100 |
commit | 8af03e782cae1e0a0f530ddd22301cdd12cf9dc0 (patch) | |
tree | c4af13a38bd3cc1a811a37f2358491f171052070 /drivers/macintosh/via-pmu-backlight.c | |
parent | 6232665040f9a23fafd9d94d4ae8d5a2dc850f65 (diff) | |
parent | 99e139126ab2e84be67969650f92eb37c12ab5cd (diff) | |
download | talos-obmc-linux-8af03e782cae1e0a0f530ddd22301cdd12cf9dc0.tar.gz talos-obmc-linux-8af03e782cae1e0a0f530ddd22301cdd12cf9dc0.zip |
Merge branch 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc
* 'for-2.6.25' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (454 commits)
[POWERPC] Cell IOMMU fixed mapping support
[POWERPC] Split out the ioid fetching/checking logic
[POWERPC] Add support to cell_iommu_setup_page_tables() for multiple windows
[POWERPC] Split out the IOMMU logic from cell_dma_dev_setup()
[POWERPC] Split cell_iommu_setup_hardware() into two parts
[POWERPC] Split out the logic that allocates struct iommus
[POWERPC] Allocate the hash table under 1G on cell
[POWERPC] Add set_dma_ops() to match get_dma_ops()
[POWERPC] 83xx: Clean up / convert mpc83xx board DTS files to v1 format.
[POWERPC] 85xx: Only invalidate TLB0 and TLB1
[POWERPC] 83xx: Fix typo in mpc837x compatible entries
[POWERPC] 85xx: convert sbc85* boards to use machine_device_initcall
[POWERPC] 83xx: rework platform Kconfig
[POWERPC] 85xx: rework platform Kconfig
[POWERPC] 86xx: Remove unused IRQ defines
[POWERPC] QE: Explicitly set address-cells and size cells for muram
[POWERPC] Convert StorCenter DTS file to /dts-v1/ format.
[POWERPC] 86xx: Convert all 86xx DTS files to /dts-v1/ format.
[PPC] Remove 85xx from arch/ppc
[PPC] Remove 83xx from arch/ppc
...
Diffstat (limited to 'drivers/macintosh/via-pmu-backlight.c')
-rw-r--r-- | drivers/macintosh/via-pmu-backlight.c | 48 |
1 files changed, 29 insertions, 19 deletions
diff --git a/drivers/macintosh/via-pmu-backlight.c b/drivers/macintosh/via-pmu-backlight.c index 7e27071746e4..741a2e3f4fc6 100644 --- a/drivers/macintosh/via-pmu-backlight.c +++ b/drivers/macintosh/via-pmu-backlight.c @@ -22,7 +22,7 @@ static u8 bl_curve[FB_BACKLIGHT_LEVELS]; static void pmu_backlight_init_curve(u8 off, u8 min, u8 max) { - unsigned int i, flat, count, range = (max - min); + int i, flat, count, range = (max - min); bl_curve[0] = off; @@ -68,17 +68,11 @@ static int pmu_backlight_get_level_brightness(int level) return pmulevel; } -static int pmu_backlight_update_status(struct backlight_device *bd) +static int __pmu_backlight_update_status(struct backlight_device *bd) { struct adb_request req; - unsigned long flags; int level = bd->props.brightness; - spin_lock_irqsave(&pmu_backlight_lock, flags); - - /* Don't update brightness when sleeping */ - if (sleeping) - goto out; if (bd->props.power != FB_BLANK_UNBLANK || bd->props.fb_blank != FB_BLANK_UNBLANK) @@ -99,12 +93,23 @@ static int pmu_backlight_update_status(struct backlight_device *bd) pmu_wait_complete(&req); } -out: - spin_unlock_irqrestore(&pmu_backlight_lock, flags); - return 0; } +static int pmu_backlight_update_status(struct backlight_device *bd) +{ + unsigned long flags; + int rc = 0; + + spin_lock_irqsave(&pmu_backlight_lock, flags); + /* Don't update brightness when sleeping */ + if (!sleeping) + rc = __pmu_backlight_update_status(bd); + spin_unlock_irqrestore(&pmu_backlight_lock, flags); + return rc; +} + + static int pmu_backlight_get_brightness(struct backlight_device *bd) { return bd->props.brightness; @@ -123,6 +128,16 @@ void pmu_backlight_set_sleep(int sleep) spin_lock_irqsave(&pmu_backlight_lock, flags); sleeping = sleep; + if (pmac_backlight) { + if (sleep) { + struct adb_request req; + + pmu_request(&req, NULL, 2, PMU_POWER_CTRL, + PMU_POW_BACKLIGHT | PMU_POW_OFF); + pmu_wait_complete(&req); + } else + __pmu_backlight_update_status(pmac_backlight); + } spin_unlock_irqrestore(&pmu_backlight_lock, flags); } #endif /* CONFIG_PM */ @@ -148,8 +163,8 @@ void __init pmu_backlight_init() bd = backlight_device_register(name, NULL, NULL, &pmu_backlight_data); if (IS_ERR(bd)) { - printk("pmubl: Backlight registration failed\n"); - goto error; + printk(KERN_ERR "PMU Backlight registration failed\n"); + return; } bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1; pmu_backlight_init_curve(0x7F, 0x46, 0x0E); @@ -171,10 +186,5 @@ void __init pmu_backlight_init() bd->props.power = FB_BLANK_UNBLANK; backlight_update_status(bd); - printk("pmubl: Backlight initialized (%s)\n", name); - - return; - -error: - return; + printk(KERN_INFO "PMU Backlight initialized (%s)\n", name); } |