Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Rafael Diniz <rafael@riseup.net>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	patches@opensource.cirrus.com, linux-sound@vger.kernel.org
Subject: Re: [PATCH v3 1/2] ASoC: wm8731: activate the interface after the converters, before the outputs
Date: Mon, 30 Nov 2026 10:28:30 +0000	[thread overview]
Message-ID: <aw1PzssG7zIoJ0dy@opensource.cirrus.com> (raw)
In-Reply-To: <20261128092306.1566199-2-rafael@riseup.net>

On Sat, Nov 28, 2026 at 09:23:04AM +0000, Rafael Diniz wrote:
> +#define WM8731_PWR_CONVERTERS	(WM8731_PWR_ADCPD | WM8731_PWR_DACPD)
> +
> +static int wm8731_converters_event(struct snd_soc_dapm_widget *w,
> +				   struct snd_kcontrol *kcontrol, int event)
> +{
> +	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
> +
> +	switch (event) {
> +	case SND_SOC_DAPM_PRE_PMU:
> +		snd_soc_component_update_bits(component, WM8731_PWR,
> +					      WM8731_PWR_CONVERTERS, 0);
> +		break;
> +	case SND_SOC_DAPM_POST_PMU:
> +		snd_soc_component_update_bits(component, WM8731_ACTIVE,
> +					      WM8731_ACTIVE_ACTIVE,
> +					      WM8731_ACTIVE_ACTIVE);
> +		break;
> +	case SND_SOC_DAPM_PRE_PMD:
> +		snd_soc_component_update_bits(component, WM8731_ACTIVE,
> +					      WM8731_ACTIVE_ACTIVE, 0);
> +		break;
> +	case SND_SOC_DAPM_POST_PMD:
> +		snd_soc_component_update_bits(component, WM8731_PWR,
> +					      WM8731_PWR_CONVERTERS,
> +					      WM8731_PWR_CONVERTERS);
> +		break;
> +	}
> +	return 0;
> +}
> +
>  static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = {
> -SND_SOC_DAPM_SUPPLY("ACTIVE",WM8731_ACTIVE, 0, 0, NULL, 0),
>  SND_SOC_DAPM_SUPPLY("OSC", WM8731_PWR, 5, 1, NULL, 0),
> +SND_SOC_DAPM_SUPPLY_S("Converters", 1, SND_SOC_NOPM, 0, 0,
> +		      wm8731_converters_event,
> +		      SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
> +		      SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD),
>  SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1,
>  	&wm8731_output_mixer_controls[0],
>  	ARRAY_SIZE(wm8731_output_mixer_controls)),
> -SND_SOC_DAPM_DAC("DAC", "HiFi Playback", WM8731_PWR, 3, 1),
> +SND_SOC_DAPM_DAC("DAC", "HiFi Playback", SND_SOC_NOPM, 0, 0),
>  SND_SOC_DAPM_OUTPUT("LOUT"),
>  SND_SOC_DAPM_OUTPUT("LHPOUT"),
>  SND_SOC_DAPM_OUTPUT("ROUT"),
>  SND_SOC_DAPM_OUTPUT("RHPOUT"),
> -SND_SOC_DAPM_ADC("ADC", "HiFi Capture", WM8731_PWR, 2, 1),
> +SND_SOC_DAPM_ADC("ADC", "HiFi Capture", SND_SOC_NOPM, 0, 0),
>  SND_SOC_DAPM_MUX("Input Mux", SND_SOC_NOPM, 0, 0, &wm8731_input_mux_controls),
>  SND_SOC_DAPM_PGA("Line Input", WM8731_PWR, 0, 1, NULL, 0),
>  SND_SOC_DAPM_MICBIAS("Mic Bias", WM8731_PWR, 1, 1),

Don't you still have a different sequence from the datasheet
here. Assuming everything powers up and I didn't make a mistake,
you have:

 1) Power OSCPD
 2) Power ADCPD/DACPD
 3) Set ACTIVE
 4) Power MICPD
 5) Power OUTPD
 6) Power LINEINPD

And I think following the section of the datasheet Mark linked
you want:

 1) Power OSCPD
 2) Power ADCPD/DACPD
 3) Power MICPD
 4) Power LINEINPD
 5) Set ACTIVE
 6) Power OUTPD

Although doubt the order of 2-4 matter in there.

Thanks,
Charles

  reply	other threads:[~2026-11-30 10:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  9:23 [PATCH v3 0/2] ASoC: wm8731: interface activation order Rafael Diniz
2026-11-28  9:23 ` [PATCH v3 1/2] ASoC: wm8731: activate the interface after the converters, before the outputs Rafael Diniz
2026-11-30 10:28   ` Charles Keepax [this message]
2026-11-28  9:23 ` [PATCH v3 2/2] ASoC: wm8731: use one sample width for both directions Rafael Diniz
2026-11-30 10:03   ` Charles Keepax

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aw1PzssG7zIoJ0dy@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=rafael@riseup.net \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox