public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: nau8325: Add software reset during probe
@ 2026-04-08  5:26 Neo Chang
  2026-04-08  8:07 ` Cezary Rojewski
  2026-04-08 12:02 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Neo Chang @ 2026-04-08  5:26 UTC (permalink / raw)
  To: broonie, lgirdwood, linux-sound
  Cc: perex, tiwai, krzysztof.kozlowski, dan.carpenter, linux-kernel,
	alsa-devel, neo.chang70, kchsu0, Neo Chang

Currently, the driver only performs a hardware reset during the I2C probe
sequence. To ensure all internal states of the codec are properly cleared
without affecting the configuration registers, a software reset is also
required.

According to the hardware specification, writing to the Software Reset
register (R01) twice will reset all internal states safely.

This patch adds the nau8325_software_reset() function, executes it right
after the hardware reset in the probe function, and marks the R01 register
as writeable in the regmap configuration.

Signed-off-by: Neo Chang <YLCHANG2@nuvoton.com>
---
 sound/soc/codecs/nau8325.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/nau8325.c b/sound/soc/codecs/nau8325.c
index e651263a9812..58ef5c493835 100644
--- a/sound/soc/codecs/nau8325.c
+++ b/sound/soc/codecs/nau8325.c
@@ -142,7 +142,7 @@ static bool nau8325_readable_reg(struct device *dev, unsigned int reg)
 static bool nau8325_writeable_reg(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
-	case NAU8325_R00_HARDWARE_RST:
+	case NAU8325_R00_HARDWARE_RST ... NAU8325_R01_SOFTWARE_RST:
 	case NAU8325_R03_CLK_CTRL ... NAU8325_R06_INT_CLR_STATUS:
 	case NAU8325_R09_IRQOUT ... NAU8325_R13_DAC_VOLUME:
 	case NAU8325_R29_DAC_CTRL1 ... NAU8325_R2A_DAC_CTRL2:
@@ -670,6 +670,12 @@ static void nau8325_reset_chip(struct regmap *regmap)
 	regmap_write(regmap, NAU8325_R00_HARDWARE_RST, 0x0000);
 }
 
+static void nau8325_software_reset(struct regmap *regmap)
+{
+	regmap_write(regmap, NAU8325_R01_SOFTWARE_RST, 0x0000);
+	regmap_write(regmap, NAU8325_R01_SOFTWARE_RST, 0x0000);
+}
+
 static void nau8325_init_regs(struct nau8325 *nau8325)
 {
 	struct regmap *regmap = nau8325->regmap;
@@ -856,6 +862,7 @@ static int nau8325_i2c_probe(struct i2c_client *i2c)
 	nau8325_print_device_properties(nau8325);
 
 	nau8325_reset_chip(nau8325->regmap);
+	nau8325_software_reset(nau8325->regmap);
 	ret = regmap_read(nau8325->regmap, NAU8325_R02_DEVICE_ID, &value);
 	if (ret) {
 		dev_dbg(dev, "Failed to read device id (%d)", ret);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: nau8325: Add software reset during probe
  2026-04-08  5:26 [PATCH] ASoC: nau8325: Add software reset during probe Neo Chang
@ 2026-04-08  8:07 ` Cezary Rojewski
  2026-04-08  8:51   ` YLCHANG2
  2026-04-08 12:02 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Cezary Rojewski @ 2026-04-08  8:07 UTC (permalink / raw)
  To: Neo Chang
  Cc: perex, tiwai, krzysztof.kozlowski, dan.carpenter, linux-kernel,
	alsa-devel, neo.chang70, kchsu0, broonie, lgirdwood, linux-sound

On 2026-04-08 7:26 AM, Neo Chang wrote:
> Currently, the driver only performs a hardware reset during the I2C probe
> sequence. To ensure all internal states of the codec are properly cleared
> without affecting the configuration registers, a software reset is also
> required.
> 
> According to the hardware specification, writing to the Software Reset
> register (R01) twice will reset all internal states safely.
> 
> This patch adds the nau8325_software_reset() function, executes it right
> after the hardware reset in the probe function, and marks the R01 register
> as writeable in the regmap configuration.

The first two paragraphs explain the situation, I'd say the third is 
redundant. Not a reason for a resend though, only something to consider.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: nau8325: Add software reset during probe
  2026-04-08  8:07 ` Cezary Rojewski
@ 2026-04-08  8:51   ` YLCHANG2
  0 siblings, 0 replies; 4+ messages in thread
From: YLCHANG2 @ 2026-04-08  8:51 UTC (permalink / raw)
  To: Cezary Rojewski, Neo Chang
  Cc: perex, tiwai, krzysztof.kozlowski, dan.carpenter, linux-kernel,
	alsa-devel, kchsu0, broonie, lgirdwood, linux-sound


On 4/8/26 16:07, Cezary Rojewski wrote:
> On 2026-04-08 7:26 AM, Neo Chang wrote:
>> Currently, the driver only performs a hardware reset during the I2C 
>> probe
>> sequence. To ensure all internal states of the codec are properly 
>> cleared
>> without affecting the configuration registers, a software reset is also
>> required.
>>
>> According to the hardware specification, writing to the Software Reset
>> register (R01) twice will reset all internal states safely.
>>
>> This patch adds the nau8325_software_reset() function, executes it right
>> after the hardware reset in the probe function, and marks the R01 
>> register
>> as writeable in the regmap configuration.
>
> The first two paragraphs explain the situation, I'd say the third is 
> redundant. Not a reason for a resend though, only something to consider.
>
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>

Thank you for the review and the advice on the commit message.

I will keep it in mind for the next time.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: nau8325: Add software reset during probe
  2026-04-08  5:26 [PATCH] ASoC: nau8325: Add software reset during probe Neo Chang
  2026-04-08  8:07 ` Cezary Rojewski
@ 2026-04-08 12:02 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-04-08 12:02 UTC (permalink / raw)
  To: lgirdwood, linux-sound, Neo Chang
  Cc: perex, tiwai, krzysztof.kozlowski, dan.carpenter, linux-kernel,
	alsa-devel, neo.chang70, kchsu0

On Wed, 08 Apr 2026 13:26:39 +0800, Neo Chang wrote:
> ASoC: nau8325: Add software reset during probe

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.0

Thanks!

[1/1] ASoC: nau8325: Add software reset during probe
      https://git.kernel.org/broonie/sound/c/f4c90fb761f6

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-04-08 18:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-08  5:26 [PATCH] ASoC: nau8325: Add software reset during probe Neo Chang
2026-04-08  8:07 ` Cezary Rojewski
2026-04-08  8:51   ` YLCHANG2
2026-04-08 12:02 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox