Skip to content

Commit 0e36f32

Browse files
Dan Murphybroonie
authored andcommitted
ASoC: tlv320adcx140: Fix bias config values
The device tree binding declares the ti,mic-bias-source and the ti,vref-source properties as u32. The code reads them as u8 which is incorrect. Since the device tree binding indicates them as u32 the conde needs to be updated to read u32. In addition the bias source needs to be shifted 4 bits to correctly write the register. driver family") Fixes: 37bde5acf040 ("ASoC: tlv320adcx140: Add the tlv320adcx140 codec Signed-off-by: Dan Murphy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 65e412a commit 0e36f32

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

sound/soc/codecs/tlv320adcx140.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -739,11 +739,12 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
739739
{
740740
struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component);
741741
int sleep_cfg_val = ADCX140_WAKE_DEV;
742-
u8 bias_source;
743-
u8 vref_source;
742+
u32 bias_source;
743+
u32 vref_source;
744+
u8 bias_cfg;
744745
int ret;
745746

746-
ret = device_property_read_u8(adcx140->dev, "ti,mic-bias-source",
747+
ret = device_property_read_u32(adcx140->dev, "ti,mic-bias-source",
747748
&bias_source);
748749
if (ret)
749750
bias_source = ADCX140_MIC_BIAS_VAL_VREF;
@@ -754,7 +755,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
754755
return -EINVAL;
755756
}
756757

757-
ret = device_property_read_u8(adcx140->dev, "ti,vref-source",
758+
ret = device_property_read_u32(adcx140->dev, "ti,vref-source",
758759
&vref_source);
759760
if (ret)
760761
vref_source = ADCX140_MIC_BIAS_VREF_275V;
@@ -765,7 +766,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
765766
return -EINVAL;
766767
}
767768

768-
bias_source |= vref_source;
769+
bias_cfg = bias_source << ADCX140_MIC_BIAS_SHIFT | vref_source;
769770

770771
ret = adcx140_reset(adcx140);
771772
if (ret)
@@ -785,7 +786,7 @@ static int adcx140_codec_probe(struct snd_soc_component *component)
785786

786787
ret = regmap_update_bits(adcx140->regmap, ADCX140_BIAS_CFG,
787788
ADCX140_MIC_BIAS_VAL_MSK |
788-
ADCX140_MIC_BIAS_VREF_MSK, bias_source);
789+
ADCX140_MIC_BIAS_VREF_MSK, bias_cfg);
789790
if (ret)
790791
dev_err(adcx140->dev, "setting MIC bias failed %d\n", ret);
791792
out:

sound/soc/codecs/tlv320adcx140.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
#define ADCX140_MIC_BIAS_VAL_VREF_1096 1
117117
#define ADCX140_MIC_BIAS_VAL_AVDD 6
118118
#define ADCX140_MIC_BIAS_VAL_MSK GENMASK(6, 4)
119+
#define ADCX140_MIC_BIAS_SHIFT 4
119120

120121
#define ADCX140_MIC_BIAS_VREF_275V 0
121122
#define ADCX140_MIC_BIAS_VREF_25V 1

0 commit comments

Comments
 (0)