alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
	MANAGEM..." <alsa-devel@alsa-project.org>,
	open list <linux-kernel@vger.kernel.org>,
	Takashi Iwai <tiwai@suse.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Ravulapati Vishnu vardhan rao
	<Vishnuvardhanrao.Ravulapati@amd.com>,
	Mark Brown <broonie@kernel.org>,
	Alexander.Deucher@amd.com
Subject: [alsa-devel] [PATCH 5/7] ASoC: amd: add ACP3x TDM mode support
Date: Tue, 1 Oct 2019 06:28:13 +0530	[thread overview]
Message-ID: <1569891524-18875-5-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com> (raw)
In-Reply-To: <1569891524-18875-1-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com>

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@amd.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

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-09-30 14:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-01  0:58 [alsa-devel] [PATCH 1/7] ASoC: amd: No need PCI-MSI interrupts Ravulapati Vishnu vardhan rao
2019-10-01  0:58 ` [alsa-devel] [PATCH 2/7] ASoC: amd: Registering device endpoints using MFD framework Ravulapati Vishnu vardhan rao
2019-10-01  6:45   ` Lee Jones
2019-10-01 10:00     ` vishnu
2019-10-01 12:00       ` Lee Jones
2019-10-01 18:53         ` Deucher, Alexander
2019-10-02 12:37           ` Lee Jones
2019-10-02 13:11             ` Deucher, Alexander
2019-10-02 13:35               ` Lee Jones
2019-10-10 13:08                 ` RAVULAPATI, VISHNU VARDHAN RAO
2019-10-14  7:03                   ` Lee Jones
2019-10-17  9:26                     ` vishnu
2019-10-01  0:58 ` [alsa-devel] [PATCH 3/7] ASoC: amd: Refactoring of DAI from DMA driver Ravulapati Vishnu vardhan rao
2019-10-01  0:58 ` [alsa-devel] [PATCH 4/7] ASoC: amd: Enabling I2S instance in DMA and DAI Ravulapati Vishnu vardhan rao
2019-10-01  0:58 ` Ravulapati Vishnu vardhan rao [this message]
2019-10-01  0:58 ` [alsa-devel] [PATCH 6/7] ASoC: AMD: handle ACP3x i2s-sp watermark interrupt Ravulapati Vishnu vardhan rao
2019-10-01  0:58 ` [alsa-devel] [PATCH 7/7] ASoc: amd: Added ACP3x system resume and runtime pm ops Ravulapati Vishnu vardhan rao
2019-10-01 17:23 ` [alsa-devel] [PATCH 1/7] ASoC: amd: No need PCI-MSI interrupts Deucher, Alexander
2019-10-01 17:29   ` Mark Brown
2019-10-10 10:40     ` vishnu
2019-10-17  9:33       ` vishnu
2019-10-17 11:12         ` Mark Brown
2019-10-17 13:56         ` Deucher, Alexander
2019-10-17  9:31     ` vishnu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1569891524-18875-5-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com \
    --to=vishnuvardhanrao.ravulapati@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).