Skip to content

Commit dd593b0

Browse files
marcanjannau
authored andcommitted
ASoC: tas2770: Add zero-fill and pull-down controls
Expose the bits that control the behavior of the SDOUT pin when not actively transmitting slot data. Zero-fill is useful when there is a single amp on the SDOUT bus (e.g. Apple machines with mono speakers or a single stereo pair, where L/R are on separate buses). Pull-down is useful, though not perfect, when multiple amps share a bus. It typically takes around 2 bits for the line to transition from high to low after going Hi-Z, with the pull-down. Signed-off-by: Hector Martin <marcan@marcan.st>
1 parent 40fb0b2 commit dd593b0

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

sound/soc/codecs/tas2770.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,11 +654,24 @@ static int tas2770_codec_probe(struct snd_soc_component *component)
654654

655655
if (tas2770->pdm_slot != -1) {
656656
ret = tas2770_set_pdm_transmit(tas2770, tas2770->pdm_slot);
657-
658657
if (ret < 0)
659658
return ret;
660659
}
661660

661+
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
662+
TAS2770_TDM_CFG_REG4_TX_FILL,
663+
tas2770->sdout_zfill ? 0 :
664+
TAS2770_TDM_CFG_REG4_TX_FILL);
665+
if (ret < 0)
666+
return ret;
667+
668+
ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
669+
TAS2770_DIN_PD_SDOUT,
670+
tas2770->sdout_pd ?
671+
TAS2770_DIN_PD_SDOUT : 0);
672+
if (ret < 0)
673+
return ret;
674+
662675
return 0;
663676
}
664677

@@ -811,6 +824,9 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770)
811824
if (rc)
812825
tas2770->pdm_slot = -1;
813826

827+
tas2770->sdout_pd = fwnode_property_read_bool(dev->fwnode, "ti,sdout-pull-down");
828+
tas2770->sdout_zfill = fwnode_property_read_bool(dev->fwnode, "ti,sdout-zero-fill");
829+
814830
tas2770->sdz_reg = devm_regulator_get(dev, "SDZ");
815831
if (IS_ERR(tas2770->sdz_reg))
816832
return dev_err_probe(dev, PTR_ERR(tas2770->sdz_reg),

sound/soc/codecs/tas2770.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@
6767
#define TAS2770_TDM_CFG_REG3_RXS_SHIFT 0x4
6868
#define TAS2770_TDM_CFG_REG3_30_MASK GENMASK(3, 0)
6969
#define TAS2770_TDM_CFG_REG3_30_SHIFT 0
70+
/* TDM Configuration Reg4 */
71+
#define TAS2770_TDM_CFG_REG4 TAS2770_REG(0X0, 0x0E)
72+
#define TAS2770_TDM_CFG_REG4_TX_LSB_CFG BIT(7)
73+
#define TAS2770_TDM_CFG_REG4_TX_KEEPER_CFG BIT(6)
74+
#define TAS2770_TDM_CFG_REG4_TX_KEEPER BIT(5)
75+
#define TAS2770_TDM_CFG_REG4_TX_FILL BIT(4)
76+
#define TAS2770_TDM_CFG_REG4_TX_OFFSET_MASK GENMASK(3, 1)
77+
#define TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING BIT(0)
7078
/* TDM Configuration Reg5 */
7179
#define TAS2770_TDM_CFG_REG5 TAS2770_REG(0X0, 0x0F)
7280
#define TAS2770_TDM_CFG_REG5_VSNS_MASK BIT(6)
@@ -115,6 +123,9 @@
115123
#define TAS2770_TEMP_LSB TAS2770_REG(0X0, 0x2A)
116124
/* Interrupt Configuration */
117125
#define TAS2770_INT_CFG TAS2770_REG(0X0, 0x30)
126+
/* Data In Pull-Down */
127+
#define TAS2770_DIN_PD TAS2770_REG(0X0, 0x31)
128+
#define TAS2770_DIN_PD_SDOUT BIT(7)
118129
/* Misc IRQ */
119130
#define TAS2770_MISC_IRQ TAS2770_REG(0X0, 0x32)
120131
/* Clock Configuration */
@@ -145,6 +156,8 @@ struct tas2770_priv {
145156
int v_sense_slot;
146157
int i_sense_slot;
147158
int pdm_slot;
159+
bool sdout_pd;
160+
bool sdout_zfill;
148161
bool dac_powered;
149162
bool unmuted;
150163
};

0 commit comments

Comments
 (0)