]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
1. current implementation tests wrong value for setting aat2870_bl->max_current.
authorAxel Lin <axel.lin@gmail.com>
Tue, 26 Jul 2011 10:14:45 +0000 (20:14 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Tue, 2 Aug 2011 05:14:20 +0000 (15:14 +1000)
2. In current implementation, we cannot differentiate below 2 cases:
       a) if pdata->max_current is not set , or
       b) pdata->max_current is set to AAT2870_CURRENT_0_45 ( which is also 0 ).
   fix it by setting AAT2870_CURRENT_0_45 to be 1 and adjust the equation
   in aat2870_brightness() accordingly.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Tested-by: Jin Park <jinyoungp@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/video/backlight/aat2870_bl.c
include/linux/mfd/aat2870.h

index f13a3f7e2e8fc251c8d598a4033f8439972ae031..331f1ef1dad5c87984c813d465c06b84733896a8 100644 (file)
@@ -44,7 +44,7 @@ static inline int aat2870_brightness(struct aat2870_bl_driver_data *aat2870_bl,
        struct backlight_device *bd = aat2870_bl->bd;
        int val;
 
-       val = brightness * aat2870_bl->max_current;
+       val = brightness * (aat2870_bl->max_current - 1);
        val /= bd->props.max_brightness;
 
        return val;
@@ -175,7 +175,7 @@ static int aat2870_bl_probe(struct platform_device *pdev)
        else
                aat2870_bl->channels = AAT2870_BL_CH_ALL;
 
-       if (pdata->max_brightness > 0)
+       if (pdata->max_current > 0)
                aat2870_bl->max_current = pdata->max_current;
        else
                aat2870_bl->max_current = AAT2870_CURRENT_27_9;
index 89212df05622193a801452195953e770a18c90a9..f7316c29bdec6a06f1e57890ed42efef5be7a443 100644 (file)
@@ -89,7 +89,7 @@ enum aat2870_id {
 
 /* Backlight current magnitude (mA) */
 enum aat2870_current {
-       AAT2870_CURRENT_0_45,
+       AAT2870_CURRENT_0_45 = 1,
        AAT2870_CURRENT_0_90,
        AAT2870_CURRENT_1_80,
        AAT2870_CURRENT_2_70,