drm/amd/display: Fix DP audio DTO1 clock source on DCE 6.
Subsystems (3)
PATCH 1/1 drm/amd/display: Fix DP audio DTO1 clock source on DCE 6.
On DCE 6, DP audio was not working. However, it worked when an HDMI monitor was also plugged in.
Looking at dce_aud_wall_dto_setup it seems that the main difference is that we use DTO1 when only DP is plugged in.
When programming DTO1, it uses audio_dto_source_clock_in_khz which is set from get_dp_ref_freq_khz
The dce60_get_dp_ref_freq_khz implementation looks incorrect, because DENTIST_DISPCLK_CNTL seems to be always zero on DCE 6, so it isn't usable.
I compared dce60_get_dp_ref_freq_khz to the legacy display code, specifically dce_v6_0_audio_set_dto, and it turns out that in case of DCE 6, it needs to use the display clock. With that, DP audio started working on Pitcairn, Oland and Cape Verde.
However, it still didn't work on Tahiti. Despite having the same DCE version, Tahiti seems to have a different audio device. After some trial and error I realized that it works with the default display clock as reported by the VBIOS, not the current display clock.
The patch was tested on all four SI GPUs:
* Pitcairn (DCE 6.0)
* Oland (DCE 6.4)
* Cape Verde (DCE 6.0)
* Tahiti (DCE 6.0 but different)
The testing was done on Samsung Odyssey G7 LS28BG700EPXEN on each of the above GPUs, at the following settings:
* 4K 60 Hz
* 1080p 60 Hz
* 1080p 144 Hz
--- .../display/dc/clk_mgr/dce60/dce60_clk_mgr.c | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +6 -15
@@ -83,22 +83,13 @@ static const struct state_dependent_clocks dce60_max_clks_by_state[] = {static int dce60_get_dp_ref_freq_khz (struct clk_mgr *clk_mgr_base) {struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); -int dprefclk_wdivider; -int dp_ref_clk_khz; -int target_div; +struct dc_context *ctx = clk_mgr_base->ctx; +int dp_ref_clk_khz =0 ; -/* DCE6 has no DPREFCLK_CNTL to read DP Reference Clock source */ - -/* Read the mmDENTIST_DISPCLK_CNTL to get the currently -* programmed DID DENTIST_DPREFCLK_WDIVIDER*/ -REG_GET (DENTIST_DISPCLK_CNTL ,DENTIST_DPREFCLK_WDIVIDER , &dprefclk_wdivider); - -/* Convert DENTIST_DPREFCLK_WDIVIDERto actual divider*/ - target_div =dentist_get_divider_from_did (dprefclk_wdivider); - -/* Calculate the current DFS clock, in kHz.*/ - dp_ref_clk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR - * clk_mgr->base.dentist_vco_freq_khz) / target_div; +if (ASIC_REV_IS_TAHITI_P (ctx->asic_id.hw_internal_rev)) + dp_ref_clk_khz = ctx->dc_bios->fw_info.default_display_engine_pll_frequency; +else + dp_ref_clk_khz = clk_mgr_base->clks.dispclk_khz;return dce_adjust_dp_ref_freq_for_ss (clk_mgr, dp_ref_clk_khz); }
Signature · 1 line
2.50.1
Quoted 18 lines · Timur Kristóf
On DCE 6, DP audio was not working. However, it worked when an HDMI monitor was also plugged in.
Looking at
dce_aud_wall_dto_setupit seems that the main difference is that we use DTO1 when only DP is plugged in.When programming DTO1, it uses
audio_dto_source_clock_in_khzwhich is set fromget_dp_ref_freq_khzThe
dce60_get_dp_ref_freq_khzimplementation looks incorrect, becauseDENTIST_DISPCLK_CNTLseems to be always zero on DCE 6, so it isn't usable.
I compareddce60_get_dp_ref_freq_khzto the legacy display code, specificallydce_v6_0_audio_set_dto, and it turns out that in case of DCE 6, it needs to use the display clock. With that, DP audio started working on Pitcairn, Oland and Cape Verde.
Quoted 6 lines
However, it still didn't work on Tahiti. Despite having the same DCE version, Tahiti seems to have a different audio device. After some trial and error I realized that it works with the default display clock as reported by the VBIOS, not the current display clock.
This looks good to me, but it would be good to get an ack from Harry or Leo.
Quoted 55 lines
The patch was tested on all four SI GPUs:
* Pitcairn (DCE 6.0)
* Oland (DCE 6.4)
* Cape Verde (DCE 6.0)
* Tahiti (DCE 6.0 but different)The testing was done on Samsung Odyssey G7 LS28BG700EPXEN on each of the above GPUs, at the following settings:
* 4K 60 Hz
* 1080p 60 Hz
* 1080p 144 HzSigned-off-by Timur Kristóf <[email protected]>--- .../display/dc/clk_mgr/dce60/dce60_clk_mgr.c | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +6
-16@@ -83,22 +83,13 @@ static const struct state_dependent_clocks dce60_max_clks_by_state[] = {static int dce60_get_dp_ref_freq_khz (struct clk_mgr *clk_mgr_base) {struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); -int dprefclk_wdivider; -int dp_ref_clk_khz; -int target_div; +struct dc_context *ctx = clk_mgr_base->ctx; +int dp_ref_clk_khz =0 ; -/* DCE6 has no DPREFCLK_CNTL to read DP Reference Clock source */ - -/* Read the mmDENTIST_DISPCLK_CNTL to get the currently -* programmed DID DENTIST_DPREFCLK_WDIVIDER*/ -REG_GET (DENTIST_DISPCLK_CNTL ,DENTIST_DPREFCLK_WDIVIDER , &dprefclk_wdivider); - -/* Convert DENTIST_DPREFCLK_WDIVIDERto actual divider*/ - target_div =dentist_get_divider_from_did (dprefclk_wdivider); - -/* Calculate the current DFS clock, in kHz.*/ - dp_ref_clk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR - * clk_mgr->base.dentist_vco_freq_khz) / target_div; +if (ASIC_REV_IS_TAHITI_P (ctx->asic_id.hw_internal_rev)) + dp_ref_clk_khz = ctx->dc_bios->fw_info.default_display_engine_pll_frequency; +else + dp_ref_clk_khz = clk_mgr_base->clks.dispclk_khz;return dce_adjust_dp_ref_freq_for_ss (clk_mgr, dp_ref_clk_khz); } --2.50.1
Quoted 78 lines · Timur Kristóf
On DCE 6, DP audio was not working. However, it worked when an HDMI monitor was also plugged in.
Looking at
dce_aud_wall_dto_setupit seems that the main difference is that we use DTO1 when only DP is plugged in.When programming DTO1, it uses
audio_dto_source_clock_in_khzwhich is set fromget_dp_ref_freq_khzThe
dce60_get_dp_ref_freq_khzimplementation looks incorrect, becauseDENTIST_DISPCLK_CNTLseems to be always zero on DCE 6, so it isn't usable.
I compareddce60_get_dp_ref_freq_khzto the legacy display code, specificallydce_v6_0_audio_set_dto, and it turns out that in case of DCE 6, it needs to use the display clock. With that, DP audio started working on Pitcairn, Oland and Cape Verde.However, it still didn't work on Tahiti. Despite having the same DCE version, Tahiti seems to have a different audio device. After some trial and error I realized that it works with the default display clock as reported by the VBIOS, not the current display clock.
The patch was tested on all four SI GPUs:
* Pitcairn (DCE 6.0)
* Oland (DCE 6.4)
* Cape Verde (DCE 6.0)
* Tahiti (DCE 6.0 but different)The testing was done on Samsung Odyssey G7 LS28BG700EPXEN on each of the above GPUs, at the following settings:
* 4K 60 Hz
* 1080p 60 Hz
* 1080p 144 HzSigned-off-by Timur Kristóf <[email protected]>--- .../display/dc/clk_mgr/dce60/dce60_clk_mgr.c | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +6
-15@@ -83,22 +83,13 @@ static const struct state_dependent_clocks dce60_max_clks_by_state[] = {static int dce60_get_dp_ref_freq_khz (struct clk_mgr *clk_mgr_base) {struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); -int dprefclk_wdivider; -int dp_ref_clk_khz; -int target_div; +struct dc_context *ctx = clk_mgr_base->ctx; +int dp_ref_clk_khz =0 ; -/* DCE6 has no DPREFCLK_CNTL to read DP Reference Clock source */ - -/* Read the mmDENTIST_DISPCLK_CNTL to get the currently -* programmed DID DENTIST_DPREFCLK_WDIVIDER*/ -REG_GET (DENTIST_DISPCLK_CNTL ,DENTIST_DPREFCLK_WDIVIDER , &dprefclk_wdivider); - -/* Convert DENTIST_DPREFCLK_WDIVIDERto actual divider*/ - target_div =dentist_get_divider_from_did (dprefclk_wdivider); - -/* Calculate the current DFS clock, in kHz.*/ - dp_ref_clk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR - * clk_mgr->base.dentist_vco_freq_khz) / target_div; +if (ASIC_REV_IS_TAHITI_P (ctx->asic_id.hw_internal_rev)) + dp_ref_clk_khz = ctx->dc_bios->fw_info.default_display_engine_pll_frequency; +else + dp_ref_clk_khz = clk_mgr_base->clks.dispclk_khz;return dce_adjust_dp_ref_freq_for_ss (clk_mgr, dp_ref_clk_khz); }Signature · 1 line
2.50.1
Very nice patch! I checked the mentioned functions, and it looks correct to me.
I added other display folks for further review/validation. It could be a good idea to include this patch in the next week's promotion.
Thanks
Signature · 1 line
Rodrigo Siqueira
Alex Deucher
AppliedApplied. Thanks!
Alex
Quoted 93 lines · Rodrigo Siqueira
Quoted 76 lines · Timur Kristóf
On DCE 6, DP audio was not working. However, it worked when an HDMI monitor was also plugged in.
Looking at
dce_aud_wall_dto_setupit seems that the main difference is that we use DTO1 when only DP is plugged in.When programming DTO1, it uses
audio_dto_source_clock_in_khzwhich is set fromget_dp_ref_freq_khzThe
dce60_get_dp_ref_freq_khzimplementation looks incorrect, becauseDENTIST_DISPCLK_CNTLseems to be always zero on DCE 6, so it isn't usable.
I compareddce60_get_dp_ref_freq_khzto the legacy display code, specificallydce_v6_0_audio_set_dto, and it turns out that in case of DCE 6, it needs to use the display clock. With that, DP audio started working on Pitcairn, Oland and Cape Verde.However, it still didn't work on Tahiti. Despite having the same DCE version, Tahiti seems to have a different audio device. After some trial and error I realized that it works with the default display clock as reported by the VBIOS, not the current display clock.
The patch was tested on all four SI GPUs:
* Pitcairn (DCE 6.0)
* Oland (DCE 6.4)
* Cape Verde (DCE 6.0)
* Tahiti (DCE 6.0 but different)The testing was done on Samsung Odyssey G7 LS28BG700EPXEN on each of the above GPUs, at the following settings:
* 4K 60 Hz
* 1080p 60 Hz
* 1080p 144 HzSigned-off-by Timur Kristóf <[email protected]>--- .../display/dc/clk_mgr/dce60/dce60_clk_mgr.c | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-)drivers/gpu/drm/amd/display/dc/clk_mgr/dce60/dce60_clk_mgr.c +6
-16@@ -83,22 +83,13 @@ static const struct state_dependent_clocks dce60_max_clks_by_state[] = {static int dce60_get_dp_ref_freq_khz (struct clk_mgr *clk_mgr_base) {struct clk_mgr_internal *clk_mgr =TO_CLK_MGR_INTERNAL (clk_mgr_base); -int dprefclk_wdivider; -int dp_ref_clk_khz; -int target_div; +struct dc_context *ctx = clk_mgr_base->ctx; +int dp_ref_clk_khz =0 ; -/* DCE6 has no DPREFCLK_CNTL to read DP Reference Clock source */ - -/* Read the mmDENTIST_DISPCLK_CNTL to get the currently -* programmed DID DENTIST_DPREFCLK_WDIVIDER*/ -REG_GET (DENTIST_DISPCLK_CNTL ,DENTIST_DPREFCLK_WDIVIDER , &dprefclk_wdivider); - -/* Convert DENTIST_DPREFCLK_WDIVIDERto actual divider*/ - target_div =dentist_get_divider_from_did (dprefclk_wdivider); - -/* Calculate the current DFS clock, in kHz.*/ - dp_ref_clk_khz = (DENTIST_DIVIDER_RANGE_SCALE_FACTOR - * clk_mgr->base.dentist_vco_freq_khz) / target_div; +if (ASIC_REV_IS_TAHITI_P (ctx->asic_id.hw_internal_rev)) + dp_ref_clk_khz = ctx->dc_bios->fw_info.default_display_engine_pll_frequency; +else + dp_ref_clk_khz = clk_mgr_base->clks.dispclk_khz;return dce_adjust_dp_ref_freq_for_ss (clk_mgr, dp_ref_clk_khz); } --Quoted 2 lines
2.50.1
Very nice patch! I checked the mentioned functions, and it looks correct to me.
I added other display folks for further review/validation. It could be a good idea to include this patch in the next week's promotion.
Reviewed-by Rodrigo Siqueira <[email protected]>Thanks
--
Rodrigo Siqueira