summaryrefslogtreecommitdiff
path: root/sound/soc/codecs/sgtl5000.c
diff options
context:
space:
mode:
authorJean-Michel Hautbois <jean-michel.hautbois@vodalys.com>2014-10-14 08:43:12 +0200
committerMark Brown <broonie@kernel.org>2014-10-20 12:22:33 +0100
commit8735779774b8bbe14456c9e6ba4525eefc67a228 (patch)
treea011c1f117e4193cece5654d3b4d3ea2bd7349e7 /sound/soc/codecs/sgtl5000.c
parentbd0593f5f6add279257334b4a76aecd3ee8d31dc (diff)
ASoC: sgtl5000: Add MicBias voltage support
Some systems may require to specify a bias different than default (1.25V). This adds a property in sgtl5000 codec. The property is specified in milli-volts so that it is coherent with datasheet. Signed-off-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/sgtl5000.c')
-rw-r--r--sound/soc/codecs/sgtl5000.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index c417b4ad0492..59336f6aba80 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -140,6 +140,7 @@ struct sgtl5000_priv {
struct clk *mclk;
int revision;
u8 micbias_resistor;
+ u8 micbias_voltage;
};
/*
@@ -1342,6 +1343,9 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
SGTL5000_BIAS_R_MASK,
sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT);
+ snd_soc_update_bits(codec, SGTL5000_CHIP_MIC_CTRL,
+ SGTL5000_BIAS_R_MASK,
+ sgtl5000->micbias_voltage << SGTL5000_BIAS_R_SHIFT);
/*
* disable DAP
* TODO:
@@ -1511,10 +1515,19 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
/* default is 4Kohms */
sgtl5000->micbias_resistor = 2;
}
+ if (!of_property_read_u32(np,
+ "micbias-voltage-m-volts", &value)) {
+ /* 1250mV => 0 */
+ /* steps of 250mV */
+ if ((value >= 1250) && (value <= 3000))
+ sgtl5000->micbias_voltage = (value / 250) - 5;
+ else {
+ sgtl5000->micbias_voltage = 0;
dev_err(&client->dev,
"Unsuitable MicBias resistor\n");
}
} else {
+ sgtl5000->micbias_voltage = 0;
}
}