Skip to content

Commit f4c90fb

Browse files
NeoChang10broonie
authored andcommitted
ASoC: nau8325: Add software reset during probe
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> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com> Link: https://patch.msgid.link/20260408052639.187149-1-YLCHANG2@nuvoton.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent c5408d8 commit f4c90fb

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sound/soc/codecs/nau8325.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ static bool nau8325_readable_reg(struct device *dev, unsigned int reg)
142142
static bool nau8325_writeable_reg(struct device *dev, unsigned int reg)
143143
{
144144
switch (reg) {
145-
case NAU8325_R00_HARDWARE_RST:
145+
case NAU8325_R00_HARDWARE_RST ... NAU8325_R01_SOFTWARE_RST:
146146
case NAU8325_R03_CLK_CTRL ... NAU8325_R06_INT_CLR_STATUS:
147147
case NAU8325_R09_IRQOUT ... NAU8325_R13_DAC_VOLUME:
148148
case NAU8325_R29_DAC_CTRL1 ... NAU8325_R2A_DAC_CTRL2:
@@ -670,6 +670,12 @@ static void nau8325_reset_chip(struct regmap *regmap)
670670
regmap_write(regmap, NAU8325_R00_HARDWARE_RST, 0x0000);
671671
}
672672

673+
static void nau8325_software_reset(struct regmap *regmap)
674+
{
675+
regmap_write(regmap, NAU8325_R01_SOFTWARE_RST, 0x0000);
676+
regmap_write(regmap, NAU8325_R01_SOFTWARE_RST, 0x0000);
677+
}
678+
673679
static void nau8325_init_regs(struct nau8325 *nau8325)
674680
{
675681
struct regmap *regmap = nau8325->regmap;
@@ -856,6 +862,7 @@ static int nau8325_i2c_probe(struct i2c_client *i2c)
856862
nau8325_print_device_properties(nau8325);
857863

858864
nau8325_reset_chip(nau8325->regmap);
865+
nau8325_software_reset(nau8325->regmap);
859866
ret = regmap_read(nau8325->regmap, NAU8325_R02_DEVICE_ID, &value);
860867
if (ret) {
861868
dev_dbg(dev, "Failed to read device id (%d)", ret);

0 commit comments

Comments
 (0)