Skip to content

Commit 31e14b5

Browse files
marcanjannau
authored andcommitted
ASoC: tas2770: 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 fbe64b0 commit 31e14b5

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sound/soc/codecs/tas2770.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
364364
struct snd_soc_component *component = dai->component;
365365
struct tas2770_priv *tas2770 =
366366
snd_soc_component_get_drvdata(component);
367-
u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0;
367+
u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0, asi_cfg_4 = 0;
368368
int ret;
369369

370370
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
@@ -381,6 +381,7 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
381381
fallthrough;
382382
case SND_SOC_DAIFMT_NB_NF:
383383
asi_cfg_1 |= TAS2770_TDM_CFG_REG1_RX_RSING;
384+
asi_cfg_4 |= TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING;
384385
break;
385386
case SND_SOC_DAIFMT_IB_IF:
386387
invert_fpol = 1;
@@ -399,6 +400,12 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
399400
if (ret < 0)
400401
return ret;
401402

403+
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
404+
TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING,
405+
asi_cfg_4);
406+
if (ret < 0)
407+
return ret;
408+
402409
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
403410
case SND_SOC_DAIFMT_I2S:
404411
tdm_rx_start_slot = 1;

0 commit comments

Comments
 (0)