Skip to content

Commit 84e43bf

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 2cbc944 commit 84e43bf

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
@@ -362,7 +362,7 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
362362
struct snd_soc_component *component = dai->component;
363363
struct tas2770_priv *tas2770 =
364364
snd_soc_component_get_drvdata(component);
365-
u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0;
365+
u8 tdm_rx_start_slot = 0, invert_fpol = 0, fpol_preinv = 0, asi_cfg_1 = 0, asi_cfg_4 = 0;
366366
int ret;
367367

368368
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
@@ -379,6 +379,7 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
379379
fallthrough;
380380
case SND_SOC_DAIFMT_NB_NF:
381381
asi_cfg_1 |= TAS2770_TDM_CFG_REG1_RX_RSING;
382+
asi_cfg_4 |= TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING;
382383
break;
383384
case SND_SOC_DAIFMT_IB_IF:
384385
invert_fpol = 1;
@@ -397,6 +398,12 @@ static int tas2770_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
397398
if (ret < 0)
398399
return ret;
399400

401+
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
402+
TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING,
403+
asi_cfg_4);
404+
if (ret < 0)
405+
return ret;
406+
400407
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
401408
case SND_SOC_DAIFMT_I2S:
402409
tdm_rx_start_slot = 1;

0 commit comments

Comments
 (0)