Skip to content

Commit a557d6a

Browse files
committed
drm: msm: dsi-staging: hijack 60hz backlight control for 90hz
This is a hack with vibe contribution from chatgpt. We are defining 90hz's blacklight control to just redirect to 60hz's as we have noticed does not have the issue of werid green tint when hjacking 120hz's bc. This fixes the twitching and sudden brightness increase when switching refresh rate to 90hz from 120hz. It DOES NOT fix the werid colouring. Depends on Xiaomi's drm changes. Signed-off-by: Yahya Wessam <yahyawessam2002@gmail.com>
1 parent e4a1f35 commit a557d6a

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

drivers/gpu/drm/msm/dsi-staging/dsi_defs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ enum dsi_cmd_set_type {
316316
DSI_CMD_SET_DISP_DC_CRC_SETTING_60HZ,
317317
DSI_CMD_SET_DISP_DC_CRC_SETTING_120HZ,
318318
DSI_CMD_SET_DISP_BC_120HZ,
319+
DSI_CMD_SET_DISP_BC_90HZ,
319320
DSI_CMD_SET_DISP_BC_60HZ,
320321
DSI_CMD_SET_DOZE_HBM,
321322
DSI_CMD_SET_DOZE_LBM,

drivers/gpu/drm/msm/dsi-staging/dsi_display.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ void dsi_display_panel_gamma_mode_change(struct dsi_display *display,
9494

9595
if (adj_mode->timing.refresh_rate == 120)
9696
rc = panel_disp_param_send_lock(display->panel, DISPPARAM_BC_120HZ);
97+
else if (adj_mode->timing.refresh_rate == 90)
98+
rc = panel_disp_param_send_lock(display->panel, DISPPARAM_BC_90HZ);
9799
else if (adj_mode->timing.refresh_rate == 60)
98100
rc = panel_disp_param_send_lock(display->panel, DISPPARAM_BC_60HZ);
99101

@@ -7119,7 +7121,7 @@ int dsi_display_set_mode(struct dsi_display *display,
71197121
goto error;
71207122
}
71217123

7122-
if (adj_mode.timing.refresh_rate == 60)
7124+
if (adj_mode.timing.refresh_rate == 60 || adj_mode.timing.refresh_rate == 90)
71237125
dsi_display_panel_gamma_mode_change(display, &adj_mode);
71247126

71257127
if (!display->panel->cur_mode) {

drivers/gpu/drm/msm/dsi-staging/dsi_panel.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,6 +2010,7 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = {
20102010
"qcom,mdss-dsi-dispparam-60hz-dc-crc-setting-command",
20112011
"qcom,mdss-dsi-dispparam-120hz-dc-crc-setting-command",
20122012
"qcom,mdss-dsi-dispparam-bc-120hz-command",
2013+
"qcom,mdss-dsi-dispparam-bc-90hz-command",
20132014
"qcom,mdss-dsi-dispparam-bc-60hz-command",
20142015
"qcom,mdss-dsi-doze-hbm-command",
20152016
"qcom,mdss-dsi-doze-lbm-command",
@@ -2048,6 +2049,7 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
20482049
"qcom,mdss-dsi-dispparam-60hz-dc-crc-setting-command-state",
20492050
"qcom,mdss-dsi-dispparam-120hz-dc-crc-setting-command-state",
20502051
"qcom,mdss-dsi-dispparam-bc-120hz-command-state",
2052+
"qcom,mdss-dsi-dispparam-bc-90hz-command-state",
20512053
"qcom,mdss-dsi-dispparam-bc-60hz-command-state",
20522054
"qcom,mdss-dsi-doze-hbm-command-state",
20532055
"qcom,mdss-dsi-doze-lbm-command-state",
@@ -4848,14 +4850,20 @@ int panel_disp_param_send_lock(struct dsi_panel *panel, int param)
48484850
pr_info("BC 120hz\n");
48494851
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_BC_120HZ);
48504852
break;
4851-
case DISPPARAM_BC_60HZ:
4852-
pr_info("BC 60hz\n");
4853-
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_BC_60HZ);
4854-
break;
48554853
default:
48564854
break;
48574855
}
48584856

4857+
temp = param & 0x000F0000;
4858+
if (temp == DISPPARAM_BC_60HZ) {
4859+
pr_info("BC 60hz\n");
4860+
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_BC_60HZ);
4861+
} else if (temp == DISPPARAM_BC_90HZ) {
4862+
pr_info("BC 90hz\n");
4863+
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_BC_90HZ);
4864+
} else {
4865+
}
4866+
48594867
temp = param & 0x00F00000;
48604868
switch (temp) {
48614869
case DISPPARAM_DOZE_BRIGHTNESS_HBM:

drivers/gpu/drm/msm/dsi-staging/dsi_panel_mi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ enum DISPPARAM_MODE {
3030
DISPPARAM_DC_ON = 0x40000,
3131
DISPPARAM_DC_OFF = 0x50000,
3232
DISPPARAM_BC_120HZ = 0x60000,
33+
DISPPARAM_BC_90HZ = 0x70000,
3334
DISPPARAM_BC_60HZ = 0x70000,
3435
DISPPARAM_HBM_OFF = 0xF0000,
3536
DISPPARAM_DOZE_BRIGHTNESS_HBM = 0x600000,

0 commit comments

Comments
 (0)