Skip to contentSkip to conversation

drm/vc4: hdmi: Avoid ASoC error messages on startup

RFC PATCH In review Stefan Wahren 4 participants 10 messages Dec 29, 2020 – Jan 19, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 drm/vc4: hdmi: Avoid ASoC error messages on startup

During startup of Raspberry Pi 4 there seems to be a race between VC4 probing and Pulseaudio trying to open its PCM device:

ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19

Avoid these errors by returning EPROBE_DEFER in this situation.

---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +6 -4
index 5551062..e0f9357 100644
@@ -909,12 +909,14 @@ static int vc4_hdmi_audio_startup(struct snd_pcm_substream *substream,
 
 	vc4_hdmi->audio.substream = substream;
 
+	if (!encoder->crtc)
+		return -EPROBE_DEFER;
+
 	/*
-	 * If the HDMI encoder hasn't probed, or the encoder is
-	 * currently in DVI mode, treat the codec dai as missing.
+	 * If the HDMI encoder is currently in DVI mode,
+	 * treat the codec dai as missing.
 	 */
-	if (!encoder->crtc || !(HDMI_READ(HDMI_RAM_PACKET_CONFIG) &
-				VC4_HDMI_RAM_PACKET_ENABLE))
+	if (!(HDMI_READ(HDMI_RAM_PACKET_CONFIG) & VC4_HDMI_RAM_PACKET_ENABLE))
 		return -ENODEV;
 
 	ret = snd_pcm_hw_constraint_eld(substream->runtime, connector->eld);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Hi Maxime,

Am 29.12.20 um 16:36 schrieb Stefan Wahren:

Quoted 8 lines

During startup of Raspberry Pi 4 there seems to be a race between VC4 probing and Pulseaudio trying to open its PCM device:

ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19

Avoid these errors by returning EPROBE_DEFER in this situation.

should i resend without RFC?

Best regards
Stefan

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hi Stefan,

Quoted 6 lines · Stefan Wahren

Hi Maxime,

Am 29.12.20 um 16:36 schrieb Stefan Wahren:

Quoted 3 lines

During startup of Raspberry Pi 4 there seems to be a race between VC4 probing and Pulseaudio trying to open its PCM device:

Quoted 7 lines
Quoted 5 lines

ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19

Avoid these errors by returning EPROBE_DEFER in this situation.

should i resend without RFC?

Yeah, it looks reasonable enough to me :)

I'd like to get Mark's opinion before merging though

Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

Hi,

Quoted 7 lines · Mark Brown
Quoted 1 line · Maxime Ripard

I'd like to get Mark's opinion before merging though

I'm not sure what the question is here? I get CCed on a bunch of not obviously relevant DRM patches so there's a good chance I've just deleted some relevnat discussion.

The patch is question is here:
https://lore.kernel.org/dri-devel/[email protected]/

In particular, I'm not so sure whether it's fine to return -EPROBE_DEFER in the startup hook.

Thanks!
Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw
Quoted 9 lines · Maxime Ripard
Quoted 7 lines · Mark Brown
Quoted 1 line · Maxime Ripard

I'd like to get Mark's opinion before merging though

I'm not sure what the question is here? I get CCed on a bunch of not obviously relevant DRM patches so there's a good chance I've just deleted some relevnat discussion.

Quoted 5 lines

The patch is question is here:
https://lore.kernel.org/dri-devel/[email protected]/

In particular, I'm not so sure whether it's fine to return -EPROBE_DEFER in the startup hook.

I wouldn't expect that to do anything useful and IIRC that error code will end up in userspace which isn't good. If the driver wants to defer probe it should defer it from the probe() routine, after the driver has been instantiated I'm not sure what the expectation would be. In general a driver should acquire all resources it needs when probing.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Hi,

Am 15.01.21 um 19:39 schrieb Mark Brown:

Quoted 11 lines · Maxime Ripard
Quoted 10 lines · Mark Brown
Quoted 5 lines · Maxime Ripard
Quoted 1 line

I'd like to get Mark's opinion before merging though

I'm not sure what the question is here? I get CCed on a bunch of not obviously relevant DRM patches so there's a good chance I've just deleted some relevnat discussion.

The patch is question is here:
https://lore.kernel.org/dri-devel/[email protected]/
In particular, I'm not so sure whether it's fine to return -EPROBE_DEFER in the startup hook.

