Skip to content

Commit 923d742

Browse files
marcanjannau
authored andcommitted
ASoC: tas2764: Set the SDOUT polarity correctly
TX launch polarity needs to be the opposite of RX capture polarity, to generate the right bit slot alignment. Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent c4b6faf commit 923d742

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

sound/soc/codecs/tas2764.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
408408
{
409409
struct snd_soc_component *component = dai->component;
410410
struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
411-
u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0;
411+
u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0, asi_cfg_4 = 0;
412412
int ret;
413413

414414
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@@ -417,12 +417,14 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
417417
fallthrough;
418418
case SND_SOC_DAIFMT_NB_NF:
419419
asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING;
420+
asi_cfg_4 = TAS2764_TDM_CFG4_TX_FALLING;
420421
break;
421422
case SND_SOC_DAIFMT_IB_IF:
422423
asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
423424
fallthrough;
424425
case SND_SOC_DAIFMT_IB_NF:
425426
asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING;
427+
asi_cfg_4 = TAS2764_TDM_CFG4_TX_RISING;
426428
break;
427429
}
428430

@@ -432,6 +434,12 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
432434
if (ret < 0)
433435
return ret;
434436

437+
ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG4,
438+
TAS2764_TDM_CFG4_TX_MASK,
439+
asi_cfg_4);
440+
if (ret < 0)
441+
return ret;
442+
435443
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
436444
case SND_SOC_DAIFMT_I2S:
437445
asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;

sound/soc/codecs/tas2764.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484
#define TAS2764_TDM_CFG3_RXS_SHIFT 0x4
8585
#define TAS2764_TDM_CFG3_MASK GENMASK(3, 0)
8686

87+
/* TDM Configuration Reg4 */
88+
#define TAS2764_TDM_CFG4 TAS2764_REG(0X0, 0x0c)
89+
#define TAS2764_TDM_CFG4_TX_MASK BIT(0)
90+
#define TAS2764_TDM_CFG4_TX_RISING 0x0
91+
#define TAS2764_TDM_CFG4_TX_FALLING BIT(0)
92+
8793
/* TDM Configuration Reg5 */
8894
#define TAS2764_TDM_CFG5 TAS2764_REG(0X0, 0x0e)
8995
#define TAS2764_TDM_CFG5_VSNS_MASK BIT(6)

0 commit comments

Comments
 (0)