[PATCH 14/28] ASoC: ops: Export snd_soc_control_matches()
From: James Calligeros
Date: Sun Sep 20 2026 - 01:00:55 EST
From: Hector Martin <marcan@xxxxxxxxx>
This helper is useful for drivers that want to do their own control
lookups and matching as part of more complex logic than the existing
operations.
Signed-off-by: Hector Martin <marcan@xxxxxxxxx>
Signed-off-by: James Calligeros <jcalligeros99@xxxxxxxxx>
---
include/sound/soc.h | 2 ++
sound/soc/soc-ops.c | 9 +++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index d638fc69925c..6c4689ef8973 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -576,6 +576,8 @@ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol);
+bool snd_soc_control_matches(struct snd_kcontrol *kcontrol,
+ const char *pattern);
int snd_soc_limit_volume(struct snd_soc_card *card,
const char *name, int max);
int snd_soc_deactivate_kctl(struct snd_soc_card *card,
diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c
index dc27d1c409ab..94d0514be66d 100644
--- a/sound/soc/soc-ops.c
+++ b/sound/soc/soc-ops.c
@@ -403,7 +403,7 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol,
}
EXPORT_SYMBOL_GPL(snd_soc_put_volsw_sx);
-static bool soc_control_matches(struct snd_kcontrol *kctl,
+bool snd_soc_control_matches(struct snd_kcontrol *kctl,
const char *pattern)
{
const char *name = kctl->id.name;
@@ -425,6 +425,7 @@ static bool soc_control_matches(struct snd_kcontrol *kctl,
return !strcmp(name, pattern);
}
+EXPORT_SYMBOL_GPL(snd_soc_control_matches);
static int snd_soc_clip_to_platform_max(struct snd_kcontrol *kctl)
{
@@ -492,7 +493,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max)
return -EINVAL;
list_for_each_entry(kctl, &card->snd_card->controls, list) {
- if (!soc_control_matches(kctl, name))
+ if (!snd_soc_control_matches(kctl, name))
continue;
ret = soc_limit_volume(kctl, max);
@@ -534,7 +535,7 @@ int snd_soc_deactivate_kctl(struct snd_soc_card *card,
return -EINVAL;
list_for_each_entry(kctl, &card->snd_card->controls, list) {
- if (!soc_control_matches(kctl, name))
+ if (!snd_soc_control_matches(kctl, name))
continue;
ret = snd_ctl_activate_id(card->snd_card, &kctl->id, active);
@@ -604,7 +605,7 @@ int snd_soc_set_enum_kctl(struct snd_soc_card *card,
return -EINVAL;
list_for_each_entry(kctl, &card->snd_card->controls, list) {
- if (!soc_control_matches(kctl, name))
+ if (!snd_soc_control_matches(kctl, name))
continue;
ret = soc_set_enum_kctl(kctl, value);
--
2.55.0