[PATCH 03/12] ASoC: codecs: wm8994: Implement set_jack callback

From: Amadeusz Sławiński

Date: Mon Oct 26 2026 - 16:20:22 EST


Add set_jack callback to the component driver so machine drivers
can use the standard snd_soc_component_set_jack() API instead of
driver-specific wm8994_mic_detect() and wm8958_mic_detect() helpers.

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

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 6b91e02f130b..69afba1764eb 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4642,12 +4642,30 @@ static void wm8994_component_remove(struct snd_soc_component *component)
kfree(wm8994->retune_mobile_texts);
}

+static int wm8994_set_jack(struct snd_soc_component *component,
+ struct snd_soc_jack *jack, void *data)
+{
+ struct wm8994_priv *wm8994 = snd_soc_component_get_drvdata(component);
+ struct wm8994 *control = wm8994->wm8994;
+
+ switch (control->type) {
+ case WM8994:
+ return wm8994_mic_detect(component, jack, data ? *(int *)data : 1);
+ case WM1811:
+ case WM8958:
+ return wm8958_mic_detect(component, jack, NULL, NULL, NULL, NULL);
+ default:
+ return -EINVAL;
+ }
+}
+
static const struct snd_soc_component_driver soc_component_dev_wm8994 = {
.probe = wm8994_component_probe,
.remove = wm8994_component_remove,
.suspend = wm8994_component_suspend,
.resume = wm8994_component_resume,
.set_bias_level = wm8994_set_bias_level,
+ .set_jack = wm8994_set_jack,
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
--
2.56.0