lkml.org 
[lkml]   [2020]   [Jul]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/2] ASoC: tlv320adcx140: Add tx offset slot programming
Date
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
\
 
 \ /
  Last update: 2020-07-09 20:53    [W:0.034 / U:1.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site