summaryrefslogtreecommitdiff
path: root/include/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2026-09-15 17:35:05 +0100
committerMark Brown <broonie@kernel.org>2026-09-15 17:35:05 +0100
commit82ecb042d5f4efc01298fbf7575e22fadfd8dfd3 (patch)
treeff2799c20bd35a2e4129b47710138d8b1dd05d75 /include/sound
parent247b84c07b7ea4940f69995cc4fc4f20d8c0c615 (diff)
parentdf0afa439044d7099055d5dc27189a083d8c9899 (diff)
downloadlinux-next-82ecb042d5f4efc01298fbf7575e22fadfd8dfd3.tar.gz
linux-next-82ecb042d5f4efc01298fbf7575e22fadfd8dfd3.zip
ASoC: generic: Free jack GPIOs on card remove
Chancel Liu <chancel.liu@oss.nxp.com> says: simple_util_init_jack() acquires a jack detection GPIO with gpiod_get_optional() and passes it to snd_soc_jack_add_gpios(), which also installs an IRQ handler, a PM notifier, a delayed work and a sysfs export for it. None of simple-card, audio-graph-card or audio-graph-card2 implements a card->remove() callback, so none of this is ever released. That goes unnoticed while the card is only torn down together with its platform device, because the devres cleanup registered by snd_soc_jack_add_gpios() is tied to that platform device. It becomes a problem once the card alone is unregistered and registered again while the platform device stays bound - for instance when a codec component is unbound and bound again. card->probe() then runs a second time and gpiod_get_optional() fails with -EBUSY, because the descriptor is still held by the previous bind. The card is not registered again and audio stays broken until the platform device itself is unbound. Patch 1 adds the simple_util_remove_jack() helper, patches 2-4 wire it up in the three generic card drivers. Verified with audio-graph-card2 and a wm8962 codec using hp-det-gpios. Before the series, the first echo 3-001a > /sys/bus/i2c/drivers/wm8962/unbind echo 3-001a > /sys/bus/i2c/drivers/wm8962/bind leaves the GPIO line and IRQ claimed while the card is gone, and the re-bind fails with ASoC error (-16): at graph_util_card_probe() ASoC error (-16): at snd_soc_card_probe() on wm8962-audio after which the sound card never comes back. With the series applied, both codec unbind/bind and platform unbind/bind cycles release the GPIO and IRQ on unbind and fully restore the card. Link: https://patch.msgid.link/20260913102502.2805912-1-chancel.liu@oss.nxp.com
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/simple_card_utils.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h
index bd8c3a033577..68faec56970e 100644
--- a/include/sound/simple_card_utils.h
+++ b/include/sound/simple_card_utils.h
@@ -219,12 +219,14 @@ static inline int simple_util_parse_aux_devs(struct simple_util_priv *priv, char
int simple_util_init_jack(struct snd_soc_card *card,
struct simple_util_jack *sjack,
int is_hp, char *prefix, char *pin);
+void simple_util_remove_jack(struct simple_util_jack *sjack);
int simple_util_init_aux_jacks(struct snd_soc_card *card, char *prefix);
int simple_util_init_priv(struct simple_util_priv *priv,
struct link_info *li);
void simple_util_remove(struct platform_device *pdev);
int graph_util_card_probe(struct snd_soc_card *card);
+int graph_util_card_remove(struct snd_soc_card *card);
int graph_util_is_ports0(struct device_node *port);
int graph_util_parse_dai(struct simple_util_priv *priv, struct device_node *ep,
struct snd_soc_dai_link_component *dlc, int *is_single_link);