mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 14:19:09 -04:00
wled: enable cabc before set brightness when adjust bl
As https://gerrit.mot.com/#/c/1743071/ do, if enable cabc after setting brightness when adjust brightness, may cause backlight flicker. So move cabc enable before setting brightness when adjust brightness. But still enable cabc after setting brihtness if phone screen on to avoid peak current. Change-Id: I625f6cdc8cd6c30e049c13994850932b9653dde9 Reviewed-on: https://gerrit.mot.com/1782873 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Yeqing Wang <wangyq13@motorola.com> Reviewed-by: Shanshan Dai <daiss1@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
633ebc419c
commit
8df86193da
1 changed files with 29 additions and 14 deletions
|
|
@ -566,17 +566,24 @@ static int wled_update_status(struct backlight_device *bl)
|
|||
brightness = 0;
|
||||
|
||||
mutex_lock(&wled->lock);
|
||||
|
||||
if (wled->low_bl_force_cabc_disable && brightness <= wled->low_bl_cfg.low_bl_threshold) {
|
||||
brightness = brightness * wled->low_bl_cfg.low_bl_remap_percent/100;
|
||||
if (!wled->cabc_disabled) {
|
||||
wled->cabc_config(wled, false);
|
||||
wled->cabc_disabled = true;
|
||||
pr_info("low brightness(%d), disable cabc\n", brightness);
|
||||
}
|
||||
}
|
||||
|
||||
if (brightness) {
|
||||
if (wled->low_bl_force_cabc_disable && wled->brightness) {
|
||||
if (brightness <= wled->low_bl_cfg.low_bl_threshold) {
|
||||
brightness = brightness * wled->low_bl_cfg.low_bl_remap_percent/100;
|
||||
if (!wled->cabc_disabled) {
|
||||
wled->cabc_config(wled, false);
|
||||
wled->cabc_disabled = true;
|
||||
pr_info("under low brightness(%d), will disable cabc\n", brightness);
|
||||
}
|
||||
|
||||
}
|
||||
else if ((wled->brightness < wled->low_bl_cfg.low_bl_threshold) && (wled->cabc_disabled)) {
|
||||
wled->cabc_disabled = false;
|
||||
wled->cabc_config(wled, true);
|
||||
pr_info("exit low brightness(%d), will enable cabc\n", brightness);
|
||||
}
|
||||
}
|
||||
|
||||
if (wled->bl_step_up_enable) {
|
||||
rc = wled_set_brightness_step(wled, brightness);
|
||||
if (rc < 0) {
|
||||
|
|
@ -590,12 +597,15 @@ static int wled_update_status(struct backlight_device *bl)
|
|||
goto unlock_mutex;
|
||||
}
|
||||
|
||||
if (wled->low_bl_force_cabc_disable && brightness > wled->low_bl_cfg.low_bl_threshold
|
||||
&& wled->brightness <= wled->low_bl_cfg.low_bl_threshold && wled->cabc_disabled) {
|
||||
msleep(wled->low_bl_cfg.low_bl_delay_ms);
|
||||
wled->cabc_disabled = false;
|
||||
wled->cabc_config(wled, true);
|
||||
pr_info("enable wled cabc\n");
|
||||
if (wled->cabc_disabled && wled->low_bl_force_cabc_disable && !wled->brightness) {
|
||||
if (brightness <= wled->low_bl_cfg.low_bl_threshold)
|
||||
pr_info("keep cabc disabled\n");
|
||||
else {
|
||||
msleep(wled->low_bl_cfg.low_bl_delay_ms);
|
||||
wled->cabc_disabled = false;
|
||||
wled->cabc_config(wled, true);
|
||||
pr_info("enable wled cabc\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (is_wled5(wled)) {
|
||||
|
|
@ -645,6 +655,11 @@ static int wled_update_status(struct backlight_device *bl)
|
|||
}
|
||||
}
|
||||
|
||||
if (!wled->cabc_disabled && wled->low_bl_force_cabc_disable) {
|
||||
wled->cabc_config(wled, false);
|
||||
wled->cabc_disabled = true;
|
||||
pr_info("disable wled cabc\n");
|
||||
}
|
||||
rc = wled_module_enable(wled, brightness);
|
||||
if (rc < 0) {
|
||||
pr_err("wled disable failed rc:%d\n", rc);
|
||||
|
|
|
|||
Loading…
Reference in a new issue