56106a42743253056364a6d8cd1eeaf10a7c44e4
[openwrt/staging/mkresin.git] /
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
5 previously streaming
6
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
10 itself.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++++++++
15 drivers/gpu/drm/vc4/vc4_hdmi.h | 2 ++
16 2 files changed, 14 insertions(+)
17
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
21
22 static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder)
23 {
24 + struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
25 +
26 vc4_hdmi_set_avi_infoframe(encoder);
27 vc4_hdmi_set_spd_infoframe(encoder);
28 + /*
29 + * If audio was streaming, then we need to reenabled the audio
30 + * infoframe here during encoder_enable.
31 + */
32 + if (vc4_hdmi->audio.streaming)
33 + vc4_hdmi_set_audio_infoframe(encoder);
34 }
35
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;
39 int ret;
40
41 + vc4_hdmi->audio.streaming = false;
42 ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO);
43 if (ret)
44 dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);
45 @@ -928,6 +937,7 @@ static int vc4_hdmi_audio_trigger(struct
46 switch (cmd) {
47 case SNDRV_PCM_TRIGGER_START:
48 vc4_hdmi_set_audio_infoframe(encoder);
49 + vc4_hdmi->audio.streaming = true;
50
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);
56
57 + vc4_hdmi->audio.streaming = false;
58 +
59 break;
60 default:
61 break;
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 {
65 int channels;
66 struct snd_dmaengine_dai_dma_data dma_data;
67 struct snd_pcm_substream *substream;
68 +
69 + bool streaming;
70 };
71
72 /* General HDMI hardware state. */