Message ID | 20200624174932.9604-5-dmurphy@ti.com |
---|---|
State | New |
Headers | show |
Series | TAS2562 issue fixes and slot programming | expand |
Hello On 6/24/20 12:49 PM, Dan Murphy wrote: > Add programming for the tdm slots for both tx and rx offsets. > > Signed-off-by: Dan Murphy <dmurphy@ti.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; > + I need to fix this patch to remove the slot programming during dai_fmt as the code is not correct and resets the slots Dan
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)
Add programming for the tdm slots for both tx and rx offsets. Signed-off-by: Dan Murphy <dmurphy@ti.com> --- sound/soc/codecs/tas2562.c | 17 ++++++++++++++++- sound/soc/codecs/tas2562.h | 4 ++++ 2 files changed, 20 insertions(+), 1 deletion(-) -- 2.26.2