Merge remote-tracking branches 'spi/topic/mtk', 'spi/topic/pxa2xx', 'spi/topic/qspi...
[deliverable/linux.git] / sound / soc / codecs / max98090.c
index c2306268cab839e86e2ae587deef8b887331d97b..78268f0514e95073e8b2006d4e2822a482fb6d3b 100644 (file)
@@ -27,7 +27,7 @@
 #include "max98090.h"
 
 /* Allows for sparsely populated register maps */
-static struct reg_default max98090_reg[] = {
+static const struct reg_default max98090_reg[] = {
        { 0x00, 0x00 }, /* 00 Software Reset */
        { 0x03, 0x04 }, /* 03 Interrupt Masks */
        { 0x04, 0x00 }, /* 04 System Clock Quick */
@@ -2419,6 +2419,8 @@ static int max98090_probe(struct snd_soc_codec *codec)
        struct max98090_cdata *cdata;
        enum max98090_type devtype;
        int ret = 0;
+       int err;
+       unsigned int micbias;
 
        dev_dbg(codec->dev, "max98090_probe\n");
 
@@ -2503,8 +2505,17 @@ static int max98090_probe(struct snd_soc_codec *codec)
        snd_soc_write(codec, M98090_REG_BIAS_CONTROL,
                M98090_VCM_MODE_MASK);
 
+       err = device_property_read_u32(codec->dev, "maxim,micbias", &micbias);
+       if (err) {
+               micbias = M98090_MBVSEL_2V8;
+               dev_info(codec->dev, "use default 2.8v micbias\n");
+       } else if (micbias < M98090_MBVSEL_2V2 || micbias > M98090_MBVSEL_2V8) {
+               dev_err(codec->dev, "micbias out of range 0x%x\n", micbias);
+               micbias = M98090_MBVSEL_2V8;
+       }
+
        snd_soc_update_bits(codec, M98090_REG_MIC_BIAS_VOLTAGE,
-               M98090_MBVSEL_MASK, M98090_MBVSEL_2V8);
+               M98090_MBVSEL_MASK, micbias);
 
        max98090_add_widgets(codec);
 
@@ -2693,7 +2704,7 @@ static const struct of_device_id max98090_of_match[] = {
 MODULE_DEVICE_TABLE(of, max98090_of_match);
 
 #ifdef CONFIG_ACPI
-static struct acpi_device_id max98090_acpi_match[] = {
+static const struct acpi_device_id max98090_acpi_match[] = {
        { "193C9890", MAX98090 },
        { }
 };
This page took 0.037637 seconds and 5 git commands to generate.