[PATCH] drm/amd/display: Add DC feature flag to disable audio

Ernst Sjöstrand ernstp at gmail.com
Tue Jan 26 14:31:55 UTC 2021


With the pre-DC path you could set audio=0 to disable audio.
This adds a similar feature for the DC path with
amdgpu.dcfeaturemask=0x10.

Signed-off-by: Ernst Sjöstrand <ernstp at gmail.com>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 3 +++
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 7 ++++---
 drivers/gpu/drm/amd/display/dc/dc.h               | 1 +
 drivers/gpu/drm/amd/include/amd_shared.h          | 1 +
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index e490fc2486f7..322d9439b9c2 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -1013,6 +1013,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 	if (amdgpu_dc_feature_mask & DC_DISABLE_FRACTIONAL_PWM_MASK)
 		init_data.flags.disable_fractional_pwm = true;
 
+	if (amdgpu_dc_feature_mask & DC_DISABLE_AUDIO)
+		init_data.flags.disable_audio = true;
+
 	init_data.flags.power_down_display_on_boot = true;
 
 	init_data.soc_bounding_box = adev->dm.soc_bounding_box;
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
index 68b65a090d17..4cc0d2308c98 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c
@@ -2141,9 +2141,10 @@ enum dc_status resource_map_pool_resources(
 		true);
 
 	/* TODO: Add check if ASIC support and EDID audio */
-	if (!stream->converter_disable_audio &&
-	    dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
-	    stream->audio_info.mode_count && stream->audio_info.flags.all) {
+	if (!dc->config.disable_audio &&
+		!stream->converter_disable_audio &&
+		dc_is_audio_capable_signal(pipe_ctx->stream->signal) &&
+		stream->audio_info.mode_count && stream->audio_info.flags.all) {
 		pipe_ctx->stream_res.audio = find_first_free_audio(
 		&context->res_ctx, pool, pipe_ctx->stream_res.stream_enc->id, dc_ctx->dce_version);
 
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h
index 71d46ade24e5..2ab6d770c66b 100644
--- a/drivers/gpu/drm/amd/display/dc/dc.h
+++ b/drivers/gpu/drm/amd/display/dc/dc.h
@@ -297,6 +297,7 @@ struct dc_config {
 	bool multi_mon_pp_mclk_switch;
 	bool disable_dmcu;
 	bool enable_4to1MPC;
+	bool disable_audio;
 #if defined(CONFIG_DRM_AMD_DC_DCN)
 	bool clamp_min_dcfclk;
 #endif
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index 9676016a37ce..7202d816a97e 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -220,6 +220,7 @@ enum DC_FEATURE_MASK {
 	DC_MULTI_MON_PP_MCLK_SWITCH_MASK = 0x2,
 	DC_DISABLE_FRACTIONAL_PWM_MASK = 0x4,
 	DC_PSR_MASK = 0x8,
+	DC_DISABLE_AUDIO = 0x10,
 };
 
 enum DC_DEBUG_MASK {
-- 
2.27.0



More information about the amd-gfx mailing list