Re: [PATCH v3 3/8] ASoC: samsung: midas_wm1811: Add headset mic bias supply support

From: Artur Weber
Date: Wed May 22 2024 - 12:20:29 EST


On 20.05.2024 16:35, Mark Brown wrote:
On Sun, May 19, 2024 at 10:17:49AM +0200, Artur Weber wrote:

+static int midas_headset_mic_bias(struct snd_soc_dapm_widget *w,
+ struct snd_kcontrol *kcontrol, int event)
+{
+ struct snd_soc_card *card = w->dapm->card;
+ struct midas_priv *priv = snd_soc_card_get_drvdata(card);
+
+ if (!priv->reg_headset_mic_bias)
+ return 0;
+
+ switch (event) {
+ case SND_SOC_DAPM_PRE_PMU:
+ return regulator_enable(priv->reg_headset_mic_bias);
+ case SND_SOC_DAPM_POST_PMD:
+ return regulator_disable(priv->reg_headset_mic_bias);
+ }

We have SND_SOC_DAPM_REGULATOR_SUPPLY?

This is pretty much copied from the implementation of the mic bias
and sub mic bias regulator handling in the same driver; they all use
SND_SOC_DAPM_MIC combined with an enable/disable function like this one.

What would be the correct thing to do here - add a secondary DAPM widget
of type REGULATOR_SUPPLY and connect it to the MIC widget via audio-
routing, or replace the entire MIC widget with a REGULATOR_SUPPLY (or
something else entirely)?
And should this be done with the Main Mic and Sub Mic as well?

Best regards
Artur