Re: [PATCH v8 2/2] ASoC: codecs: nau8360: Add support for NAU83G60 amplifier
Mark Brown <[email protected]>
| Newsgroups | org.alsa-project.alsa-devel,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-sound |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Aug 13, 2026 at 02:43:27PM +0800, Neo Chang wrote:
> Add support for the Nuvoton NAU83G60 audio codec. The NAU83G60 is a
> stereo 30W+30W smart amplifier with an integrated low-latency
> Advanced Audio DSP.
> +int nau8360_dsp_init(struct snd_soc_component *cp)
> +{
> + struct nau8360 *nau8360 = snd_soc_component_get_drvdata(cp);
> + int i, ret;
> +
> + for (i = 0; i < NAU8360_DSP_FW_NUM; i++) {
> + ret = nau8360_dsp_chan_kcs_setup(cp, nau8360->dsp_firmware[i], nau8360_dsp_addr[i]);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
Should this or the binding parsing code do something about PBTL mode,
the binding says that the left DSP firmware is ignored in PBTL mode but
this looks like it will still try to load the firmware.
> +static int nau8360_peq_coeff_get(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_to_dapm(kcontrol);
> + struct snd_soc_component *cp = snd_kcontrol_chip(kcontrol);
This is registered as a regular kcontrol so should get the DAPM context
with snd_soc_component_to_dapm(). Same for _put().
> + if (snd_soc_dapm_get_bias_level(dapm) > SND_SOC_BIAS_STANDBY) {
> + dev_dbg(nau8360->dev, "PEQ access is not allowed during playback");
> + return 0;
> + }
What happens if something starts playback simultaneously with this?
Nothing stops playback starting before we start accessing the registers.
The check will also fail if we've got an active capture stream, IIUC
we shouldn't have one without playback since it's an amplifier and
that's presumably for DSP feedback but at least the docs should be
clearer.
> +static int nau8360_hv_pre_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);
> +
> + if (SND_SOC_DAPM_EVENT_OFF(event)) {
> + snd_soc_component_update_bits(component, NAU8360_R9C_HW1_CTL2,
> + NAU8360_HW1_CH_MUTE, NAU8360_HW1_CH_MUTE);
> + snd_soc_component_update_bits(component, NAU8360_R99_HW2_CTL9,
> + NAU8360_HW2_CH_MUTE, NAU8360_HW2_CH_MUTE);
> + }
> +
> + return 0;
> +}
This is registered as a SND_SOC_DAPM_PRE() so it'll run for capture
streams too. That's probably not the end of the world since IIUC that's
only used for speaker protection data but it's still fun?
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmp97tcACgkQJNaLcl1U h9BF7wf8D5dBFlj7AiQei8Nr98NDLQy9SjP8QVGdtbBgyPzpU4E5K6gWD//63TtY Nfe2LSIB5czpaFkGVc8AC/tdR3pw5g4612qt6MtdTikckdcieso7aVcx//9S08Ny iP+15/jWA4E+NoszxkkuIWdt0BZDcYGkkgRpt4/cAtidJ9rqwxfUs8k+4rcGOKIS kHEuIgDl9MUL79Az4vLSCdAyheq3E7hVc8bTxeSPBx/A0l4DeFA2+FyixsORBEvu ojJndnYP0Jkal+RnQKt/fCUY3lf6pyocc6XQ9RehabJ6JuMJSwmIGeI7EENHq7I7 Xxz5xK5XX0NKRzTMVFUjllzGA/udYg== =7G6m -----END PGP SIGNATURE-----