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 <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1656600
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2018-02-13 09:38:43 +00:00
committed by Sameer Pujar
parent 2cae54a567
commit 3b6209c985

View File

@@ -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",