summaryrefslogtreecommitdiffstats
path: root/drivers/video/aty/radeon_backlight.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/video/aty/radeon_backlight.c')
-rw-r--r--drivers/video/aty/radeon_backlight.c59
1 files changed, 14 insertions, 45 deletions
diff --git a/drivers/video/aty/radeon_backlight.c b/drivers/video/aty/radeon_backlight.c
index 3abfd4a380c..0be25fa5540 100644
--- a/drivers/video/aty/radeon_backlight.c
+++ b/drivers/video/aty/radeon_backlight.c
@@ -19,8 +19,6 @@
#define MAX_RADEON_LEVEL 0xFF
-static struct backlight_properties radeon_bl_data;
-
struct radeon_bl_privdata {
struct radeonfb_info *rinfo;
uint8_t negative;
@@ -29,17 +27,13 @@ struct radeon_bl_privdata {
static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata,
int level)
{
- struct fb_info *info = pdata->rinfo->info;
int rlevel;
- mutex_lock(&info->bl_mutex);
-
/* Get and convert the value */
+ /* No locking of bl_curve since we read a single value */
rlevel = pdata->rinfo->info->bl_curve[level] *
FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL;
- mutex_unlock(&info->bl_mutex);
-
if (rlevel < 0)
rlevel = 0;
else if (rlevel > MAX_RADEON_LEVEL)
@@ -65,11 +59,11 @@ static int radeon_bl_update_status(struct backlight_device *bd)
* backlight. This provides some greater power saving and the display
* is useless without backlight anyway.
*/
- if (bd->props->power != FB_BLANK_UNBLANK ||
- bd->props->fb_blank != FB_BLANK_UNBLANK)
+ if (bd->props.power != FB_BLANK_UNBLANK ||
+ bd->props.fb_blank != FB_BLANK_UNBLANK)
level = 0;
else
- level = bd->props->brightness;
+ level = bd->props.brightness;
del_timer_sync(&rinfo->lvds_timer);
radeon_engine_idle();
@@ -130,14 +124,12 @@ static int radeon_bl_update_status(struct backlight_device *bd)
static int radeon_bl_get_brightness(struct backlight_device *bd)
{
- return bd->props->brightness;
+ return bd->props.brightness;
}
-static struct backlight_properties radeon_bl_data = {
- .owner = THIS_MODULE,
+static struct backlight_ops radeon_bl_data = {
.get_brightness = radeon_bl_get_brightness,
.update_status = radeon_bl_update_status,
- .max_brightness = (FB_BACKLIGHT_LEVELS - 1),
};
void radeonfb_bl_init(struct radeonfb_info *rinfo)
@@ -188,25 +180,15 @@ void radeonfb_bl_init(struct radeonfb_info *rinfo)
machine_is_compatible("PowerBook6,5");
#endif
- mutex_lock(&rinfo->info->bl_mutex);
rinfo->info->bl_dev = bd;
fb_bl_default_curve(rinfo->info, 0,
63 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL,
217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL);
- mutex_unlock(&rinfo->info->bl_mutex);
- down(&bd->sem);
- bd->props->brightness = radeon_bl_data.max_brightness;
- bd->props->power = FB_BLANK_UNBLANK;
- bd->props->update_status(bd);
- up(&bd->sem);
-
-#ifdef CONFIG_PMAC_BACKLIGHT
- mutex_lock(&pmac_backlight_mutex);
- if (!pmac_backlight)
- pmac_backlight = bd;
- mutex_unlock(&pmac_backlight_mutex);
-#endif
+ bd->props.max_brightness = FB_BACKLIGHT_LEVELS - 1;
+ bd->props.brightness = bd->props.max_brightness;
+ bd->props.power = FB_BLANK_UNBLANK;
+ backlight_update_status(bd);
printk("radeonfb: Backlight initialized (%s)\n", name);
@@ -219,29 +201,16 @@ error:
void radeonfb_bl_exit(struct radeonfb_info *rinfo)
{
-#ifdef CONFIG_PMAC_BACKLIGHT
- mutex_lock(&pmac_backlight_mutex);
-#endif
+ struct backlight_device *bd = rinfo->info->bl_dev;
- mutex_lock(&rinfo->info->bl_mutex);
- if (rinfo->info->bl_dev) {
+ if (bd) {
struct radeon_bl_privdata *pdata;
-#ifdef CONFIG_PMAC_BACKLIGHT
- if (pmac_backlight == rinfo->info->bl_dev)
- pmac_backlight = NULL;
-#endif
-
- pdata = class_get_devdata(&rinfo->info->bl_dev->class_dev);
- backlight_device_unregister(rinfo->info->bl_dev);
+ pdata = class_get_devdata(&bd->class_dev);
+ backlight_device_unregister(bd);
kfree(pdata);
rinfo->info->bl_dev = NULL;
printk("radeonfb: Backlight unloaded\n");
}
- mutex_unlock(&rinfo->info->bl_mutex);
-
-#ifdef CONFIG_PMAC_BACKLIGHT
- mutex_unlock(&pmac_backlight_mutex);
-#endif
}