Skip to content

Commit f5468be

Browse files
marcanbroonie
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. Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: James Calligeros <jcalligeros99@gmail.com> Link: https://patch.msgid.link/20250218-apple-codec-changes-v2-28-932760fd7e07@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent a3f1723 commit f5468be

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

sound/soc/codecs/tas2764.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
365365
{
366366
struct snd_soc_component *component = dai->component;
367367
struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
368-
u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0;
368+
u8 tdm_rx_start_slot = 0, asi_cfg_0 = 0, asi_cfg_1 = 0, asi_cfg_4 = 0;
369369
int ret;
370370

371371
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@@ -374,12 +374,14 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
374374
fallthrough;
375375
case SND_SOC_DAIFMT_NB_NF:
376376
asi_cfg_1 = TAS2764_TDM_CFG1_RX_RISING;
377+
asi_cfg_4 = TAS2764_TDM_CFG4_TX_FALLING;
377378
break;
378379
case SND_SOC_DAIFMT_IB_IF:
379380
asi_cfg_0 ^= TAS2764_TDM_CFG0_FRAME_START;
380381
fallthrough;
381382
case SND_SOC_DAIFMT_IB_NF:
382383
asi_cfg_1 = TAS2764_TDM_CFG1_RX_FALLING;
384+
asi_cfg_4 = TAS2764_TDM_CFG4_TX_RISING;
383385
break;
384386
}
385387

@@ -389,6 +391,12 @@ static int tas2764_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
389391
if (ret < 0)
390392
return ret;
391393

394+
ret = snd_soc_component_update_bits(component, TAS2764_TDM_CFG4,
395+
TAS2764_TDM_CFG4_TX_MASK,
396+
asi_cfg_4);
397+
if (ret < 0)
398+
return ret;
399+
392400
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
393401
case SND_SOC_DAIFMT_I2S:
394402
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
@@ -79,6 +79,12 @@
7979
#define TAS2764_TDM_CFG3_RXS_SHIFT 0x4
8080
#define TAS2764_TDM_CFG3_MASK GENMASK(3, 0)
8181

82+
/* TDM Configuration Reg4 */
83+
#define TAS2764_TDM_CFG4 TAS2764_REG(0X0, 0x0d)
84+
#define TAS2764_TDM_CFG4_TX_MASK BIT(0)
85+
#define TAS2764_TDM_CFG4_TX_RISING 0x0
86+
#define TAS2764_TDM_CFG4_TX_FALLING BIT(0)
87+
8288
/* TDM Configuration Reg5 */
8389
#define TAS2764_TDM_CFG5 TAS2764_REG(0X0, 0x0e)
8490
#define TAS2764_TDM_CFG5_VSNS_MASK BIT(6)

0 commit comments

Comments
 (0)