Hi, On Mon, 2019-03-04 at 15:52 +0100, Maxime Ripard wrote: > The current code assumes as soon as the device is an HDMI one that it > supports an audio sink. However, strictly speaking, this is exposed as a > separate part of EDID. > > This can be checked through the drm_detect_monitor_audio function, so let's > use it and make sure that we can use the HDMI monitor as an output before > sending sound. > > Signed-off-by: Maxime Ripard <maxime.rip...@bootlin.com>
Reviewed-by: Paul Kocialkowski <paul.kocialkow...@bootlin.com> Cheers, Paul > --- > drivers/gpu/drm/vc4/vc4_hdmi.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > index 88fd5df7e7dc..a1bdc065c47c 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > @@ -109,6 +109,7 @@ struct vc4_hdmi_encoder { > struct vc4_encoder base; > bool hdmi_monitor; > bool limited_rgb_range; > + bool monitor_has_audio; > }; > > static inline struct vc4_hdmi_encoder * > @@ -278,6 +279,7 @@ static int vc4_hdmi_connector_get_modes(struct > drm_connector *connector) > return -ENODEV; > > vc4_encoder->hdmi_monitor = drm_detect_hdmi_monitor(edid); > + vc4_encoder->monitor_has_audio = drm_detect_monitor_audio(edid); > > drm_connector_update_edid_property(connector, edid); > ret = drm_add_edid_modes(connector, edid); > @@ -785,9 +787,13 @@ static int vc4_hdmi_audio_startup(struct > snd_pcm_substream *substream, > { > struct vc4_hdmi *hdmi = dai_to_hdmi(dai); > struct drm_encoder *encoder = hdmi->encoder; > + struct vc4_hdmi_encoder *vc4_encoder = to_vc4_hdmi_encoder(encoder); > struct vc4_dev *vc4 = to_vc4_dev(encoder->dev); > int ret; > > + if (!vc4_encoder->monitor_has_audio) > + return -ENODEV; > + > if (hdmi->audio.substream && hdmi->audio.substream != substream) > return -EINVAL; > -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel