* [PATCH v2 01/13] ASoC: soc-component: tidyup be_hw_params_fixup() define position
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
@ 2026-10-02 2:51 ` Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 02/13] ASoC: soc-component: replace bool member to bit field Kuninori Morimoto
` (11 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:51 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
be_hw_params_fixup() is one of snd_soc_component_driver callback
function, but is defined as alone in a remote location.
Let's move it to the same place as other callbacks.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 6c1acc984ecb0..2da196de6b89c 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -154,6 +154,8 @@ struct snd_soc_component_driver {
struct snd_pcm_substream *substream);
snd_pcm_sframes_t (*delay)(struct snd_soc_component *component,
struct snd_pcm_substream *substream);
+ int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
+ struct snd_pcm_hw_params *params);
const struct snd_compress_ops *compress_ops;
@@ -197,8 +199,7 @@ struct snd_soc_component_driver {
/* this component uses topology and ignore machine driver FEs */
const char *ignore_machine;
const char *topology_name_prefix;
- int (*be_hw_params_fixup)(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_hw_params *params);
+
bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */
int be_pcm_base; /* base device ID for all BE PCMs */
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 02/13] ASoC: soc-component: replace bool member to bit field
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 01/13] ASoC: soc-component: tidyup be_hw_params_fixup() define position Kuninori Morimoto
@ 2026-10-02 2:51 ` Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 03/13] ASoC: soc-component: move snd_soc_add_component_controls() Kuninori Morimoto
` (10 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:51 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
soc-component has meny bit fields (A), no need to have bool member (B).
Let's makes it as bit field, too
struct snd_soc_component_driver {
...
^ unsigned int module_get_upon_open:1;
(A) unsigned int idle_bias_on:1;
| unsigned int suspend_bias_off:1;
| ...
v unsigned int legacy_dai_naming:1;
...
(B) bool use_dai_pcm_id;
...
}
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 2da196de6b89c..734dc44773e96 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -196,11 +196,13 @@ struct snd_soc_component_driver {
unsigned int endianness:1;
unsigned int legacy_dai_naming:1;
+ /* use DAI link PCM ID as PCM device number */
+ unsigned int use_dai_pcm_id:1;
+
/* this component uses topology and ignore machine driver FEs */
const char *ignore_machine;
const char *topology_name_prefix;
- bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */
int be_pcm_base; /* base device ID for all BE PCMs */
const char *debugfs_prefix;
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 03/13] ASoC: soc-component: move snd_soc_add_component_controls()
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 01/13] ASoC: soc-component: tidyup be_hw_params_fixup() define position Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 02/13] ASoC: soc-component: replace bool member to bit field Kuninori Morimoto
@ 2026-10-02 2:51 ` Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 04/13] ASoC: soc-component: move snd_soc_component_fixup_controls() Kuninori Morimoto
` (9 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:51 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
snd_soc_add_component_controls() is Component related function.
And its parameter will be capsuled soon, will be not enable to access from
soc-core.c. Move it to soc-component.c
It renames function name
- snd_soc_add_component_controls()
+ snd_soc_component_add_controls()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 3 +++
include/sound/soc.h | 3 +--
sound/soc/soc-component.c | 21 +++++++++++++++++++++
sound/soc/soc-core.c | 19 -------------------
4 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 734dc44773e96..d83ba2996653e 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -355,6 +355,9 @@ void snd_soc_component_init_regmap(struct snd_soc_component *component,
void snd_soc_component_exit_regmap(struct snd_soc_component *component);
#endif
+int snd_soc_component_add_controls(struct snd_soc_component *component,
+ const struct snd_kcontrol_new *controls, unsigned int num_controls);
+
#define snd_soc_component_module_get_when_probe(component)\
snd_soc_component_module_get(component, NULL, 0)
#define snd_soc_component_module_get_when_open(component, substream) \
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 553bb7e2be984..09a3e737c23d9 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -551,8 +551,6 @@ static inline int snd_soc_set_ac97_ops(struct snd_ac97_bus_ops *ops)
struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
void *data, const char *long_name,
const char *prefix);
-int snd_soc_add_component_controls(struct snd_soc_component *component,
- const struct snd_kcontrol_new *controls, unsigned int num_controls);
int snd_soc_add_card_controls(struct snd_soc_card *soc_card,
const struct snd_kcontrol_new *controls, int num_controls);
int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
@@ -1548,5 +1546,6 @@ static inline void _snd_soc_dpcm_mutex_assert_held_r(struct snd_soc_pcm_runtime
#define snd_soc_add_dai_controls snd_soc_dai_add_controls
#define snd_soc_register_dai snd_soc_dai_register
#define snd_soc_unregister_dai snd_soc_dai_unregister
+#define snd_soc_add_component_controls snd_soc_component_add_controls
#endif
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 463ea227cac81..709d78ee92fd5 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -12,6 +12,7 @@
#include <linux/pm_runtime.h>
#include <sound/soc.h>
#include <linux/bitops.h>
+#include "soc-internal.h"
#define soc_component_ret(dai, ret) _soc_component_ret(dai, __func__, ret)
static inline int _soc_component_ret(struct snd_soc_component *component, const char *func, int ret)
@@ -339,6 +340,26 @@ int snd_soc_component_probe(struct snd_soc_component *component)
return soc_component_ret(component, ret);
}
+/**
+ * snd_soc_component_add_controls - Add an array of controls to a component.
+ *
+ * @component: Component to add controls to
+ * @controls: Array of controls to add
+ * @num_controls: Number of elements in the array
+ *
+ * Return: 0 for success, else error.
+ */
+int snd_soc_component_add_controls(struct snd_soc_component *component,
+ const struct snd_kcontrol_new *controls,
+ unsigned int num_controls)
+{
+ struct snd_card *card = component->card->snd_card;
+
+ return snd_soc_add_controls(card, component->dev, controls,
+ num_controls, component->name_prefix, component);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_add_controls);
+
int snd_soc_component_fixup_controls(struct snd_soc_component *component)
{
int ret = 0;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 06167a1985912..b54706dbb527a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2305,25 +2305,6 @@ int snd_soc_add_controls(struct snd_card *card, struct device *dev,
return 0;
}
-/**
- * snd_soc_add_component_controls - Add an array of controls to a component.
- *
- * @component: Component to add controls to
- * @controls: Array of controls to add
- * @num_controls: Number of elements in the array
- *
- * Return: 0 for success, else error.
- */
-int snd_soc_add_component_controls(struct snd_soc_component *component,
- const struct snd_kcontrol_new *controls, unsigned int num_controls)
-{
- struct snd_card *card = component->card->snd_card;
-
- return snd_soc_add_controls(card, component->dev, controls,
- num_controls, component->name_prefix, component);
-}
-EXPORT_SYMBOL_GPL(snd_soc_add_component_controls);
-
/**
* snd_soc_add_card_controls - add an array of controls to a SoC card.
* Convenience function to add a list of controls.
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 04/13] ASoC: soc-component: move snd_soc_component_fixup_controls()
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (2 preceding siblings ...)
2026-10-02 2:51 ` [PATCH v2 03/13] ASoC: soc-component: move snd_soc_add_component_controls() Kuninori Morimoto
@ 2026-10-02 2:51 ` Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 05/13] ASoC: soc-component: move soc_component_to_node() to soc-component.c Kuninori Morimoto
` (8 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:51 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
snd_soc_component_xxx_controls() are located between _probe()
and _remove() in soc-component.c, and are located in scattered
positions in soc-component.h. Fixup them.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 2 +-
sound/soc/soc-component.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index d83ba2996653e..7708d84af8853 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -355,6 +355,7 @@ void snd_soc_component_init_regmap(struct snd_soc_component *component,
void snd_soc_component_exit_regmap(struct snd_soc_component *component);
#endif
+int snd_soc_component_fixup_controls(struct snd_soc_component *component);
int snd_soc_component_add_controls(struct snd_soc_component *component,
const struct snd_kcontrol_new *controls, unsigned int num_controls);
@@ -404,7 +405,6 @@ void snd_soc_component_suspend(struct snd_soc_component *component);
void snd_soc_component_resume(struct snd_soc_component *component);
int snd_soc_component_is_suspended(struct snd_soc_component *component);
int snd_soc_component_probe(struct snd_soc_component *component);
-int snd_soc_component_fixup_controls(struct snd_soc_component *component);
void snd_soc_component_remove(struct snd_soc_component *component);
int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
struct device_node *ep);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 709d78ee92fd5..6077d07f873f5 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -340,6 +340,12 @@ int snd_soc_component_probe(struct snd_soc_component *component)
return soc_component_ret(component, ret);
}
+void snd_soc_component_remove(struct snd_soc_component *component)
+{
+ if (component->driver->remove)
+ component->driver->remove(component);
+}
+
/**
* snd_soc_component_add_controls - Add an array of controls to a component.
*
@@ -370,12 +376,6 @@ int snd_soc_component_fixup_controls(struct snd_soc_component *component)
return soc_component_ret(component, ret);
}
-void snd_soc_component_remove(struct snd_soc_component *component)
-{
- if (component->driver->remove)
- component->driver->remove(component);
-}
-
int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
struct device_node *ep)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 05/13] ASoC: soc-component: move soc_component_to_node() to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (3 preceding siblings ...)
2026-10-02 2:51 ` [PATCH v2 04/13] ASoC: soc-component: move snd_soc_component_fixup_controls() Kuninori Morimoto
@ 2026-10-02 2:51 ` Kuninori Morimoto
2026-10-02 2:51 ` [PATCH v2 06/13] ASoC: soc-component: move snd_soc_is_matching_component() " Kuninori Morimoto
` (7 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:51 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move soc_component_to_node() to soc-component.c
It renames function name
- soc_component_to_node()
+ snd_soc_component_to_node()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-component.c | 11 +++++++++++
sound/soc/soc-core.c | 18 +++---------------
sound/soc/soc-internal.h | 6 ++++++
3 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 6077d07f873f5..11acf0d42213f 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1295,3 +1295,14 @@ int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream)
return 0;
}
+
+struct device_node *snd_soc_component_to_node(struct snd_soc_component *component)
+{
+ struct device_node *of_node;
+
+ of_node = component->dev->of_node;
+ if (!of_node && component->dev->parent)
+ of_node = component->dev->parent->of_node;
+
+ return of_node;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b54706dbb527a..59a8f44e249a3 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -771,18 +771,6 @@ static void soc_resume_init(struct snd_soc_card *card)
static inline void soc_resume_init(struct snd_soc_card *card) { }
#endif
-static struct device_node
-*soc_component_to_node(struct snd_soc_component *component)
-{
- struct device_node *of_node;
-
- of_node = component->dev->of_node;
- if (!of_node && component->dev->parent)
- of_node = component->dev->parent->of_node;
-
- return of_node;
-}
-
struct of_phandle_args *snd_soc_copy_dai_args(struct device *dev,
const struct of_phandle_args *args)
{
@@ -815,7 +803,7 @@ static int snd_soc_is_matching_component(
return 0;
}
- component_of_node = soc_component_to_node(component);
+ component_of_node = snd_soc_component_to_node(component);
if (dlc->of_node && component_of_node != dlc->of_node)
return 0;
@@ -1339,7 +1327,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
static void soc_set_name_prefix(struct snd_soc_card *card,
struct snd_soc_component *component)
{
- struct device_node *of_node = soc_component_to_node(component);
+ struct device_node *of_node = snd_soc_component_to_node(component);
const char *str;
int ret, i;
@@ -3275,7 +3263,7 @@ int snd_soc_get_dlc(const struct of_phandle_args *args, struct snd_soc_dai_link_
guard(mutex)(&client_mutex);
for_each_component(pos) {
- struct device_node *component_of_node = soc_component_to_node(pos);
+ struct device_node *component_of_node = snd_soc_component_to_node(pos);
if (component_of_node != args->np || !pos->num_dai)
continue;
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index 31559918355f8..a08e6e8ef17f3 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -36,4 +36,10 @@ struct clk *snd_soc_dai_get_bclk(struct snd_soc_dai *dai);
unsigned int snd_soc_dai_get_bclk_ratio(struct snd_soc_dai *dai);
void snd_soc_dai_active_update(struct snd_soc_dai *dai, int stream, int action);
+/*
+ * In soc-component
+ */
+struct device_node *snd_soc_component_to_node(struct snd_soc_component *component);
+
+
#endif /* __SOC_INTERNAL_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 06/13] ASoC: soc-component: move snd_soc_is_matching_component() to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (4 preceding siblings ...)
2026-10-02 2:51 ` [PATCH v2 05/13] ASoC: soc-component: move soc_component_to_node() to soc-component.c Kuninori Morimoto
@ 2026-10-02 2:51 ` Kuninori Morimoto
2026-10-02 2:52 ` [PATCH v2 07/13] ASoC: soc-component: move soc_{probe/remove}_component() " Kuninori Morimoto
` (6 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:51 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move snd_soc_is_matching_component() to soc-component.c
It renames function name
- snd_soc_is_matching_component()
+ snd_soc_component_matches_dlc()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-component.c | 27 +++++++++++++++++++++++++++
sound/soc/soc-core.c | 36 ++++--------------------------------
sound/soc/soc-internal.h | 3 ++-
3 files changed, 33 insertions(+), 33 deletions(-)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 11acf0d42213f..9622ad96d4691 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1306,3 +1306,30 @@ struct device_node *snd_soc_component_to_node(struct snd_soc_component *componen
return of_node;
}
+
+bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
+ const struct snd_soc_dai_link_component *dlc)
+{
+ struct device_node *component_of_node;
+
+ if (!dlc)
+ return false;
+
+ if (dlc->dai_args) {
+ struct snd_soc_dai *dai;
+
+ for_each_component_dais(component, dai)
+ if (snd_soc_dai_matches_dlc(dai, dlc))
+ return true;
+ return false;
+ }
+
+ component_of_node = snd_soc_component_to_node(component);
+
+ if (dlc->of_node && component_of_node != dlc->of_node)
+ return false;
+ if (dlc->name && strcmp(component->name, dlc->name))
+ return false;
+
+ return true;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 59a8f44e249a3..11e25ac7235f2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -785,34 +785,6 @@ struct of_phandle_args *snd_soc_copy_dai_args(struct device *dev,
}
EXPORT_SYMBOL_GPL(snd_soc_copy_dai_args);
-static int snd_soc_is_matching_component(
- const struct snd_soc_dai_link_component *dlc,
- struct snd_soc_component *component)
-{
- struct device_node *component_of_node;
-
- if (!dlc)
- return 0;
-
- if (dlc->dai_args) {
- struct snd_soc_dai *dai;
-
- for_each_component_dais(component, dai)
- if (snd_soc_dai_matches_dlc(dai, dlc))
- return 1;
- return 0;
- }
-
- component_of_node = snd_soc_component_to_node(component);
-
- if (dlc->of_node && component_of_node != dlc->of_node)
- return 0;
- if (dlc->name && strcmp(component->name, dlc->name))
- return 0;
-
- return 1;
-}
-
static struct snd_soc_component *soc_find_component(
const struct snd_soc_dai_link_component *dlc)
{
@@ -829,7 +801,7 @@ static struct snd_soc_component *soc_find_component(
* CPU component and generic DMAEngine component
*/
for_each_component(component)
- if (snd_soc_is_matching_component(dlc, component))
+ if (snd_soc_component_matches_dlc(component, dlc))
return component;
return NULL;
@@ -856,7 +828,7 @@ struct snd_soc_dai *snd_soc_find_dai(
/* Find CPU DAI from registered DAIs */
for_each_component(component)
- if (snd_soc_is_matching_component(dlc, component))
+ if (snd_soc_component_matches_dlc(component, dlc))
for_each_component_dais(component, dai)
if (snd_soc_dai_matches_dlc(dai, dlc))
return dai;
@@ -1155,7 +1127,7 @@ static int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
/* Find PLATFORM from registered PLATFORMs */
for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
- if (!snd_soc_is_matching_component(platform, component))
+ if (!snd_soc_component_matches_dlc(component, platform))
continue;
if (snd_soc_component_is_dummy(component) && component->num_dai)
@@ -1334,7 +1306,7 @@ static void soc_set_name_prefix(struct snd_soc_card *card,
for (i = 0; i < card->num_configs; i++) {
struct snd_soc_codec_conf *map = &card->codec_conf[i];
- if (snd_soc_is_matching_component(&map->dlc, component) &&
+ if (snd_soc_component_matches_dlc(component, &map->dlc) &&
map->name_prefix) {
component->name_prefix = map->name_prefix;
return;
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index a08e6e8ef17f3..76353d52ce971 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -40,6 +40,7 @@ void snd_soc_dai_active_update(struct snd_soc_dai *dai, int stream, int action);
* In soc-component
*/
struct device_node *snd_soc_component_to_node(struct snd_soc_component *component);
-
+bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
+ const struct snd_soc_dai_link_component *dlc);
#endif /* __SOC_INTERNAL_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 07/13] ASoC: soc-component: move soc_{probe/remove}_component() to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (5 preceding siblings ...)
2026-10-02 2:51 ` [PATCH v2 06/13] ASoC: soc-component: move snd_soc_is_matching_component() " Kuninori Morimoto
@ 2026-10-02 2:52 ` Kuninori Morimoto
2026-10-04 21:52 ` Mark Brown
2026-10-02 2:52 ` [PATCH v2 08/13] ASoC: soc-component: move snd_soc_component_to_dapm() " Kuninori Morimoto
` (5 subsequent siblings)
12 siblings, 1 reply; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:52 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move soc_{probe/remove}_component() to soc-component.c
It renames function name
- soc_{probe/remove}_component()
+ snd_soc_component_{probe/remove}()
Then soc-component.c had original snd_soc_component_{probe/remove}() which
is wrapper function. These wil be deployed internally.
Releted fucntions also be moved. It renames function name.
soc_set_name_prefix() -> snd_soc_component_set_name_prefix()
soc_init_component_debugfs() -> snd_soc_component_debugfs_init()
soc_cleanup_component_debugfs() -> snd_soc_component_debugfs_cleanup()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 2 -
sound/soc/soc-component.c | 191 +++++++++++++++++++++++++++++++---
sound/soc/soc-core.c | 179 +------------------------------
sound/soc/soc-internal.h | 2 +
4 files changed, 181 insertions(+), 193 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 7708d84af8853..f2dccd3c9ca8e 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -404,8 +404,6 @@ int snd_soc_component_close(struct snd_soc_component *component,
void snd_soc_component_suspend(struct snd_soc_component *component);
void snd_soc_component_resume(struct snd_soc_component *component);
int snd_soc_component_is_suspended(struct snd_soc_component *component);
-int snd_soc_component_probe(struct snd_soc_component *component);
-void snd_soc_component_remove(struct snd_soc_component *component);
int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
struct device_node *ep);
int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 9622ad96d4691..91d30ec9a8fbd 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -8,6 +8,7 @@
// Mark Brown <broonie@opensource.wolfsonmicro.com>
// Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
//
+#include <linux/debugfs.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h>
@@ -330,22 +331,6 @@ int snd_soc_component_is_suspended(struct snd_soc_component *component)
return component->suspended;
}
-int snd_soc_component_probe(struct snd_soc_component *component)
-{
- int ret = 0;
-
- if (component->driver->probe)
- ret = component->driver->probe(component);
-
- return soc_component_ret(component, ret);
-}
-
-void snd_soc_component_remove(struct snd_soc_component *component)
-{
- if (component->driver->remove)
- component->driver->remove(component);
-}
-
/**
* snd_soc_component_add_controls - Add an array of controls to a component.
*
@@ -1333,3 +1318,177 @@ bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
return true;
}
+
+#ifdef CONFIG_DEBUG_FS
+static void snd_soc_component_debugfs_init(struct snd_soc_component *component)
+{
+ if (!component->card->debugfs_card_root)
+ return;
+
+ if (component->driver->debugfs_prefix) {
+ char *name;
+
+ name = kasprintf(GFP_KERNEL, "%s:%s",
+ component->driver->debugfs_prefix, component->name);
+ if (name) {
+ component->debugfs_root = debugfs_create_dir(name,
+ component->card->debugfs_card_root);
+ kfree(name);
+ }
+ } else {
+ component->debugfs_root = debugfs_create_dir(component->name,
+ component->card->debugfs_card_root);
+ }
+
+ snd_soc_dapm_debugfs_init(snd_soc_component_to_dapm(component),
+ component->debugfs_root);
+}
+
+static void snd_soc_component_debugfs_cleanup(struct snd_soc_component *component)
+{
+ if (!component->debugfs_root)
+ return;
+ debugfs_remove_recursive(component->debugfs_root);
+ component->debugfs_root = NULL;
+}
+#else
+static inline void snd_soc_component_debugfs_init(struct snd_soc_component *component) { }
+static inline void snd_soc_component_debugfs_cleanup(struct snd_soc_component *component) { }
+#endif /* CONFIG_DEBUG_FS */
+
+static void snd_soc_component_set_name_prefix(struct snd_soc_component *component)
+{
+ struct snd_soc_card *card = component->card;
+ struct device_node *of_node = snd_soc_component_to_node(component);
+ const char *str;
+ int ret, i;
+
+ for (i = 0; i < card->num_configs; i++) {
+ struct snd_soc_codec_conf *map = &card->codec_conf[i];
+
+ if (snd_soc_component_matches_dlc(component, &map->dlc) &&
+ map->name_prefix) {
+ component->name_prefix = map->name_prefix;
+ return;
+ }
+ }
+
+ /*
+ * If there is no configuration table or no match in the table,
+ * check if a prefix is provided in the node
+ */
+ ret = of_property_read_string(of_node, "sound-name-prefix", &str);
+ if (ret < 0)
+ return;
+
+ component->name_prefix = str;
+}
+
+void snd_soc_component_remove(struct snd_soc_component *component, int probed)
+{
+ if (!component->card)
+ return;
+
+ if (probed && component->driver->remove)
+ component->driver->remove(component);
+
+ list_del_init(&component->card_list);
+ snd_soc_dapm_free(snd_soc_component_to_dapm(component));
+ snd_soc_component_debugfs_cleanup(component);
+ component->card = NULL;
+ snd_soc_component_module_put_when_remove(component);
+}
+
+int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_card *card)
+{
+ struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
+ struct snd_soc_dai *dai;
+ int probed = 0;
+ int ret;
+
+ if (snd_soc_component_is_dummy(component))
+ return 0;
+
+ if (component->card) {
+ if (component->card != card) {
+ dev_err(component->dev,
+ "Trying to bind component \"%s\" to card \"%s\" "
+ "but is already bound to card \"%s\"\n",
+ component->name, card->name, component->card->name);
+ return -ENODEV;
+ }
+ return 0;
+ }
+
+ ret = snd_soc_component_module_get_when_probe(component);
+ if (ret < 0)
+ return ret;
+
+ component->card = card;
+ snd_soc_component_set_name_prefix(component);
+
+ snd_soc_component_debugfs_init(component);
+
+ snd_soc_dapm_init(dapm, card, component);
+
+ ret = snd_soc_dapm_new_controls(dapm,
+ component->driver->dapm_widgets,
+ component->driver->num_dapm_widgets);
+
+ if (ret != 0) {
+ dev_err(component->dev,
+ "Failed to create new controls %d\n", ret);
+ goto err_probe;
+ }
+
+ for_each_component_dais(component, dai) {
+ ret = snd_soc_dapm_new_dai_widgets(dapm, dai);
+ if (ret != 0) {
+ dev_err(component->dev,
+ "Failed to create DAI widgets %d\n", ret);
+ goto err_probe;
+ }
+ }
+
+ if (component->driver->probe) {
+ ret = component->driver->probe(component);
+ if (ret < 0)
+ goto err_probe;
+ }
+
+ WARN(!snd_soc_dapm_get_idle_bias(dapm) &&
+ snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_OFF,
+ "codec %s can not start from non-off bias with idle_bias_off==1\n",
+ component->name);
+ probed = 1;
+
+ /*
+ * machine specific init
+ * see
+ * snd_soc_component_set_aux()
+ */
+ ret = snd_soc_component_init(component);
+ if (ret < 0)
+ goto err_probe;
+
+ ret = snd_soc_component_add_controls(component,
+ component->driver->controls,
+ component->driver->num_controls);
+ if (ret < 0)
+ goto err_probe;
+
+ ret = snd_soc_dapm_add_routes(dapm,
+ component->driver->dapm_routes,
+ component->driver->num_dapm_routes);
+ if (ret < 0)
+ goto err_probe;
+
+ /* see for_each_card_components */
+ list_add(&component->card_list, &card->component_dev_list);
+
+err_probe:
+ if (ret < 0)
+ snd_soc_component_remove(component, probed);
+
+ return ret;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 11e25ac7235f2..6fc9f428d4060 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -133,38 +133,6 @@ static const struct attribute_group *soc_dev_attr_groups[] = {
struct dentry *snd_soc_debugfs_root;
EXPORT_SYMBOL_GPL(snd_soc_debugfs_root);
-static void soc_init_component_debugfs(struct snd_soc_component *component)
-{
- if (!component->card->debugfs_card_root)
- return;
-
- if (component->driver->debugfs_prefix) {
- char *name;
-
- name = kasprintf(GFP_KERNEL, "%s:%s",
- component->driver->debugfs_prefix, component->name);
- if (name) {
- component->debugfs_root = debugfs_create_dir(name,
- component->card->debugfs_card_root);
- kfree(name);
- }
- } else {
- component->debugfs_root = debugfs_create_dir(component->name,
- component->card->debugfs_card_root);
- }
-
- snd_soc_dapm_debugfs_init(snd_soc_component_to_dapm(component),
- component->debugfs_root);
-}
-
-static void soc_cleanup_component_debugfs(struct snd_soc_component *component)
-{
- if (!component->debugfs_root)
- return;
- debugfs_remove_recursive(component->debugfs_root);
- component->debugfs_root = NULL;
-}
-
static int dai_list_show(struct seq_file *m, void *v)
{
struct snd_soc_component *component;
@@ -225,8 +193,6 @@ static void snd_soc_debugfs_exit(void)
#else
-static inline void soc_init_component_debugfs(struct snd_soc_component *component) { }
-static inline void soc_cleanup_component_debugfs(struct snd_soc_component *component) { }
static inline void soc_init_card_debugfs(struct snd_soc_card *card) { }
static inline void soc_cleanup_card_debugfs(struct snd_soc_card *card) { }
static inline void snd_soc_debugfs_init(void) { }
@@ -1296,143 +1262,6 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
return ret;
}
-static void soc_set_name_prefix(struct snd_soc_card *card,
- struct snd_soc_component *component)
-{
- struct device_node *of_node = snd_soc_component_to_node(component);
- const char *str;
- int ret, i;
-
- for (i = 0; i < card->num_configs; i++) {
- struct snd_soc_codec_conf *map = &card->codec_conf[i];
-
- if (snd_soc_component_matches_dlc(component, &map->dlc) &&
- map->name_prefix) {
- component->name_prefix = map->name_prefix;
- return;
- }
- }
-
- /*
- * If there is no configuration table or no match in the table,
- * check if a prefix is provided in the node
- */
- ret = of_property_read_string(of_node, "sound-name-prefix", &str);
- if (ret < 0)
- return;
-
- component->name_prefix = str;
-}
-
-static void soc_remove_component(struct snd_soc_component *component,
- int probed)
-{
-
- if (!component->card)
- return;
-
- if (probed)
- snd_soc_component_remove(component);
-
- list_del_init(&component->card_list);
- snd_soc_dapm_free(snd_soc_component_to_dapm(component));
- soc_cleanup_component_debugfs(component);
- component->card = NULL;
- snd_soc_component_module_put_when_remove(component);
-}
-
-static int soc_probe_component(struct snd_soc_card *card,
- struct snd_soc_component *component)
-{
- struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
- struct snd_soc_dai *dai;
- int probed = 0;
- int ret;
-
- if (snd_soc_component_is_dummy(component))
- return 0;
-
- if (component->card) {
- if (component->card != card) {
- dev_err(component->dev,
- "Trying to bind component \"%s\" to card \"%s\" but is already bound to card \"%s\"\n",
- component->name, card->name, component->card->name);
- return -ENODEV;
- }
- return 0;
- }
-
- ret = snd_soc_component_module_get_when_probe(component);
- if (ret < 0)
- return ret;
-
- component->card = card;
- soc_set_name_prefix(card, component);
-
- soc_init_component_debugfs(component);
-
- snd_soc_dapm_init(dapm, card, component);
-
- ret = snd_soc_dapm_new_controls(dapm,
- component->driver->dapm_widgets,
- component->driver->num_dapm_widgets);
-
- if (ret != 0) {
- dev_err(component->dev,
- "Failed to create new controls %d\n", ret);
- goto err_probe;
- }
-
- for_each_component_dais(component, dai) {
- ret = snd_soc_dapm_new_dai_widgets(dapm, dai);
- if (ret != 0) {
- dev_err(component->dev,
- "Failed to create DAI widgets %d\n", ret);
- goto err_probe;
- }
- }
-
- ret = snd_soc_component_probe(component);
- if (ret < 0)
- goto err_probe;
-
- WARN(!snd_soc_dapm_get_idle_bias(dapm) &&
- snd_soc_dapm_get_bias_level(dapm) != SND_SOC_BIAS_OFF,
- "codec %s can not start from non-off bias with idle_bias_off==1\n",
- component->name);
- probed = 1;
-
- /*
- * machine specific init
- * see
- * snd_soc_component_set_aux()
- */
- ret = snd_soc_component_init(component);
- if (ret < 0)
- goto err_probe;
-
- ret = snd_soc_add_component_controls(component,
- component->driver->controls,
- component->driver->num_controls);
- if (ret < 0)
- goto err_probe;
-
- ret = snd_soc_dapm_add_routes(dapm,
- component->driver->dapm_routes,
- component->driver->num_dapm_routes);
- if (ret < 0)
- goto err_probe;
-
- /* see for_each_card_components */
- list_add(&component->card_list, &card->component_dev_list);
-
-err_probe:
- if (ret < 0)
- soc_remove_component(component, probed);
-
- return ret;
-}
-
static void soc_remove_link_dais(struct snd_soc_card *card)
{
struct snd_soc_pcm_runtime *rtd;
@@ -1475,7 +1304,7 @@ static void soc_remove_link_components(struct snd_soc_card *card)
if (component->driver->remove_order != order)
continue;
- soc_remove_component(component, 1);
+ snd_soc_component_remove(component, 1);
}
}
}
@@ -1493,7 +1322,7 @@ static int soc_probe_link_components(struct snd_soc_card *card)
if (component->driver->probe_order != order)
continue;
- ret = soc_probe_component(card, component);
+ ret = snd_soc_component_probe(component, card);
if (ret < 0)
return ret;
}
@@ -1545,7 +1374,7 @@ static int soc_probe_aux_devices(struct snd_soc_card *card)
if (component->driver->probe_order != order)
continue;
- ret = soc_probe_component(card, component);
+ ret = snd_soc_component_probe(component, card);
if (ret < 0)
return ret;
}
@@ -1562,7 +1391,7 @@ static void soc_remove_aux_devices(struct snd_soc_card *card)
for_each_comp_order(order) {
for_each_card_auxs_safe(card, comp, _comp) {
if (comp->driver->remove_order == order)
- soc_remove_component(comp, 1);
+ snd_soc_component_remove(comp, 1);
}
}
}
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index 76353d52ce971..17ed22c2cd505 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -42,5 +42,7 @@ void snd_soc_dai_active_update(struct snd_soc_dai *dai, int stream, int action);
struct device_node *snd_soc_component_to_node(struct snd_soc_component *component);
bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
const struct snd_soc_dai_link_component *dlc);
+void snd_soc_component_remove(struct snd_soc_component *component, int probed);
+int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_card *card);
#endif /* __SOC_INTERNAL_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* Re: [PATCH v2 07/13] ASoC: soc-component: move soc_{probe/remove}_component() to soc-component.c
2026-10-02 2:52 ` [PATCH v2 07/13] ASoC: soc-component: move soc_{probe/remove}_component() " Kuninori Morimoto
@ 2026-10-04 21:52 ` Mark Brown
0 siblings, 0 replies; 15+ messages in thread
From: Mark Brown @ 2026-10-04 21:52 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Alvin Šipraga, linux-sound
[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]
On Fri, Oct 02, 2026 at 02:52:01AM +0000, Kuninori Morimoto wrote:
> struct snd_soc_component will be capsuled soon, its member will not be
> able to access from non soc-component.c.
>
> Move soc_{probe/remove}_component() to soc-component.c
> -int snd_soc_component_probe(struct snd_soc_component *component)
> -{
> - int ret = 0;
> -
> - if (component->driver->probe)
> - ret = component->driver->probe(component);
> -
> - return soc_component_ret(component, ret);
This has a soc_component_ret()...
> +int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_card *card)
> +{
> + if (component->card) {
> + if (component->card != card) {
> + dev_err(component->dev,
> + "Trying to bind component \"%s\" to card \"%s\" "
> + "but is already bound to card \"%s\"\n",
> + component->name, card->name, component->card->name);
Just have a long line - it's better not to split error messages to help
grep.
> + if (component->driver->probe) {
> + ret = component->driver->probe(component);
> + if (ret < 0)
> + goto err_probe;
> + }
...this doesn't have an equivalent error log to what soc_component_ret()
does which is probably not great for diagnostics, nor does the cleanup.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v2 08/13] ASoC: soc-component: move snd_soc_component_to_dapm() to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (6 preceding siblings ...)
2026-10-02 2:52 ` [PATCH v2 07/13] ASoC: soc-component: move soc_{probe/remove}_component() " Kuninori Morimoto
@ 2026-10-02 2:52 ` Kuninori Morimoto
2026-10-02 2:52 ` [PATCH v2 09/13] ASoC: soc-component: move snd_soc_component_cache_sync() " Kuninori Morimoto
` (4 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:52 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move snd_soc_component_to_dapm() to soc-component.c
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 11 +----------
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index f2dccd3c9ca8e..306d61b2cb5eb 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -272,16 +272,7 @@ struct snd_soc_component {
snd_soc_dai_to_list(dai) != &(component)->dai_list; \
dai = _dai, _dai = snd_soc_dai_from_list(snd_soc_dai_to_list(_dai)->next))
-/**
- * snd_soc_component_to_dapm() - Returns the DAPM context associated with a
- * component
- * @component: The component for which to get the DAPM context
- */
-static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm(
- struct snd_soc_component *component)
-{
- return component->dapm;
-}
+struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component);
/**
* snd_soc_component_cache_sync() - Sync the register cache with the hardware
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 91d30ec9a8fbd..1d7085cb4a141 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -68,6 +68,12 @@ void *snd_soc_component_to_priv(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_to_priv);
+struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component)
+{
+ return component->dapm;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_to_dapm);
+
/*
* We might want to check substream by using list.
* In such case, we can update these macros.
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 09/13] ASoC: soc-component: move snd_soc_component_cache_sync() to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (7 preceding siblings ...)
2026-10-02 2:52 ` [PATCH v2 08/13] ASoC: soc-component: move snd_soc_component_to_dapm() " Kuninori Morimoto
@ 2026-10-02 2:52 ` Kuninori Morimoto
2026-10-02 2:52 ` [PATCH v2 10/13] ASoC: soc-component: move snd_soc_component_active() " Kuninori Morimoto
` (3 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:52 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move snd_soc_component_cache_sync() to soc-component.c
It renames function name
- snd_soc_component_cache_sync()
+ snd_soc_component_regmap_cache_sync()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 16 ++++------------
sound/soc/soc-component.c | 15 +++++++++++++++
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 306d61b2cb5eb..0f5738154a23b 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -274,18 +274,6 @@ struct snd_soc_component {
struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component);
-/**
- * snd_soc_component_cache_sync() - Sync the register cache with the hardware
- * @component: COMPONENT to sync
- *
- * Note: This function will call regcache_sync()
- */
-static inline int snd_soc_component_cache_sync(
- struct snd_soc_component *component)
-{
- return regcache_sync(component->regmap);
-}
-
struct snd_soc_component *snd_soc_component_alloc(struct device *dev);
void snd_soc_component_set_name(struct snd_soc_component *component, const char *name);
@@ -340,6 +328,7 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level);
int snd_soc_component_regmap_val_bytes(struct snd_soc_component *component);
+int snd_soc_component_regmap_cache_sync(struct snd_soc_component *component);
#ifdef CONFIG_REGMAP
void snd_soc_component_init_regmap(struct snd_soc_component *component,
struct regmap *regmap);
@@ -452,4 +441,7 @@ int snd_soc_pcm_component_ack(struct snd_pcm_substream *substream);
void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
snd_pcm_sframes_t *cpu_delay, snd_pcm_sframes_t *codec_delay);
+/* REMOVE ME */
+#define snd_soc_component_cache_sync snd_soc_component_regmap_cache_sync
+
#endif /* __SOC_COMPONENT_H */
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 1d7085cb4a141..35c48ccb352cd 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -410,6 +410,21 @@ int snd_soc_component_regmap_val_bytes(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_regmap_val_bytes);
+/**
+ * snd_soc_component_regmap_cache_sync() - Sync the register cache with the hardware
+ * @component: COMPONENT to sync
+ *
+ * Note: This function will call regcache_sync()
+ */
+int snd_soc_component_regmap_cache_sync(struct snd_soc_component *component)
+{
+ if (!component->regmap)
+ return 0;
+
+ return regcache_sync(component->regmap);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regmap_cache_sync);
+
#ifdef CONFIG_REGMAP
/**
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 10/13] ASoC: soc-component: move snd_soc_component_active() to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (8 preceding siblings ...)
2026-10-02 2:52 ` [PATCH v2 09/13] ASoC: soc-component: move snd_soc_component_cache_sync() " Kuninori Morimoto
@ 2026-10-02 2:52 ` Kuninori Morimoto
2026-10-02 2:52 ` [PATCH v2 11/13] ASoC: soc-component: move component_list " Kuninori Morimoto
` (2 subsequent siblings)
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:52 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move snd_soc_component_active() to soc-component.c
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 6 +-----
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 0f5738154a23b..f5249de004942 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -363,11 +363,7 @@ static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
return dev_get_drvdata(c->dev);
}
-static inline unsigned int
-snd_soc_component_active(struct snd_soc_component *component)
-{
- return component->active;
-}
+unsigned int snd_soc_component_active(struct snd_soc_component *component);
/* component controls */
struct snd_kcontrol *snd_soc_component_get_kcontrol(struct snd_soc_component *component,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 35c48ccb352cd..381195d0fc78b 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -74,6 +74,12 @@ struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component
}
EXPORT_SYMBOL_GPL(snd_soc_component_to_dapm);
+unsigned int snd_soc_component_active(struct snd_soc_component *component)
+{
+ return component->active;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_active);
+
/*
* We might want to check substream by using list.
* In such case, we can update these macros.
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 11/13] ASoC: soc-component: move component_list to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (9 preceding siblings ...)
2026-10-02 2:52 ` [PATCH v2 10/13] ASoC: soc-component: move snd_soc_component_active() " Kuninori Morimoto
@ 2026-10-02 2:52 ` Kuninori Morimoto
2026-10-02 2:52 ` [PATCH v2 12/13] ASoC: soc-component: move snd_soc_lookup_component() " Kuninori Morimoto
2026-10-02 2:52 ` [PATCH v2 13/13] ASoC: soc-component: rename snd_soc_component_async_complete() Kuninori Morimoto
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:52 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move component_list to soc-component.c
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-component.c | 6 ++++++
sound/soc/soc-core.c | 7 +------
sound/soc/soc-internal.h | 4 ++++
3 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 381195d0fc78b..a692edba8f07f 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -44,6 +44,12 @@ struct snd_soc_component *snd_soc_component_alloc(struct device *dev)
}
EXPORT_SYMBOL_GPL(snd_soc_component_alloc);
+static LIST_HEAD(component_list);
+struct list_head *snd_soc_component_get_list_head(void)
+{
+ return &component_list;
+}
+
void snd_soc_component_set_name(struct snd_soc_component *component, const char *name)
{
component->name = name;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 6fc9f428d4060..16bff4cbc27a5 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -47,13 +47,8 @@
#include <trace/events/asoc.h>
DEFINE_MUTEX(client_mutex);
-
-static LIST_HEAD(component_list);
static LIST_HEAD(unbind_card_list);
-#define for_each_component(component) \
- list_for_each_entry(component, &component_list, list)
-
/*
* This is used if driver don't need to have CPU/Codec/Platform
* dai_link. see soc.h
@@ -2389,7 +2384,7 @@ static int soc_component_add(struct snd_soc_component *component,
}
/* see for_each_component */
- list_add(&component->list, &component_list);
+ list_add(&component->list, snd_soc_component_get_list_head());
list_for_each_entry_safe(card, c, &unbind_card_list, list)
call_soc_bind_card(card);
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index 17ed22c2cd505..b844b27574c8a 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -44,5 +44,9 @@ bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
const struct snd_soc_dai_link_component *dlc);
void snd_soc_component_remove(struct snd_soc_component *component, int probed);
int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_card *card);
+struct list_head *snd_soc_component_get_list_head(void);
+
+#define for_each_component(component) \
+ list_for_each_entry(component, snd_soc_component_get_list_head(), list)
#endif /* __SOC_INTERNAL_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 12/13] ASoC: soc-component: move snd_soc_lookup_component() to soc-component.c
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (10 preceding siblings ...)
2026-10-02 2:52 ` [PATCH v2 11/13] ASoC: soc-component: move component_list " Kuninori Morimoto
@ 2026-10-02 2:52 ` Kuninori Morimoto
2026-10-02 2:52 ` [PATCH v2 13/13] ASoC: soc-component: rename snd_soc_component_async_complete() Kuninori Morimoto
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:52 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Move snd_soc_lookup_component() to soc-component.c
It renames function name
snd_soc_lookup_component_nolocked() -> snd_soc_component_lookup_nolock()
snd_soc_lookup_component() -> snd_soc_component_lookup()
snd_soc_lookup_component_by_name() -> snd_soc_component_lookup_by_name()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 8 ++++++
include/sound/soc.h | 5 ----
sound/soc/soc-component.c | 48 +++++++++++++++++++++++++++++++++++
sound/soc/soc-core.c | 48 -----------------------------------
4 files changed, 56 insertions(+), 53 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index f5249de004942..26d2a4fb9380e 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -287,6 +287,11 @@ void snd_soc_component_set_aux(struct snd_soc_component *component,
int snd_soc_component_init(struct snd_soc_component *component);
int snd_soc_component_is_dummy(struct snd_soc_component *component);
+struct snd_soc_component *snd_soc_component_lookup_nolock(struct device *dev,
+ const char *driver_name);
+struct snd_soc_component *snd_soc_component_lookup(struct device *dev, const char *driver_name);
+struct snd_soc_component *snd_soc_component_lookup_by_name(const char *component_name);
+
/* component IO */
unsigned int snd_soc_component_read(struct snd_soc_component *component,
unsigned int reg);
@@ -439,5 +444,8 @@ void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
/* REMOVE ME */
#define snd_soc_component_cache_sync snd_soc_component_regmap_cache_sync
+#define snd_soc_lookup_component_nolocked snd_soc_component_lookup_nolock
+#define snd_soc_lookup_component snd_soc_component_lookup
+#define snd_soc_lookup_component_by_name snd_soc_component_lookup_by_name
#endif /* __SOC_COMPONENT_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 09a3e737c23d9..bff24c68d7627 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -463,11 +463,6 @@ int devm_snd_soc_register_component(struct device *dev,
#define snd_soc_unregister_component(dev) snd_soc_unregister_component_by_driver(dev, NULL)
void snd_soc_unregister_component_by_driver(struct device *dev,
const struct snd_soc_component_driver *component_driver);
-struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev,
- const char *driver_name);
-struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
- const char *driver_name);
-struct snd_soc_component *snd_soc_lookup_component_by_name(const char *component_name);
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd);
#ifdef CONFIG_SND_SOC_COMPRESS
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index a692edba8f07f..b339a0c7506e9 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1525,3 +1525,51 @@ int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_
return ret;
}
+
+struct snd_soc_component
+*snd_soc_component_lookup_nolock(struct device *dev, const char *driver_name)
+{
+ struct snd_soc_component *component;
+
+ for_each_component(component) {
+ if (dev != component->dev)
+ continue;
+
+ if (!driver_name)
+ return component;
+
+ if (!component->driver->name)
+ continue;
+
+ if (component->driver->name == driver_name)
+ return component;
+
+ if (strcmp(component->driver->name, driver_name) == 0)
+ return component;
+ }
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_lookup_nolock);
+
+struct snd_soc_component *snd_soc_component_lookup(struct device *dev,
+ const char *driver_name)
+{
+ guard(mutex)(&client_mutex);
+
+ return snd_soc_component_lookup_nolock(dev, driver_name);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_lookup);
+
+struct snd_soc_component *snd_soc_component_lookup_by_name(const char *component_name)
+{
+ struct snd_soc_component *component;
+
+ guard(mutex)(&client_mutex);
+ for_each_component(component)
+ if (strstr(component->name, component_name))
+ return component;
+
+ return NULL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_lookup_by_name);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 16bff4cbc27a5..db83256125959 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -261,54 +261,6 @@ struct snd_soc_component *snd_soc_rtdcom_lookup(struct snd_soc_pcm_runtime *rtd,
}
EXPORT_SYMBOL_GPL(snd_soc_rtdcom_lookup);
-struct snd_soc_component
-*snd_soc_lookup_component_nolocked(struct device *dev, const char *driver_name)
-{
- struct snd_soc_component *component;
-
- for_each_component(component) {
- if (dev != component->dev)
- continue;
-
- if (!driver_name)
- return component;
-
- if (!component->driver->name)
- continue;
-
- if (component->driver->name == driver_name)
- return component;
-
- if (strcmp(component->driver->name, driver_name) == 0)
- return component;
- }
-
- return NULL;
-}
-EXPORT_SYMBOL_GPL(snd_soc_lookup_component_nolocked);
-
-struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
- const char *driver_name)
-{
- guard(mutex)(&client_mutex);
-
- return snd_soc_lookup_component_nolocked(dev, driver_name);
-}
-EXPORT_SYMBOL_GPL(snd_soc_lookup_component);
-
-struct snd_soc_component *snd_soc_lookup_component_by_name(const char *component_name)
-{
- struct snd_soc_component *component;
-
- guard(mutex)(&client_mutex);
- for_each_component(component)
- if (strstr(component->name, component_name))
- return component;
-
- return NULL;
-}
-EXPORT_SYMBOL_GPL(snd_soc_lookup_component_by_name);
-
struct snd_soc_pcm_runtime
*snd_soc_get_pcm_runtime(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_link)
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread* [PATCH v2 13/13] ASoC: soc-component: rename snd_soc_component_async_complete()
2026-10-02 2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
` (11 preceding siblings ...)
2026-10-02 2:52 ` [PATCH v2 12/13] ASoC: soc-component: move snd_soc_lookup_component() " Kuninori Morimoto
@ 2026-10-02 2:52 ` Kuninori Morimoto
12 siblings, 0 replies; 15+ messages in thread
From: Kuninori Morimoto @ 2026-10-02 2:52 UTC (permalink / raw)
To: Mark Brown, Alvin Šipraga; +Cc: linux-sound
snd_soc_component_async_complete() is regmap related function.
Let's add _regmap_ on function name.
It renames function name
- snd_soc_component_async_complete()
+ snd_soc_component_regmap_async_complete()
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 3 ++-
sound/soc/soc-component.c | 28 ++++++++++++++--------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 26d2a4fb9380e..33626d06796db 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -303,7 +303,6 @@ int snd_soc_component_update_bits(struct snd_soc_component *component,
int snd_soc_component_update_bits_async(struct snd_soc_component *component,
unsigned int reg, unsigned int mask,
unsigned int val);
-void snd_soc_component_async_complete(struct snd_soc_component *component);
int snd_soc_component_test_bits(struct snd_soc_component *component,
unsigned int reg, unsigned int mask,
unsigned int value);
@@ -334,6 +333,7 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,
int snd_soc_component_regmap_val_bytes(struct snd_soc_component *component);
int snd_soc_component_regmap_cache_sync(struct snd_soc_component *component);
+void snd_soc_component_regmap_async_complete(struct snd_soc_component *component);
#ifdef CONFIG_REGMAP
void snd_soc_component_init_regmap(struct snd_soc_component *component,
struct regmap *regmap);
@@ -444,6 +444,7 @@ void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
/* REMOVE ME */
#define snd_soc_component_cache_sync snd_soc_component_regmap_cache_sync
+#define snd_soc_component_async_complete snd_soc_component_regmap_async_complete
#define snd_soc_lookup_component_nolocked snd_soc_component_lookup_nolock
#define snd_soc_lookup_component snd_soc_component_lookup
#define snd_soc_lookup_component_by_name snd_soc_component_lookup_by_name
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index b339a0c7506e9..e4cde6ec6cf41 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -437,6 +437,20 @@ int snd_soc_component_regmap_cache_sync(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_regmap_cache_sync);
+/**
+ * snd_soc_component_regmap_async_complete() - Ensure asynchronous I/O has completed
+ * @component: Component for which to wait
+ *
+ * This function blocks until all asynchronous I/O which has previously been
+ * scheduled using snd_soc_component_update_bits_async() has completed.
+ */
+void snd_soc_component_regmap_async_complete(struct snd_soc_component *component)
+{
+ if (component->regmap)
+ regmap_async_complete(component->regmap);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regmap_async_complete);
+
#ifdef CONFIG_REGMAP
/**
@@ -941,20 +955,6 @@ int snd_soc_component_write_field(struct snd_soc_component *component,
}
EXPORT_SYMBOL_GPL(snd_soc_component_write_field);
-/**
- * snd_soc_component_async_complete() - Ensure asynchronous I/O has completed
- * @component: Component for which to wait
- *
- * This function blocks until all asynchronous I/O which has previously been
- * scheduled using snd_soc_component_update_bits_async() has completed.
- */
-void snd_soc_component_async_complete(struct snd_soc_component *component)
-{
- if (component->regmap)
- regmap_async_complete(component->regmap);
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_async_complete);
-
/**
* snd_soc_component_test_bits - Test register for change
* @component: component
--
2.53.0
^ permalink raw reply related [flat|nested] 15+ messages in thread