Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Fang, Yang A and committed by
Mark Brown
bb13f0e0 b787f68c

+18 -1
+6
Documentation/devicetree/bindings/sound/max98090.txt
··· 18 18 19 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 27 Pins on the device (for linking into audio routes): 22 28 23 29 * MIC1
+12 -1
sound/soc/codecs/max98090.c
··· 2422 2422 struct max98090_cdata *cdata; 2423 2423 enum max98090_type devtype; 2424 2424 int ret = 0; 2425 + int err; 2426 + unsigned int micbias; 2425 2427 2426 2428 dev_dbg(codec->dev, "max98090_probe\n"); 2427 2429 ··· 2508 2506 snd_soc_write(codec, M98090_REG_BIAS_CONTROL, 2509 2507 M98090_VCM_MODE_MASK); 2510 2508 2509 + err = device_property_read_u32(codec->dev, "maxim,micbias", &micbias); 2510 + if (err) { 2511 + micbias = M98090_MBVSEL_2V8; 2512 + dev_info(codec->dev, "use default 2.8v micbias\n"); 2513 + } else if (micbias < M98090_MBVSEL_2V2 || micbias > M98090_MBVSEL_2V8) { 2514 + dev_err(codec->dev, "micbias out of range 0x%x\n", micbias); 2515 + micbias = M98090_MBVSEL_2V8; 2516 + } 2517 + 2511 2518 snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE, 2512 - M98090_MBVSEL_MASK, M98090_MBVSEL_2V8); 2519 + M98090_MBVSEL_MASK, micbias); 2513 2520 2514 2521 max98090_add_widgets(codec); 2515 2522