[PATCH] wm8962: add a simple DMIC enable control
Charles Keepax
ckeepax at opensource.cirrus.com
Wed Feb 2 10:53:01 CET 2022
On Tue, Feb 01, 2022 at 04:01:13PM +0100, Martin Kepplinger wrote:
> In order to use the external mic we need to switch DMIC_ENA off.
When you say external mic do you mean an analogue mic connected
to the INxy pins on the chip?
> I know when DMIC is not used at all, the codec driver does
> snd_soc_dapm_nc_pin(dapm, "DMICDAT"); but I'm not sure how I'd create
> a control based on that.
snd_soc_dapm_nc_pin should be called on DMICDAT if the GPIOs are
not configured for use of a DMIC. And if called DMIC_ENA should
never be set by the driver, since it can't be used as the pins
are not configured to operate as DMICs.
> I'm not yet looking into detection - only making it work when selected
> manually, via ucm. Although I need detection too later.
>
> While this works when I set the control in ucm, AFAIK the way I do it
> here is not correct though due to dapm.
>
> I guess this conflicts with the widget:
> SND_SOC_DAPM_AIF_IN("DMIC_ENA", NULL, 0, WM8962_PWR_MGMT_1, 10, 0),
>
> Do you have any advice for me on how to do what I want?
>
Yes the DMIC enable should be controlled through DAPM when the
relevant audio path is enabled.
Just to check I understand the problem correctly. You have a system
that has both analogue and digital mics connected, and the
problem is that DMIC_ENA is then permanently enabled, meaning you
can't access the audio from the analogue mics?
Assuming I am correct above, looking through the DAPM graph it does
look like the DMIC is oddly wired. It does appear to be hard wired
into ADCL, which would indeed cause it to be permanently enabled
if the pins are configured for DMIC. Assuming there isn't some
reason the chip can't switch between digital and analogue modes
(I can't see an obvious one in the datasheet), I think really there
is a DAPM mux missing here. There should be a mux connecting both
MIXINL and DMIC_ENA to ADCL/ADCR, rather than them both being
directly connected that would let the user switch between
analogue and digital inputs.
Thanks,
Charles
More information about the Alsa-devel
mailing list