提交 87357797 编写于 作者: J Jean-Michel Hautbois 提交者: Mark Brown

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: NJean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 bd0593f5
...@@ -13,6 +13,10 @@ Required properties: ...@@ -13,6 +13,10 @@ Required properties:
If this node is not mentioned or if the value is unknown, then If this node is not mentioned or if the value is unknown, then
micbias resistor is set to 4K. micbias resistor is set to 4K.
- micbias-voltage-m-volts : the bias voltage to be used in mVolts
The voltage can take values from 1.25V to 3V by 250mV steps
If this node is not mentionned or the value is unknown, then
the value is set to 1.25V.
Example: Example:
...@@ -20,5 +24,6 @@ codec: sgtl5000@0a { ...@@ -20,5 +24,6 @@ codec: sgtl5000@0a {
compatible = "fsl,sgtl5000"; compatible = "fsl,sgtl5000";
reg = <0x0a>; reg = <0x0a>;
clocks = <&clks 150>; clocks = <&clks 150>;
sgtl5000-micbias-resistor = <1>; micbias-resistor-k-ohms = <2>;
micbias-voltage-m-volts = <2250>;
}; };
...@@ -140,6 +140,7 @@ struct sgtl5000_priv { ...@@ -140,6 +140,7 @@ struct sgtl5000_priv {
struct clk *mclk; struct clk *mclk;
int revision; int revision;
u8 micbias_resistor; u8 micbias_resistor;
u8 micbias_voltage;
}; };
/* /*
...@@ -1342,6 +1343,9 @@ static int sgtl5000_probe(struct snd_soc_codec *codec) ...@@ -1342,6 +1343,9 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
SGTL5000_BIAS_R_MASK, SGTL5000_BIAS_R_MASK,
sgtl5000->micbias_resistor << SGTL5000_BIAS_R_SHIFT); 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 * disable DAP
* TODO: * TODO:
...@@ -1511,10 +1515,19 @@ static int sgtl5000_i2c_probe(struct i2c_client *client, ...@@ -1511,10 +1515,19 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
/* default is 4Kohms */ /* default is 4Kohms */
sgtl5000->micbias_resistor = 2; 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, dev_err(&client->dev,
"Unsuitable MicBias resistor\n"); "Unsuitable MicBias resistor\n");
} }
} else { } else {
sgtl5000->micbias_voltage = 0;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册