From 7704ad9bb06b97de75437700dc08549c99d16f0c Mon Sep 17 00:00:00 2001 From: Sayak Ghosh Choudhury Date: Tue, 24 Apr 2012 20:09:09 +0530 Subject: hdmi: Set INJECT_NULL_SAMPLE only for stereo streams Bug 953210 Change-Id: Id40b3fe90174a2a8c9a6faf3f35f61d9f7eeb642 Signed-off-by: Sayak Ghosh Choudhury Reviewed-on: http://git-master/r/98477 Reviewed-by: Simone Willett Tested-by: Simone Willett --- arch/arm/mach-tegra/include/mach/hdmi-audio.h | 1 + drivers/video/tegra/dc/hdmi.c | 31 ++++++++++++++++++++++++++- sound/pci/hda/patch_hdmi.c | 6 ++++++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-tegra/include/mach/hdmi-audio.h b/arch/arm/mach-tegra/include/mach/hdmi-audio.h index 7d760690081a..35555504037a 100644 --- a/arch/arm/mach-tegra/include/mach/hdmi-audio.h +++ b/arch/arm/mach-tegra/include/mach/hdmi-audio.h @@ -42,5 +42,6 @@ enum { int tegra_hdmi_setup_audio_freq_source(unsigned audio_freq, unsigned audio_source); int tegra_hdmi_setup_hda_presence(void); +int tegra_hdmi_audio_null_sample_inject(bool on); #endif /* __MACH_TEGRA_HDMI_AUDIO_H */ diff --git a/drivers/video/tegra/dc/hdmi.c b/drivers/video/tegra/dc/hdmi.c index 9c96badee373..112c1aa19e39 100644 --- a/drivers/video/tegra/dc/hdmi.c +++ b/drivers/video/tegra/dc/hdmi.c @@ -94,6 +94,7 @@ struct tegra_dc_hdmi_data { bool clk_enabled; unsigned audio_freq; unsigned audio_source; + bool audio_inject_null; bool dvi; }; @@ -1820,7 +1821,10 @@ static int tegra_dc_hdmi_setup_audio(struct tegra_dc *dc, unsigned audio_freq, a_source = AUDIO_CNTRL0_SOURCE_SELECT_SPDIF; #if !defined(CONFIG_ARCH_TEGRA_2x_SOC) - tegra_hdmi_writel(hdmi,a_source | AUDIO_CNTRL0_INJECT_NULLSMPL, + if (hdmi->audio_inject_null) + a_source |= AUDIO_CNTRL0_INJECT_NULLSMPL; + + tegra_hdmi_writel(hdmi,a_source, HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_0); tegra_hdmi_writel(hdmi, AUDIO_CNTRL0_ERROR_TOLERANCE(6) | @@ -1923,6 +1927,31 @@ int tegra_hdmi_setup_audio_freq_source(unsigned audio_freq, unsigned audio_sourc EXPORT_SYMBOL(tegra_hdmi_setup_audio_freq_source); #if !defined(CONFIG_ARCH_TEGRA_2x_SOC) +int tegra_hdmi_audio_null_sample_inject(bool on) +{ + struct tegra_dc_hdmi_data *hdmi = dc_hdmi; + unsigned int val = 0; + + if (!hdmi) + return -EAGAIN; + + if (hdmi->audio_inject_null != on) { + hdmi->audio_inject_null = on; + if (hdmi->clk_enabled) { + val = tegra_hdmi_readl(hdmi, + HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_0); + val &= ~AUDIO_CNTRL0_INJECT_NULLSMPL; + if (on) + val |= AUDIO_CNTRL0_INJECT_NULLSMPL; + tegra_hdmi_writel(hdmi,val, + HDMI_NV_PDISP_SOR_AUDIO_CNTRL0_0); + } + } + + return 0; +} +EXPORT_SYMBOL(tegra_hdmi_audio_null_sample_inject); + int tegra_hdmi_setup_hda_presence() { struct tegra_dc_hdmi_data *hdmi = dc_hdmi; diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index fcc32f590874..5942395099ad 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1112,6 +1112,12 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo, #if defined(CONFIG_SND_HDA_PLATFORM_NVIDIA_TEGRA) && defined(CONFIG_TEGRA_DC) if (codec->preset->id == 0x10de0020) { int err = 0; + + if (substream->runtime->channels == 2) + tegra_hdmi_audio_null_sample_inject(true); + else + tegra_hdmi_audio_null_sample_inject(false); + /* Set hdmi:audio freq and source selection*/ err = tegra_hdmi_setup_audio_freq_source( substream->runtime->rate, HDA); -- cgit v1.2.3