From 3b6209c985636b328d87d38484e55c3189f306c9 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Tue, 13 Feb 2018 09:38:43 +0000 Subject: [PATCH] ASoC: tegra-alt: Fix support for I2S DSP-B mode The Tegra sound machine driver only set the TDM slots for DSP-A mode. The TDM slots also need to be set for DSP-B mode so update the machine driver to set the slots for DSP-B mode as well. The 'tx_mask' and 'rx_mask' for for TDM modes is the same and will always be the same. So simplify the code by having a single mask variable. Finally, remove unnecessary initialisation of 'err'. Bug 2025176 Change-Id: I98630772432c2083bf4b4cf37bdfaf2f4c4514e5 Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/1656600 GVS: Gerrit_Virtual_Submit Reviewed-by: Sameer Pujar Reviewed-by: Bibek Basu Reviewed-by: mobile promotions Tested-by: mobile promotions --- .../tegra_machine_driver_mobile.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c index 1e833e40..1018af38 100644 --- a/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c +++ b/sound/soc/tegra-alt/machine_drivers/tegra_machine_driver_mobile.c @@ -674,8 +674,7 @@ static int tegra_machine_set_params(struct snd_soc_card *card, int channels, u64 formats) { - unsigned int tx_mask = (1 << channels) - 1; - unsigned int rx_mask = (1 << channels) - 1; + unsigned int mask = (1 << channels) - 1; int idx = 0, err = 0; u64 format_k; @@ -709,12 +708,9 @@ static int tegra_machine_set_params(struct snd_soc_card *card, && (idx < num_of_dai_links)) { unsigned int fmt; - err = 0; /* TODO: why below overrite is needed */ dai_params->formats = formats; - fmt = rtd->dai_link->dai_fmt; - err = tegra_machine_set_bclk_ratio(machine, rtd); if (err < 0) { @@ -724,12 +720,15 @@ static int tegra_machine_set_params(struct snd_soc_card *card, return err; } + fmt = rtd->dai_link->dai_fmt; + fmt &= SND_SOC_DAIFMT_FORMAT_MASK; + /* set TDM slot mask */ - if ((fmt & SND_SOC_DAIFMT_FORMAT_MASK) == - SND_SOC_DAIFMT_DSP_A) { + if (fmt == SND_SOC_DAIFMT_DSP_A || + fmt == SND_SOC_DAIFMT_DSP_B) { err = snd_soc_dai_set_tdm_slot( - rtd->cpu_dai, - tx_mask, rx_mask, 0, 0); + rtd->cpu_dai, mask, + mask, 0, 0); if (err < 0) { dev_err(card->dev, "%s cpu DAI slot mask not set\n",