diff mbox series

drm/radeon: Fix spurious unplug event on radeon HDMI

Message ID 20241115-hdmi-audio-radeon-connectors-v1-1-d6d66d3128dd@chromium.org (mailing list archive)
State New
Headers show
Series drm/radeon: Fix spurious unplug event on radeon HDMI | expand

Commit Message

Steven 'Steve' Kendall Nov. 15, 2024, 9:17 p.m. UTC
On several HP models (tested on HP 3125 and HP Probook 455 G2),
spurious unplug events are emitted upon login on Chrome OS.
This is likely due to the way Chrome OS restarts graphics
upon login, so it's possible it's an issue on other
distributions but not as common, though I haven't
reproduced the issue elsewhere.
Use logic from an earlier version of the merged change
(see link below) which iterates over connectors and finds
matching encoders, rather than the other way around.
Also fixes an issue with screen mirroring on Chrome OS.
I've deployed this patch on Fedora and did not observe
any regression on these devices.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1569#note_1603002
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3771
Fixes: 20ea34710f7b ("drm/radeon: Add HD-audio component notifier support (v6)")
Signed-off-by: Steven 'Steve' Kendall <skend@chromium.org>
---
 drivers/gpu/drm/radeon/radeon_audio.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)


---
base-commit: 2d5404caa8c7bb5c4e0435f94b28834ae5456623
change-id: 20241115-hdmi-audio-radeon-connectors-f8ffac989b0d

Best regards,

Comments

Alex Deucher Nov. 18, 2024, 3:37 p.m. UTC | #1
Applied.  Thanks!

Alex

On Sat, Nov 16, 2024 at 4:51 AM Steven 'Steve' Kendall
<skend@chromium.org> wrote:
>
> On several HP models (tested on HP 3125 and HP Probook 455 G2),
> spurious unplug events are emitted upon login on Chrome OS.
> This is likely due to the way Chrome OS restarts graphics
> upon login, so it's possible it's an issue on other
> distributions but not as common, though I haven't
> reproduced the issue elsewhere.
> Use logic from an earlier version of the merged change
> (see link below) which iterates over connectors and finds
> matching encoders, rather than the other way around.
> Also fixes an issue with screen mirroring on Chrome OS.
> I've deployed this patch on Fedora and did not observe
> any regression on these devices.
>
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/1569#note_1603002
> Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3771
> Fixes: 20ea34710f7b ("drm/radeon: Add HD-audio component notifier support (v6)")
> Signed-off-by: Steven 'Steve' Kendall <skend@chromium.org>
> ---
>  drivers/gpu/drm/radeon/radeon_audio.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
> index 47aa06a9a942..5b69cc8011b4 100644
> --- a/drivers/gpu/drm/radeon/radeon_audio.c
> +++ b/drivers/gpu/drm/radeon/radeon_audio.c
> @@ -760,16 +760,20 @@ static int radeon_audio_component_get_eld(struct device *kdev, int port,
>         if (!rdev->audio.enabled || !rdev->mode_info.mode_config_initialized)
>                 return 0;
>
> -       list_for_each_entry(encoder, &rdev_to_drm(rdev)->mode_config.encoder_list, head) {
> +       list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
> +               const struct drm_connector_helper_funcs *connector_funcs =
> +                               connector->helper_private;
> +               encoder = connector_funcs->best_encoder(connector);
> +
> +               if (!encoder)
> +                       continue;
> +
>                 if (!radeon_encoder_is_digital(encoder))
>                         continue;
>                 radeon_encoder = to_radeon_encoder(encoder);
>                 dig = radeon_encoder->enc_priv;
>                 if (!dig->pin || dig->pin->id != port)
>                         continue;
> -               connector = radeon_get_connector_for_encoder(encoder);
> -               if (!connector)
> -                       continue;
>                 *enabled = true;
>                 ret = drm_eld_size(connector->eld);
>                 memcpy(buf, connector->eld, min(max_bytes, ret));
>
> ---
> base-commit: 2d5404caa8c7bb5c4e0435f94b28834ae5456623
> change-id: 20241115-hdmi-audio-radeon-connectors-f8ffac989b0d
>
> Best regards,
> --
> Steven 'Steve' Kendall <skend@chromium.org>
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/radeon/radeon_audio.c b/drivers/gpu/drm/radeon/radeon_audio.c
index 47aa06a9a942..5b69cc8011b4 100644
--- a/drivers/gpu/drm/radeon/radeon_audio.c
+++ b/drivers/gpu/drm/radeon/radeon_audio.c
@@ -760,16 +760,20 @@  static int radeon_audio_component_get_eld(struct device *kdev, int port,
 	if (!rdev->audio.enabled || !rdev->mode_info.mode_config_initialized)
 		return 0;
 
-	list_for_each_entry(encoder, &rdev_to_drm(rdev)->mode_config.encoder_list, head) {
+	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+		const struct drm_connector_helper_funcs *connector_funcs =
+				connector->helper_private;
+		encoder = connector_funcs->best_encoder(connector);
+
+		if (!encoder)
+			continue;
+
 		if (!radeon_encoder_is_digital(encoder))
 			continue;
 		radeon_encoder = to_radeon_encoder(encoder);
 		dig = radeon_encoder->enc_priv;
 		if (!dig->pin || dig->pin->id != port)
 			continue;
-		connector = radeon_get_connector_for_encoder(encoder);
-		if (!connector)
-			continue;
 		*enabled = true;
 		ret = drm_eld_size(connector->eld);
 		memcpy(buf, connector->eld, min(max_bytes, ret));