[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tencent_E5B1CAABB0320691EB730CDB19E55EA85E05@qq.com>
Date: Fri, 15 Aug 2025 16:38:51 +0800
From: 2564278112@...com
To: alex.williamson@...hat.com
Cc: christian.koenig@....com,
airlied@...il.com,
simona@...ll.ch,
sunil.khatri@....com,
alexandre.f.demers@...il.com,
boyuan.zhang@....com,
jiangwang@...inos.cn,
amd-gfx@...ts.freedesktop.org,
dri-devel@...ts.freedesktop.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] drm/amdgpu: Fixed an issue where audio did not turn off properly after unplugging HDMI
From: Wang Jiang <jiangwang@...inos.cn>
In commit 3c021931023a ("drm/amdgpu: replace drm_detect_hdmi_monitor() with drm_display_info.is_hdmi")',
the method for determining connector types has been modified.
After the modification, when disconnecting the monitor, the information from the previous connection cannot be retrieved,
because display_info.is_hdmi has been reset, resulting in the connector type returned as dvi.
On AMD Oland and other cards, the audio driver determines whether to turn off audio based on connector type
However, when the monitor is disconnected, the information from the previous connection cannot be obtained, resulting in the inability to turn off the audio.
I don't understand why this is being done, I think the right thing to do is to decide whether or not to enable audio based on whether the connector has audio.
This commit modifies the code to retrieve audio information from the connected EDID.
Now, the decision to turn audio on/off is based on the audio information in the EDID.
Signed-off-by: Wang Jiang <jiangwang@...inos.cn>
---
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 276c025c4c03..c56b2027d53e 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -3253,17 +3253,22 @@ static void dce_v6_0_encoder_mode_set(struct drm_encoder *encoder,
struct drm_display_mode *adjusted_mode)
{
struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
- int em = amdgpu_atombios_encoder_get_encoder_mode(encoder);
-
+ struct drm_connector *connector;
+ struct amdgpu_connector *amdgpu_connector = NULL;
amdgpu_encoder->pixel_clock = adjusted_mode->clock;
/* need to call this here rather than in prepare() since we need some crtc info */
amdgpu_atombios_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+ connector = amdgpu_get_connector_for_encoder_init(encoder);
+ amdgpu_connector = to_amdgpu_connector(connector);
+ if (!amdgpu_connector) {
+ DRM_ERROR("Couldn't find encoder's connector\n");
+ }
/* set scaler clears this on some chips */
dce_v6_0_set_interleave(encoder->crtc, mode);
- if (em == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(em)) {
+ if (drm_detect_monitor_audio(amdgpu_connector_edid(connector))) {
dce_v6_0_afmt_enable(encoder, true);
dce_v6_0_afmt_setmode(encoder, adjusted_mode);
}
@@ -3322,12 +3327,18 @@ static void dce_v6_0_encoder_disable(struct drm_encoder *encoder)
{
struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder);
struct amdgpu_encoder_atom_dig *dig;
- int em = amdgpu_atombios_encoder_get_encoder_mode(encoder);
+ struct drm_connector *connector;
+ struct amdgpu_connector *amdgpu_connector = NULL;
amdgpu_atombios_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
+ connector = amdgpu_get_connector_for_encoder_init(encoder);
+ amdgpu_connector = to_amdgpu_connector(connector);
+ if (!amdgpu_connector) {
+ DRM_ERROR("Couldn't find encoder's connector\n");
+ }
if (amdgpu_atombios_encoder_is_digital(encoder)) {
- if (em == ATOM_ENCODER_MODE_HDMI || ENCODER_MODE_IS_DP(em))
+ if (drm_detect_monitor_audio(amdgpu_connector_edid(connector)))
dce_v6_0_afmt_enable(encoder, false);
dig = amdgpu_encoder->enc_priv;
dig->dig_encoder = -1;
--
2.25.1
Powered by blists - more mailing lists