Skip to content

Commit

Permalink
drm: introduce hybrid DC dimming
Browse files Browse the repository at this point in the history
need to check Disable Hardware Overlays in developer options.

Signed-off-by: DevriesL <therkduan@gmail.com>
  • Loading branch information
DevriesL committed Oct 27, 2019
1 parent 1a2308f commit 3932208
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
8 changes: 8 additions & 0 deletions drivers/gpu/drm/msm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -204,3 +204,11 @@ config EXPOSURE_ADJUSTMENT
help
The EXPOSURE ADJUSTMENT provides exposure adjustment function without change
panel hardware brightness to avoid PWM flicker on OLED devices.

config HYBRID_DC_DIMMING
depends on DRM_MSM
depends on EXPOSURE_ADJUSTMENT
bool "FORCED HYBRID DC DIMMING"
default n
help
Forced dc dimming mode by hijack panel gamma and SDE.
9 changes: 9 additions & 0 deletions drivers/gpu/drm/msm/samsung/ss_dsi_panel_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ Copyright (C) 2015, Samsung Electronics. All rights reserved.
*/

#include "ss_dsi_panel_common.h"
#ifdef CONFIG_HYBRID_DC_DIMMING
#include "exposure_adjustment.h"
#endif

static void ss_panel_recovery(struct samsung_display_driver_data *vdd);
static void ss_event_osc_te_fitting(
Expand Down Expand Up @@ -4538,6 +4541,9 @@ int ss_brightness_dcs(struct samsung_display_driver_data *vdd, int level)
int need_lpm_lock = 0;
struct dsi_panel_cmd_set *brightness_cmds = NULL;
struct dsi_panel *panel = GET_DSI_PANEL(vdd);
#ifdef CONFIG_HYBRID_DC_DIMMING
struct dsi_display *display = GET_DSI_DISPLAY(vdd);
#endif

/* FC2 change: set panle mode in SurfaceFlinger initialization, instead of kenrel booting... */
if (!panel->cur_mode) {
Expand Down Expand Up @@ -4604,6 +4610,9 @@ int ss_brightness_dcs(struct samsung_display_driver_data *vdd, int level)
}

if (cmd_cnt) {
#ifdef CONFIG_HYBRID_DC_DIMMING
ea_panel_calc_backlight(display, vdd->br.cd_level);
#endif
/* setting tx cmds cmt */
brightness_cmds = ss_get_cmds(vdd, TX_BRIGHT_CTRL);
brightness_cmds->count = cmd_cnt;
Expand Down
12 changes: 11 additions & 1 deletion drivers/gpu/drm/msm/samsung/ss_interpolation_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,11 @@ static int find_normal_candela(struct samsung_display_driver_data *vdd)
if (index < 0) {
LCD_INFO("fail to find %d candela at normal.candela_table\n", candela);
}
#ifdef CONFIG_HYBRID_DC_DIMMING
if (index > GAMMA_VOLTAGE_THRESHOLD) {
index = GAMMA_VOLTAGE_THRESHOLD;
}
#endif

return index;
}
Expand Down Expand Up @@ -902,7 +907,12 @@ int br_interpolation_generate_event(struct samsung_display_driver_data *vdd, enu
memcpy(buf, vdd->panel_br_info.hmd.aor[candela_index], aor_size);
break;
case GEN_NORMAL_INTERPOLATION_AOR:
memcpy(buf, ss_itp->normal.br_aor_table[vdd->br.pac_cd_idx].aor_hex_string, aor_size);
#ifdef CONFIG_HYBRID_DC_DIMMING
if (vdd->br.pac_cd_idx < AOR_DISABLE_THRESHOLD)
memcpy(buf, ss_itp->normal.br_aor_table[AOR_DISABLE_THRESHOLD].aor_hex_string, aor_size);
else
#endif
memcpy(buf, ss_itp->normal.br_aor_table[vdd->br.pac_cd_idx].aor_hex_string, aor_size);
vdd->br.aor_data = ss_itp->normal.br_aor_table[vdd->br.pac_cd_idx].aor_percent_x10000 / 100;
break;
case GEN_HBM_INTERPOLATION_AOR:
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/msm/samsung/ss_interpolation_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ Copyright (C) 2012, Samsung Electronics. All rights reserved.

#define AOR_HEX_STRING_CNT (sizeof(unsigned int))

#define AOR_DISABLE_THRESHOLD 499
#define GAMMA_VOLTAGE_THRESHOLD 40

#define V255_START (1)
#define V0_VT_BYTE (3)

Expand Down

0 comments on commit 3932208

Please sign in to comment.