Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Pass pwrseq inst for backlight and ABM

[Why]
OTG inst and pwrseq inst mapping is not align therefore we cannot use
otg_inst as pwrseq inst to get DCIO register.

[How]
1. Pass the correct pwrseq instance to dmub when set abm pipe.
2. LVTMA control index change from panel_inst to pwrseq_inst.

Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Reviewed-by: Phil Hsieh <phil.hsieh@amd.com>
Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Signed-off-by: Lewis Huang <lewis.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Lewis Huang and committed by
Alex Deucher
b17ef04b 62fbfdbb

+119 -53
+2 -2
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
··· 1691 1691 static enum bp_result bios_parser_enable_lvtma_control( 1692 1692 struct dc_bios *dcb, 1693 1693 uint8_t uc_pwr_on, 1694 - uint8_t panel_instance, 1694 + uint8_t pwrseq_instance, 1695 1695 uint8_t bypass_panel_control_wait) 1696 1696 { 1697 1697 struct bios_parser *bp = BP_FROM_DCB(dcb); ··· 1699 1699 if (!bp->cmd_tbl.enable_lvtma_control) 1700 1700 return BP_RESULT_FAILURE; 1701 1701 1702 - return bp->cmd_tbl.enable_lvtma_control(bp, uc_pwr_on, panel_instance, bypass_panel_control_wait); 1702 + return bp->cmd_tbl.enable_lvtma_control(bp, uc_pwr_on, pwrseq_instance, bypass_panel_control_wait); 1703 1703 } 1704 1704 1705 1705 static bool bios_parser_is_accelerated_mode(
+6 -6
drivers/gpu/drm/amd/display/dc/bios/command_table2.c
··· 976 976 static enum bp_result enable_lvtma_control( 977 977 struct bios_parser *bp, 978 978 uint8_t uc_pwr_on, 979 - uint8_t panel_instance, 979 + uint8_t pwrseq_instance, 980 980 uint8_t bypass_panel_control_wait); 981 981 982 982 static void init_enable_lvtma_control(struct bios_parser *bp) ··· 989 989 static void enable_lvtma_control_dmcub( 990 990 struct dc_dmub_srv *dmcub, 991 991 uint8_t uc_pwr_on, 992 - uint8_t panel_instance, 992 + uint8_t pwrseq_instance, 993 993 uint8_t bypass_panel_control_wait) 994 994 { 995 995 ··· 1002 1002 DMUB_CMD__VBIOS_LVTMA_CONTROL; 1003 1003 cmd.lvtma_control.data.uc_pwr_action = 1004 1004 uc_pwr_on; 1005 - cmd.lvtma_control.data.panel_inst = 1006 - panel_instance; 1005 + cmd.lvtma_control.data.pwrseq_inst = 1006 + pwrseq_instance; 1007 1007 cmd.lvtma_control.data.bypass_panel_control_wait = 1008 1008 bypass_panel_control_wait; 1009 1009 dm_execute_dmub_cmd(dmcub->ctx, &cmd, DM_DMUB_WAIT_TYPE_WAIT); ··· 1012 1012 static enum bp_result enable_lvtma_control( 1013 1013 struct bios_parser *bp, 1014 1014 uint8_t uc_pwr_on, 1015 - uint8_t panel_instance, 1015 + uint8_t pwrseq_instance, 1016 1016 uint8_t bypass_panel_control_wait) 1017 1017 { 1018 1018 enum bp_result result = BP_RESULT_FAILURE; ··· 1021 1021 bp->base.ctx->dc->debug.dmub_command_table) { 1022 1022 enable_lvtma_control_dmcub(bp->base.ctx->dmub_srv, 1023 1023 uc_pwr_on, 1024 - panel_instance, 1024 + pwrseq_instance, 1025 1025 bypass_panel_control_wait); 1026 1026 return BP_RESULT_OK; 1027 1027 }
+1 -1
drivers/gpu/drm/amd/display/dc/bios/command_table2.h
··· 96 96 struct bios_parser *bp, uint8_t id); 97 97 enum bp_result (*enable_lvtma_control)(struct bios_parser *bp, 98 98 uint8_t uc_pwr_on, 99 - uint8_t panel_instance, 99 + uint8_t pwrseq_instance, 100 100 uint8_t bypass_panel_control_wait); 101 101 }; 102 102
+1 -1
drivers/gpu/drm/amd/display/dc/dc_bios_types.h
··· 140 140 enum bp_result (*enable_lvtma_control)( 141 141 struct dc_bios *bios, 142 142 uint8_t uc_pwr_on, 143 - uint8_t panel_instance, 143 + uint8_t pwrseq_instance, 144 144 uint8_t bypass_panel_control_wait); 145 145 146 146 enum bp_result (*get_soc_bb_info)(
+6 -2
drivers/gpu/drm/amd/display/dc/dce/dmub_abm.c
··· 145 145 return ret; 146 146 } 147 147 148 - static bool dmub_abm_set_pipe_ex(struct abm *abm, uint32_t otg_inst, uint32_t option, uint32_t panel_inst) 148 + static bool dmub_abm_set_pipe_ex(struct abm *abm, 149 + uint32_t otg_inst, 150 + uint32_t option, 151 + uint32_t panel_inst, 152 + uint32_t pwrseq_inst) 149 153 { 150 154 bool ret = false; 151 155 unsigned int feature_support; ··· 157 153 feature_support = abm_feature_support(abm, panel_inst); 158 154 159 155 if (feature_support == ABM_LCD_SUPPORT) 160 - ret = dmub_abm_set_pipe(abm, otg_inst, option, panel_inst); 156 + ret = dmub_abm_set_pipe(abm, otg_inst, option, panel_inst, pwrseq_inst); 161 157 162 158 return ret; 163 159 }
+6 -1
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c
··· 254 254 return true; 255 255 } 256 256 257 - bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst, uint32_t option, uint32_t panel_inst) 257 + bool dmub_abm_set_pipe(struct abm *abm, 258 + uint32_t otg_inst, 259 + uint32_t option, 260 + uint32_t panel_inst, 261 + uint32_t pwrseq_inst) 258 262 { 259 263 union dmub_rb_cmd cmd; 260 264 struct dc_context *dc = abm->ctx; ··· 268 264 cmd.abm_set_pipe.header.type = DMUB_CMD__ABM; 269 265 cmd.abm_set_pipe.header.sub_type = DMUB_CMD__ABM_SET_PIPE; 270 266 cmd.abm_set_pipe.abm_set_pipe_data.otg_inst = otg_inst; 267 + cmd.abm_set_pipe.abm_set_pipe_data.pwrseq_inst = pwrseq_inst; 271 268 cmd.abm_set_pipe.abm_set_pipe_data.set_pipe_option = option; 272 269 cmd.abm_set_pipe.abm_set_pipe_data.panel_inst = panel_inst; 273 270 cmd.abm_set_pipe.abm_set_pipe_data.ramping_boundary = ramping_boundary;
+1 -1
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h
··· 44 44 struct dc_context *dc, 45 45 unsigned int panel_inst, 46 46 struct abm_save_restore *pData); 47 - bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst, uint32_t option, uint32_t panel_inst); 47 + bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst, uint32_t option, uint32_t panel_inst, uint32_t pwrseq_inst); 48 48 bool dmub_abm_set_backlight_level(struct abm *abm, 49 49 unsigned int backlight_pwm_u16_16, 50 50 unsigned int frame_ramp,
+3 -2
drivers/gpu/drm/amd/display/dc/dcn31/dcn31_panel_cntl.c
··· 50 50 cmd->panel_cntl.header.type = DMUB_CMD__PANEL_CNTL; 51 51 cmd->panel_cntl.header.sub_type = DMUB_CMD__PANEL_CNTL_QUERY_BACKLIGHT_INFO; 52 52 cmd->panel_cntl.header.payload_bytes = sizeof(cmd->panel_cntl.data); 53 - cmd->panel_cntl.data.inst = dcn31_panel_cntl->base.inst; 53 + cmd->panel_cntl.data.pwrseq_inst = dcn31_panel_cntl->base.pwrseq_inst; 54 54 55 55 return dm_execute_dmub_cmd(dc_dmub_srv->ctx, cmd, DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY); 56 56 } ··· 78 78 cmd.panel_cntl.header.type = DMUB_CMD__PANEL_CNTL; 79 79 cmd.panel_cntl.header.sub_type = DMUB_CMD__PANEL_CNTL_HW_INIT; 80 80 cmd.panel_cntl.header.payload_bytes = sizeof(cmd.panel_cntl.data); 81 - cmd.panel_cntl.data.inst = dcn31_panel_cntl->base.inst; 81 + cmd.panel_cntl.data.pwrseq_inst = dcn31_panel_cntl->base.pwrseq_inst; 82 82 cmd.panel_cntl.data.bl_pwm_cntl = panel_cntl->stored_backlight_registers.BL_PWM_CNTL; 83 83 cmd.panel_cntl.data.bl_pwm_period_cntl = panel_cntl->stored_backlight_registers.BL_PWM_PERIOD_CNTL; 84 84 cmd.panel_cntl.data.bl_pwm_ref_div1 = ··· 157 157 dcn31_panel_cntl->base.funcs = &dcn31_link_panel_cntl_funcs; 158 158 dcn31_panel_cntl->base.ctx = init_data->ctx; 159 159 dcn31_panel_cntl->base.inst = init_data->inst; 160 + dcn31_panel_cntl->base.pwrseq_inst = init_data->pwrseq_inst; 160 161 }
+8 -8
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c
··· 790 790 struct dc_context *ctx = link->ctx; 791 791 struct bp_transmitter_control cntl = { 0 }; 792 792 enum bp_result bp_result; 793 - uint8_t panel_instance; 793 + uint8_t pwrseq_instance; 794 794 795 795 796 796 if (dal_graphics_object_id_get_connector_id(link->link_enc->connector) ··· 873 873 cntl.coherent = false; 874 874 cntl.lanes_number = LANE_COUNT_FOUR; 875 875 cntl.hpd_sel = link->link_enc->hpd_source; 876 - panel_instance = link->panel_cntl->inst; 876 + pwrseq_instance = link->panel_cntl->pwrseq_inst; 877 877 878 878 if (ctx->dc->ctx->dmub_srv && 879 879 ctx->dc->debug.dmub_command_table) { ··· 881 881 if (cntl.action == TRANSMITTER_CONTROL_POWER_ON) { 882 882 bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 883 883 LVTMA_CONTROL_POWER_ON, 884 - panel_instance, link->link_powered_externally); 884 + pwrseq_instance, link->link_powered_externally); 885 885 } else { 886 886 bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 887 887 LVTMA_CONTROL_POWER_OFF, 888 - panel_instance, link->link_powered_externally); 888 + pwrseq_instance, link->link_powered_externally); 889 889 } 890 890 } 891 891 ··· 956 956 { 957 957 struct dc_context *ctx = link->ctx; 958 958 struct bp_transmitter_control cntl = { 0 }; 959 - uint8_t panel_instance; 959 + uint8_t pwrseq_instance; 960 960 unsigned int pre_T11_delay = OLED_PRE_T11_DELAY; 961 961 unsigned int post_T7_delay = OLED_POST_T7_DELAY; 962 962 ··· 1009 1009 */ 1010 1010 /* dc_service_sleep_in_milliseconds(50); */ 1011 1011 /*edp 1.2*/ 1012 - panel_instance = link->panel_cntl->inst; 1012 + pwrseq_instance = link->panel_cntl->pwrseq_inst; 1013 1013 1014 1014 if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON) { 1015 1015 if (!link->dc->config.edp_no_power_sequencing) ··· 1034 1034 if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON) 1035 1035 ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 1036 1036 LVTMA_CONTROL_LCD_BLON, 1037 - panel_instance, link->link_powered_externally); 1037 + pwrseq_instance, link->link_powered_externally); 1038 1038 else 1039 1039 ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 1040 1040 LVTMA_CONTROL_LCD_BLOFF, 1041 - panel_instance, link->link_powered_externally); 1041 + pwrseq_instance, link->link_powered_externally); 1042 1042 } 1043 1043 1044 1044 link_transmitter_control(ctx->dc_bios, &cntl);
+28 -8
drivers/gpu/drm/amd/display/dc/hwss/dcn21/dcn21_hwseq.c
··· 137 137 pipe_ctx->stream->dpms_off = true; 138 138 } 139 139 140 - static bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst, uint32_t option, uint32_t panel_inst) 140 + static bool dmub_abm_set_pipe(struct abm *abm, uint32_t otg_inst, 141 + uint32_t option, uint32_t panel_inst, uint32_t pwrseq_inst) 141 142 { 142 143 union dmub_rb_cmd cmd; 143 144 struct dc_context *dc = abm->ctx; ··· 148 147 cmd.abm_set_pipe.header.type = DMUB_CMD__ABM; 149 148 cmd.abm_set_pipe.header.sub_type = DMUB_CMD__ABM_SET_PIPE; 150 149 cmd.abm_set_pipe.abm_set_pipe_data.otg_inst = otg_inst; 150 + cmd.abm_set_pipe.abm_set_pipe_data.pwrseq_inst = pwrseq_inst; 151 151 cmd.abm_set_pipe.abm_set_pipe_data.set_pipe_option = option; 152 152 cmd.abm_set_pipe.abm_set_pipe_data.panel_inst = panel_inst; 153 153 cmd.abm_set_pipe.abm_set_pipe_data.ramping_boundary = ramping_boundary; ··· 181 179 struct abm *abm = pipe_ctx->stream_res.abm; 182 180 uint32_t otg_inst = pipe_ctx->stream_res.tg->inst; 183 181 struct panel_cntl *panel_cntl = pipe_ctx->stream->link->panel_cntl; 184 - 185 182 struct dmcu *dmcu = pipe_ctx->stream->ctx->dc->res_pool->dmcu; 186 183 187 184 if (dmcu) { ··· 191 190 if (abm && panel_cntl) { 192 191 if (abm->funcs && abm->funcs->set_pipe_ex) { 193 192 abm->funcs->set_pipe_ex(abm, otg_inst, SET_ABM_PIPE_IMMEDIATELY_DISABLE, 194 - panel_cntl->inst); 193 + panel_cntl->inst, panel_cntl->pwrseq_inst); 195 194 } else { 196 - dmub_abm_set_pipe(abm, otg_inst, SET_ABM_PIPE_IMMEDIATELY_DISABLE, panel_cntl->inst); 195 + dmub_abm_set_pipe(abm, 196 + otg_inst, 197 + SET_ABM_PIPE_IMMEDIATELY_DISABLE, 198 + panel_cntl->inst, 199 + panel_cntl->pwrseq_inst); 197 200 } 198 201 panel_cntl->funcs->store_backlight_level(panel_cntl); 199 202 } ··· 217 212 218 213 if (abm && panel_cntl) { 219 214 if (abm->funcs && abm->funcs->set_pipe_ex) { 220 - abm->funcs->set_pipe_ex(abm, otg_inst, SET_ABM_PIPE_NORMAL, panel_cntl->inst); 215 + abm->funcs->set_pipe_ex(abm, 216 + otg_inst, 217 + SET_ABM_PIPE_NORMAL, 218 + panel_cntl->inst, 219 + panel_cntl->pwrseq_inst); 221 220 } else { 222 - dmub_abm_set_pipe(abm, otg_inst, SET_ABM_PIPE_NORMAL, panel_cntl->inst); 221 + dmub_abm_set_pipe(abm, otg_inst, 222 + SET_ABM_PIPE_NORMAL, 223 + panel_cntl->inst, 224 + panel_cntl->pwrseq_inst); 223 225 } 224 226 } 225 227 } ··· 249 237 250 238 if (abm && panel_cntl) { 251 239 if (abm->funcs && abm->funcs->set_pipe_ex) { 252 - abm->funcs->set_pipe_ex(abm, otg_inst, SET_ABM_PIPE_NORMAL, panel_cntl->inst); 240 + abm->funcs->set_pipe_ex(abm, 241 + otg_inst, 242 + SET_ABM_PIPE_NORMAL, 243 + panel_cntl->inst, 244 + panel_cntl->pwrseq_inst); 253 245 } else { 254 - dmub_abm_set_pipe(abm, otg_inst, SET_ABM_PIPE_NORMAL, panel_cntl->inst); 246 + dmub_abm_set_pipe(abm, 247 + otg_inst, 248 + SET_ABM_PIPE_NORMAL, 249 + panel_cntl->inst, 250 + panel_cntl->pwrseq_inst); 255 251 } 256 252 } 257 253 }
+2 -1
drivers/gpu/drm/amd/display/dc/inc/hw/abm.h
··· 64 64 bool (*set_pipe_ex)(struct abm *abm, 65 65 unsigned int otg_inst, 66 66 unsigned int option, 67 - unsigned int panel_inst); 67 + unsigned int panel_inst, 68 + unsigned int pwrseq_inst); 68 69 }; 69 70 70 71 #endif
+2
drivers/gpu/drm/amd/display/dc/inc/hw/panel_cntl.h
··· 56 56 struct panel_cntl_init_data { 57 57 struct dc_context *ctx; 58 58 uint32_t inst; 59 + uint32_t pwrseq_inst; 59 60 }; 60 61 61 62 struct panel_cntl { 62 63 const struct panel_cntl_funcs *funcs; 63 64 struct dc_context *ctx; 64 65 uint32_t inst; 66 + uint32_t pwrseq_inst; 65 67 /* registers setting needs to be saved and restored at InitBacklight */ 66 68 struct panel_cntl_backlight_registers stored_backlight_registers; 67 69 };
+12 -2
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
··· 3498 3498 * TODO: Remove. 3499 3499 */ 3500 3500 uint8_t ramping_boundary; 3501 + 3502 + /** 3503 + * PwrSeq HW Instance. 3504 + */ 3505 + uint8_t pwrseq_inst; 3506 + 3507 + /** 3508 + * Explicit padding to 4 byte boundary. 3509 + */ 3510 + uint8_t pad[3]; 3501 3511 }; 3502 3512 3503 3513 /** ··· 3888 3878 * struct dmub_cmd_panel_cntl_data - Panel control data. 3889 3879 */ 3890 3880 struct dmub_cmd_panel_cntl_data { 3891 - uint32_t inst; /**< panel instance */ 3881 + uint32_t pwrseq_inst; /**< pwrseq instance */ 3892 3882 uint32_t current_backlight; /* in/out */ 3893 3883 uint32_t bl_pwm_cntl; /* in/out */ 3894 3884 uint32_t bl_pwm_period_cntl; /* in/out */ ··· 3947 3937 uint8_t uc_pwr_action; /**< LVTMA_ACTION */ 3948 3938 uint8_t bypass_panel_control_wait; 3949 3939 uint8_t reserved_0[2]; /**< For future use */ 3950 - uint8_t panel_inst; /**< LVTMA control instance */ 3940 + uint8_t pwrseq_inst; /**< LVTMA control instance */ 3951 3941 uint8_t reserved_1[3]; /**< For future use */ 3952 3942 }; 3953 3943