From f3939a0b6d9260b4415eb05c1ace2ac194708ea2 Mon Sep 17 00:00:00 2001 From: Robert Shih Date: Thu, 6 Nov 2014 13:08:11 +0800 Subject: [PATCH] Revert "Revert "dc: tegra: disable prism at low brightness"" This reverts commit 313c1675fe3c2cadef882d84590ab0bf82c4ca8b. bug 1536020 Change-Id: I0f4d1b4f92ed95155dd90a0970511a3fd7afc470 Signed-off-by: Robert Shih Reviewed-on: http://git-master/r/594717 GVS: Gerrit_Virtual_Submit Reviewed-by: Arun Swain Tested-by: Arun Swain Reviewed-by: Todd Poynter --- arch/arm/mach-tegra/panel-a-1200-1920-8-0.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-tegra/panel-a-1200-1920-8-0.c b/arch/arm/mach-tegra/panel-a-1200-1920-8-0.c index 5f18b2b64f3..d8782336d01 100644 --- a/arch/arm/mach-tegra/panel-a-1200-1920-8-0.c +++ b/arch/arm/mach-tegra/panel-a-1200-1920-8-0.c @@ -41,15 +41,20 @@ #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. */ + .enable_int = 0, /* disabled by default. */ .use_auto_pwm = false, .hw_update_delay = 0, .bin_width = -1, @@ -309,7 +314,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 +339,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 +535,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; -- 2.39.2