[PATCH] ASoC: rk817: Do not free the regmap of the parent PMIC

Igor Velkov via B4 Relay devnull+iav.iav.lv at kernel.org
Fri Nov 27 17:06:46 PST 2026


From: Igor Velkov <iav at iav.lv>

The codec uses the regmap of its RK817/RK809 PMIC parent, which the
PMIC core, RTC and regulator drivers use too. rk817_remove() calls
snd_soc_component_exit_regmap(), so removing the component, on a card
unbind or a failed bind, runs regmap_exit() on that shared regmap. The
other users are left with a freed regmap, and devm runs regmap_exit()
on it again when the PMIC goes away.

Clear the pointer instead, as commit 6d66c5ccf5cb ("ASoC: mediatek:
mt6359: Fix unexpected error in bind/unbind flow") does for mt6359.

On an ODROID-M1 (RK3568, RK809) the PMIC regmap (3-0020) disappears
from debugfs after unbinding the card, and a later hybrid sleep oopsed
in regmap_update_bits_base() called from rk808_rtc_readtime(). With
this change the regmap stays, the RTC reads and binding the card again
works.

Fixes: 0d6a04da9b25 ("ASoC: Add Rockchip rk817 audio CODEC support")
Signed-off-by: Igor Velkov <iav at iav.lv>
---
mt6660 has a similar issue: mt6660_component_remove() calls
snd_soc_component_exit_regmap() on a regmap created with
devm_regmap_init(). Not tested, I have no such hardware.
---
 sound/soc/codecs/rk817_codec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/codecs/rk817_codec.c b/sound/soc/codecs/rk817_codec.c
index 2c0fe1dfd842..c7804b2b559c 100644
--- a/sound/soc/codecs/rk817_codec.c
+++ b/sound/soc/codecs/rk817_codec.c
@@ -434,7 +434,7 @@ static int rk817_probe(struct snd_soc_component *component)
 
 static void rk817_remove(struct snd_soc_component *component)
 {
-	snd_soc_component_exit_regmap(component);
+	component->regmap = NULL;
 }
 
 static const struct snd_soc_component_driver soc_codec_dev_rk817 = {

---
base-commit: a6c7e545d8abac8ad0b48da4c8b4ca5ef8ea8eda
change-id: 20261128-rk817-keep-parent-regmap-354a8b6c9f89

Best regards,
-- 
Igor Velkov <iav at iav.lv>





More information about the Linux-rockchip mailing list