diff options
author | Fang, Yang A <yang.a.fang@intel.com> | 2015-05-29 14:56:10 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-06-02 13:11:03 -0400 |
commit | bb13f0e08d16a6a303aab786b2aaf2ca76747cfb (patch) | |
tree | cc33bc2ce075a98330bb25b4672146acb424ce59 | |
parent | b787f68c36d49bb1d9236f403813641efa74a031 (diff) |
ASoC: max98090: read micbias from device property
This patch reads max98090 micbias from acpi or dt
Signed-off-by: Fang, Yang A <yang.a.fang@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | Documentation/devicetree/bindings/sound/max98090.txt | 6 | ||||
-rw-r--r-- | sound/soc/codecs/max98090.c | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/sound/max98090.txt b/Documentation/devicetree/bindings/sound/max98090.txt index aa802a274520..4e3be6682c98 100644 --- a/Documentation/devicetree/bindings/sound/max98090.txt +++ b/Documentation/devicetree/bindings/sound/max98090.txt | |||
@@ -18,6 +18,12 @@ Optional properties: | |||
18 | 18 | ||
19 | - maxim,dmic-freq: Frequency at which to clock DMIC | 19 | - maxim,dmic-freq: Frequency at which to clock DMIC |
20 | 20 | ||
21 | - maxim,micbias: Micbias voltage applies to the analog mic, valid voltages value are: | ||
22 | 0 - 2.2v | ||
23 | 1 - 2.55v | ||
24 | 2 - 2.4v | ||
25 | 3 - 2.8v | ||
26 | |||
21 | Pins on the device (for linking into audio routes): | 27 | Pins on the device (for linking into audio routes): |
22 | 28 | ||
23 | * MIC1 | 29 | * MIC1 |
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 3e33ef2acf3c..9d80c68abdd5 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c | |||
@@ -2422,6 +2422,8 @@ static int max98090_probe(struct snd_soc_codec *codec) | |||
2422 | struct max98090_cdata *cdata; | 2422 | struct max98090_cdata *cdata; |
2423 | enum max98090_type devtype; | 2423 | enum max98090_type devtype; |
2424 | int ret = 0; | 2424 | int ret = 0; |
2425 | int err; | ||
2426 | unsigned int micbias; | ||
2425 | 2427 | ||
2426 | dev_dbg(codec->dev, "max98090_probe\n"); | 2428 | dev_dbg(codec->dev, "max98090_probe\n"); |
2427 | 2429 | ||
@@ -2506,8 +2508,17 @@ static int max98090_probe(struct snd_soc_codec *codec) | |||
2506 | snd_soc_write(codec, M98090_REG_BIAS_CONTROL, | 2508 | snd_soc_write(codec, M98090_REG_BIAS_CONTROL, |
2507 | M98090_VCM_MODE_MASK); | 2509 | M98090_VCM_MODE_MASK); |
2508 | 2510 | ||
2511 | err = device_property_read_u32(codec->dev, "maxim,micbias", &micbias); | ||
2512 | if (err) { | ||
2513 | micbias = M98090_MBVSEL_2V8; | ||
2514 | dev_info(codec->dev, "use default 2.8v micbias\n"); | ||
2515 | } else if (micbias < M98090_MBVSEL_2V2 || micbias > M98090_MBVSEL_2V8) { | ||
2516 | dev_err(codec->dev, "micbias out of range 0x%x\n", micbias); | ||
2517 | micbias = M98090_MBVSEL_2V8; | ||
2518 | } | ||
2519 | |||
2509 | snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE, | 2520 | snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE, |
2510 | M98090_MBVSEL_MASK, M98090_MBVSEL_2V8); | 2521 | M98090_MBVSEL_MASK, micbias); |
2511 | 2522 | ||
2512 | max98090_add_widgets(codec); | 2523 | max98090_add_widgets(codec); |
2513 | 2524 | ||