From a8376d64f49dd280599377ecfe3374ea1936ded1 Mon Sep 17 00:00:00 2001 From: smj Date: Mon, 19 Sep 2016 11:08:35 +0800 Subject: [PATCH] video: rockchip: hdmi: v2: improved the hdmi nlpcm_mode for bitstream output - Add the corresponding to samplerate for bitstream - Add the audio type judgement when open the mode Change-Id: Ic5bbd2ee214e707fd3695f1a1f359cd43fed9618 Signed-off-by: smj Signed-off-by: Sugar Zhang --- .../hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c index 3b75d7143337..14a3a3067cd6 100644 --- a/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c +++ b/drivers/video/rockchip/hdmi/rockchip-hdmiv2/rockchip_hdmiv2_hw.c @@ -1899,15 +1899,35 @@ static int hdmi_dev_config_audio(struct hdmi *hdmi, struct hdmi_audio *audio) else hdmi_writel(hdmi_dev, AUD_CONF2, 0x0); usleep_range(90, 100); - if (channel == I2S_CHANNEL_7_8) { - HDMIDBG("hbr mode.\n"); - hdmi_writel(hdmi_dev, AUD_CONF2, 0x1); - word_length = I2S_24BIT_SAMPLE; - } else if ((audio->rate == HDMI_AUDIO_FS_48000) || - (audio->rate == HDMI_AUDIO_FS_192000)) { - HDMIDBG("nlpcm mode.\n"); - hdmi_writel(hdmi_dev, AUD_CONF2, 0x2); - word_length = I2S_24BIT_SAMPLE; + /* + * when we try to use hdmi nlpcm mode + * we should use set AUD_CONF2 to open this route and set + * word_length to 24bit for b.p.c.u.v with 16bit raw data + * when the bitstream data up to 8 channel, we should use + * the hdmi hbr mode + * HBR Mode : Dolby TrueHD + * Dolby Atmos + * DTS-HDMA + * NLPCM Mode : + * FS_32000 FS_44100 FS_48000 : Dolby Digital & DTS + * FS_176400 FS_192000 : Dolby Digital Plus + */ + if (audio->type == HDMI_AUDIO_NLPCM) { + if (channel == I2S_CHANNEL_7_8) { + HDMIDBG("hbr mode.\n"); + hdmi_writel(hdmi_dev, AUD_CONF2, 0x1); + word_length = I2S_24BIT_SAMPLE; + } else if ((audio->rate == HDMI_AUDIO_FS_32000) || + (audio->rate == HDMI_AUDIO_FS_44100) || + (audio->rate == HDMI_AUDIO_FS_48000) || + (audio->rate == HDMI_AUDIO_FS_176400) || + (audio->rate == HDMI_AUDIO_FS_192000)) { + HDMIDBG("nlpcm mode.\n"); + hdmi_writel(hdmi_dev, AUD_CONF2, 0x2); + word_length = I2S_24BIT_SAMPLE; + } else { + hdmi_writel(hdmi_dev, AUD_CONF2, 0x0); + } } else { if (design_id >= 0x21) hdmi_writel(hdmi_dev, AUD_CONF2, 0x4); -- 2.34.1