[PATCH 01/12] ASoC: codecs: wm8903: Implement set_jack callback

From: Amadeusz Sławiński

Date: Mon Oct 26 2026 - 16:21:03 EST


Add set_jack callback to the component driver so machine drivers
can use the standard snd_soc_component_set_jack() API instead of
the driver-specific wm8903_mic_detect() helper.

Signed-off-by: Amadeusz Sławiński <amade@xxxxxxxxxx>
---
sound/soc/codecs/wm8903.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 553f8d68a546..25a488f589a7 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1638,6 +1638,17 @@ int wm8903_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *
}
EXPORT_SYMBOL_GPL(wm8903_mic_detect);

+static int wm8903_set_jack(struct snd_soc_component *component,
+ struct snd_soc_jack *jack, void *data)
+{
+ int *shrt = data;
+
+ if (!jack)
+ return wm8903_mic_detect(component, NULL, 0, 0);
+
+ return wm8903_mic_detect(component, jack, SND_JACK_MICROPHONE, shrt ? *shrt : 0);
+}
+
static irqreturn_t wm8903_irq(int irq, void *data)
{
struct wm8903_priv *wm8903 = data;
@@ -1902,6 +1913,7 @@ static void wm8903_free_gpio(struct wm8903_priv *wm8903)
static const struct snd_soc_component_driver soc_component_dev_wm8903 = {
.resume = wm8903_resume,
.set_bias_level = wm8903_set_bias_level,
+ .set_jack = wm8903_set_jack,
.seq_notifier = wm8903_seq_notifier,
.controls = wm8903_snd_controls,
.num_controls = ARRAY_SIZE(wm8903_snd_controls),
--
2.56.0