mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-14 08:36:12 -04:00
drm/dsi_panel: send specific demura command when bl change
dsi_panel: Send specific demura commands when brightness changes. This is panel IC limitation, it can't change demura parameters automatically when 51 reg value changes. MTK changes: https://gerrit.mot.com/#/c/2097095/ Change-Id: Ic5b6945e1eb7c905658dfe58e6dca18a0bfeb2e9 Signed-off-by: wangyq13 <wangyq13@lenovo.com> Reviewed-on: https://gerrit.mot.com/2152146 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Hua Tan <tanhua1@motorola.com> Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
cf526d3224
commit
1e339b7f38
3 changed files with 76 additions and 0 deletions
|
|
@ -275,6 +275,13 @@ enum dsi_dyn_clk_feature_type {
|
|||
* @DSI_CMD_SET_DFPS_CMD_60: DFPS switch to 60
|
||||
* @DSI_CMD_SET_DC_ON: DC mode on
|
||||
* @DSI_CMD_SET_DC_OFF: DC mode off
|
||||
* @DSI_CMD_SET_BRIGHTNESS_1E: Send demura codes when brightness changes to 0-1E
|
||||
* @DSI_CMD_SET_BRIGHTNESS_1FD: Send demura codes when brightness changes to 1F-1FD
|
||||
* @DSI_CMD_SET_BRIGHTNESS_2FF: Send demura codes when brightness changes to 1FE-2FF
|
||||
* @DSI_CMD_SET_BRIGHTNESS_3FF: Send demura codes when brightness changes to 300-3FF
|
||||
* @DSI_CMD_SET_BRIGHTNESS_4FF: Send demura codes when brightness changes to 400-4FF
|
||||
* @DSI_CMD_SET_BRIGHTNESS_5FF: Send demura codes when brightness changes to 500-5FF
|
||||
* @DSI_CMD_SET_BRIGHTNESS_FFF: Send demura codes when brightness changes to 600-FFF
|
||||
* @DSI_CMD_SET_MAX
|
||||
*/
|
||||
enum dsi_cmd_set_type {
|
||||
|
|
@ -314,6 +321,13 @@ enum dsi_cmd_set_type {
|
|||
DSI_CMD_SET_DFPS_CMD_60,
|
||||
DSI_CMD_SET_DC_ON,
|
||||
DSI_CMD_SET_DC_OFF,
|
||||
DSI_CMD_SET_BRIGHTNESS_1E,
|
||||
DSI_CMD_SET_BRIGHTNESS_1FD,
|
||||
DSI_CMD_SET_BRIGHTNESS_2FF,
|
||||
DSI_CMD_SET_BRIGHTNESS_3FF,
|
||||
DSI_CMD_SET_BRIGHTNESS_4FF,
|
||||
DSI_CMD_SET_BRIGHTNESS_5FF,
|
||||
DSI_CMD_SET_BRIGHTNESS_FFF,
|
||||
DSI_CMD_SET_MAX
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -695,11 +695,14 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
|
|||
struct mipi_dsi_device *dsi = NULL;
|
||||
struct dsi_backlight_config *bl = &panel->bl_config;
|
||||
u32 bl_lvl_2bytes;
|
||||
u32 bl_lvl_backup;
|
||||
enum dsi_cmd_set_type type;
|
||||
|
||||
if (!panel || (bl_lvl > 0xffff)) {
|
||||
DSI_ERR("invalid params\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
bl_lvl_backup = bl_lvl;
|
||||
|
||||
dsi = &panel->mipi_device;
|
||||
if (unlikely(panel->bl_config.lp_mode)) {
|
||||
|
|
@ -721,6 +724,43 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
|
|||
|
||||
if (unlikely(panel->bl_config.lp_mode))
|
||||
dsi->mode_flags = mode_flags;
|
||||
if (bl->bl_demura_cmd) {
|
||||
switch (bl_lvl_backup) {
|
||||
case 0x00 ... 0x1e:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_1E;
|
||||
break;
|
||||
case 0x1f ... 0x1fd:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_1FD;
|
||||
break;
|
||||
case 0x1fe ... 0x2ff:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_2FF;
|
||||
break;
|
||||
case 0x300 ... 0x3ff:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_3FF;
|
||||
break;
|
||||
case 0x400 ... 0x4ff:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_4FF;
|
||||
break;
|
||||
case 0x500 ... 0x5ff:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_5FF;
|
||||
break;
|
||||
case 0x600 ... 0xfff:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_FFF;
|
||||
break;
|
||||
default:
|
||||
type = DSI_CMD_SET_BRIGHTNESS_1E;
|
||||
break;
|
||||
}
|
||||
if (bl->demura_type != type) {
|
||||
DSI_INFO("update dcs backlight:0x%x, demura_type %d, type %d\n", bl_lvl_backup, bl->demura_type, type);
|
||||
rc = dsi_panel_tx_cmd_set(panel, type);
|
||||
if (rc)
|
||||
DSI_ERR("[%s] failed to send DSI_CMD_SET_BRIGHTNESS cmds, rc=%d\n",
|
||||
panel->name, rc);
|
||||
else
|
||||
bl->demura_type = type;
|
||||
}
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
|
@ -2265,6 +2305,13 @@ const char *cmd_set_prop_map[DSI_CMD_SET_MAX] = {
|
|||
"qcom,mdss-dsi-dfps-60-command",
|
||||
"qcom,mdss-dsi-dc-on-command",
|
||||
"qcom,mdss-dsi-dc-off-command",
|
||||
"qcom,mdss-dsi-brightness-1e-command",
|
||||
"qcom,mdss-dsi-brightness-1fd-command",
|
||||
"qcom,mdss-dsi-brightness-2ff-command",
|
||||
"qcom,mdss-dsi-brightness-3ff-command",
|
||||
"qcom,mdss-dsi-brightness-4ff-command",
|
||||
"qcom,mdss-dsi-brightness-5ff-command",
|
||||
"qcom,mdss-dsi-brightness-fff-command",
|
||||
};
|
||||
|
||||
const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
|
||||
|
|
@ -2304,6 +2351,13 @@ const char *cmd_set_state_map[DSI_CMD_SET_MAX] = {
|
|||
"qcom,mdss-dsi-dfps-60-command-state",
|
||||
"qcom,mdss-dsi-dc-on-command-state",
|
||||
"qcom,mdss-dsi-dc-off-command-state",
|
||||
"qcom,mdss-dsi-brightness-1e-command-state",
|
||||
"qcom,mdss-dsi-brightness-1fd-command-state",
|
||||
"qcom,mdss-dsi-brightness-2ff-command-state",
|
||||
"qcom,mdss-dsi-brightness-3ff-command-state",
|
||||
"qcom,mdss-dsi-brightness-4ff-command-state",
|
||||
"qcom,mdss-dsi-brightness-5ff-command-state",
|
||||
"qcom,mdss-dsi-brightness-fff-command-state",
|
||||
};
|
||||
|
||||
int dsi_panel_get_cmd_pkt_count(const char *data, u32 length, u32 *cnt)
|
||||
|
|
@ -3012,6 +3066,12 @@ static int dsi_panel_parse_bl_config(struct dsi_panel *panel)
|
|||
DSI_INFO("[%s] bl_2bytes_enable=%d\n", panel->name,
|
||||
panel->bl_config.bl_2bytes_enable);
|
||||
|
||||
panel->bl_config.bl_demura_cmd= utils->read_bool(utils->data,
|
||||
"qcom,brightness-demura-command");
|
||||
|
||||
DSI_INFO("[%s] bl_demura_cmd=%d\n", panel->name,
|
||||
panel->bl_config.bl_demura_cmd);
|
||||
|
||||
if (panel->bl_config.type == DSI_BACKLIGHT_PWM) {
|
||||
rc = dsi_panel_parse_bl_pwm_config(panel);
|
||||
if (rc) {
|
||||
|
|
|
|||
|
|
@ -162,6 +162,8 @@ struct dsi_backlight_config {
|
|||
u32 bl_scale;
|
||||
u32 bl_scale_sv;
|
||||
bool bl_inverted_dbv;
|
||||
bool bl_demura_cmd;
|
||||
u32 demura_type;
|
||||
|
||||
int en_gpio;
|
||||
/* PWM params */
|
||||
|
|
|
|||
Loading…
Reference in a new issue