From f949dfa7db39a84572b2baf1c88b0a5eba90d06b Mon Sep 17 00:00:00 2001 From: Ke Ai Date: Wed, 2 May 2012 15:02:36 +0800 Subject: [PATCH] CTP-Display: fix brightness can not change smooth BZ: 29596 we set the PWM_CLK and PWM_PERIOD correctly. test, it works well. Change-Id: Ia2032413904a8f330ffae7b6cc531a547883e60a Signed-off-by: Ke Ai Reviewed-on: http://android.intel.com:8080/46952 Reviewed-by: Tong, BoX Tested-by: Tong, BoX Reviewed-by: buildbot Tested-by: buildbot --- drivers/staging/mrst/drv/h8c7_cmd.c | 16 ++++++---------- drivers/staging/mrst/drv/h8c7_vid.c | 15 ++++++--------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/drivers/staging/mrst/drv/h8c7_cmd.c b/drivers/staging/mrst/drv/h8c7_cmd.c index b5c3174..0875272 100644 --- a/drivers/staging/mrst/drv/h8c7_cmd.c +++ b/drivers/staging/mrst/drv/h8c7_cmd.c @@ -69,6 +69,7 @@ static u32 h8c7_gamma_g[] = {0x3d3e3be1, 0x33323131, 0x0b070346, 0x110e100d, 0x3e3b1710, 0x3231313d, 0x07034633, 0x0e100d0b, 0x00171011}; static u32 h8c7_gamma_b[] = {0x070601e2, 0x1f322a2d, 0x0e0c0540, 0x13121411, 0x0601180f, 0x322a2d07, 0x0c05401f, 0x1214110e, 0x00180f13}; +static u32 h8c7_enter_set_cabc[] = {0x1e001fc9, 0x0000001e, 0x00003e01}; static u32 h8c7_mcs_clumn_addr[] = {0x0200002a,0xcf}; static u32 h8c7_mcs_page_addr[] = {0x0400002b,0xff}; @@ -222,6 +223,11 @@ static void mdfld_h8c7_dci_ic_init(struct mdfld_dsi_config *dsi_config, int pipe while (time_before_eq(jiffies, wait_timeout)) cpu_relax(); + mdfld_dsi_send_mcs_long_lp(sender, h8c7_enter_set_cabc, 10, 0); + wait_timeout = jiffies + (HZ / 100); + while (time_before_eq(jiffies, wait_timeout)) + cpu_relax(); + mdfld_dsi_send_gen_long_lp(sender, h8c7_mcs_protect_on, 4, 0); wait_timeout = jiffies + (HZ / 100); while (time_before_eq(jiffies, wait_timeout)) @@ -1126,16 +1132,6 @@ int mdfld_dsi_h8c7_cmd_set_brightness(struct mdfld_dsi_config *dsi_config, int duty_val = 0; unsigned long wait_timeout; - /* - * FIXME: need to check the CABA setting about brightness adjustment - * range. - */ - - if (level < MIN_BRIGHTNESS_LEVEL || level > MAX_BRIGHTNESS_LEVEL) { - printk(KERN_ALERT"Invalid brightness level: %d\n", level); - return -EINVAL; - } - if (!sender) { DRM_ERROR("Failed to get DSI packet sender\n"); return -EINVAL; diff --git a/drivers/staging/mrst/drv/h8c7_vid.c b/drivers/staging/mrst/drv/h8c7_vid.c index 4ceba9b..96e490b 100644 --- a/drivers/staging/mrst/drv/h8c7_vid.c +++ b/drivers/staging/mrst/drv/h8c7_vid.c @@ -66,6 +66,7 @@ static u32 h8c7_gamma_g[] = {0x3d3e3be1, 0x33323131, 0x0b070346, 0x110e100d, 0x3e3b1710, 0x3231313d, 0x07034633, 0x0e100d0b, 0x00171011}; static u32 h8c7_gamma_b[] = {0x070601e2, 0x1f322a2d, 0x0e0c0540, 0x13121411, 0x0601180f, 0x322a2d07, 0x0c05401f, 0x1214110e, 0x00180f13}; +static u32 h8c7_enter_set_cabc[] = {0x1e001fc9, 0x0000001e, 0x00003e01}; static u32 h8c7_mcs_protect_on[] = {0x000000b9}; static u32 h8c7_set_address_mode[] = {0x00000036}; @@ -201,6 +202,11 @@ static void mdfld_h8c7_dpi_ic_init(struct mdfld_dsi_config *dsi_config, int pipe while (time_before_eq(jiffies, wait_timeout)) cpu_relax(); + mdfld_dsi_send_mcs_long_lp(sender, h8c7_enter_set_cabc, 10, 0); + wait_timeout = jiffies + (HZ / 100); + while (time_before_eq(jiffies, wait_timeout)) + cpu_relax(); + /* disable password and wait for 10ms. */ mdfld_dsi_send_gen_long_lp(sender, h8c7_mcs_protect_on, 4, 0); wait_timeout = jiffies + (HZ / 100); @@ -435,15 +441,6 @@ int mdfld_dsi_h8c7_set_brightness(struct mdfld_dsi_config *dsi_config, int duty_val = 0; unsigned long wait_timeout; - /* - * FIXME: need to check the CABA setting about brightness adjustment - * range. - */ - if (level < MIN_BRIGHTNESS_LEVEL || level > MAX_BRIGHTNESS_LEVEL) { - PSB_DEBUG_ENTRY("Invalid brightness level: %d\n", level); - return -EINVAL; - } - if (!sender) { DRM_ERROR("Failed to get DSI packet sender\n"); return -EINVAL; -- 2.7.4