Skip to content

Commit 04ac1ee

Browse files
povikjannau
authored andcommitted
ASoC: tas2764: Configure zeroing of SDOUT slots
The codec has an option to zero out certain TDM slots on its SDOUT output according to a preconfigured mask (otherwise the output is, for the duration of unused slots, in a Hi-Z state). Configure this feature based on a mask read from the devicetree. Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
1 parent 7625bea commit 04ac1ee

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

sound/soc/codecs/tas2764.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ struct tas2764_priv {
4141

4242
int v_sense_slot;
4343
int i_sense_slot;
44+
u32 sdout_zero_mask;
4445

4546
bool dac_powered;
4647
bool unmuted;
@@ -692,6 +693,23 @@ static int tas2764_codec_probe(struct snd_soc_component *component)
692693

693694
switch (tas2764->devid) {
694695
case DEVID_SN012776:
696+
if (tas2764->sdout_zero_mask) {
697+
for (i = 0; i < 4; i++) {
698+
ret = snd_soc_component_write(component, TAS2764_SDOUT_HIZ_1 + i,
699+
(tas2764->sdout_zero_mask >> (i * 8)) & 0xff);
700+
701+
if (ret < 0)
702+
return ret;
703+
}
704+
705+
ret = snd_soc_component_update_bits(component, TAS2764_SDOUT_HIZ_9,
706+
TAS2764_SDOUT_HIZ_9_FORCE_0_EN,
707+
TAS2764_SDOUT_HIZ_9_FORCE_0_EN);
708+
709+
if (ret < 0)
710+
return ret;
711+
}
712+
695713
ret = snd_soc_component_update_bits(component, TAS2764_PWR_CTRL,
696714
TAS2764_PWR_CTRL_BOP_SRC,
697715
TAS2764_PWR_CTRL_BOP_SRC);
@@ -848,6 +866,11 @@ static int tas2764_parse_dt(struct device *dev, struct tas2764_priv *tas2764)
848866
if (ret)
849867
tas2764->v_sense_slot = -1;
850868

869+
ret = fwnode_property_read_u32(dev->fwnode, "ti,sdout-force-zero-mask",
870+
&tas2764->sdout_zero_mask);
871+
if (ret)
872+
tas2764->sdout_zero_mask = 0;
873+
851874
return 0;
852875
}
853876

sound/soc/codecs/tas2764.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,4 +126,15 @@
126126

127127
#define TAS2764_BOP_CFG0 TAS2764_REG(0X0, 0x1d)
128128

129+
#define TAS2764_SDOUT_HIZ_1 TAS2764_REG(0x1, 0x3d)
130+
#define TAS2764_SDOUT_HIZ_2 TAS2764_REG(0x1, 0x3e)
131+
#define TAS2764_SDOUT_HIZ_3 TAS2764_REG(0x1, 0x3f)
132+
#define TAS2764_SDOUT_HIZ_4 TAS2764_REG(0x1, 0x40)
133+
#define TAS2764_SDOUT_HIZ_5 TAS2764_REG(0x1, 0x41)
134+
#define TAS2764_SDOUT_HIZ_6 TAS2764_REG(0x1, 0x42)
135+
#define TAS2764_SDOUT_HIZ_7 TAS2764_REG(0x1, 0x43)
136+
#define TAS2764_SDOUT_HIZ_8 TAS2764_REG(0x1, 0x44)
137+
#define TAS2764_SDOUT_HIZ_9 TAS2764_REG(0x1, 0x45)
138+
#define TAS2764_SDOUT_HIZ_9_FORCE_0_EN BIT(7)
139+
129140
#endif /* __TAS2764__ */

0 commit comments

Comments
 (0)