Re: [PATCH] ASoC: Fix vaud18 power leakage of mt6359

From: Mark Brown
Date: Fri Nov 06 2020 - 07:26:48 EST


On Fri, Nov 06, 2020 at 02:18:37PM +0800, Shane Chien wrote:

> +static int mt_vaud18_event(struct snd_soc_dapm_widget *w,
> + struct snd_kcontrol *kcontrol,
> + int event)
> +{
> + struct snd_soc_component *cmpnt = snd_soc_dapm_to_component(w->dapm);
> + struct mt6359_priv *priv = snd_soc_component_get_drvdata(cmpnt);
> + int ret = 0;
> +
> + switch (event) {
> + case SND_SOC_DAPM_PRE_PMU:
> + ret = regulator_enable(priv->avdd_reg);
> + if (ret)
> + dev_err(priv->dev, "regulator_enable err: %d\n", ret);
> + break;
> + case SND_SOC_DAPM_POST_PMD:
> + ret = regulator_disable(priv->avdd_reg);
> + if (ret)
> + dev_err(priv->dev, "regulator_disable err: %d\n", ret);
> + break;

This is just a SND_SOC_DAPM_REGULATOR_SUPPLY widget as far as I can see
- why not use one of those rather than open coding?

Attachment: signature.asc
Description: PGP signature