aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8962.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm8962.c')
-rw-r--r--sound/soc/codecs/wm8962.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 549018e46233..ec4417a5e669 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -2468,6 +2468,7 @@ SND_SOC_DAPM_INPUT("IN3R"),
2468SND_SOC_DAPM_INPUT("IN4L"), 2468SND_SOC_DAPM_INPUT("IN4L"),
2469SND_SOC_DAPM_INPUT("IN4R"), 2469SND_SOC_DAPM_INPUT("IN4R"),
2470SND_SOC_DAPM_INPUT("Beep"), 2470SND_SOC_DAPM_INPUT("Beep"),
2471SND_SOC_DAPM_INPUT("DMICDAT"),
2471 2472
2472SND_SOC_DAPM_MICBIAS("MICBIAS", WM8962_PWR_MGMT_1, 1, 0), 2473SND_SOC_DAPM_MICBIAS("MICBIAS", WM8962_PWR_MGMT_1, 1, 0),
2473 2474
@@ -2487,6 +2488,8 @@ SND_SOC_DAPM_MIXER("MIXINL", WM8962_PWR_MGMT_1, 5, 0,
2487SND_SOC_DAPM_MIXER("MIXINR", WM8962_PWR_MGMT_1, 4, 0, 2488SND_SOC_DAPM_MIXER("MIXINR", WM8962_PWR_MGMT_1, 4, 0,
2488 mixinr, ARRAY_SIZE(mixinr)), 2489 mixinr, ARRAY_SIZE(mixinr)),
2489 2490
2491SND_SOC_DAPM_AIF_IN("DMIC", NULL, 0, WM8962_PWR_MGMT_1, 10, 0),
2492
2490SND_SOC_DAPM_ADC("ADCL", "Capture", WM8962_PWR_MGMT_1, 3, 0), 2493SND_SOC_DAPM_ADC("ADCL", "Capture", WM8962_PWR_MGMT_1, 3, 0),
2491SND_SOC_DAPM_ADC("ADCR", "Capture", WM8962_PWR_MGMT_1, 2, 0), 2494SND_SOC_DAPM_ADC("ADCR", "Capture", WM8962_PWR_MGMT_1, 2, 0),
2492 2495
@@ -2564,13 +2567,17 @@ static const struct snd_soc_dapm_route wm8962_intercon[] = {
2564 2567
2565 { "MICBIAS", NULL, "SYSCLK" }, 2568 { "MICBIAS", NULL, "SYSCLK" },
2566 2569
2570 { "DMIC", NULL, "DMICDAT" },
2571
2567 { "ADCL", NULL, "SYSCLK" }, 2572 { "ADCL", NULL, "SYSCLK" },
2568 { "ADCL", NULL, "TOCLK" }, 2573 { "ADCL", NULL, "TOCLK" },
2569 { "ADCL", NULL, "MIXINL" }, 2574 { "ADCL", NULL, "MIXINL" },
2575 { "ADCL", NULL, "DMIC" },
2570 2576
2571 { "ADCR", NULL, "SYSCLK" }, 2577 { "ADCR", NULL, "SYSCLK" },
2572 { "ADCR", NULL, "TOCLK" }, 2578 { "ADCR", NULL, "TOCLK" },
2573 { "ADCR", NULL, "MIXINR" }, 2579 { "ADCR", NULL, "MIXINR" },
2580 { "ADCR", NULL, "DMIC" },
2574 2581
2575 { "STL", "Left", "ADCL" }, 2582 { "STL", "Left", "ADCL" },
2576 { "STL", "Right", "ADCR" }, 2583 { "STL", "Right", "ADCR" },
@@ -3719,6 +3726,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3719 dev); 3726 dev);
3720 u16 *reg_cache = codec->reg_cache; 3727 u16 *reg_cache = codec->reg_cache;
3721 int i, trigger, irq_pol; 3728 int i, trigger, irq_pol;
3729 bool dmicclk, dmicdat;
3722 3730
3723 wm8962->codec = codec; 3731 wm8962->codec = codec;
3724 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); 3732 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work);
@@ -3856,6 +3864,29 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3856 3864
3857 wm8962_add_widgets(codec); 3865 wm8962_add_widgets(codec);
3858 3866
3867 /* Save boards having to disable DMIC when not in use */
3868 dmicclk = false;
3869 dmicdat = false;
3870 for (i = 0; i < WM8962_MAX_GPIO; i++) {
3871 switch (snd_soc_read(codec, WM8962_GPIO_BASE + i)
3872 & WM8962_GP2_FN_MASK) {
3873 case WM8962_GPIO_FN_DMICCLK:
3874 dmicclk = true;
3875 break;
3876 case WM8962_GPIO_FN_DMICDAT:
3877 dmicdat = true;
3878 break;
3879 default:
3880 break;
3881 }
3882 }
3883 if (!dmicclk || !dmicdat) {
3884 dev_dbg(codec->dev, "DMIC not in use, disabling\n");
3885 snd_soc_dapm_nc_pin(&codec->dapm, "DMICDAT");
3886 }
3887 if (dmicclk != dmicdat)
3888 dev_warn(codec->dev, "DMIC GPIOs partially configured\n");
3889
3859 wm8962_init_beep(codec); 3890 wm8962_init_beep(codec);
3860 wm8962_init_gpio(codec); 3891 wm8962_init_gpio(codec);
3861 3892