Re: [PATCH v3 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 Tue, May 26, 2026 at 09:58:26AM +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.
A few things below, you also have a bunch of what look like legitimate
issues picked up by sashiko (some of which overlap with what I've got
below):
https://sashiko.dev/#/patchset/20260526015826.440769-1-YLCHANG2%40nuvoton.com
> +static int nau8360_peq_coeff_get(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
...
> + snd_soc_component_update_bits(cp, NAU8360_R9D_PEQ_CTL, NAU8360_HW1_MEM_TEST,
> + NAU8360_HW1_MEM_TEST);
> + for (i = 0; i < params->max / sizeof(u16); i++) {
> + value = snd_soc_component_read(cp, reg + i);
> + *(val + i) = cpu_to_be16(value);
> + }
> + snd_soc_component_update_bits(cp, NAU8360_R9D_PEQ_CTL, NAU8360_HW1_MEM_TEST, 0);
> +
> + return 0;
> +}
> +static int nau8360_peq_coeff_put(struct snd_kcontrol *kcontrol,
> + struct snd_ctl_elem_value *ucontrol)
> +{
> + snd_soc_component_update_bits(cp, NAU8360_R9D_PEQ_CTL, NAU8360_HW1_MEM_TEST,
> + NAU8360_HW1_MEM_TEST);
...
> + snd_soc_component_update_bits(cp, NAU8360_R9D_PEQ_CTL, NAU8360_HW1_MEM_TEST, 0);
We use an rwsem to protect the controls from userspace so we could get
more than one caller in these, you need some driver local locking.
> +static int nau8360_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
> + unsigned int rx_mask, int slots, int slot_width)
> +{
> + struct snd_soc_component *cp = dai->component;
> + struct nau8360 *nau8360 = snd_soc_component_get_drvdata(cp);
> + unsigned int tx_slot_used = 0, rx_slot_used = 0;
> + int ret = 0;
> +
> + if (slot_width != 16 && slot_width != 24 && slot_width != 32) {
> + dev_err(cp->dev, "Invalid TDM channel length: %d", slot_width);
> + return -EINVAL;
> + }
This stops the support for disabling TDM from working, a slot_width is
required here.
signature.asc
(application/pgp-signature, 488 B)
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmoW9RkACgkQJNaLcl1U h9AOAwf/XCpGenqAsg5VdLiNBYcT/3lty5A1czozWimgLpuXdu6a8xLeqFCYlOfQ ECzRk/arz8HxuonhicRhMQ45lzA3O56D67Y1X1ajLIQLkaiqlmSILTesbQ9xFRyQ y3LSIqCcZA15FWDEHjFI9y9OpkIiht5PSSzoxEl27991Do8FkGrcizSgU/DTlfiD Y5D7Wp5Zbx4BIxwWsxtkG54n207YmMUBETfsaLbmn6rijv9OISrfXFAAdP4YNMmM aCF3r7e+lpamW5PAaiUdQp8cKntSu36zHGeY0SmkhAhMU/ClR6TB0ZdnI6YT+DPT 2axvsMhw+oCPaBVr3+Pb4eQFgzyX+w== =IE9q -----END PGP SIGNATURE-----