[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1569891524-18875-5-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com>
Date: Tue, 1 Oct 2019 06:28:13 +0530
From: Ravulapati Vishnu vardhan rao
<Vishnuvardhanrao.Ravulapati@....com>
To: unlisted-recipients:; (no To-header on input)
CC: <Alexander.Deucher@....com>,
Ravulapati Vishnu vardhan rao
<Vishnuvardhanrao.Ravulapati@....com>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
"Takashi Iwai" <tiwai@...e.com>,
"moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..."
<alsa-devel@...a-project.org>,
open list <linux-kernel@...r.kernel.org>
Subject: [PATCH 5/7] ASoC: amd: add ACP3x TDM mode support
ACP3x I2S (CPU DAI) can act in normal I2S and TDM modes. Added support
for TDM mode. Desired mode can be selected from ASoC machine driver.
Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@....com>
---
sound/soc/amd/raven/acp3x-i2s.c | 36 ++++++++++++++++++++++++++----------
1 file changed, 26 insertions(+), 10 deletions(-)
diff --git a/sound/soc/amd/raven/acp3x-i2s.c b/sound/soc/amd/raven/acp3x-i2s.c
index 4511b9b..312207b 100644
--- a/sound/soc/amd/raven/acp3x-i2s.c
+++ b/sound/soc/amd/raven/acp3x-i2s.c
@@ -43,7 +43,8 @@ static int acp3x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
u32 rx_mask, int slots, int slot_width)
{
u32 val = 0;
- u16 slot_len;
+ u32 mode = 0;
+ u16 slot_len, flen;
struct i2s_dev_data *adata = snd_soc_dai_get_drvdata(cpu_dai);
@@ -64,16 +65,31 @@ static int acp3x_i2s_set_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
return -EINVAL;
}
- val = rv_readl(adata->acp3x_base + mmACP_BTTDM_ITER);
- rv_writel((val | 0x2), adata->acp3x_base + mmACP_BTTDM_ITER);
- val = rv_readl(adata->acp3x_base + mmACP_BTTDM_IRER);
- rv_writel((val | 0x2), adata->acp3x_base + mmACP_BTTDM_IRER);
-
- val = (FRM_LEN | (slots << 15) | (slot_len << 18));
- rv_writel(val, adata->acp3x_base + mmACP_BTTDM_TXFRMT);
- rv_writel(val, adata->acp3x_base + mmACP_BTTDM_RXFRMT);
+ /* Enable I2S / BT channels TDM and respective
+ * I2S/BT`s TX/RX Formats frame lengths.
+ */
+ flen = (FRM_LEN | (slots << 15) | (slot_len << 18));
+
+ mode = rv_readl(adata->acp3x_base + mmACP_BTTDM_IER);
+ if (mode) {
+ val = rv_readl(adata->acp3x_base + mmACP_BTTDM_ITER);
+ rv_writel((val | 0x2), adata->acp3x_base + mmACP_BTTDM_ITER);
+ rv_writel(flen, adata->acp3x_base + mmACP_BTTDM_TXFRMT);
+ val = rv_readl(adata->acp3x_base + mmACP_BTTDM_IRER);
+ rv_writel((val | 0x2), adata->acp3x_base + mmACP_BTTDM_IRER);
+ rv_writel(flen, adata->acp3x_base + mmACP_BTTDM_RXFRMT);
+ }
- adata->tdm_fmt = val;
+ mode = rv_readl(adata->acp3x_base + mmACP_I2STDM_IER);
+ if (mode) {
+ val = rv_readl(adata->acp3x_base + mmACP_I2STDM_ITER);
+ rv_writel((val | 0x2), adata->acp3x_base + mmACP_I2STDM_ITER);
+ rv_writel(flen, adata->acp3x_base + mmACP_I2STDM_TXFRMT);
+ val = rv_readl(adata->acp3x_base + mmACP_I2STDM_IRER);
+ rv_writel((val | 0x2), adata->acp3x_base + mmACP_I2STDM_IRER);
+ rv_writel(flen, adata->acp3x_base + mmACP_I2STDM_RXFRMT);
+ }
+ adata->tdm_fmt = flen;
return 0;
}
--
2.7.4
Powered by blists - more mailing lists