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

drm/amd/display: Call DMUB for eDP power control

[Why]
If DMUB is used, LVTMA VBIOS call can be used to control eDP instead of
tranditional transmitter control. Interface is agreed with VBIOS for
eDP to use this new path to program LVTMA registers.

[How]
Create DAL interface to send DMUB command for LVTMA as currently
implemented in VBIOS.

Signed-off-by: Chris Park <Chris.Park@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Chris Park and committed by
Alex Deucher
5dea2142 34174b89

+80 -2
+15 -1
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
··· 1108 1108 action); 1109 1109 } 1110 1110 1111 + static enum bp_result bios_parser_enable_lvtma_control( 1112 + struct dc_bios *dcb, 1113 + uint8_t uc_pwr_on) 1114 + { 1115 + struct bios_parser *bp = BP_FROM_DCB(dcb); 1116 + 1117 + if (!bp->cmd_tbl.enable_lvtma_control) 1118 + return BP_RESULT_FAILURE; 1119 + 1120 + return bp->cmd_tbl.enable_lvtma_control(bp, uc_pwr_on); 1121 + } 1122 + 1111 1123 static bool bios_parser_is_accelerated_mode( 1112 1124 struct dc_bios *dcb) 1113 1125 { ··· 2220 2208 .get_board_layout_info = bios_get_board_layout_info, 2221 2209 .pack_data_tables = bios_parser_pack_data_tables, 2222 2210 2223 - .get_atom_dc_golden_table = bios_get_atom_dc_golden_table 2211 + .get_atom_dc_golden_table = bios_get_atom_dc_golden_table, 2212 + 2213 + .enable_lvtma_control = bios_parser_enable_lvtma_control 2224 2214 }; 2225 2215 2226 2216 static bool bios_parser2_construct(
+28
drivers/gpu/drm/amd/display/dc/bios/command_table2.c
··· 904 904 return 0; 905 905 } 906 906 907 + /****************************************************************************** 908 + ****************************************************************************** 909 + ** 910 + ** LVTMA CONTROL 911 + ** 912 + ****************************************************************************** 913 + *****************************************************************************/ 914 + 915 + static enum bp_result enable_lvtma_control( 916 + struct bios_parser *bp, 917 + uint8_t uc_pwr_on); 918 + 919 + static void init_enable_lvtma_control(struct bios_parser *bp) 920 + { 921 + /* TODO add switch for table vrsion */ 922 + bp->cmd_tbl.enable_lvtma_control = enable_lvtma_control; 923 + 924 + } 925 + 926 + static enum bp_result enable_lvtma_control( 927 + struct bios_parser *bp, 928 + uint8_t uc_pwr_on) 929 + { 930 + enum bp_result result = BP_RESULT_FAILURE; 931 + return result; 932 + } 933 + 907 934 void dal_firmware_parser_init_cmd_tbl(struct bios_parser *bp) 908 935 { 909 936 init_dig_encoder_control(bp); ··· 946 919 init_set_dce_clock(bp); 947 920 init_get_smu_clock_info(bp); 948 921 922 + init_enable_lvtma_control(bp); 949 923 }
+2 -1
drivers/gpu/drm/amd/display/dc/bios/command_table2.h
··· 94 94 struct bp_set_dce_clock_parameters *bp_params); 95 95 unsigned int (*get_smu_clock_info)( 96 96 struct bios_parser *bp, uint8_t id); 97 - 97 + enum bp_result (*enable_lvtma_control)(struct bios_parser *bp, 98 + uint8_t uc_pwr_on); 98 99 }; 99 100 100 101 void dal_firmware_parser_init_cmd_tbl(struct bios_parser *bp);
+4
drivers/gpu/drm/amd/display/dc/dc_bios_types.h
··· 136 136 137 137 enum bp_result (*get_atom_dc_golden_table)( 138 138 struct dc_bios *dcb); 139 + 140 + enum bp_result (*enable_lvtma_control)( 141 + struct dc_bios *bios, 142 + uint8_t uc_pwr_on); 139 143 }; 140 144 141 145 struct bios_registers {
+24
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
··· 842 842 cntl.coherent = false; 843 843 cntl.lanes_number = LANE_COUNT_FOUR; 844 844 cntl.hpd_sel = link->link_enc->hpd_source; 845 + 846 + if (ctx->dc->ctx->dmub_srv && 847 + ctx->dc->debug.dmub_command_table) { 848 + if (cntl.action == TRANSMITTER_CONTROL_POWER_ON) 849 + bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 850 + LVTMA_CONTROL_POWER_ON); 851 + else 852 + bp_result = ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 853 + LVTMA_CONTROL_POWER_OFF); 854 + } 855 + 845 856 bp_result = link_transmitter_control(ctx->dc_bios, &cntl); 846 857 847 858 if (!power_up) ··· 930 919 /*edp 1.2*/ 931 920 if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON) 932 921 edp_receiver_ready_T7(link); 922 + 923 + if (ctx->dc->ctx->dmub_srv && 924 + ctx->dc->debug.dmub_command_table) { 925 + if (cntl.action == TRANSMITTER_CONTROL_BACKLIGHT_ON) 926 + ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 927 + LVTMA_CONTROL_LCD_BLON); 928 + else 929 + ctx->dc_bios->funcs->enable_lvtma_control(ctx->dc_bios, 930 + LVTMA_CONTROL_LCD_BLOFF); 931 + } 932 + 933 933 link_transmitter_control(ctx->dc_bios, &cntl); 934 + 935 + 934 936 935 937 if (enable && link->dpcd_sink_ext_caps.bits.oled) 936 938 msleep(OLED_POST_T7_DELAY);
+7
drivers/gpu/drm/amd/display/include/bios_parser_types.h
··· 101 101 ASIC_PIPE_INIT 102 102 }; 103 103 104 + enum bp_lvtma_control_action { 105 + LVTMA_CONTROL_LCD_BLOFF = 2, 106 + LVTMA_CONTROL_LCD_BLON = 3, 107 + LVTMA_CONTROL_POWER_ON = 12, 108 + LVTMA_CONTROL_POWER_OFF = 13 109 + }; 110 + 104 111 struct bp_encoder_control { 105 112 enum bp_encoder_control_action action; 106 113 enum engine_id engine_id;