diff options
author | Michael Hanselmann <linux-kernel@hansmi.ch> | 2006-06-25 08:47:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:00:59 -0400 |
commit | 5474c120aafe78ca54bf272f7a01107c42da2b21 (patch) | |
tree | c1b002a27703ce92c816bfb9844752186e33d403 /drivers/video/chipsfb.c | |
parent | 17660bdd5c1f1a165273c1a59cb5b87670a81cc4 (diff) |
[PATCH] Rewritten backlight infrastructure for portable Apple computers
This patch contains a total rewrite of the backlight infrastructure for
portable Apple computers. Backward compatibility is retained. A sysfs
interface allows userland to control the brightness with more steps than
before. Userland is allowed to upload a brightness curve for different
monitors, similar to Mac OS X.
[akpm@osdl.org: add needed exports]
Signed-off-by: Michael Hanselmann <linux-kernel@hansmi.ch>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/video/chipsfb.c')
-rw-r--r-- | drivers/video/chipsfb.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/video/chipsfb.c b/drivers/video/chipsfb.c index 72ff6bf75e5e..d76bbfac92cc 100644 --- a/drivers/video/chipsfb.c +++ b/drivers/video/chipsfb.c | |||
@@ -148,9 +148,24 @@ static int chipsfb_set_par(struct fb_info *info) | |||
148 | static int chipsfb_blank(int blank, struct fb_info *info) | 148 | static int chipsfb_blank(int blank, struct fb_info *info) |
149 | { | 149 | { |
150 | #ifdef CONFIG_PMAC_BACKLIGHT | 150 | #ifdef CONFIG_PMAC_BACKLIGHT |
151 | // used to disable backlight only for blank > 1, but it seems | 151 | mutex_lock(&pmac_backlight_mutex); |
152 | // useful at blank = 1 too (saves battery, extends backlight life) | 152 | |
153 | set_backlight_enable(!blank); | 153 | if (pmac_backlight) { |
154 | down(&pmac_backlight->sem); | ||
155 | |||
156 | /* used to disable backlight only for blank > 1, but it seems | ||
157 | * useful at blank = 1 too (saves battery, extends backlight | ||
158 | * life) | ||
159 | */ | ||
160 | if (blank) | ||
161 | pmac_backlight->props->power = FB_BLANK_POWERDOWN; | ||
162 | else | ||
163 | pmac_backlight->props->power = FB_BLANK_UNBLANK; | ||
164 | pmac_backlight->props->update_status(pmac_backlight); | ||
165 | up(&pmac_backlight->sem); | ||
166 | } | ||
167 | |||
168 | mutex_unlock(&pmac_backlight_mutex); | ||
154 | #endif /* CONFIG_PMAC_BACKLIGHT */ | 169 | #endif /* CONFIG_PMAC_BACKLIGHT */ |
155 | 170 | ||
156 | return 1; /* get fb_blank to set the colormap to all black */ | 171 | return 1; /* get fb_blank to set the colormap to all black */ |
@@ -401,7 +416,14 @@ chipsfb_pci_init(struct pci_dev *dp, const struct pci_device_id *ent) | |||
401 | 416 | ||
402 | #ifdef CONFIG_PMAC_BACKLIGHT | 417 | #ifdef CONFIG_PMAC_BACKLIGHT |
403 | /* turn on the backlight */ | 418 | /* turn on the backlight */ |
404 | set_backlight_enable(1); | 419 | mutex_lock(&pmac_backlight_mutex); |
420 | if (pmac_backlight) { | ||
421 | down(&pmac_backlight->sem); | ||
422 | pmac_backlight->props->power = FB_BLANK_UNBLANK; | ||
423 | pmac_backlight->props->update_status(pmac_backlight); | ||
424 | up(&pmac_backlight->sem); | ||
425 | } | ||
426 | mutex_unlock(&pmac_backlight_mutex); | ||
405 | #endif /* CONFIG_PMAC_BACKLIGHT */ | 427 | #endif /* CONFIG_PMAC_BACKLIGHT */ |
406 | 428 | ||
407 | #ifdef CONFIG_PPC | 429 | #ifdef CONFIG_PPC |