diff mbox series

ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove

Message ID 20221110190612.1341469-1-detlev.casanova@collabora.com
State Accepted
Commit 0bb8e9b36b5b7f2e77892981ff6c27ee831d8026
Headers show
Series ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove | expand

Commit Message

Detlev Casanova Nov. 10, 2022, 7:06 p.m. UTC
Since commit bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove"),
the device power control registers are reset when the driver is
removed/shutdown.

This is an issue when the device is configured to use the PLL clock. The
device will stop responding if it is still configured to use the PLL
clock but the PLL clock is powered down.

When rebooting linux, the probe function will show:
sgtl5000 0-000a: Error reading chip id -11

Make sure that the CHIP_CLK_CTRL is reset to its default value before
powering down the device.

Fixes: bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove")
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
---
 sound/soc/codecs/sgtl5000.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Fabio Estevam Nov. 10, 2022, 7:08 p.m. UTC | #1
On Thu, Nov 10, 2022 at 4:06 PM Detlev Casanova
<detlev.casanova@collabora.com> wrote:
>
> Since commit bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove"),
> the device power control registers are reset when the driver is
> removed/shutdown.
>
> This is an issue when the device is configured to use the PLL clock. The
> device will stop responding if it is still configured to use the PLL
> clock but the PLL clock is powered down.
>
> When rebooting linux, the probe function will show:
> sgtl5000 0-000a: Error reading chip id -11
>
> Make sure that the CHIP_CLK_CTRL is reset to its default value before
> powering down the device.
>
> Fixes: bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove")
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Mark Brown Nov. 10, 2022, 8:38 p.m. UTC | #2
On Thu, 10 Nov 2022 14:06:12 -0500, Detlev Casanova wrote:
> Since commit bf2aebccddef ("ASoC: sgtl5000: Fix noise on shutdown/remove"),
> the device power control registers are reset when the driver is
> removed/shutdown.
> 
> This is an issue when the device is configured to use the PLL clock. The
> device will stop responding if it is still configured to use the PLL
> clock but the PLL clock is powered down.
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: sgtl5000: Reset the CHIP_CLK_CTRL reg on remove
      commit: 0bb8e9b36b5b7f2e77892981ff6c27ee831d8026

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
diff mbox series

Patch

diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index 4b2135eba74d..a916f4619ea3 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1794,6 +1794,7 @@  static void sgtl5000_i2c_remove(struct i2c_client *client)
 {
 	struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);
 
+	regmap_write(sgtl5000->regmap, SGTL5000_CHIP_CLK_CTRL, SGTL5000_CHIP_CLK_CTRL_DEFAULT);
 	regmap_write(sgtl5000->regmap, SGTL5000_CHIP_DIG_POWER, SGTL5000_DIG_POWER_DEFAULT);
 	regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, SGTL5000_ANA_POWER_DEFAULT);