]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/video/aty/radeon_backlight.c
radeonfb: accelerate imageblit and other improvements
[linux-2.6-omap-h63xx.git] / drivers / video / aty / radeon_backlight.c
index 3abfd4a380cc22c229520d3eaba7d728c0330001..f343ba83f0ae0dbb6e50d25aa8ea95239598b1fd 100644 (file)
@@ -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)
@@ -53,7 +47,7 @@ static int radeon_bl_get_level_brightness(struct radeon_bl_privdata *pdata,
 
 static int radeon_bl_update_status(struct backlight_device *bd)
 {
-       struct radeon_bl_privdata *pdata = class_get_devdata(&bd->class_dev);
+       struct radeon_bl_privdata *pdata = bl_get_data(bd);
        struct radeonfb_info *rinfo = pdata->rinfo;
        u32 lvds_gen_cntl, tmpPixclksCntl;
        int level;
@@ -65,14 +59,14 @@ 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();
+       radeon_engine_idle(rinfo);
 
        lvds_gen_cntl = INREG(LVDS_GEN_CNTL);
        if (level > 0) {
@@ -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 = bl_get_data(bd);
+               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
 }