Quoted 5 lines

I wouldn't expect that to do anything useful and IIRC that error code will end up in userspace which isn't good. If the driver wants to defer probe it should defer it from the probe() routine, after the driver has been instantiated I'm not sure what the expectation would be. In general a driver should acquire all resources it needs when probing.

understand. Unfortunately, currently i don't have the time to investigate how we can achieve this with this drm driver.

Maybe some else can take over?

Regards
Stefan

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#7 lore raw

Hi Stefan, Maxime,

Quoted 20 lines · Stefan Wahren

Hi,

Am 15.01.21 um 19:39 schrieb Mark Brown:

Quoted 11 lines · Maxime Ripard
Quoted 10 lines · Mark Brown
Quoted 5 lines · Maxime Ripard
Quoted 1 line

I'd like to get Mark's opinion before merging though

I'm not sure what the question is here? I get CCed on a bunch of not obviously relevant DRM patches so there's a good chance I've just deleted some relevnat discussion.

The patch is question is here:
https://lore.kernel.org/dri-devel/[email protected]/
In particular, I'm not so sure whether it's fine to return -EPROBE_DEFER in the startup hook.

Quoted 5 lines

I wouldn't expect that to do anything useful and IIRC that error code will end up in userspace which isn't good. If the driver wants to defer probe it should defer it from the probe() routine, after the driver has been instantiated I'm not sure what the expectation would be. In general a driver should acquire all resources it needs when probing.

Quoted 4 lines

understand. Unfortunately, currently i don't have the time to investigate how we can achieve this with this drm driver.

Maybe some else can take over?

My two cents: IIUC it's a tricky one since components don't have a way to express dependencies. Somewhat similar to what happened with the DSI bus/display race. To what extent vc4-crtc has a dependency with vc4-hdmi? Couldn't we move vc4-hdmi component's registration at the end of vc4_crtc_bind()?

Regards,
Nicolas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#8 lore raw
Quoted 23 lines · Nicolas Saenz Julienne

Hi Stefan, Maxime,

Quoted 20 lines · Stefan Wahren

Hi,

Am 15.01.21 um 19:39 schrieb Mark Brown:

Quoted 16 lines · Maxime Ripard
Quoted 10 lines · Mark Brown
Quoted 5 lines · Maxime Ripard
Quoted 1 line

I'd like to get Mark's opinion before merging though

I'm not sure what the question is here? I get CCed on a bunch of not obviously relevant DRM patches so there's a good chance I've just deleted some relevnat discussion.

The patch is question is here:
https://lore.kernel.org/dri-devel/[email protected]/
In particular, I'm not so sure whether it's fine to return -EPROBE_DEFER in the startup hook.

I wouldn't expect that to do anything useful and IIRC that error code will end up in userspace which isn't good. If the driver wants to defer probe it should defer it from the probe() routine, after the driver has been instantiated I'm not sure what the expectation would be. In general a driver should acquire all resources it needs when probing.

Quoted 7 lines
Quoted 4 lines

understand. Unfortunately, currently i don't have the time to investigate how we can achieve this with this drm driver.

Maybe some else can take over?

My two cents: IIUC it's a tricky one since components don't have a way to express dependencies.

There's a way though :)

Components are bound in the order they've been added to the component list, so as long as the component we have a dependency on is added first, it's fine.

The issue here is that the HDMI devices are added first:
https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/vc4/vc4_drv.c#L334

We could just move the HDMI driver after the CRTC one and we would solve it. I'm not sure if it has any other side effects though.

Quoted 1 line

Somewhat similar to what happened with the DSI bus/display race.

DSI is a bit different, especially on vc4 since the panel driver doesn't sit on the DSI bus in DT and as such isn't added by the bus code when the controller is added.

Maxime

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Tested-by Reviewed-by on v1 1/1
#9 lore raw
In reply to Stefan Wahren
Quoted 9 lines · Stefan Wahren

During startup of Raspberry Pi 4 there seems to be a race between VC4 probing and Pulseaudio trying to open its PCM device:

    ASoC: error at snd_soc_dai_startup on fef05700.hdmi: -19

Avoid these errors by returning EPROBE_DEFER in this situation.

---

Seems reasonable to me:

Regards,
Nicolas

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel