From: Dan Murphy <dmurphy@ti.com>
To: <lgirdwood@gmail.com>, <broonie@kernel.org>, <perex@perex.cz>,
<tiwai@suse.com>
Cc: <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
Dan Murphy <dmurphy@ti.com>
Subject: [PATCH 2/2] ASoC: tlv320adcx140: Add tx offset slot programming
Date: Thu, 9 Jul 2020 13:51:29 -0500 [thread overview]
Message-ID: <20200709185129.10505-2-dmurphy@ti.com> (raw)
In-Reply-To: <20200709185129.10505-1-dmurphy@ti.com>
Add the TX offset slot programming. There is no RX offset slot
register.
Since there is no RX offset the check for slot symmetry can be removed.
Signed-off-by: Dan Murphy <dmurphy@ti.com>
---
sound/soc/codecs/tlv320adcx140.c | 40 ++++++++------------------------
1 file changed, 10 insertions(+), 30 deletions(-)
diff --git a/sound/soc/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c
index f884abdb576e..d900af967f8c 100644
--- a/sound/soc/codecs/tlv320adcx140.c
+++ b/sound/soc/codecs/tlv320adcx140.c
@@ -646,6 +646,8 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
u8 iface_reg1 = 0;
u8 iface_reg2 = 0;
+ int offset = 0;
+ int width = adcx140->slot_width;
/* set master/slave audio interface */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
@@ -688,7 +690,10 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
iface_reg1 |= ADCX140_LEFT_JUST_BIT;
break;
case SND_SOC_DAIFMT_DSP_A:
+ offset += (adcx140->tdm_delay * width + 1);
+ break;
case SND_SOC_DAIFMT_DSP_B:
+ offset += adcx140->tdm_delay * width;
break;
default:
dev_err(component->dev, "Invalid DAI interface format\n");
@@ -705,6 +710,11 @@ static int adcx140_set_dai_fmt(struct snd_soc_dai *codec_dai,
snd_soc_component_update_bits(component, ADCX140_MST_CFG0,
ADCX140_BCLK_FSYNC_MASTER, iface_reg2);
+ /* Configure data offset */
+ snd_soc_component_update_bits(component, ADCX140_ASI_CFG1,
+ ADCX140_TX_OFFSET_MASK, offset);
+
+
return 0;
}
@@ -716,11 +726,6 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai,
struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
unsigned int lsb;
- if (tx_mask != rx_mask) {
- dev_err(component->dev, "tx and rx masks must be symmetric\n");
- return -EINVAL;
- }
-
/* TDM based on DSP mode requires slots to be adjacent */
lsb = __ffs(tx_mask);
if ((lsb + 1) != __fls(tx_mask)) {
@@ -745,34 +750,9 @@ static int adcx140_set_dai_tdm_slot(struct snd_soc_dai *codec_dai,
return 0;
}
-static int adcx140_prepare(struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
-{
- struct snd_soc_component *component = dai->component;
- struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
- int offset = 0;
- int width = adcx140->slot_width;
-
- if (!width)
- width = substream->runtime->sample_bits;
-
- /* TDM slot selection only valid in DSP_A/_B mode */
- if (adcx140->dai_fmt == SND_SOC_DAIFMT_DSP_A)
- offset += (adcx140->tdm_delay * width + 1);
- else if (adcx140->dai_fmt == SND_SOC_DAIFMT_DSP_B)
- offset += adcx140->tdm_delay * width;
-
- /* Configure data offset */
- snd_soc_component_update_bits(component, ADCX140_ASI_CFG1,
- ADCX140_TX_OFFSET_MASK, offset);
-
- return 0;
-}
-
static const struct snd_soc_dai_ops adcx140_dai_ops = {
.hw_params = adcx140_hw_params,
.set_fmt = adcx140_set_dai_fmt,
- .prepare = adcx140_prepare,
.set_tdm_slot = adcx140_set_dai_tdm_slot,
};
--
2.27.0
next prev parent reply other threads:[~2020-07-09 18:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-09 18:51 [PATCH 1/2] ASoC: tlv320adcx140: Add ASI enable for channel 5-8 Dan Murphy
2020-07-09 18:51 ` Dan Murphy [this message]
2020-07-09 22:00 ` Mark Brown
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=20200709185129.10505-2-dmurphy@ti.com \
--to=dmurphy@ti.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--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).