All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] drm/amdgpu: Only enable HDMI audio if display supports it
@ 2026-11-03  6:11 Panpan Ren
  2026-11-03  6:27 ` sashiko-bot
  2026-11-03 11:49 ` Timur Kristóf
  0 siblings, 2 replies; 3+ messages in thread
From: Panpan Ren @ 2026-11-03  6:11 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, simona
  Cc: amd-gfx, dri-devel, linux-kernel, stable, tzimmermann,
	timur.kristof, lijo.lazar, renpanpan

From: renpanpan <renpanpan@kylinos.cn>

The amdgpu legacy DCE audio path (dce_v6/v8/v10) unconditionally calls
audio_enable(pin, true) at the end of afmt_setmode(), regardless of
whether the connected display advertises audio support in its EDID.

This causes a phantom HDMI audio output to appear for displays that
have no audio capability (no basic audio bit, no Audio Data Block in
EDID), because the GPU sets the AUDIO_ENABLED register bit, which
drives the HDA codec's ELDV pin sense, making the codec report the
jack as audio-available.

The radeon, nouveau, and dw-hdmi drivers all gate audio enablement on
the display's audio capability. Apply the same check to amdgpu's DCE
afmt_setmode functions, while still respecting the AMDGPU_AUDIO_ENABLE
override for users who explicitly force audio on.

Fixes: e2cdf640cbb5 ("drm/amdgpu: add display controller implementation for si v10")
Cc: stable@vger.kernel.org
Signed-off-by: renpanpan <renpanpan@kylinos.cn>
---
Changes in v3:
- Also gate the initial audio_enable(pin, false) to avoid touching a
  potentially shared audio pin when the display has no audio support

Changes in v2:
- Respect AMDGPU_AUDIO_ENABLE override for users who force audio on
- Add Fixes tag and Cc: stable@vger.kernel.org for stable backport

 drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 12 ++++++++----
 drivers/gpu/drm/amd/amdgpu/dce_v6_0.c  | 12 ++++++++----
 drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 12 ++++++++----
 3 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index f2977fe6d824..a8f5eb2394c6 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -1555,9 +1555,11 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
 		bpc = amdgpu_crtc->bpc;
 	}
 
-	/* disable audio prior to setting up hw */
+	/* disable audio prior to setting up hw, unless the display has no audio */
 	dig->afmt->pin = dce_v10_0_audio_get_pin(adev);
-	dce_v10_0_audio_enable(adev, dig->afmt->pin, false);
+	if (connector->display_info.has_audio ||
+	    to_amdgpu_connector(connector)->audio == AMDGPU_AUDIO_ENABLE)
+		dce_v10_0_audio_enable(adev, dig->afmt->pin, false);
 
 	dce_v10_0_audio_set_dto(encoder, mode->clock);
 
@@ -1705,8 +1707,10 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
 	WREG32(mmAFMT_RAMP_CONTROL2 + dig->afmt->offset, 0x00000001);
 	WREG32(mmAFMT_RAMP_CONTROL3 + dig->afmt->offset, 0x00000001);
 
-	/* enable audio after to setting up hw */
-	dce_v10_0_audio_enable(adev, dig->afmt->pin, true);
+	/* Only enable audio if the display supports it or is forced on */
+	if (connector->display_info.has_audio ||
+	    to_amdgpu_connector(connector)->audio == AMDGPU_AUDIO_ENABLE)
+		dce_v10_0_audio_enable(adev, dig->afmt->pin, true);
 }
 
 static void dce_v10_0_afmt_enable(struct drm_encoder *encoder, bool enable)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index c68de0fe1d7d..3cd9f1bb3a70 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -1724,8 +1724,10 @@ static void dce_v6_0_afmt_setmode(struct drm_encoder *encoder,
 		bpc = amdgpu_crtc->bpc;
 	}
 
-	/* disable audio before setting up hw */
-	dce_v6_0_audio_enable(adev, dig->afmt->pin, false);
+	/* disable audio before setting up hw, unless the display has no audio */
+	if (connector->display_info.has_audio ||
+	    amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
+		dce_v6_0_audio_enable(adev, dig->afmt->pin, false);
 
 	dce_v6_0_audio_set_mute(encoder, true);
 	dce_v6_0_audio_write_speaker_allocation(encoder);
@@ -1748,8 +1750,10 @@ static void dce_v6_0_afmt_setmode(struct drm_encoder *encoder,
 		dce_v6_0_audio_dp_enable(encoder, 1);
 	}
 
-	/* enable audio after setting up hw */
-	dce_v6_0_audio_enable(adev, dig->afmt->pin, true);
+	/* Only enable audio if the display supports it or is forced on */
+	if (connector->display_info.has_audio ||
+	    amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
+		dce_v6_0_audio_enable(adev, dig->afmt->pin, true);
 }
 
 static void dce_v6_0_afmt_enable(struct drm_encoder *encoder, bool enable)
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index c3906270f25e..eb1fcf0b39cc 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -1523,9 +1523,11 @@ static void dce_v8_0_afmt_setmode(struct drm_encoder *encoder,
 		bpc = amdgpu_crtc->bpc;
 	}
 
-	/* disable audio prior to setting up hw */
+	/* disable audio prior to setting up hw, unless the display has no audio */
 	dig->afmt->pin = dce_v8_0_audio_get_pin(adev);
-	dce_v8_0_audio_enable(adev, dig->afmt->pin, false);
+	if (connector->display_info.has_audio ||
+	    to_amdgpu_connector(connector)->audio == AMDGPU_AUDIO_ENABLE)
+		dce_v8_0_audio_enable(adev, dig->afmt->pin, false);
 
 	dce_v8_0_audio_set_dto(encoder, mode->clock);
 
@@ -1653,8 +1655,10 @@ static void dce_v8_0_afmt_setmode(struct drm_encoder *encoder,
 	WREG32(mmAFMT_RAMP_CONTROL2 + offset, 0x00000001);
 	WREG32(mmAFMT_RAMP_CONTROL3 + offset, 0x00000001);
 
-	/* enable audio after setting up hw */
-	dce_v8_0_audio_enable(adev, dig->afmt->pin, true);
+	/* Only enable audio if the display supports it or is forced on */
+	if (connector->display_info.has_audio ||
+	    to_amdgpu_connector(connector)->audio == AMDGPU_AUDIO_ENABLE)
+		dce_v8_0_audio_enable(adev, dig->afmt->pin, true);
 }
 
 static void dce_v8_0_afmt_enable(struct drm_encoder *encoder, bool enable)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] drm/amdgpu: Only enable HDMI audio if display supports it
  2026-11-03  6:11 [PATCH v3] drm/amdgpu: Only enable HDMI audio if display supports it Panpan Ren
@ 2026-11-03  6:27 ` sashiko-bot
  2026-11-03 11:49 ` Timur Kristóf
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-03  6:27 UTC (permalink / raw)
  To: Panpan Ren; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] drm/amdgpu: broken audio pin state and sharing in dce_v*_0_afmt_setmode()
- [Medium] drm/amdgpu: dce_v6_0_afmt_setmode() ignores AMDGPU_AUDIO_DISABLE on DP
--

commit bd861db0f0aadc54fc085212778f034d398ae2b3
Author: renpanpan <renpanpan@kylinos.cn>

drm/amdgpu: Only enable HDMI audio if display supports it

This commit gates the initial and final audio_enable() calls in
dce_v6_0_afmt_setmode(), dce_v8_0_afmt_setmode(), and
dce_v10_0_afmt_setmode() on whether the connected display reports audio
support in its EDID or has audio forced on via AMDGPU_AUDIO_ENABLE.

> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index 7de7adc8f225c..6d5f25ea67c2f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -1555,9 +1555,11 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
>  		bpc = amdgpu_crtc->bpc;
>  	}
>  
> -	/* disable audio prior to setting up hw */
> +	/* disable audio prior to setting up hw, unless the display has no audio */
>  	dig->afmt->pin = dce_v10_0_audio_get_pin(adev);
> -	dce_v10_0_audio_enable(adev, dig->afmt->pin, false);
> +	if (connector->display_info.has_audio ||
> +	    to_amdgpu_connector(connector)->audio == AMDGPU_AUDIO_ENABLE)
> +		dce_v10_0_audio_enable(adev, dig->afmt->pin, false);
>  
>  	dce_v10_0_audio_set_dto(encoder, mode->clock);
>  
> @@ -1705,8 +1707,10 @@ static void dce_v10_0_afmt_setmode(struct drm_encoder *encoder,
>  	WREG32(mmAFMT_RAMP_CONTROL2 + dig->afmt->offset, 0x00000001);
>  	WREG32(mmAFMT_RAMP_CONTROL3 + dig->afmt->offset, 0x00000001);
>  
> -	/* enable audio after to setting up hw */
> -	dce_v10_0_audio_enable(adev, dig->afmt->pin, true);
> +	/* Only enable audio if the display supports it or is forced on */
> +	if (connector->display_info.has_audio ||
> +	    to_amdgpu_connector(connector)->audio == AMDGPU_AUDIO_ENABLE)
> +		dce_v10_0_audio_enable(adev, dig->afmt->pin, true);
>  }

[Severity: Medium]
As reported by Sashiko on v2 [1], gating only the initial
audio_enable(adev, dig->afmt->pin, false) and final
audio_enable(adev, dig->afmt->pin, true) calls in dce_v10_0_afmt_setmode(),
dce_v6_0_afmt_setmode(), and dce_v8_0_afmt_setmode() still leaves two issues
with audio pin state and sharing:

First, when an already-active encoder transitions from an audio-enabled state
to a non-audio state (for example, changing the connector audio property from
AMDGPU_AUDIO_ENABLE back to AMDGPU_AUDIO_AUTO on a non-audio HDMI monitor via
amdgpu_connector_set_property() -> amdgpu_connector_property_change_mode() ->
drm_crtc_helper_set_mode(), or hot-swapping an audio-capable display for a
non-audio display on the same active CRTC), drm_crtc_prepare_encoders() does
not disable the active encoder, and dce_v10_0_afmt_enable(encoder, true)
returns early because dig->afmt->enabled is already true. When
dce_v10_0_afmt_setmode() then runs with both connector->display_info.has_audio
and audio == AMDGPU_AUDIO_ENABLE evaluating to false, both the initial
dce_v10_0_audio_enable(..., false) and final dce_v10_0_audio_enable(..., true)
calls are skipped. Doesn't this leave
AZALIA_F0_CODEC_PIN_CONTROL_HOT_PLUG_CONTROL__AUDIO_ENABLED_MASK stuck enabled
in hardware?

Second, dce_v10_0_audio_get_pin(), dce_v8_0_audio_get_pin(), and
dce_v6_0_audio_get_pin() do not track per-encoder pin ownership and always
return the first connected pin in adev->mode_info.audio.pin[]:

drivers/gpu/drm/amd/amdgpu/dce_v10_0.c:dce_v10_0_afmt_setmode() {
    ...
    dig->afmt->pin = dce_v10_0_audio_get_pin(adev);
    if (connector->display_info.has_audio ||
        to_amdgpu_connector(connector)->audio == AMDGPU_AUDIO_ENABLE)
            dce_v10_0_audio_enable(adev, dig->afmt->pin, false);

    dce_v10_0_audio_set_dto(encoder, mode->clock);
    ...
    dce_v10_0_audio_write_speaker_allocation(encoder);
    ...
    dce_v10_0_afmt_audio_select_pin(encoder);
    dce_v10_0_audio_write_sad_regs(encoder);
    dce_v10_0_audio_write_latency_fields(encoder, mode);
    ...
}

