Skip to content

Commit f7a8c77

Browse files
6by9popcornmix
authored andcommitted
drm/vc4: Reset audio infoframe on encoder_enable if previously streaming
If the encoder is disabled and re-enabled (eg mode change) all infoframes are reset, whilst the audio subsystem know nothing about this change. The driver therefore needs to reinstate the audio infoframe for itself. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
1 parent fc1740f commit f7a8c77

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

‎drivers/gpu/drm/vc4/vc4_hdmi.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,16 @@ static void vc4_hdmi_set_audio_infoframe(struct drm_encoder *encoder)
341341

342342
static void vc4_hdmi_set_infoframes(struct drm_encoder *encoder)
343343
{
344+
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
345+
344346
vc4_hdmi_set_avi_infoframe(encoder);
345347
vc4_hdmi_set_spd_infoframe(encoder);
348+
/*
349+
* If audio was streaming, then we need to reenabled the audio
350+
* infoframe here during encoder_enable.
351+
*/
352+
if (vc4_hdmi->audio.streaming)
353+
vc4_hdmi_set_audio_infoframe(encoder);
346354
}
347355

348356
static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder)
@@ -806,6 +814,7 @@ static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi)
806814
struct device *dev = &vc4_hdmi->pdev->dev;
807815
int ret;
808816

817+
vc4_hdmi->audio.streaming = false;
809818
ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO);
810819
if (ret)
811820
dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);
@@ -909,6 +918,7 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
909918
switch (cmd) {
910919
case SNDRV_PCM_TRIGGER_START:
911920
vc4_hdmi_set_audio_infoframe(encoder);
921+
vc4_hdmi->audio.streaming = true;
912922

913923
if (vc4_hdmi->variant->phy_rng_enable)
914924
vc4_hdmi->variant->phy_rng_enable(vc4_hdmi);
@@ -927,6 +937,8 @@ static int vc4_hdmi_audio_trigger(struct snd_pcm_substream *substream, int cmd,
927937
if (vc4_hdmi->variant->phy_rng_disable)
928938
vc4_hdmi->variant->phy_rng_disable(vc4_hdmi);
929939

940+
vc4_hdmi->audio.streaming = false;
941+
930942
break;
931943
default:
932944
break;

‎drivers/gpu/drm/vc4/vc4_hdmi.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ struct vc4_hdmi_audio {
101101
int channels;
102102
struct snd_dmaengine_dai_dma_data dma_data;
103103
struct snd_pcm_substream *substream;
104+
105+
bool streaming;
104106
};
105107

106108
/* General HDMI hardware state. */

0 commit comments

Comments
 (0)