ASoC: Define constants for WM8962 GPIO functions
Subsystems (3)
PATCH 1/2 ASoC: Define constants for WM8962 GPIO functions
--- include/sound/wm8962.h | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
include/sound/wm8962.h +22 -0
@@ -14,6 +14,28 @@/* Use to set GPIO default values to zero */ #define WM8962_GPIO_SET 0x10000 +#define WM8962_GPIO_FN_CLKOUT 0 +#define WM8962_GPIO_FN_LOGIC 1 +#define WM8962_GPIO_FN_SDOUT 2 +#define WM8962_GPIO_FN_IRQ 3 +#define WM8962_GPIO_FN_THERMAL 4 +#define WM8962_GPIO_FN_PLL2_LOCK 6 +#define WM8962_GPIO_FN_PLL3_LOCK 7 +#define WM8962_GPIO_FN_FLL_LOCK 9 +#define WM8962_GPIO_FN_DRC_ACT 10 +#define WM8962_GPIO_FN_WSEQ_DONE 11 +#define WM8962_GPIO_FN_ALC_NG_ACT 12 +#define WM8962_GPIO_FN_ALC_PEAK_LIMIT 13 +#define WM8962_GPIO_FN_ALC_SATURATION 14 +#define WM8962_GPIO_FN_ALC_LEVEL_THR 15 +#define WM8962_GPIO_FN_ALC_LEVEL_LOCK 16 +#define WM8962_GPIO_FN_FIFO_ERR 17 +#define WM8962_GPIO_FN_OPCLK 18 +#define WM8962_GPIO_FN_DMICCLK 19 +#define WM8962_GPIO_FN_DMICDAT 20 +#define WM8962_GPIO_FN_MICD 21 +#define WM8962_GPIO_FN_MICSCD 22 +struct wm8962_pdata {int gpio_base;u32 gpio_init[WM8962_MAX_GPIO ];
Signature · 1 line
1.7.4.1
PATCH 2/2 ASoC: Implement WM8962 DMIC support
DMIC support is automatically disabled when none of the GPIOs are set up to bring out the DMICCLK and DMICDAT pins at startup.
Note that there's no support for controlling DMIC routing except the power control so the board DAPM configuration will need to manage DMIC enable and disable if analogue mics (eg, a headset) also exist.
--- sound/soc/codecs/wm8962.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
sound/soc/codecs/wm8962.c +31 -0
@@ -2468,6 +2468,7 @@ SND_SOC_DAPM_INPUT("IN3R"),SND_SOC_DAPM_INPUT ("IN4L" ),SND_SOC_DAPM_INPUT ("IN4R" ),SND_SOC_DAPM_INPUT ("Beep" ), +SND_SOC_DAPM_INPUT ("DMICDAT" ), SND_SOC_DAPM_MICBIAS("MICBIAS", WM8962_PWR_MGMT_1, 1, 0),
@@ -2487,6 +2488,8 @@ SND_SOC_DAPM_MIXER("MIXINL", WM8962_PWR_MGMT_1, 5, 0,SND_SOC_DAPM_MIXER ("MIXINR" ,WM8962_PWR_MGMT_1 ,4 ,0 , mixinr,ARRAY_SIZE (mixinr)), +SND_SOC_DAPM_AIF_IN ("DMIC" ,NULL ,0 ,WM8962_PWR_MGMT_1 ,10 ,0 ), +SND_SOC_DAPM_ADC ("ADCL" ,"Capture" ,WM8962_PWR_MGMT_1 ,3 ,0 ), SND_SOC_DAPM_ADC("ADCR", "Capture", WM8962_PWR_MGMT_1, 2, 0),
@@ -2564,13 +2567,17 @@ static const struct snd_soc_dapm_route wm8962_intercon[] = { { "MICBIAS", NULL, "SYSCLK" }, + { "DMIC", NULL, "DMICDAT" }, + { "ADCL", NULL, "SYSCLK" }, { "ADCL", NULL, "TOCLK" }, { "ADCL", NULL, "MIXINL" }, + { "ADCL", NULL, "DMIC" }, { "ADCR", NULL, "SYSCLK" }, { "ADCR", NULL, "TOCLK" }, { "ADCR", NULL, "MIXINR" }, + { "ADCR", NULL, "DMIC" }, { "STL", "Left", "ADCL" }, { "STL", "Right", "ADCR" },
@@ -3718,6 +3725,7 @@ static int wm8962_probe(struct snd_soc_codec *codec) dev);u16 *reg_cache = codec->reg_cache;int i, trigger, irq_pol; +bool dmicclk, dmicdat; wm8962->codec = codec;INIT_DELAYED_WORK (&wm8962->mic_work, wm8962_mic_work);
@@ -3855,6 +3863,29 @@ static int wm8962_probe(struct snd_soc_codec *codec)wm8962_add_widgets (codec); +/* Save boards having to disable DMIC when not in use */ + dmicclk = false; + dmicdat = false; +for (i =0 ; i <WM8962_MAX_GPIO ; i++) { +switch (snd_soc_read (codec,WM8962_GPIO_BASE + i) + &WM8962_GP2_FN_MASK ) { +case WM8962_GPIO_FN_DMICCLK : + dmicclk = true; +break ; +case WM8962_GPIO_FN_DMICDAT : + dmicdat = true; +break ; +default : +break ; + } + } +if (!dmicclk || !dmicdat) { +dev_dbg (codec->dev,"DMIC not in use, disabling\n" ); +snd_soc_dapm_nc_pin (&codec->dapm,"DMICDAT" ); + } +if (dmicclk != dmicdat) +dev_warn (codec->dev,"DMIC GPIOs partially configured\n" ); +wm8962_init_beep (codec);wm8962_init_gpio (codec);
Signature · 1 line
1.7.4.1
Re: [PATCH 2/2] ASoC: Implement WM8962 DMIC support
Mark Brown wrote at Monday, April 25, 2011 1:15 PM:
Quoted 12 lines
...
sound/soc/codecs/wm8962.c +1
-0@@ -2468,6 +2468,7 @@ SND_SOC_DAPM_INPUT("IN3R"),SND_SOC_DAPM_INPUT ("IN4L" ),SND_SOC_DAPM_INPUT ("IN4R" ),SND_SOC_DAPM_INPUT ("Beep" ), +SND_SOC_DAPM_INPUT ("DMICDAT" ), SND_SOC_DAPM_MICBIAS("MICBIAS", WM8962_PWR_MGMT_1, 1, 0),
sound/soc/codecs/wm8962.c SND_SOC_DAPM_MIXER("MIXINL", WM8962_PWR_MGMT_1, 5, · line 2493
Quoted 6 lines
sound/soc/codecs/wm8962.c +2
-0@@ -2487,6 +2488,8 @@ SND_SOC_DAPM_MIXER("MIXINL", WM8962_PWR_MGMT_1, 5,0 ,SND_SOC_DAPM_MIXER ("MIXINR" ,WM8962_PWR_MGMT_1 ,4 ,0 , mixinr,ARRAY_SIZE (mixinr)), +SND_SOC_DAPM_AIF_IN("DMIC", NULL, 0, WM8962_PWR_MGMT_1, 10, 0), +
Mark,
I notice you added both a SND_SOC_DAPM_INPUT and a SND_SOC_DAPM_AIF_IN for the DMIC path here. Should the WM8903 DMIC patch I provided have done the same?
Thanks
Signature · 1 line
nvpublic
Re: [PATCH 2/2] ASoC: Implement WM8962 DMIC support
Quoted 3 lines · Stephen Warren
I notice you added both a
SND_SOC_DAPM_INPUTand aSND_SOC_DAPM_AIF_INfor the DMIC path here. Should the WM8903 DMIC patch I provided have done the same?
Note that the AIF widget here is a power control, not a routing control.
Quoted 4 lines · Mark Brown
Signed-off-by Mark Brown <[email protected]>--- include/sound/wm8962.h | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-)
Both