diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 10:17:32 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-20 10:17:32 -0800 |
commit | a5527c6a586537c1af7ae6db30bb444ee4abdfe8 (patch) | |
tree | f0682de5c461c270f5f58b7304fd5ea5b5d6fb38 /drivers/video/backlight/corgi_bl.c | |
parent | 4afffe5eabc4005674a1ef4f4c96f1ae9f4a979b (diff) | |
parent | 8f27489d1105c2386e6ed71c35e74e0e69603cbc (diff) |
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-backlight:
backlight: Remove bogus SYSFS dependency
backlight: simplify corgi_bl locking
backlight: Separate backlight properties from backlight ops pointers
backlight: Clean up pmac_backlight handling
backlight: Improve backlight selection for fbdev drivers
backlight: Rework backlight/fb interaction simplifying, lots
backlight: Remove unneeded backlight update_status calls
backlight: Remove uneeded update_status call from chipsfb.c
backlight/fbcon: Add FB_EVENT_CONBLANK
backlight: Fix Kconfig entries
backlight: Remove uneeded nvidia set_power calls
backlight: Convert semaphore -> mutex
backlight: Fix external uses of backlight internal semaphore
backlight: Minor code cleanups for hp680_bl.c
backlight: Minor code cleanups for corgi_bl.c
backlight: Remove excessive (un)likelys
backlight: Remove unneeded owner field
backlight: Fix error handling
backlight: Add Frontpath ProGear HX1050+ driver
backlight: Add maintainer entry
Diffstat (limited to 'drivers/video/backlight/corgi_bl.c')
-rw-r--r-- | drivers/video/backlight/corgi_bl.c | 54 |
1 files changed, 26 insertions, 28 deletions
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c index fde1d9518123..ce00e18a4e5d 100644 --- a/drivers/video/backlight/corgi_bl.c +++ b/drivers/video/backlight/corgi_bl.c @@ -22,7 +22,6 @@ #include <asm/hardware/sharpsl_pm.h> static int corgibl_intensity; -static DEFINE_MUTEX(bl_mutex); static struct backlight_properties corgibl_data; static struct backlight_device *corgi_backlight_device; static struct corgibl_machinfo *bl_machinfo; @@ -34,20 +33,18 @@ static unsigned long corgibl_flags; static int corgibl_send_intensity(struct backlight_device *bd) { void (*corgi_kick_batt)(void); - int intensity = bd->props->brightness; + int intensity = bd->props.brightness; - if (bd->props->power != FB_BLANK_UNBLANK) + if (bd->props.power != FB_BLANK_UNBLANK) intensity = 0; - if (bd->props->fb_blank != FB_BLANK_UNBLANK) + if (bd->props.fb_blank != FB_BLANK_UNBLANK) intensity = 0; if (corgibl_flags & CORGIBL_SUSPENDED) intensity = 0; if (corgibl_flags & CORGIBL_BATTLOW) intensity &= bl_machinfo->limit_mask; - mutex_lock(&bl_mutex); bl_machinfo->set_bl_intensity(intensity); - mutex_unlock(&bl_mutex); corgibl_intensity = intensity; @@ -61,17 +58,21 @@ static int corgibl_send_intensity(struct backlight_device *bd) } #ifdef CONFIG_PM -static int corgibl_suspend(struct platform_device *dev, pm_message_t state) +static int corgibl_suspend(struct platform_device *pdev, pm_message_t state) { + struct backlight_device *bd = platform_get_drvdata(pdev); + corgibl_flags |= CORGIBL_SUSPENDED; - corgibl_send_intensity(corgi_backlight_device); + backlight_update_status(bd); return 0; } -static int corgibl_resume(struct platform_device *dev) +static int corgibl_resume(struct platform_device *pdev) { + struct backlight_device *bd = platform_get_drvdata(pdev); + corgibl_flags &= ~CORGIBL_SUSPENDED; - corgibl_send_intensity(corgi_backlight_device); + backlight_update_status(bd); return 0; } #else @@ -84,12 +85,6 @@ static int corgibl_get_intensity(struct backlight_device *bd) return corgibl_intensity; } -static int corgibl_set_intensity(struct backlight_device *bd) -{ - corgibl_send_intensity(corgi_backlight_device); - return 0; -} - /* * Called when the battery is low to limit the backlight intensity. * If limit==0 clear any limit, otherwise limit the intensity @@ -100,15 +95,14 @@ void corgibl_limit_intensity(int limit) corgibl_flags |= CORGIBL_BATTLOW; else corgibl_flags &= ~CORGIBL_BATTLOW; - corgibl_send_intensity(corgi_backlight_device); + backlight_update_status(corgi_backlight_device); } EXPORT_SYMBOL(corgibl_limit_intensity); -static struct backlight_properties corgibl_data = { - .owner = THIS_MODULE, +static struct backlight_ops corgibl_ops = { .get_brightness = corgibl_get_intensity, - .update_status = corgibl_set_intensity, + .update_status = corgibl_send_intensity, }; static int corgibl_probe(struct platform_device *pdev) @@ -116,30 +110,34 @@ static int corgibl_probe(struct platform_device *pdev) struct corgibl_machinfo *machinfo = pdev->dev.platform_data; bl_machinfo = machinfo; - corgibl_data.max_brightness = machinfo->max_intensity; if (!machinfo->limit_mask) machinfo->limit_mask = -1; corgi_backlight_device = backlight_device_register ("corgi-bl", - &pdev->dev, NULL, &corgibl_data); + &pdev->dev, NULL, &corgibl_ops); if (IS_ERR (corgi_backlight_device)) return PTR_ERR (corgi_backlight_device); - corgibl_data.power = FB_BLANK_UNBLANK; - corgibl_data.brightness = machinfo->default_intensity; - corgibl_send_intensity(corgi_backlight_device); + platform_set_drvdata(pdev, corgi_backlight_device); + + corgi_backlight_device->props.max_brightness = machinfo->max_intensity; + corgi_backlight_device->props.power = FB_BLANK_UNBLANK; + corgi_backlight_device->props.brightness = machinfo->default_intensity; + backlight_update_status(corgi_backlight_device); printk("Corgi Backlight Driver Initialized.\n"); return 0; } -static int corgibl_remove(struct platform_device *dev) +static int corgibl_remove(struct platform_device *pdev) { + struct backlight_device *bd = platform_get_drvdata(pdev); + corgibl_data.power = 0; corgibl_data.brightness = 0; - corgibl_send_intensity(corgi_backlight_device); + backlight_update_status(bd); - backlight_device_unregister(corgi_backlight_device); + backlight_device_unregister(bd); printk("Corgi Backlight Driver Unloaded\n"); return 0; |