1 From 3e45488069e20b07b83d8cbba88c7fa2b205e559 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 25 Mar 2020 18:01:04 +0000
4 Subject: [PATCH] drm/vc4: Reset audio infoframe on encoder_enable if
7 If the encoder is disabled and re-enabled (eg mode change) all infoframes
8 are reset, whilst the audio subsystem know nothing about this change.
9 The driver therefore needs to reinstate the audio infoframe for
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
14 drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++++++++
15 drivers/gpu/drm/vc4/vc4_hdmi.h | 2 ++
16 2 files changed, 14 insertions(+)
18 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
19 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
20 @@ -344,8 +344,16 @@ static void vc4_hdmi_set_audio_infoframe
22 static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder)
24 + struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
26 vc4_hdmi_set_avi_infoframe(encoder);
27 vc4_hdmi_set_spd_infoframe(encoder);
29 + * If audio was streaming, then we need to reenabled the audio
30 + * infoframe here during encoder_enable.
32 + if (vc4_hdmi->audio.streaming)
33 + vc4_hdmi_set_audio_infoframe(encoder);
36 static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder)
37 @@ -825,6 +833,7 @@ static void vc4_hdmi_audio_reset(struct
38 struct device *dev = &vc4_hdmi->pdev->dev;
41 + vc4_hdmi->audio.streaming = false;
42 ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO);
44 dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);
45 @@ -928,6 +937,7 @@ static int vc4_hdmi_audio_trigger(struct
47 case SNDRV_PCM_TRIGGER_START:
48 vc4_hdmi_set_audio_infoframe(encoder);
49 + vc4_hdmi->audio.streaming = true;
51 if (vc4_hdmi->variant->phy_rng_enable)
52 vc4_hdmi->variant->phy_rng_enable(vc4_hdmi);
53 @@ -946,6 +956,8 @@ static int vc4_hdmi_audio_trigger(struct
54 if (vc4_hdmi->variant->phy_rng_disable)
55 vc4_hdmi->variant->phy_rng_disable(vc4_hdmi);
57 + vc4_hdmi->audio.streaming = false;
62 --- a/drivers/gpu/drm/vc4/vc4_hdmi.h
63 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
64 @@ -101,6 +101,8 @@ struct vc4_hdmi_audio {
66 struct snd_dmaengine_dai_dma_data dma_data;
67 struct snd_pcm_substream *substream;
72 /* General HDMI hardware state. */