On Fri, Aug 15, 2025 at 11:23 AM <2564278...@qq.com> wrote: > > From: Wang Jiang <jiangw...@kylinos.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 <jiangw...@kylinos.cn> > --- > drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 21 ++++++++++++++++-----
This only fixes up DCE6. I would suggest one of the following to fix this: 1. Revert the changes from 3c021931023a in atombios_encoders.c or 2. Add amdgpu_connector->is_hdmi and set it when connector->display_info.is_hdmi is valid and use that rather than connector->display_info.is_hdmi. Alex > 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 >