Skip to content

Commit 6d6a7c8

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 4884057 commit 6d6a7c8

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

sound/soc/codecs/tas2770.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,20 @@ static int tas2770_codec_probe(struct snd_soc_component *component)
602602
return ret;
603603
}
604604

605+
ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
606+
TAS2770_TDM_CFG_REG4_TX_FILL,
607+
tas2770->sdout_zfill ? 0 :
608+
TAS2770_TDM_CFG_REG4_TX_FILL);
609+
if (ret < 0)
610+
return ret;
611+
612+
ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
613+
TAS2770_DIN_PD_SDOUT,
614+
tas2770->sdout_pd ?
615+
TAS2770_DIN_PD_SDOUT : 0);
616+
if (ret < 0)
617+
return ret;
618+
605619
ret = sysfs_create_groups(&component->dev->kobj, tas2770_sysfs_groups);
606620

607621
if (ret < 0)
@@ -755,6 +769,9 @@ static int tas2770_parse_dt(struct device *dev, struct tas2770_priv *tas2770)
755769
tas2770->v_sense_slot = -1;
756770
}
757771

772+
tas2770->sdout_pd = fwnode_property_read_bool(dev->fwnode, "ti,sdout-pull-down");
773+
tas2770->sdout_zfill = fwnode_property_read_bool(dev->fwnode, "ti,sdout-zero-fill");
774+
758775
tas2770->sdz_reg = devm_regulator_get(dev, "SDZ");
759776
if (IS_ERR(tas2770->sdz_reg))
760777
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)
@@ -110,6 +118,9 @@
110118
#define TAS2770_TEMP_LSB TAS2770_REG(0X0, 0x2A)
111119
/* Interrupt Configuration */
112120
#define TAS2770_INT_CFG TAS2770_REG(0X0, 0x30)
121+
/* Data In Pull-Down */
122+
#define TAS2770_DIN_PD TAS2770_REG(0X0, 0x31)
123+
#define TAS2770_DIN_PD_SDOUT BIT(7)
113124
/* Misc IRQ */
114125
#define TAS2770_MISC_IRQ TAS2770_REG(0X0, 0x32)
115126
/* Clock Configuration */
@@ -139,6 +150,8 @@ struct tas2770_priv {
139150
struct device *dev;
140151
int v_sense_slot;
141152
int i_sense_slot;
153+
bool sdout_pd;
154+
bool sdout_zfill;
142155
bool dac_powered;
143156
bool unmuted;
144157
};

0 commit comments

Comments
 (0)