Pull platform-drivers into test branch
[powerpc.git] / drivers / video / aty / aty128fb.c
index 3e827e0..2e976ff 100644 (file)
@@ -1333,6 +1333,8 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
        if (vclk * 12 < c.ppll_min)
                vclk = c.ppll_min/12;
 
+       pll->post_divider = -1;
+
        /* now, find an acceptable divider */
        for (i = 0; i < sizeof(post_dividers); i++) {
                output_freq = post_dividers[i] * vclk;
@@ -1342,6 +1344,9 @@ static int aty128_var_to_pll(u32 period_in_ps, struct aty128_pll *pll,
                }
        }
 
+       if (pll->post_divider < 0)
+               return -EINVAL;
+
        /* calculate feedback divider */
        n = c.ref_divider * output_freq;
        d = c.ref_clk;
@@ -1801,10 +1806,14 @@ static struct backlight_properties aty128_bl_data = {
 static void aty128_bl_set_power(struct fb_info *info, int power)
 {
        mutex_lock(&info->bl_mutex);
-       up(&info->bl_dev->sem);
-       info->bl_dev->props->power = power;
-       __aty128_bl_update_status(info->bl_dev);
-       down(&info->bl_dev->sem);
+
+       if (info->bl_dev) {
+               down(&info->bl_dev->sem);
+               info->bl_dev->props->power = power;
+               __aty128_bl_update_status(info->bl_dev);
+               up(&info->bl_dev->sem);
+       }
+
        mutex_unlock(&info->bl_mutex);
 }
 
@@ -1825,10 +1834,10 @@ static void aty128_bl_init(struct aty128fb_par *par)
 
        snprintf(name, sizeof(name), "aty128bl%d", info->node);
 
-       bd = backlight_device_register(name, par, &aty128_bl_data);
+       bd = backlight_device_register(name, info->dev, par, &aty128_bl_data);
        if (IS_ERR(bd)) {
                info->bl_dev = NULL;
-               printk("aty128: Backlight registration failed\n");
+               printk(KERN_WARNING "aty128: Backlight registration failed\n");
                goto error;
        }
 
@@ -1839,11 +1848,11 @@ static void aty128_bl_init(struct aty128fb_par *par)
                219 * FB_BACKLIGHT_MAX / MAX_LEVEL);
        mutex_unlock(&info->bl_mutex);
 
-       up(&bd->sem);
+       down(&bd->sem);
        bd->props->brightness = aty128_bl_data.max_brightness;
        bd->props->power = FB_BLANK_UNBLANK;
        bd->props->update_status(bd);
-       down(&bd->sem);
+       up(&bd->sem);
 
 #ifdef CONFIG_PMAC_BACKLIGHT
        mutex_lock(&pmac_backlight_mutex);