Because dig->afmt->pin is still unconditionally assigned on a non-audio
display, dce_v10_0_afmt_setmode() still overwrites the global
mmDCCG_AUDIO_DTO_SOURCE and mmDCCG_AUDIO_DTO0_* registers as well as the
shared pin's speaker allocation, SAD, and latency registers, and enables audio
infoframes and sample packets. Furthermore, when the non-audio encoder is
later disabled via dce_v10_0_encoder_disable() ->
dce_v10_0_afmt_enable(encoder, false):

drivers/gpu/drm/amd/amdgpu/dce_v10_0.c:dce_v10_0_afmt_enable() {
    ...
    if (!enable && dig->afmt->pin) {
            dce_v10_0_audio_enable(adev, dig->afmt->pin, false);
            dig->afmt->pin = NULL;
    }
    ...
}

won't disabling the non-audio encoder unconditionally call
dce_v10_0_audio_enable(adev, dig->afmt->pin, false) and turn off audio on
another active display sharing that pin (and similarly in dce_v6_0.c and
dce_v8_0.c)?

> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index 3c1d6901127d1..3add851974b47 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -1724,8 +1724,10 @@ static void dce_v6_0_afmt_setmode(struct drm_encoder *encoder,
>  		bpc = amdgpu_crtc->bpc;
>  	}
>  
> -	/* disable audio before setting up hw */
> -	dce_v6_0_audio_enable(adev, dig->afmt->pin, false);
> +	/* disable audio before setting up hw, unless the display has no audio */
> +	if (connector->display_info.has_audio ||
> +	    amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
> +		dce_v6_0_audio_enable(adev, dig->afmt->pin, false);
>  
>  	dce_v6_0_audio_set_mute(encoder, true);
>  	dce_v6_0_audio_write_speaker_allocation(encoder);
> @@ -1748,8 +1750,10 @@ static void dce_v6_0_afmt_setmode(struct drm_encoder *encoder,
>  		dce_v6_0_audio_dp_enable(encoder, 1);
>  	}
>  
> -	/* enable audio after setting up hw */
> -	dce_v6_0_audio_enable(adev, dig->afmt->pin, true);
> +	/* Only enable audio if the display supports it or is forced on */
> +	if (connector->display_info.has_audio ||
> +	    amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
> +		dce_v6_0_audio_enable(adev, dig->afmt->pin, true);
>  }

[Severity: Medium]
For HDMI and DVI connectors, amdgpu_atombios_encoder_get_encoder_mode()
returns ATOM_ENCODER_MODE_DVI when amdgpu_connector->audio ==
AMDGPU_AUDIO_DISABLE, which prevents dce_v6_0_afmt_setmode() from being
called.

However, for native DisplayPort sinks,
amdgpu_atombios_encoder_get_encoder_mode() unconditionally returns
ATOM_ENCODER_MODE_DP regardless of amdgpu_connector->audio:

drivers/gpu/drm/amd/amdgpu/atombios_encoders.c:amdgpu_atombios_encoder_get_encoder_mode() {
    ...
    case DRM_MODE_CONNECTOR_DisplayPort:
        dig_connector = amdgpu_connector->con_priv;
        if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
            (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) {
                return ATOM_ENCODER_MODE_DP;
        }
    ...
}

and dce_v6_0_encoder_mode_set() calls dce_v6_0_afmt_setmode() whenever
ENCODER_MODE_IS_DP(em) is true.

Because dce_v6_0_afmt_setmode() checks connector->display_info.has_audio
without checking amdgpu_connector->audio != AMDGPU_AUDIO_DISABLE, won't
setting the audio connector property to off (AMDGPU_AUDIO_DISABLE) on an
audio-capable DisplayPort monitor still enable audio here?

[1] https://lore.kernel.org/r/20261103033914.21660-1-renpanpan@kylinos.cn

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103061147.25827-1-renpanpan@kylinos.cn?part=1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3] drm/amdgpu: Only enable HDMI audio if display supports it
  2026-11-03  6:11 [PATCH v3] drm/amdgpu: Only enable HDMI audio if display supports it Panpan Ren
  2026-11-03  6:27 ` sashiko-bot
@ 2026-11-03 11:49 ` Timur Kristóf
  1 sibling, 0 replies; 3+ messages in thread
