]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
dc: tegra: disable prism at low brightness
authorArun Swain <arswain@nvidia.com>
Sun, 2 Nov 2014 22:30:38 +0000 (14:30 -0800)
committerMitch Luban <mluban@nvidia.com>
Mon, 3 Nov 2014 06:59:49 +0000 (22:59 -0800)
Enable/disbale prism depending on the brightmess
value.

Bug 1536020

Change-Id: Idcd8f56f7d256a928f1c6e1988685cc37d20bb85
Signed-off-by: Arun Swain <arswain@nvidia.com>
Reviewed-on: http://git-master/r/592380
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Mitch Luban <mluban@nvidia.com>
arch/arm/mach-tegra/panel-a-1200-1920-8-0.c

index 6f176ce9cb03a2712baab11f38c5fc7fd059af9f..59e3e0177f88b93624ba27ebf080e0b82dce477e 100644 (file)
 #define DC_CTRL_MODE   (TEGRA_DC_OUT_CONTINUOUS_MODE  |\
                        TEGRA_DC_OUT_INITIALIZED_MODE)
 
+#define PRISM_THRESHOLD                50
+#define HYST_VAL               25
+
 static bool reg_requested;
 static bool gpio_requested;
 static struct platform_device *disp_device;
 static struct regulator *avdd_lcd_3v3;
 static struct regulator *vdd_lcd_bl_en;
 static struct regulator *dvdd_lcd_1v8;
+static struct device *dc_dev;
 
 static struct tegra_dc_sd_settings dsi_a_1200_1920_8_0_sd_settings = {
        .enable = 0, /* disabled by default. */
@@ -309,7 +313,7 @@ static int dsi_a_1200_1920_8_0_enable(struct device *dev)
                msleep(20);
        }
 #endif
-
+       dc_dev = dev;
        return 0;
 fail:
        return err;
@@ -334,6 +338,7 @@ static int dsi_a_1200_1920_8_0_disable(void)
        if (dvdd_lcd_1v8)
                regulator_disable(dvdd_lcd_1v8);
 
+       dc_dev = NULL;
        return 0;
 }
 
@@ -529,11 +534,17 @@ static struct tegra_dc_cmu dsi_a_1200_1920_8_0_cmu = {
 
 static int dsi_a_1200_1920_8_0_bl_notify(struct device *unused, int brightness)
 {
-       int cur_sd_brightness = atomic_read(&sd_brightness);
+       int cur_sd_brightness;
 
        /* apply the non-linear curve adjustment */
        brightness = dsi_a_1200_1920_8_0_bl_nonlinear[brightness];
-
+       if (dc_dev) {
+               if (brightness <= PRISM_THRESHOLD)
+                       nvsd_enbl_dsbl_prism(dc_dev, false);
+               else if (brightness > PRISM_THRESHOLD + HYST_VAL)
+                       nvsd_enbl_dsbl_prism(dc_dev, true);
+       }
+       cur_sd_brightness = atomic_read(&sd_brightness);
        /* SD brightness is a percentage */
        brightness = (brightness * cur_sd_brightness) / 255;