MLK-18690-2: hdmi: Add audio info frame
authorSandor Yu <Sandor.yu@nxp.com>
Tue, 26 Jun 2018 08:49:04 +0000 (16:49 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Add audio info frame for hdp hdmi driver.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
drivers/gpu/drm/imx/hdp/imx-hdp-audio.c

index 40313e0..e77bc90 100644 (file)
@@ -60,6 +60,30 @@ static int select_N_index(u32 pclk)
        return i;
 }
 
+static void imx_hdmi_audio_avi_set(state_struct *state,
+                                               u32 channels)
+{
+       struct hdmi_audio_infoframe frame;
+       u8 buf[32];
+       int ret;
+
+       hdmi_audio_infoframe_init(&frame);
+
+       frame.channels = channels;
+       frame.coding_type = HDMI_AUDIO_CODING_TYPE_PCM;
+
+       ret = hdmi_audio_infoframe_pack(&frame, buf + 1, sizeof(buf) - 1);
+       if (ret < 0) {
+               DRM_ERROR("failed to pack audio infoframe: %d\n", ret);
+               return;
+       }
+
+       buf[0] = 0;
+
+       CDN_API_InfoframeSet(state, 1, sizeof(buf),
+                                   (u32 *)buf, HDMI_INFOFRAME_TYPE_AUDIO);
+}
+
 static u32 imx_hdp_audio(struct imx_hdp *hdmi, AUDIO_TYPE type, u32 sample_rate, u32 channels, u32 width)
 {
        AUDIO_FREQ  freq;
@@ -126,6 +150,10 @@ static u32 imx_hdp_audio(struct imx_hdp *hdmi, AUDIO_TYPE type, u32 sample_rate,
                                hdmi->audio_type,
                                ncts_n,
                                AUDIO_MUTE_MODE_UNMUTE);
+
+       if (hdmi->audio_type == CDN_HDMITX_TYPHOON ||
+                       hdmi->audio_type == CDN_HDMITX_KIRAN)
+               imx_hdmi_audio_avi_set(state, channels);
        return 0;
 }