From: Timur Kristóf @ 2026-11-03 11:49 UTC (permalink / raw)
  To: Panpan Ren, alexander.deucher, christian.koenig, simona
  Cc: amd-gfx, dri-devel, linux-kernel, stable, tzimmermann, lijo.lazar

On Tue, 2026-11-03 at 14:11 +0800, Panpan Ren wrote:
> From: renpanpan <renpanpan@kylinos.cn>
> 
> The amdgpu legacy DCE audio path (dce_v6/v8/v10) unconditionally
> calls
> audio_enable(pin, true) at the end of afmt_setmode(), regardless of
> whether the connected display advertises audio support in its EDID.
> 
> This causes a phantom HDMI audio output to appear for displays that
> have no audio capability (no basic audio bit, no Audio Data Block in
> EDID), because the GPU sets the AUDIO_ENABLED register bit, which
> drives the HDA codec's ELDV pin sense, making the codec report the
> jack as audio-available.
> 
> The radeon, nouveau, and dw-hdmi drivers all gate audio enablement on
> the display's audio capability. Apply the same check to amdgpu's DCE
> afmt_setmode functions, while still respecting the
> AMDGPU_AUDIO_ENABLE
> override for users who explicitly force audio on.
> 
> Fixes: e2cdf640cbb5 ("drm/amdgpu: add display controller
> implementation for si v10")
> Cc: stable@vger.kernel.org
> Signed-off-by: renpanpan <renpanpan@kylinos.cn>

Makes sense, thank you!

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>


> ---
> Changes in v3:
> - Also gate the initial audio_enable(pin, false) to avoid touching a
>   potentially shared audio pin when the display has no audio support
> 
> Changes in v2:
> - Respect AMDGPU_AUDIO_ENABLE override for users who force audio on
> - Add Fixes tag and Cc: stable@vger.kernel.org for stable backport
> 
>  drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 12 ++++++++----
>  drivers/gpu/drm/amd/amdgpu/dce_v6_0.c  | 12 ++++++++----
>  drivers/gpu/drm/amd/amdgpu/dce_v8_0.c  | 12 ++++++++----
>  3 files changed, 24 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> index f2977fe6d824..a8f5eb2394c6 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
> @@ -1555,9 +1555,11 @@ static void dce_v10_0_afmt_setmode(struct
> drm_encoder *encoder,
>  		bpc = amdgpu_crtc->bpc;
>  	}
>  
> -	/* disable audio prior to setting up hw */
> +	/* disable audio prior to setting up hw, unless the display
> has no audio */
>  	dig->afmt->pin = dce_v10_0_audio_get_pin(adev);
> -	dce_v10_0_audio_enable(adev, dig->afmt->pin, false);
> +	if (connector->display_info.has_audio ||
> +	    to_amdgpu_connector(connector)->audio ==
> AMDGPU_AUDIO_ENABLE)
> +		dce_v10_0_audio_enable(adev, dig->afmt->pin, false);
>  
>  	dce_v10_0_audio_set_dto(encoder, mode->clock);
>  
> @@ -1705,8 +1707,10 @@ static void dce_v10_0_afmt_setmode(struct
> drm_encoder *encoder,
>  	WREG32(mmAFMT_RAMP_CONTROL2 + dig->afmt->offset,
> 0x00000001);
>  	WREG32(mmAFMT_RAMP_CONTROL3 + dig->afmt->offset,
> 0x00000001);
>  
> -	/* enable audio after to setting up hw */
> -	dce_v10_0_audio_enable(adev, dig->afmt->pin, true);
> +	/* Only enable audio if the display supports it or is forced
> on */
> +	if (connector->display_info.has_audio ||
> +	    to_amdgpu_connector(connector)->audio ==
> AMDGPU_AUDIO_ENABLE)
> +		dce_v10_0_audio_enable(adev, dig->afmt->pin, true);
>  }
>  
>  static void dce_v10_0_afmt_enable(struct drm_encoder *encoder, bool
> enable)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> index c68de0fe1d7d..3cd9f1bb3a70 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
> @@ -1724,8 +1724,10 @@ static void dce_v6_0_afmt_setmode(struct
> drm_encoder *encoder,
>  		bpc = amdgpu_crtc->bpc;
>  	}
>  
> -	/* disable audio before setting up hw */
> -	dce_v6_0_audio_enable(adev, dig->afmt->pin, false);
> +	/* disable audio before setting up hw, unless the display
> has no audio */
> +	if (connector->display_info.has_audio ||
> +	    amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
> +		dce_v6_0_audio_enable(adev, dig->afmt->pin, false);
>  
>  	dce_v6_0_audio_set_mute(encoder, true);
>  	dce_v6_0_audio_write_speaker_allocation(encoder);
> @@ -1748,8 +1750,10 @@ static void dce_v6_0_afmt_setmode(struct
> drm_encoder *encoder,
>  		dce_v6_0_audio_dp_enable(encoder, 1);
>  	}
>  
> -	/* enable audio after setting up hw */
> -	dce_v6_0_audio_enable(adev, dig->afmt->pin, true);
> +	/* Only enable audio if the display supports it or is forced
> on */
> +	if (connector->display_info.has_audio ||
> +	    amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)
> +		dce_v6_0_audio_enable(adev, dig->afmt->pin, true);
>  }
>  
>  static void dce_v6_0_afmt_enable(struct drm_encoder *encoder, bool
> enable)
> diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> index c3906270f25e..eb1fcf0b39cc 100644
> --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
> @@ -1523,9 +1523,11 @@ static void dce_v8_0_afmt_setmode(struct
> drm_encoder *encoder,
>  		bpc = amdgpu_crtc->bpc;
>  	}
>  
> -	/* disable audio prior to setting up hw */
> +	/* disable audio prior to setting up hw, unless the display
> has no audio */
>  	dig->afmt->pin = dce_v8_0_audio_get_pin(adev);
> -	dce_v8_0_audio_enable(adev, dig->afmt->pin, false);
> +	if (connector->display_info.has_audio ||
> +	    to_amdgpu_connector(connector)->audio ==
> AMDGPU_AUDIO_ENABLE)
> +		dce_v8_0_audio_enable(adev, dig->afmt->pin, false);
>  
>  	dce_v8_0_audio_set_dto(encoder, mode->clock);
>  
> @@ -1653,8 +1655,10 @@ static void dce_v8_0_afmt_setmode(struct
> drm_encoder *encoder,
>  	WREG32(mmAFMT_RAMP_CONTROL2 + offset, 0x00000001);
>  	WREG32(mmAFMT_RAMP_CONTROL3 + offset, 0x00000001);
>  
> -	/* enable audio after setting up hw */
> -	dce_v8_0_audio_enable(adev, dig->afmt->pin, true);
> +	/* Only enable audio if the display supports it or is forced
> on */
> +	if (connector->display_info.has_audio ||
> +	    to_amdgpu_connector(connector)->audio ==
> AMDGPU_AUDIO_ENABLE)
> +		dce_v8_0_audio_enable(adev, dig->afmt->pin, true);
>  }
>  
>  static void dce_v8_0_afmt_enable(struct drm_encoder *encoder, bool
> enable)

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-03 11:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-03  6:11 [PATCH v3] drm/amdgpu: Only enable HDMI audio if display supports it Panpan Ren
2026-11-03  6:27 ` sashiko-bot
2026-11-03 11:49 ` Timur Kristóf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.