[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200624161459.19248-5-dmurphy@ti.com>
Date: Wed, 24 Jun 2020 11:14:56 -0500
From: Dan Murphy <dmurphy@...com>
To: <lgirdwood@...il.com>, <broonie@...nel.org>, <perex@...ex.cz>,
<tiwai@...e.com>
CC: <alsa-devel@...a-project.org>, <linux-kernel@...r.kernel.org>,
<robh@...nel.org>, <devicetree@...r.kernel.org>,
Dan Murphy <dmurphy@...com>
Subject: [PATCH v5 4/7] ASoC: tas2562: Add rx and tx slot programming
Add programming for the tdm slots for both tx and rx offsets.
Signed-off-by: Dan Murphy <dmurphy@...com>
---
sound/soc/codecs/tas2562.c | 17 ++++++++++++++++-
sound/soc/codecs/tas2562.h | 4 ++++
2 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/sound/soc/codecs/tas2562.c b/sound/soc/codecs/tas2562.c
index d26e30a2948c..2f1d4b697f01 100644
--- a/sound/soc/codecs/tas2562.c
+++ b/sound/soc/codecs/tas2562.c
@@ -208,6 +208,22 @@ static int tas2562_set_dai_tdm_slot(struct snd_soc_dai *dai,
if (ret < 0)
return ret;
+ if (tx_mask > TAS2562_TX_OFF_MAX) {
+ dev_err(tas2562->dev, "TX slot is larger then %d",
+ TAS2562_TX_OFF_MAX);
+ return -EINVAL;
+ }
+
+ ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG1,
+ TAS2562_RX_OFF_MASK, rx_mask << 1);
+ if (ret < 0)
+ return ret;
+
+ ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG4,
+ TAS2562_TX_OFF_MASK, tx_mask << 1);
+ if (ret < 0)
+ return ret;
+
return 0;
}
@@ -327,7 +343,6 @@ static int tas2562_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
ret = snd_soc_component_update_bits(component, TAS2562_TDM_CFG1,
TAS2562_TDM_CFG1_RX_OFFSET_MASK,
tdm_rx_start_slot);
-
if (ret < 0)
return ret;
diff --git a/sound/soc/codecs/tas2562.h b/sound/soc/codecs/tas2562.h
index 28e75fc431d0..47e59c82eef3 100644
--- a/sound/soc/codecs/tas2562.h
+++ b/sound/soc/codecs/tas2562.h
@@ -34,6 +34,10 @@
#define TAS2562_TDM_DET TAS2562_REG(0, 0x11)
#define TAS2562_REV_ID TAS2562_REG(0, 0x7d)
+#define TAS2562_RX_OFF_MASK GENMASK(5, 1)
+#define TAS2562_TX_OFF_MASK GENMASK(3, 1)
+#define TAS2562_TX_OFF_MAX 7
+
/* Page 2 */
#define TAS2562_DVC_CFG1 TAS2562_REG(2, 0x0c)
#define TAS2562_DVC_CFG2 TAS2562_REG(2, 0x0d)
--
2.26.2
Powered by blists - more mailing lists