* [PATCH v3 01/27] ASoC: soc-generic-dmaengine-pcm: move devm_snd_dmaengine_pcm_register()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
@ 2026-11-25 1:41 ` Kuninori Morimoto
2026-11-25 1:41 ` [PATCH v3 02/27] ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}() Kuninori Morimoto
` (25 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:41 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
We don't need to have dmaengine related function in soc-devres.c.
Let's move it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-devres.c | 40 ---------------------------
sound/soc/soc-generic-dmaengine-pcm.c | 36 ++++++++++++++++++++++++
2 files changed, 36 insertions(+), 40 deletions(-)
diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c
index 718165ba84ac8..ca6c29b54f6ab 100644
--- a/sound/soc/soc-devres.c
+++ b/sound/soc/soc-devres.c
@@ -63,43 +63,3 @@ int devm_snd_soc_register_card(struct device *dev, struct snd_soc_card *card)
return snd_soc_register_card(card);
}
EXPORT_SYMBOL_GPL(devm_snd_soc_register_card);
-
-#ifdef CONFIG_SND_SOC_GENERIC_DMAENGINE_PCM
-
-static void devm_dmaengine_pcm_release(struct device *dev, void *res)
-{
- snd_dmaengine_pcm_unregister(*(struct device **)res);
-}
-
-/**
- * devm_snd_dmaengine_pcm_register - resource managed dmaengine PCM registration
- * @dev: The parent device for the PCM device
- * @config: Platform specific PCM configuration
- * @flags: Platform specific quirks
- *
- * Register a dmaengine based PCM device with automatic unregistration when the
- * device is unregistered.
- */
-int devm_snd_dmaengine_pcm_register(struct device *dev,
- const struct snd_dmaengine_pcm_config *config, unsigned int flags)
-{
- struct device **ptr;
- int ret;
-
- ptr = devres_alloc(devm_dmaengine_pcm_release, sizeof(*ptr), GFP_KERNEL);
- if (!ptr)
- return -ENOMEM;
-
- ret = snd_dmaengine_pcm_register(dev, config, flags);
- if (ret == 0) {
- *ptr = dev;
- devres_add(dev, ptr);
- } else {
- devres_free(ptr);
- }
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(devm_snd_dmaengine_pcm_register);
-
-#endif
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index c7523bae45af7..1ecf3feb2bed0 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -520,5 +520,41 @@ void snd_dmaengine_pcm_unregister(struct device *dev)
}
EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_unregister);
+static void devm_dmaengine_pcm_release(struct device *dev, void *res)
+{
+ snd_dmaengine_pcm_unregister(*(struct device **)res);
+}
+
+/**
+ * devm_snd_dmaengine_pcm_register - resource managed dmaengine PCM registration
+ * @dev: The parent device for the PCM device
+ * @config: Platform specific PCM configuration
+ * @flags: Platform specific quirks
+ *
+ * Register a dmaengine based PCM device with automatic unregistration when the
+ * device is unregistered.
+ */
+int devm_snd_dmaengine_pcm_register(struct device *dev,
+ const struct snd_dmaengine_pcm_config *config, unsigned int flags)
+{
+ struct device **ptr;
+ int ret;
+
+ ptr = devres_alloc(devm_dmaengine_pcm_release, sizeof(*ptr), GFP_KERNEL);
+ if (!ptr)
+ return -ENOMEM;
+
+ ret = snd_dmaengine_pcm_register(dev, config, flags);
+ if (ret == 0) {
+ *ptr = dev;
+ devres_add(dev, ptr);
+ } else {
+ devres_free(ptr);
+ }
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(devm_snd_dmaengine_pcm_register);
+
MODULE_DESCRIPTION("ASoC helpers for generic PCM dmaengine API");
MODULE_LICENSE("GPL");
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 02/27] ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
2026-11-25 1:41 ` [PATCH v3 01/27] ASoC: soc-generic-dmaengine-pcm: move devm_snd_dmaengine_pcm_register() Kuninori Morimoto
@ 2026-11-25 1:41 ` Kuninori Morimoto
2026-11-25 1:42 ` [PATCH v3 03/27] ASoC: soc-component: rename snd_soc_component_regmap_val_bytes() Kuninori Morimoto
` (24 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:41 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
We already have snd_soc_component_regmap_xxx() functions.
Let's standardize the function names.
- snd_soc_component_{init/exit}_regmap()
+ snd_soc_component_regmap_{init/exit}()
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 | 14 +++++++-------
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 73d66c9766944..4e30a22a767e2 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -337,9 +337,9 @@ 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,
+void snd_soc_component_regmap_init(struct snd_soc_component *component,
struct regmap *regmap);
-void snd_soc_component_exit_regmap(struct snd_soc_component *component);
+void snd_soc_component_regmap_exit(struct snd_soc_component *component);
#endif
int snd_soc_component_fixup_controls(struct snd_soc_component *component);
@@ -445,6 +445,8 @@ 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_init_regmap snd_soc_component_regmap_init
+#define snd_soc_component_exit_regmap snd_soc_component_regmap_exit
#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
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index a6e280c798f3d..1f40caefee8f1 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -435,7 +435,7 @@ EXPORT_SYMBOL_GPL(snd_soc_component_regmap_async_complete);
#ifdef CONFIG_REGMAP
/**
- * snd_soc_component_init_regmap() - Initialize regmap instance for the
+ * snd_soc_component_regmap_init() - Initialize regmap instance for the
* component
* @component: The component for which to initialize the regmap instance
* @regmap: The regmap instance that should be used by the component
@@ -445,30 +445,30 @@ EXPORT_SYMBOL_GPL(snd_soc_component_regmap_async_complete);
* yet ready when the component is registered. The function must also be called
* before the first IO attempt of the component.
*/
-void snd_soc_component_init_regmap(struct snd_soc_component *component,
+void snd_soc_component_regmap_init(struct snd_soc_component *component,
struct regmap *regmap)
{
component->regmap = regmap;
}
-EXPORT_SYMBOL_GPL(snd_soc_component_init_regmap);
+EXPORT_SYMBOL_GPL(snd_soc_component_regmap_init);
/**
- * snd_soc_component_exit_regmap() - De-initialize regmap instance for the
+ * snd_soc_component_regmap_exit() - De-initialize regmap instance for the
* component
* @component: The component for which to de-initialize the regmap instance
*
* Calls regmap_exit() on the regmap instance associated to the component and
* removes the regmap instance from the component.
*
- * This function should only be used if snd_soc_component_init_regmap() was used
+ * This function should only be used if snd_soc_component_regmap_init() was used
* to initialize the regmap instance.
*/
-void snd_soc_component_exit_regmap(struct snd_soc_component *component)
+void snd_soc_component_regmap_exit(struct snd_soc_component *component)
{
regmap_exit(component->regmap);
component->regmap = NULL;
}
-EXPORT_SYMBOL_GPL(snd_soc_component_exit_regmap);
+EXPORT_SYMBOL_GPL(snd_soc_component_regmap_exit);
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 03/27] ASoC: soc-component: rename snd_soc_component_regmap_val_bytes()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
2026-11-25 1:41 ` [PATCH v3 01/27] ASoC: soc-generic-dmaengine-pcm: move devm_snd_dmaengine_pcm_register() Kuninori Morimoto
2026-11-25 1:41 ` [PATCH v3 02/27] ASoC: soc-component: rename snd_soc_component_{init/exit}_regmap() to snd_soc_component_regmap_{init/exit}() Kuninori Morimoto
@ 2026-11-25 1:42 ` Kuninori Morimoto
2026-11-25 1:42 ` [PATCH v3 04/27] ASoC: soc-component: rename snd_soc_component_regmap_cache_sync() Kuninori Morimoto
` (23 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:42 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
snd_soc_component_regmap_val_bytes() (A) calls regmap_get_val_bytes() (B)
(A) snd_soc_component_regmap_ val_bytes()
(B) regmap_get_val_bytes()
^^^^
Let's align the function name to original function.
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 | 4 ++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 4e30a22a767e2..fd2db8992b248 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -333,7 +333,7 @@ int snd_soc_component_stream_event(struct snd_soc_component *component,
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_get_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
@@ -448,6 +448,7 @@ void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
#define snd_soc_component_init_regmap snd_soc_component_regmap_init
#define snd_soc_component_exit_regmap snd_soc_component_regmap_exit
#define snd_soc_component_cache_sync snd_soc_component_regmap_cache_sync
+#define snd_soc_component_regmap_val_bytes snd_soc_component_regmap_get_val_bytes
#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
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 1f40caefee8f1..41fa459d954be 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -386,7 +386,7 @@ int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
return -ENOTSUPP;
}
-int snd_soc_component_regmap_val_bytes(struct snd_soc_component *component)
+int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component)
{
int val_bytes;
@@ -401,7 +401,7 @@ int snd_soc_component_regmap_val_bytes(struct snd_soc_component *component)
return val_bytes;
}
-EXPORT_SYMBOL_GPL(snd_soc_component_regmap_val_bytes);
+EXPORT_SYMBOL_GPL(snd_soc_component_regmap_get_val_bytes);
/**
* snd_soc_component_regmap_cache_sync() - Sync the register cache with the hardware
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 04/27] ASoC: soc-component: rename snd_soc_component_regmap_cache_sync()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (2 preceding siblings ...)
2026-11-25 1:42 ` [PATCH v3 03/27] ASoC: soc-component: rename snd_soc_component_regmap_val_bytes() Kuninori Morimoto
@ 2026-11-25 1:42 ` Kuninori Morimoto
2026-11-25 1:42 ` [PATCH v3 05/27] ASoC: soc-component: align snd_soc_component_{regmap/regcache}_xxx() functions Kuninori Morimoto
` (22 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:42 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
snd_soc_component_regmap_cache_sync() (A) calls regcache_sync() (B)
(A) snd_soc_component_regmap_cache_sync()
(B) reg cache_sync()
Let's align the function name to original function.
There is no snd_soc_component_regmap_cache_sync() user yet
(function name change will be happen later when all new functions were
ready to use). Don't need to care re-rename the function name in macro.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 4 ++--
sound/soc/soc-component.c | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index fd2db8992b248..d4fe3e02347eb 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -334,8 +334,8 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level);
int snd_soc_component_regmap_get_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);
+int snd_soc_component_regcache_sync(struct snd_soc_component *component);
#ifdef CONFIG_REGMAP
void snd_soc_component_regmap_init(struct snd_soc_component *component,
struct regmap *regmap);
@@ -447,7 +447,7 @@ void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
/* REMOVE ME */
#define snd_soc_component_init_regmap snd_soc_component_regmap_init
#define snd_soc_component_exit_regmap snd_soc_component_regmap_exit
-#define snd_soc_component_cache_sync snd_soc_component_regmap_cache_sync
+#define snd_soc_component_cache_sync snd_soc_component_regcache_sync
#define snd_soc_component_regmap_val_bytes snd_soc_component_regmap_get_val_bytes
#define snd_soc_component_async_complete snd_soc_component_regmap_async_complete
#define snd_soc_lookup_component_nolocked snd_soc_component_lookup_nolock
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 41fa459d954be..2979d2b79ed13 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -404,19 +404,19 @@ int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component)
EXPORT_SYMBOL_GPL(snd_soc_component_regmap_get_val_bytes);
/**
- * snd_soc_component_regmap_cache_sync() - Sync the register cache with the hardware
+ * snd_soc_component_regcache_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)
+int snd_soc_component_regcache_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);
+EXPORT_SYMBOL_GPL(snd_soc_component_regcache_sync);
/**
* snd_soc_component_regmap_async_complete() - Ensure asynchronous I/O has completed
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 05/27] ASoC: soc-component: align snd_soc_component_{regmap/regcache}_xxx() functions
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (3 preceding siblings ...)
2026-11-25 1:42 ` [PATCH v3 04/27] ASoC: soc-component: rename snd_soc_component_regmap_cache_sync() Kuninori Morimoto
@ 2026-11-25 1:42 ` Kuninori Morimoto
2026-11-25 1:42 ` [PATCH v3 06/27] ASoC: soc-core: move snd_soc_del_component_unlocked() Kuninori Morimoto
` (21 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:42 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
Current soc-component.c has snd_soc_component_{regmap/regcache}_xxx(),
but are located randumly. Let's align them.
No functional changes.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
include/sound/soc-component.h | 6 +--
sound/soc/soc-component.c | 92 +++++++++++++++++------------------
2 files changed, 49 insertions(+), 49 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index d4fe3e02347eb..7476923c60d0d 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -333,14 +333,14 @@ int snd_soc_component_stream_event(struct snd_soc_component *component,
int snd_soc_component_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level);
-int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component);
-void snd_soc_component_regmap_async_complete(struct snd_soc_component *component);
-int snd_soc_component_regcache_sync(struct snd_soc_component *component);
#ifdef CONFIG_REGMAP
void snd_soc_component_regmap_init(struct snd_soc_component *component,
struct regmap *regmap);
void snd_soc_component_regmap_exit(struct snd_soc_component *component);
#endif
+int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component);
+void snd_soc_component_regmap_async_complete(struct snd_soc_component *component);
+int snd_soc_component_regcache_sync(struct snd_soc_component *component);
int snd_soc_component_fixup_controls(struct snd_soc_component *component);
int snd_soc_component_add_controls(struct snd_soc_component *component,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 2979d2b79ed13..7e565da045b60 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -386,52 +386,6 @@ int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
return -ENOTSUPP;
}
-int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component)
-{
- int val_bytes;
-
- /* Errors are legitimate for non-integer byte multiples */
-
- if (!component->regmap)
- return 0;
-
- val_bytes = regmap_get_val_bytes(component->regmap);
- if (val_bytes < 0)
- return 0;
-
- return val_bytes;
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_regmap_get_val_bytes);
-
-/**
- * snd_soc_component_regcache_sync() - Sync the register cache with the hardware
- * @component: COMPONENT to sync
- *
- * Note: This function will call regcache_sync()
- */
-int snd_soc_component_regcache_sync(struct snd_soc_component *component)
-{
- if (!component->regmap)
- return 0;
-
- return regcache_sync(component->regmap);
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_regcache_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
/**
@@ -472,6 +426,52 @@ EXPORT_SYMBOL_GPL(snd_soc_component_regmap_exit);
#endif
+int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component)
+{
+ int val_bytes;
+
+ /* Errors are legitimate for non-integer byte multiples */
+
+ if (!component->regmap)
+ return 0;
+
+ val_bytes = regmap_get_val_bytes(component->regmap);
+ if (val_bytes < 0)
+ return 0;
+
+ return val_bytes;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regmap_get_val_bytes);
+
+/**
+ * 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);
+
+/**
+ * snd_soc_component_regcache_sync() - Sync the register cache with the hardware
+ * @component: COMPONENT to sync
+ *
+ * Note: This function will call regcache_sync()
+ */
+int snd_soc_component_regcache_sync(struct snd_soc_component *component)
+{
+ if (!component->regmap)
+ return 0;
+
+ return regcache_sync(component->regmap);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regcache_sync);
+
int snd_soc_component_compr_open(struct snd_soc_component *component,
struct snd_compr_stream *cstream)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 06/27] ASoC: soc-core: move snd_soc_del_component_unlocked()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (4 preceding siblings ...)
2026-11-25 1:42 ` [PATCH v3 05/27] ASoC: soc-component: align snd_soc_component_{regmap/regcache}_xxx() functions Kuninori Morimoto
@ 2026-11-25 1:42 ` Kuninori Morimoto
2026-11-25 1:42 ` [PATCH v3 07/27] ASoC: soc-core: add missing snd_soc_component_unregister() Kuninori Morimoto
` (20 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:42 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
No functional change, just for preparation for cleanup.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-core.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7dfd79b4ca3e5..15d466b5ac15c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1457,18 +1457,6 @@ static void convert_endianness_formats(struct snd_soc_pcm_stream *stream)
stream->formats |= endianness_format_map[i];
}
-static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
-{
- struct snd_soc_card *card = component->card;
-
- snd_soc_unregister_dais(component);
-
- if (card)
- snd_soc_card_unbind(card, true);
-
- list_del(&component->list);
-}
-
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
const struct snd_soc_component_driver *driver)
{
@@ -1505,6 +1493,18 @@ struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *
}
EXPORT_SYMBOL_GPL(snd_soc_component_new);
+static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
+{
+ struct snd_soc_card *card = component->card;
+
+ snd_soc_unregister_dais(component);
+
+ if (card)
+ snd_soc_card_unbind(card, true);
+
+ list_del(&component->list);
+}
+
int snd_soc_component_register(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv,
int num_dai)
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 07/27] ASoC: soc-core: add missing snd_soc_component_unregister()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (5 preceding siblings ...)
2026-11-25 1:42 ` [PATCH v3 06/27] ASoC: soc-core: move snd_soc_del_component_unlocked() Kuninori Morimoto
@ 2026-11-25 1:42 ` Kuninori Morimoto
2026-11-25 1:42 ` [PATCH v3 08/27] ASoC: soc-generic-dmaengine-pcm: use snd_soc_component_unregister() Kuninori Morimoto
` (19 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:42 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
Current soc-component has snd_soc_component_register() (A), but not have
snd_soc_component_unregister() (B)
(A) snd_soc_component_register()
(B) snd_soc_component_unregister()
We can use snd_soc_del_component_unlocked() for (B).
Let's add snd_soc_component_unregister().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
include/sound/soc-component.h | 1 +
sound/soc/soc-core.c | 14 +++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 7476923c60d0d..d6685812cad76 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -275,6 +275,7 @@ struct snd_soc_component {
struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component);
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
const struct snd_soc_component_driver *driver);
+void snd_soc_component_unregister(struct snd_soc_component *component);
int snd_soc_component_register(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv,
int num_dai);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 15d466b5ac15c..a7313419dc5f9 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1493,7 +1493,7 @@ struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *
}
EXPORT_SYMBOL_GPL(snd_soc_component_new);
-static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
+static void snd_soc_component_unregister_unlocked(struct snd_soc_component *component)
{
struct snd_soc_card *card = component->card;
@@ -1505,6 +1505,14 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
list_del(&component->list);
}
+void snd_soc_component_unregister(struct snd_soc_component *component)
+{
+ guard(mutex)(&client_mutex);
+
+ snd_soc_component_unregister_unlocked(component);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_unregister);
+
int snd_soc_component_register(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv,
int num_dai)
@@ -1540,7 +1548,7 @@ int snd_soc_component_register(struct snd_soc_component *component,
err_cleanup:
if (ret < 0)
- snd_soc_del_component_unlocked(component);
+ snd_soc_component_unregister_unlocked(component);
return ret;
}
@@ -1584,7 +1592,7 @@ void snd_soc_unregister_component_by_driver(struct device *dev,
if (!component)
break;
- snd_soc_del_component_unlocked(component);
+ snd_soc_component_unregister_unlocked(component);
}
}
EXPORT_SYMBOL_GPL(snd_soc_unregister_component_by_driver);
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 08/27] ASoC: soc-generic-dmaengine-pcm: use snd_soc_component_unregister()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (6 preceding siblings ...)
2026-11-25 1:42 ` [PATCH v3 07/27] ASoC: soc-core: add missing snd_soc_component_unregister() Kuninori Morimoto
@ 2026-11-25 1:42 ` Kuninori Morimoto
2026-11-25 1:42 ` [PATCH v3 09/27] ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component() Kuninori Morimoto
` (18 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:42 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
Current snd_dmaengine_pcm_unregister() (X) is using
snd_soc_unregister_component_by_driver() (Y) to unregister component.
(X) void snd_dmaengine_pcm_unregister(...)
{
(Z) component = snd_soc_lookup_component(...);
...
(p) pcm = snd_soc_component_to_priv(component);
(Y) snd_soc_unregister_component_by_driver(...);
(p) dmaengine_pcm_release_chan(pcm);
(p) kfree(pcm);
}
But it try to unregister all components from dev (a).
(Y) void snd_soc_unregister_component(...)
{
...
while (1) {
(Z) component = snd_soc_lookup_component_nolocked(...);
...
(a) snd_soc_component_unregister(component);
}
}
snd_dmaengine_pcm_unregister() (X) need to care/free pcm which is connected
to component (= p). Both (X) and (Y) are using lookup_component (Z).
So (X) can handle first component/pcm (p), but can't handle 2nd or more
component/pcm eventhough (X) was called multiple times, because (Y)
unregister all components. Let's call snd_soc_component_unregister() (a)
instead of snd_soc_unregister_component_by_driver() (Y) in (X), and
unregister target component only, not all.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/r/sashiko-outbox-206296@kernel.org
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-generic-dmaengine-pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
index 1ecf3feb2bed0..62f86d97668ef 100644
--- a/sound/soc/soc-generic-dmaengine-pcm.c
+++ b/sound/soc/soc-generic-dmaengine-pcm.c
@@ -514,7 +514,7 @@ void snd_dmaengine_pcm_unregister(struct device *dev)
pcm = snd_soc_component_to_priv(component);
- snd_soc_unregister_component_by_driver(dev, component->driver);
+ snd_soc_component_unregister(component);
dmaengine_pcm_release_chan(pcm);
kfree(pcm);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 09/27] ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (7 preceding siblings ...)
2026-11-25 1:42 ` [PATCH v3 08/27] ASoC: soc-generic-dmaengine-pcm: use snd_soc_component_unregister() Kuninori Morimoto
@ 2026-11-25 1:42 ` Kuninori Morimoto
2026-11-25 2:02 ` sashiko-bot
2026-11-25 1:43 ` [PATCH v3 10/27] ASoC: soc-core: remove snd_soc_unregister_component_by_driver() Kuninori Morimoto
` (17 subsequent siblings)
26 siblings, 1 reply; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:42 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
Current devm_snd_soc_register_component() (X) is using
snd_soc_unregister_component() (Y) to unregiser component.
(X) static void devm_component_release(...)
{
...
(Y) snd_soc_unregister_component(...);
}
int devm_snd_soc_register_component(...)
{
...
ptr = devres_alloc(devm_component_release, ...);
...
}
But now, (Y) will removes all components if multiple component
were connected to dev.
We can use snd_soc_component_unregister() (Z) which unregiser only
target component, not all. Let's use
(Y) snd_soc_unregister_component() // unregister all components
(Z) snd_soc_component_unregister() // unregister only target component
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
sound/soc/soc-devres.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c
index ca6c29b54f6ab..0323897c664dc 100644
--- a/sound/soc/soc-devres.c
+++ b/sound/soc/soc-devres.c
@@ -11,9 +11,9 @@
static void devm_component_release(struct device *dev, void *res)
{
- const struct snd_soc_component_driver **cmpnt_drv = res;
+ struct snd_soc_component **component = res;
- snd_soc_unregister_component_by_driver(dev, *cmpnt_drv);
+ snd_soc_component_unregister(*component);
}
/**
@@ -30,21 +30,32 @@ int devm_snd_soc_register_component(struct device *dev,
const struct snd_soc_component_driver *cmpnt_drv,
struct snd_soc_dai_driver *dai_drv, int num_dai)
{
- const struct snd_soc_component_driver **ptr;
- int ret;
+ const struct snd_soc_component **ptr;
+ struct snd_soc_component *component;
+ int ret = -ENOMEM;
+
+ component = snd_soc_component_new(dev, NULL, cmpnt_drv);
+ if (IS_ERR(component))
+ goto err;
ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL);
if (!ptr)
- return -ENOMEM;
+ goto free_component;
+
+ ret = snd_soc_component_register(component, dai_drv, num_dai);
+ if (ret < 0)
+ goto free_devres;
- ret = snd_soc_register_component(dev, cmpnt_drv, dai_drv, num_dai);
- if (ret == 0) {
- *ptr = cmpnt_drv;
- devres_add(dev, ptr);
- } else {
- devres_free(ptr);
- }
+ *ptr = component;
+ devres_add(dev, ptr);
+
+ return ret;
+free_devres:
+ devres_free(ptr);
+free_component:
+ devm_kfree(dev, component);
+err:
return ret;
}
EXPORT_SYMBOL_GPL(devm_snd_soc_register_component);
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH v3 09/27] ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component()
2026-11-25 1:42 ` [PATCH v3 09/27] ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component() Kuninori Morimoto
@ 2026-11-25 2:02 ` sashiko-bot
0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-11-25 2:02 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: linux-sound
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] ASoC: soc-devres: double list_del() in devm_component_release()
on teardown
--
commit 2485034f94d95731614688861ce6e0f8f1b48236
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component()
This commit updates devm_snd_soc_register_component() to store the created
component pointer in devres and call snd_soc_component_unregister() on
release.
> diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c
> index ca6c29b54f6ab..0323897c664dc 100644
> --- a/sound/soc/soc-devres.c
> +++ b/sound/soc/soc-devres.c
> @@ -11,9 +11,9 @@
>
> static void devm_component_release(struct device *dev, void *res)
> {
> - const struct snd_soc_component_driver **cmpnt_drv = res;
> + struct snd_soc_component **component = res;
>
> - snd_soc_unregister_component_by_driver(dev, *cmpnt_drv);
> + snd_soc_component_unregister(*component);
> }
[Severity: High]
Can this run list_del(&component->list) a second time when a driver
registers a component via devm_snd_soc_register_component() and also calls
snd_soc_unregister_component(dev) in its remove path?
Previously, snd_soc_unregister_component_by_driver() looked up the
component on component_list first, so devm_component_release() was a
no-op if the component had already been removed. Now
snd_soc_component_unregister() unconditionally calls
snd_soc_component_unregister_unlocked() -> list_del(&component->list).
For example, sound/soc/stm/stm32_adfsdm.c registers
stm32_adfsdm_dai_component with devm_snd_soc_register_component() in
stm32_adfsdm_probe() and calls snd_soc_unregister_component(&pdev->dev) in
stm32_adfsdm_remove(), which unregisters all components on the device
before devres_release_all() runs devm_component_release(), causing a
double list_del() on the poisoned list head during unbind or module
unload.
--
Sashiko AI review · https://sashiko.dev/#/patchset/87a4mxg01k.wl-kuninori.morimoto.gx@renesas.com?part=9
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v3 10/27] ASoC: soc-core: remove snd_soc_unregister_component_by_driver()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (8 preceding siblings ...)
2026-11-25 1:42 ` [PATCH v3 09/27] ASoC: soc-devres: use snd_soc_component_unregister() for devm_snd_soc_register_component() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 11/27] ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c Kuninori Morimoto
` (16 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
No one is using snd_soc_unregister_component_by_driver().
Let's remove it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
include/sound/soc.h | 4 +---
sound/soc/soc-core.c | 15 ++++-----------
2 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 338662645b42f..0f8e46c131c91 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -454,9 +454,7 @@ int snd_soc_register_component(struct device *dev,
int devm_snd_soc_register_component(struct device *dev,
const struct snd_soc_component_driver *component_driver,
struct snd_soc_dai_driver *dai_drv, int num_dai);
-#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);
+void snd_soc_unregister_component(struct device *dev);
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd);
#ifdef CONFIG_SND_SOC_COMPRESS
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a7313419dc5f9..406ab3620ac1d 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1570,24 +1570,17 @@ int snd_soc_register_component(struct device *dev,
EXPORT_SYMBOL_GPL(snd_soc_register_component);
/**
- * snd_soc_unregister_component_by_driver - Unregister component using a given driver
+ * snd_soc_unregister_component - Unregister component using a given driver
* from the ASoC core
*
* @dev: The device to unregister
- * @component_driver: The component driver to unregister
*/
-void snd_soc_unregister_component_by_driver(struct device *dev,
- const struct snd_soc_component_driver *component_driver)
+void snd_soc_unregister_component(struct device *dev)
{
- const char *driver_name = NULL;
-
- if (component_driver)
- driver_name = component_driver->name;
-
guard(mutex)(&client_mutex);
while (1) {
- struct snd_soc_component *component = snd_soc_lookup_component_nolocked(dev, driver_name);
+ struct snd_soc_component *component = snd_soc_lookup_component_nolocked(dev, NULL);
if (!component)
break;
@@ -1595,7 +1588,7 @@ void snd_soc_unregister_component_by_driver(struct device *dev,
snd_soc_component_unregister_unlocked(component);
}
}
-EXPORT_SYMBOL_GPL(snd_soc_unregister_component_by_driver);
+EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
/* Retrieve a card's name from device tree */
int snd_soc_of_parse_card_name(struct snd_soc_card *card,
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 11/27] ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (9 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 10/27] ASoC: soc-core: remove snd_soc_unregister_component_by_driver() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 12/27] ASoC: soc-component: move devm_snd_soc_component_register() Kuninori Morimoto
` (15 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
move snd_soc_register_[un]component() 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 | 8 ++
include/sound/soc.h | 9 --
sound/soc/soc-component.c | 213 ++++++++++++++++++++++++++++++++++
sound/soc/soc-core.c | 213 ----------------------------------
4 files changed, 221 insertions(+), 222 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index d6685812cad76..965c2555010c7 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -279,6 +279,14 @@ void snd_soc_component_unregister(struct snd_soc_component *component);
int snd_soc_component_register(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv,
int num_dai);
+int snd_soc_register_component(struct device *dev,
+ const struct snd_soc_component_driver *component_driver,
+ struct snd_soc_dai_driver *dai_drv, int num_dai);
+
+int devm_snd_soc_register_component(struct device *dev,
+ const struct snd_soc_component_driver *component_driver,
+ struct snd_soc_dai_driver *dai_drv, int num_dai);
+void snd_soc_unregister_component(struct device *dev);
const char *snd_soc_component_name(struct snd_soc_component *component);
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0f8e46c131c91..338ba5cf85fb3 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -447,15 +447,6 @@ static inline int snd_soc_resume(struct device *dev)
}
#endif
int snd_soc_poweroff(struct device *dev);
-int snd_soc_register_component(struct device *dev,
- const struct snd_soc_component_driver *component_driver,
- struct snd_soc_dai_driver *dai_drv, int num_dai);
-
-int devm_snd_soc_register_component(struct device *dev,
- const struct snd_soc_component_driver *component_driver,
- struct snd_soc_dai_driver *dai_drv, int num_dai);
-void snd_soc_unregister_component(struct device *dev);
-
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd);
#ifdef CONFIG_SND_SOC_COMPRESS
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 7e565da045b60..ca51f976ec409 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1553,3 +1553,216 @@ struct snd_soc_component *snd_soc_component_lookup_by_name(const char *component
return NULL;
}
EXPORT_SYMBOL_GPL(snd_soc_component_lookup_by_name);
+
+/**
+ * snd_soc_unregister_dais - Unregister DAIs from the ASoC core
+ *
+ * @component: The component for which the DAIs should be unregistered
+ */
+static void snd_soc_unregister_dais(struct snd_soc_component *component)
+{
+ struct snd_soc_dai *dai, *_dai;
+
+ for_each_component_dais_safe(component, dai, _dai)
+ snd_soc_unregister_dai(dai);
+}
+
+/**
+ * snd_soc_register_dais - Register a DAI with the ASoC core
+ *
+ * @component: The component the DAIs are registered for
+ * @dai_drv: DAI driver to use for the DAIs
+ * @count: Number of DAIs
+ */
+static int snd_soc_register_dais(struct snd_soc_component *component,
+ struct snd_soc_dai_driver *dai_drv,
+ size_t count)
+{
+ struct snd_soc_dai *dai;
+ unsigned int i;
+ int ret;
+
+ for (i = 0; i < count; i++) {
+ dai = snd_soc_register_dai(component, dai_drv + i, count == 1 &&
+ component->driver->legacy_dai_naming);
+ if (dai == NULL) {
+ ret = -ENOMEM;
+ goto err;
+ }
+ }
+
+ return 0;
+
+err:
+ snd_soc_unregister_dais(component);
+
+ return ret;
+}
+
+#define ENDIANNESS_MAP(name) \
+ (SNDRV_PCM_FMTBIT_##name##LE | SNDRV_PCM_FMTBIT_##name##BE)
+static u64 endianness_format_map[] = {
+ ENDIANNESS_MAP(S16_),
+ ENDIANNESS_MAP(U16_),
+ ENDIANNESS_MAP(S24_),
+ ENDIANNESS_MAP(U24_),
+ ENDIANNESS_MAP(S32_),
+ ENDIANNESS_MAP(U32_),
+ ENDIANNESS_MAP(S24_3),
+ ENDIANNESS_MAP(U24_3),
+ ENDIANNESS_MAP(S20_3),
+ ENDIANNESS_MAP(U20_3),
+ ENDIANNESS_MAP(S18_3),
+ ENDIANNESS_MAP(U18_3),
+ ENDIANNESS_MAP(FLOAT_),
+ ENDIANNESS_MAP(FLOAT64_),
+ ENDIANNESS_MAP(IEC958_SUBFRAME_),
+};
+
+/*
+ * Fix up the DAI formats for endianness: codecs don't actually see
+ * the endianness of the data but we're using the CPU format
+ * definitions which do need to include endianness so we ensure that
+ * codec DAIs always have both big and little endian variants set.
+ */
+static void convert_endianness_formats(struct snd_soc_pcm_stream *stream)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(endianness_format_map); i++)
+ if (stream->formats & endianness_format_map[i])
+ stream->formats |= endianness_format_map[i];
+}
+
+struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
+ const struct snd_soc_component_driver *driver)
+{
+ struct snd_soc_component *component;
+
+ component = devm_kzalloc_obj(dev, *component);
+ if (!component)
+ return ERR_PTR(-ENOMEM);
+
+ component->dapm = snd_soc_dapm_alloc(dev);
+ if (!component->dapm)
+ return ERR_PTR(-ENOMEM);
+
+ if (!name) {
+ name = snd_soc_fmt_single_name(dev, NULL);
+ if (!name) {
+ dev_err(dev, "ASoC: Failed to allocate name\n");
+ return ERR_PTR(-ENOMEM);
+ }
+ }
+
+ component->dev = dev;
+ component->name = name;
+ component->driver = driver;
+
+ INIT_LIST_HEAD(&component->dai_list);
+ INIT_LIST_HEAD(&component->dobj_list);
+ INIT_LIST_HEAD(&component->card_list);
+ INIT_LIST_HEAD(&component->list);
+ INIT_LIST_HEAD(&component->card_aux_list);
+ mutex_init(&component->io_mutex);
+
+ return component;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_new);
+
+static void snd_soc_component_unregister_unlocked(struct snd_soc_component *component)
+{
+ struct snd_soc_card *card = component->card;
+
+ snd_soc_unregister_dais(component);
+
+ if (card)
+ snd_soc_card_unbind(card, true);
+
+ list_del(&component->list);
+}
+
+void snd_soc_component_unregister(struct snd_soc_component *component)
+{
+ guard(mutex)(&client_mutex);
+
+ snd_soc_component_unregister_unlocked(component);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_unregister);
+
+int snd_soc_component_register(struct snd_soc_component *component,
+ struct snd_soc_dai_driver *dai_drv,
+ int num_dai)
+{
+ int ret;
+ int i;
+ guard(mutex)(&client_mutex);
+
+ if (component->driver->endianness) {
+ for (i = 0; i < num_dai; i++) {
+ convert_endianness_formats(&dai_drv[i].playback);
+ convert_endianness_formats(&dai_drv[i].capture);
+ }
+ }
+
+ ret = snd_soc_register_dais(component, dai_drv, num_dai);
+ if (ret < 0) {
+ dev_err(component->dev, "ASoC: Failed to register DAIs: %d\n",
+ ret);
+ goto err_cleanup;
+ }
+
+ if (!component->driver->write && !component->driver->read) {
+ if (!component->regmap)
+ component->regmap = dev_get_regmap(component->dev,
+ NULL);
+ }
+
+ /* see for_each_component */
+ list_add(&component->list, snd_soc_component_get_list_head());
+
+ snd_soc_card_rebind();
+
+err_cleanup:
+ if (ret < 0)
+ snd_soc_component_unregister_unlocked(component);
+
+ return ret;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_register);
+
+int snd_soc_register_component(struct device *dev,
+ const struct snd_soc_component_driver *component_driver,
+ struct snd_soc_dai_driver *dai_drv,
+ int num_dai)
+{
+ struct snd_soc_component *component;
+
+ component = snd_soc_component_new(dev, NULL, component_driver);
+ if (IS_ERR(component))
+ return PTR_ERR(component);
+
+ return snd_soc_component_register(component, dai_drv, num_dai);
+}
+EXPORT_SYMBOL_GPL(snd_soc_register_component);
+
+/**
+ * snd_soc_unregister_component - Unregister component using a given driver
+ * from the ASoC core
+ *
+ * @dev: The device to unregister
+ */
+void snd_soc_unregister_component(struct device *dev)
+{
+ guard(mutex)(&client_mutex);
+
+ while (1) {
+ struct snd_soc_component *component = snd_soc_lookup_component_nolocked(dev, NULL);
+
+ if (!component)
+ break;
+
+ snd_soc_component_unregister_unlocked(component);
+ }
+}
+EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 406ab3620ac1d..3663227adda68 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1377,219 +1377,6 @@ char *snd_soc_fmt_multiple_name(struct device *dev, struct snd_soc_dai_driver *d
return devm_kstrdup(dev, dai_drv->name, GFP_KERNEL);
}
-/**
- * snd_soc_unregister_dais - Unregister DAIs from the ASoC core
- *
- * @component: The component for which the DAIs should be unregistered
- */
-static void snd_soc_unregister_dais(struct snd_soc_component *component)
-{
- struct snd_soc_dai *dai, *_dai;
-
- for_each_component_dais_safe(component, dai, _dai)
- snd_soc_unregister_dai(dai);
-}
-
-/**
- * snd_soc_register_dais - Register a DAI with the ASoC core
- *
- * @component: The component the DAIs are registered for
- * @dai_drv: DAI driver to use for the DAIs
- * @count: Number of DAIs
- */
-static int snd_soc_register_dais(struct snd_soc_component *component,
- struct snd_soc_dai_driver *dai_drv,
- size_t count)
-{
- struct snd_soc_dai *dai;
- unsigned int i;
- int ret;
-
- for (i = 0; i < count; i++) {
- dai = snd_soc_register_dai(component, dai_drv + i, count == 1 &&
- component->driver->legacy_dai_naming);
- if (dai == NULL) {
- ret = -ENOMEM;
- goto err;
- }
- }
-
- return 0;
-
-err:
- snd_soc_unregister_dais(component);
-
- return ret;
-}
-
-#define ENDIANNESS_MAP(name) \
- (SNDRV_PCM_FMTBIT_##name##LE | SNDRV_PCM_FMTBIT_##name##BE)
-static u64 endianness_format_map[] = {
- ENDIANNESS_MAP(S16_),
- ENDIANNESS_MAP(U16_),
- ENDIANNESS_MAP(S24_),
- ENDIANNESS_MAP(U24_),
- ENDIANNESS_MAP(S32_),
- ENDIANNESS_MAP(U32_),
- ENDIANNESS_MAP(S24_3),
- ENDIANNESS_MAP(U24_3),
- ENDIANNESS_MAP(S20_3),
- ENDIANNESS_MAP(U20_3),
- ENDIANNESS_MAP(S18_3),
- ENDIANNESS_MAP(U18_3),
- ENDIANNESS_MAP(FLOAT_),
- ENDIANNESS_MAP(FLOAT64_),
- ENDIANNESS_MAP(IEC958_SUBFRAME_),
-};
-
-/*
- * Fix up the DAI formats for endianness: codecs don't actually see
- * the endianness of the data but we're using the CPU format
- * definitions which do need to include endianness so we ensure that
- * codec DAIs always have both big and little endian variants set.
- */
-static void convert_endianness_formats(struct snd_soc_pcm_stream *stream)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(endianness_format_map); i++)
- if (stream->formats & endianness_format_map[i])
- stream->formats |= endianness_format_map[i];
-}
-
-struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
- const struct snd_soc_component_driver *driver)
-{
- struct snd_soc_component *component;
-
- component = devm_kzalloc_obj(dev, *component);
- if (!component)
- return ERR_PTR(-ENOMEM);
-
- component->dapm = snd_soc_dapm_alloc(dev);
- if (!component->dapm)
- return ERR_PTR(-ENOMEM);
-
- if (!name) {
- name = snd_soc_fmt_single_name(dev, NULL);
- if (!name) {
- dev_err(dev, "ASoC: Failed to allocate name\n");
- return ERR_PTR(-ENOMEM);
- }
- }
-
- component->dev = dev;
- component->name = name;
- component->driver = driver;
-
- INIT_LIST_HEAD(&component->dai_list);
- INIT_LIST_HEAD(&component->dobj_list);
- INIT_LIST_HEAD(&component->card_list);
- INIT_LIST_HEAD(&component->list);
- INIT_LIST_HEAD(&component->card_aux_list);
- mutex_init(&component->io_mutex);
-
- return component;
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_new);
-
-static void snd_soc_component_unregister_unlocked(struct snd_soc_component *component)
-{
- struct snd_soc_card *card = component->card;
-
- snd_soc_unregister_dais(component);
-
- if (card)
- snd_soc_card_unbind(card, true);
-
- list_del(&component->list);
-}
-
-void snd_soc_component_unregister(struct snd_soc_component *component)
-{
- guard(mutex)(&client_mutex);
-
- snd_soc_component_unregister_unlocked(component);
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_unregister);
-
-int snd_soc_component_register(struct snd_soc_component *component,
- struct snd_soc_dai_driver *dai_drv,
- int num_dai)
-{
- int ret;
- int i;
- guard(mutex)(&client_mutex);
-
- if (component->driver->endianness) {
- for (i = 0; i < num_dai; i++) {
- convert_endianness_formats(&dai_drv[i].playback);
- convert_endianness_formats(&dai_drv[i].capture);
- }
- }
-
- ret = snd_soc_register_dais(component, dai_drv, num_dai);
- if (ret < 0) {
- dev_err(component->dev, "ASoC: Failed to register DAIs: %d\n",
- ret);
- goto err_cleanup;
- }
-
- if (!component->driver->write && !component->driver->read) {
- if (!component->regmap)
- component->regmap = dev_get_regmap(component->dev,
- NULL);
- }
-
- /* see for_each_component */
- list_add(&component->list, snd_soc_component_get_list_head());
-
- snd_soc_card_rebind();
-
-err_cleanup:
- if (ret < 0)
- snd_soc_component_unregister_unlocked(component);
-
- return ret;
-}
-EXPORT_SYMBOL_GPL(snd_soc_component_register);
-
-int snd_soc_register_component(struct device *dev,
- const struct snd_soc_component_driver *component_driver,
- struct snd_soc_dai_driver *dai_drv,
- int num_dai)
-{
- struct snd_soc_component *component;
-
- component = snd_soc_component_new(dev, NULL, component_driver);
- if (IS_ERR(component))
- return PTR_ERR(component);
-
- return snd_soc_component_register(component, dai_drv, num_dai);
-}
-EXPORT_SYMBOL_GPL(snd_soc_register_component);
-
-/**
- * snd_soc_unregister_component - Unregister component using a given driver
- * from the ASoC core
- *
- * @dev: The device to unregister
- */
-void snd_soc_unregister_component(struct device *dev)
-{
- guard(mutex)(&client_mutex);
-
- while (1) {
- struct snd_soc_component *component = snd_soc_lookup_component_nolocked(dev, NULL);
-
- if (!component)
- break;
-
- snd_soc_component_unregister_unlocked(component);
- }
-}
-EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
-
/* Retrieve a card's name from device tree */
int snd_soc_of_parse_card_name(struct snd_soc_card *card,
const char *propname)
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 12/27] ASoC: soc-component: move devm_snd_soc_component_register()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (10 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 11/27] ASoC: soc-component: move snd_soc_register_[un]component() to soc-component.c Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:57 ` sashiko-bot
2026-11-25 1:43 ` [PATCH v3 13/27] ASoC: soc-component: move snd_soc_of_xlate_dai_name() to soc-component.c Kuninori Morimoto
` (14 subsequent siblings)
26 siblings, 1 reply; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
We don't need to have component related function in soc-devres.c.
Let's move it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-component.c | 51 +++++++++++++++++++++++++++++++++++++++
sound/soc/soc-devres.c | 51 ---------------------------------------
2 files changed, 51 insertions(+), 51 deletions(-)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index ca51f976ec409..ea8ed0a662dc6 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1766,3 +1766,54 @@ void snd_soc_unregister_component(struct device *dev)
}
}
EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
+
+static void devm_component_release(struct device *dev, void *res)
+{
+ struct snd_soc_component **component = res;
+
+ snd_soc_component_unregister(*component);
+}
+
+/**
+ * devm_snd_soc_register_component - resource managed component registration
+ * @dev: Device used to manage component
+ * @cmpnt_drv: Component driver
+ * @dai_drv: DAI driver
+ * @num_dai: Number of DAIs to register
+ *
+ * Register a component with automatic unregistration when the device is
+ * unregistered.
+ */
+int devm_snd_soc_register_component(struct device *dev,
+ const struct snd_soc_component_driver *cmpnt_drv,
+ struct snd_soc_dai_driver *dai_drv, int num_dai)
+{
+ const struct snd_soc_component **ptr;
+ struct snd_soc_component *component;
+ int ret = -ENOMEM;
+
+ component = snd_soc_component_new(dev, NULL, cmpnt_drv);
+ if (IS_ERR(component))
+ goto err;
+
+ ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL);
+ if (!ptr)
+ goto free_component;
+
+ ret = snd_soc_component_register(component, dai_drv, num_dai);
+ if (ret < 0)
+ goto free_devres;
+
+ *ptr = component;
+ devres_add(dev, ptr);
+
+ return ret;
+
+free_devres:
+ devres_free(ptr);
+free_component:
+ devm_kfree(dev, component);
+err:
+ return ret;
+}
+EXPORT_SYMBOL_GPL(devm_snd_soc_register_component);
diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c
index 0323897c664dc..431bb366468ac 100644
--- a/sound/soc/soc-devres.c
+++ b/sound/soc/soc-devres.c
@@ -9,57 +9,6 @@
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>
-static void devm_component_release(struct device *dev, void *res)
-{
- struct snd_soc_component **component = res;
-
- snd_soc_component_unregister(*component);
-}
-
-/**
- * devm_snd_soc_register_component - resource managed component registration
- * @dev: Device used to manage component
- * @cmpnt_drv: Component driver
- * @dai_drv: DAI driver
- * @num_dai: Number of DAIs to register
- *
- * Register a component with automatic unregistration when the device is
- * unregistered.
- */
-int devm_snd_soc_register_component(struct device *dev,
- const struct snd_soc_component_driver *cmpnt_drv,
- struct snd_soc_dai_driver *dai_drv, int num_dai)
-{
- const struct snd_soc_component **ptr;
- struct snd_soc_component *component;
- int ret = -ENOMEM;
-
- component = snd_soc_component_new(dev, NULL, cmpnt_drv);
- if (IS_ERR(component))
- goto err;
-
- ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL);
- if (!ptr)
- goto free_component;
-
- ret = snd_soc_component_register(component, dai_drv, num_dai);
- if (ret < 0)
- goto free_devres;
-
- *ptr = component;
- devres_add(dev, ptr);
-
- return ret;
-
-free_devres:
- devres_free(ptr);
-free_component:
- devm_kfree(dev, component);
-err:
- return ret;
-}
-EXPORT_SYMBOL_GPL(devm_snd_soc_register_component);
-
/**
* devm_snd_soc_register_card - resource managed card registration
* @dev: Device used to manage card
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* Re: [PATCH v3 12/27] ASoC: soc-component: move devm_snd_soc_component_register()
2026-11-25 1:43 ` [PATCH v3 12/27] ASoC: soc-component: move devm_snd_soc_component_register() Kuninori Morimoto
@ 2026-11-25 1:57 ` sashiko-bot
0 siblings, 0 replies; 30+ messages in thread
From: sashiko-bot @ 2026-11-25 1:57 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: linux-sound
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] ASoC: soc-component: double list_del() in
devm_component_release()
- [Low] ASoC: soc-component: wrong function name in commit subject
--
commit bfd525c567e53a1ebadf8315dc6aad399a16e15a
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
ASoC: soc-component: move devm_snd_soc_component_register()
This commit moves devm_snd_soc_register_component() and its devres release
callback from sound/soc/soc-devres.c to sound/soc/soc-component.c.
> ASoC: soc-component: move devm_snd_soc_component_register()
[Severity: Low]
This isn't a bug, but the function moved by this patch is
devm_snd_soc_register_component() rather than
devm_snd_soc_component_register().
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index ca51f976ec409..ea8ed0a662dc6 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c
> @@ -1766,3 +1766,54 @@ void snd_soc_unregister_component(struct device *dev)
> }
> }
> EXPORT_SYMBOL_GPL(snd_soc_unregister_component);
> +
> +static void devm_component_release(struct device *dev, void *res)
> +{
> + struct snd_soc_component **component = res;
> +
> + snd_soc_component_unregister(*component);
> +}
[Severity: High]
Can devm_component_release() unregister *component a second time and run
list_del(&component->list) on an already-poisoned list head?
Together with commit "ASoC: soc-devres: use snd_soc_component_unregister()
for devm_snd_soc_register_component()" earlier in this series, devres now
stores the component pointer and calls snd_soc_component_unregister()
directly instead of looking the component up on component_list via
snd_soc_unregister_component_by_driver().
In sound/soc/stm/stm32_adfsdm.c, stm32_adfsdm_probe() registers a DAI
component on &pdev->dev with devm_snd_soc_register_component() and a
platform component on the same device with snd_soc_register_component().
On detach, stm32_adfsdm_remove() runs before devres release and calls
snd_soc_unregister_component(&pdev->dev), which unregisters every
component attached to &pdev->dev and deletes component->list. When
devres_release_all() then invokes devm_component_release(),
snd_soc_component_unregister(*component) calls list_del(&component->list)
again, causing a list corruption crash or warning.
--
Sashiko AI review · https://sashiko.dev/#/patchset/87a4mxg01k.wl-kuninori.morimoto.gx@renesas.com?part=12
^ permalink raw reply [flat|nested] 30+ messages in thread
* [PATCH v3 13/27] ASoC: soc-component: move snd_soc_of_xlate_dai_name() to soc-component.c
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (11 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 12/27] ASoC: soc-component: move devm_snd_soc_component_register() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 14/27] ASoC: soc-component: add snd_soc_component_name_prefix() Kuninori Morimoto
` (13 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
move snd_soc_of_xlate_dai_name() to soc-component.c
This renames function name
- snd_soc_of_xlate_dai_name()
+ snd_soc_component_of_simple_xlate_dai_name().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 4 ++++
include/sound/soc.h | 3 ---
sound/soc/soc-component.c | 33 +++++++++++++++++++++++++++++++++
sound/soc/soc-core.c | 33 ---------------------------------
4 files changed, 37 insertions(+), 36 deletions(-)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 965c2555010c7..caed32327daca 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -401,6 +401,9 @@ int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
const struct of_phandle_args *args,
const char **dai_name);
+int snd_soc_component_of_simple_xlate_dai_name(struct snd_soc_component *component,
+ const struct of_phandle_args *args,
+ const char **dai_name);
int snd_soc_component_compr_open(struct snd_soc_component *component,
struct snd_compr_stream *cstream);
void snd_soc_component_compr_free(struct snd_soc_component *component,
@@ -462,5 +465,6 @@ void snd_soc_pcm_component_delay(struct snd_pcm_substream *substream,
#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
+#define snd_soc_of_xlate_dai_name snd_soc_component_of_simple_xlate_dai_name
#endif /* __SOC_COMPONENT_H */
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 338ba5cf85fb3..5abebfa329b52 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1303,9 +1303,6 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
unsigned int *rx_mask,
unsigned int *slots,
unsigned int *slot_width);
-int snd_soc_of_xlate_dai_name(struct snd_soc_component *component,
- const struct of_phandle_args *args,
- const char **dai_name);
void snd_soc_of_parse_node_prefix(struct device_node *np,
struct snd_soc_codec_conf *codec_conf,
struct device_node *of_node,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index ea8ed0a662dc6..c1f90a47e182b 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1817,3 +1817,36 @@ int devm_snd_soc_register_component(struct device *dev,
return ret;
}
EXPORT_SYMBOL_GPL(devm_snd_soc_register_component);
+
+/**
+ * snd_soc_component_of_simple_xlate_dai_name - Resolve a sound-dai phandle argument to a
+ * DAI name by searching the component DAI list.
+ * @component: ASoC component to search.
+ * @args: Phandle arguments from the sound-dai property; args[0] is the
+ * DAI ID.
+ * @dai_name: Output pointer set to the matched DAI name on success.
+ *
+ * Return: 0 on success, -EINVAL if args_count != 1 or no match is found.
+ */
+int snd_soc_component_of_simple_xlate_dai_name(struct snd_soc_component *component,
+ const struct of_phandle_args *args,
+ const char **dai_name)
+{
+ struct snd_soc_dai *dai;
+ int id;
+
+ if (args->args_count != 1)
+ return -EINVAL;
+
+ id = args->args[0];
+
+ for_each_component_dais(component, dai) {
+ if (dai->driver->id == id) {
+ *dai_name = snd_soc_dai_name(dai);
+ return 0;
+ }
+ }
+
+ return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_of_simple_xlate_dai_name);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3663227adda68..894a81b2d9836 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1591,39 +1591,6 @@ int snd_soc_of_parse_tdm_slot(struct device_node *np,
}
EXPORT_SYMBOL_GPL(snd_soc_of_parse_tdm_slot);
-/**
- * snd_soc_of_xlate_dai_name - Resolve a sound-dai phandle argument to a
- * DAI name by searching the component DAI list.
- * @component: ASoC component to search.
- * @args: Phandle arguments from the sound-dai property; args[0] is the
- * DAI ID.
- * @dai_name: Output pointer set to the matched DAI name on success.
- *
- * Return: 0 on success, -EINVAL if args_count != 1 or no match is found.
- */
-int snd_soc_of_xlate_dai_name(struct snd_soc_component *component,
- const struct of_phandle_args *args,
- const char **dai_name)
-{
- struct snd_soc_dai *dai;
- int id;
-
- if (args->args_count != 1)
- return -EINVAL;
-
- id = args->args[0];
-
- for_each_component_dais(component, dai) {
- if (dai->driver->id == id) {
- *dai_name = snd_soc_dai_name(dai);
- return 0;
- }
- }
-
- return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(snd_soc_of_xlate_dai_name);
-
void snd_soc_dlc_use_cpu_as_platform(struct snd_soc_dai_link_component *platforms,
struct snd_soc_dai_link_component *cpus)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 14/27] ASoC: soc-component: add snd_soc_component_name_prefix()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (12 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 13/27] ASoC: soc-component: move snd_soc_of_xlate_dai_name() to soc-component.c Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 15/27] ASoC: soc-component: add snd_soc_component_to_dev() Kuninori Morimoto
` (12 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Add snd_soc_component_name_prefix() 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 | 1 +
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index caed32327daca..e78e0c9cc9d0d 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -289,6 +289,7 @@ int devm_snd_soc_register_component(struct device *dev,
void snd_soc_unregister_component(struct device *dev);
const char *snd_soc_component_name(struct snd_soc_component *component);
+const char *snd_soc_component_name_prefix(struct snd_soc_component *component);
void snd_soc_component_set_priv(struct snd_soc_component *component, void *priv);
void *snd_soc_component_to_priv(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index c1f90a47e182b..e6c0a66c7314e 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -43,6 +43,12 @@ const char *snd_soc_component_name(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_name);
+const char *snd_soc_component_name_prefix(struct snd_soc_component *component)
+{
+ return component->name_prefix;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_name_prefix);
+
void snd_soc_component_set_priv(struct snd_soc_component *component, void *priv)
{
component->priv = priv;
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 15/27] ASoC: soc-component: add snd_soc_component_to_dev()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (13 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 14/27] ASoC: soc-component: add snd_soc_component_name_prefix() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 16/27] ASoC: soc-component: add snd_soc_component_to_driver() Kuninori Morimoto
` (11 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Add snd_soc_component_to_dev() 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 | 1 +
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index e78e0c9cc9d0d..8a03730a2e54a 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -272,6 +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))
+struct device *snd_soc_component_to_dev(struct snd_soc_component *component);
struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component);
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
const struct snd_soc_component_driver *driver);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index e6c0a66c7314e..cb0a75901ea5b 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -61,6 +61,12 @@ void *snd_soc_component_to_priv(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_to_priv);
+struct device *snd_soc_component_to_dev(struct snd_soc_component *component)
+{
+ return component->dev;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_to_dev);
+
struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component)
{
return component->dapm;
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 16/27] ASoC: soc-component: add snd_soc_component_to_driver()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (14 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 15/27] ASoC: soc-component: add snd_soc_component_to_dev() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 17/27] ASoC: soc-component: add snd_soc_component_to_card() Kuninori Morimoto
` (10 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Add snd_soc_component_to_driver() 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 | 2 ++
sound/soc/soc-component.c | 7 +++++++
2 files changed, 9 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 8a03730a2e54a..d0b82374f2801 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -274,6 +274,8 @@ struct snd_soc_component {
struct device *snd_soc_component_to_dev(struct snd_soc_component *component);
struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component);
+const struct snd_soc_component_driver
+*snd_soc_component_to_driver(struct snd_soc_component *component);
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
const struct snd_soc_component_driver *driver);
void snd_soc_component_unregister(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index cb0a75901ea5b..3bf1b8691bdc7 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -73,6 +73,13 @@ struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component
}
EXPORT_SYMBOL_GPL(snd_soc_component_to_dapm);
+const struct snd_soc_component_driver *
+snd_soc_component_to_driver(struct snd_soc_component *component)
+{
+ return component->driver;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_to_driver);
+
unsigned int snd_soc_component_active(struct snd_soc_component *component)
{
return component->active;
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 17/27] ASoC: soc-component: add snd_soc_component_to_card()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (15 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 16/27] ASoC: soc-component: add snd_soc_component_to_driver() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 18/27] ASoC: soc-component: add snd_soc_component_to_debugfs_root() Kuninori Morimoto
` (9 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Add snd_soc_component_to_card() 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 | 1 +
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index d0b82374f2801..ec0e3d7264cc3 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -276,6 +276,7 @@ struct device *snd_soc_component_to_dev(struct snd_soc_component *component);
struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component *component);
const struct snd_soc_component_driver
*snd_soc_component_to_driver(struct snd_soc_component *component);
+struct snd_soc_card *snd_soc_component_to_card(struct snd_soc_component *component);
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
const struct snd_soc_component_driver *driver);
void snd_soc_component_unregister(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 3bf1b8691bdc7..2d666bb241223 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -80,6 +80,12 @@ snd_soc_component_to_driver(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_to_driver);
+struct snd_soc_card *snd_soc_component_to_card(struct snd_soc_component *component)
+{
+ return component->card;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_to_card);
+
unsigned int snd_soc_component_active(struct snd_soc_component *component)
{
return component->active;
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 18/27] ASoC: soc-component: add snd_soc_component_to_debugfs_root()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (16 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 17/27] ASoC: soc-component: add snd_soc_component_to_card() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 19/27] ASoC: soc-component: add snd_soc_component_to_regmap() Kuninori Morimoto
` (8 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
This patch adds snd_soc_component_debugfs_root() to get
component->debugfs_root.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 1 +
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index ec0e3d7264cc3..0bc84c9c0e7e1 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -277,6 +277,7 @@ struct snd_soc_dapm_context *snd_soc_component_to_dapm(struct snd_soc_component
const struct snd_soc_component_driver
*snd_soc_component_to_driver(struct snd_soc_component *component);
struct snd_soc_card *snd_soc_component_to_card(struct snd_soc_component *component);
+struct dentry *snd_soc_component_to_debugfs_root(struct snd_soc_component *component);
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
const struct snd_soc_component_driver *driver);
void snd_soc_component_unregister(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 2d666bb241223..110f4d60d4a4d 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -86,6 +86,12 @@ struct snd_soc_card *snd_soc_component_to_card(struct snd_soc_component *compone
}
EXPORT_SYMBOL_GPL(snd_soc_component_to_card);
+struct dentry *snd_soc_component_to_debugfs_root(struct snd_soc_component *component)
+{
+ return component->debugfs_root;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_to_debugfs_root);
+
unsigned int snd_soc_component_active(struct snd_soc_component *component)
{
return component->active;
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 19/27] ASoC: soc-component: add snd_soc_component_to_regmap()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (17 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 18/27] ASoC: soc-component: add snd_soc_component_to_debugfs_root() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:43 ` [PATCH v3 20/27] ASoC: soc-component: add snd_soc_component_regcache_mark_dirty() Kuninori Morimoto
` (7 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Add snd_soc_component_to_regmap() 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 | 1 +
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 0bc84c9c0e7e1..0caea23da4fc0 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -278,6 +278,7 @@ const struct snd_soc_component_driver
*snd_soc_component_to_driver(struct snd_soc_component *component);
struct snd_soc_card *snd_soc_component_to_card(struct snd_soc_component *component);
struct dentry *snd_soc_component_to_debugfs_root(struct snd_soc_component *component);
+struct regmap *snd_soc_component_to_regmap(struct snd_soc_component *component);
struct snd_soc_component *snd_soc_component_new(struct device *dev, const char *name,
const struct snd_soc_component_driver *driver);
void snd_soc_component_unregister(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 110f4d60d4a4d..f1ff81412420e 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -92,6 +92,12 @@ struct dentry *snd_soc_component_to_debugfs_root(struct snd_soc_component *compo
}
EXPORT_SYMBOL_GPL(snd_soc_component_to_debugfs_root);
+struct regmap *snd_soc_component_to_regmap(struct snd_soc_component *component)
+{
+ return component->regmap;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_to_regmap);
+
unsigned int snd_soc_component_active(struct snd_soc_component *component)
{
return component->active;
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 20/27] ASoC: soc-component: add snd_soc_component_regcache_mark_dirty()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (18 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 19/27] ASoC: soc-component: add snd_soc_component_to_regmap() Kuninori Morimoto
@ 2026-11-25 1:43 ` Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 21/27] ASoC: soc-component: add snd_soc_component_regcache_cache_only() Kuninori Morimoto
` (6 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:43 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Adds snd_soc_component_regcache_mark_dirty().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 1 +
sound/soc/soc-component.c | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 0caea23da4fc0..9b799cc300f48 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -357,6 +357,7 @@ void snd_soc_component_regmap_exit(struct snd_soc_component *component);
int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component);
void snd_soc_component_regmap_async_complete(struct snd_soc_component *component);
int snd_soc_component_regcache_sync(struct snd_soc_component *component);
+void snd_soc_component_regcache_mark_dirty(struct snd_soc_component *component);
int snd_soc_component_fixup_controls(struct snd_soc_component *component);
int snd_soc_component_add_controls(struct snd_soc_component *component,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index f1ff81412420e..8c1da7dbcbc73 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -509,6 +509,15 @@ int snd_soc_component_regcache_sync(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_regcache_sync);
+void snd_soc_component_regcache_mark_dirty(struct snd_soc_component *component)
+{
+ struct regmap *regmap = component->regmap;
+
+ if (regmap)
+ regcache_mark_dirty(regmap);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regcache_mark_dirty);
+
int snd_soc_component_compr_open(struct snd_soc_component *component,
struct snd_compr_stream *cstream)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 21/27] ASoC: soc-component: add snd_soc_component_regcache_cache_only()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (19 preceding siblings ...)
2026-11-25 1:43 ` [PATCH v3 20/27] ASoC: soc-component: add snd_soc_component_regcache_mark_dirty() Kuninori Morimoto
@ 2026-11-25 1:44 ` Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 22/27] ASoC: soc-component: add snd_soc_component_regcache_cache_bypass() Kuninori Morimoto
` (5 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:44 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Adds snd_soc_component_regcache_cache_only().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 1 +
sound/soc/soc-component.c | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 9b799cc300f48..3427f2f094956 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -358,6 +358,7 @@ int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component);
void snd_soc_component_regmap_async_complete(struct snd_soc_component *component);
int snd_soc_component_regcache_sync(struct snd_soc_component *component);
void snd_soc_component_regcache_mark_dirty(struct snd_soc_component *component);
+void snd_soc_component_regcache_cache_only(struct snd_soc_component *component, bool enable);
int snd_soc_component_fixup_controls(struct snd_soc_component *component);
int snd_soc_component_add_controls(struct snd_soc_component *component,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 8c1da7dbcbc73..3c9c22e8c282a 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -518,6 +518,15 @@ void snd_soc_component_regcache_mark_dirty(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_regcache_mark_dirty);
+void snd_soc_component_regcache_cache_only(struct snd_soc_component *component, bool enable)
+{
+ struct regmap *regmap = component->regmap;
+
+ if (regmap)
+ regcache_cache_only(regmap, enable);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regcache_cache_only);
+
int snd_soc_component_compr_open(struct snd_soc_component *component,
struct snd_compr_stream *cstream)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 22/27] ASoC: soc-component: add snd_soc_component_regcache_cache_bypass()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (20 preceding siblings ...)
2026-11-25 1:44 ` [PATCH v3 21/27] ASoC: soc-component: add snd_soc_component_regcache_cache_only() Kuninori Morimoto
@ 2026-11-25 1:44 ` Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 23/27] ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed() Kuninori Morimoto
` (4 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:44 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Adds snd_soc_component_regcache_cache_bypass().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 1 +
sound/soc/soc-component.c | 9 +++++++++
2 files changed, 10 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 3427f2f094956..7b1d9775422c9 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -359,6 +359,7 @@ void snd_soc_component_regmap_async_complete(struct snd_soc_component *component
int snd_soc_component_regcache_sync(struct snd_soc_component *component);
void snd_soc_component_regcache_mark_dirty(struct snd_soc_component *component);
void snd_soc_component_regcache_cache_only(struct snd_soc_component *component, bool enable);
+void snd_soc_component_regcache_cache_bypass(struct snd_soc_component *component, bool enable);
int snd_soc_component_fixup_controls(struct snd_soc_component *component);
int snd_soc_component_add_controls(struct snd_soc_component *component,
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 3c9c22e8c282a..996b66188cec1 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -527,6 +527,15 @@ void snd_soc_component_regcache_cache_only(struct snd_soc_component *component,
}
EXPORT_SYMBOL_GPL(snd_soc_component_regcache_cache_only);
+void snd_soc_component_regcache_cache_bypass(struct snd_soc_component *component, bool enable)
+{
+ struct regmap *regmap = component->regmap;
+
+ if (regmap)
+ regcache_cache_bypass(regmap, enable);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regcache_cache_bypass);
+
int snd_soc_component_compr_open(struct snd_soc_component *component,
struct snd_compr_stream *cstream)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 23/27] ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (21 preceding siblings ...)
2026-11-25 1:44 ` [PATCH v3 22/27] ASoC: soc-component: add snd_soc_component_regcache_cache_bypass() Kuninori Morimoto
@ 2026-11-25 1:44 ` Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 24/27] ASoC: soc-component: add snd_soc_component_num_dai() Kuninori Morimoto
` (3 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:44 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
Adds snd_soc_component_regmap_multi_reg_write_bypassed().
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 | 13 +++++++++++++
2 files changed, 16 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 7b1d9775422c9..458fe11a10da3 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -353,6 +353,9 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component,
void snd_soc_component_regmap_init(struct snd_soc_component *component,
struct regmap *regmap);
void snd_soc_component_regmap_exit(struct snd_soc_component *component);
+int snd_soc_component_regmap_multi_reg_write_bypassed(struct snd_soc_component *component,
+ const struct reg_sequence *regs,
+ int num_regs);
#endif
int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component);
void snd_soc_component_regmap_async_complete(struct snd_soc_component *component);
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 996b66188cec1..2a82d19b126d2 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -461,6 +461,19 @@ void snd_soc_component_regmap_exit(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_regmap_exit);
+int snd_soc_component_regmap_multi_reg_write_bypassed(struct snd_soc_component *component,
+ const struct reg_sequence *regs,
+ int num_regs)
+{
+ struct regmap *regmap = component->regmap;
+
+ if (!regmap)
+ return 0;
+
+ return regmap_multi_reg_write_bypassed(regmap, regs, num_regs);
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_regmap_multi_reg_write_bypassed);
+
#endif
int snd_soc_component_regmap_get_val_bytes(struct snd_soc_component *component)
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 24/27] ASoC: soc-component: add snd_soc_component_num_dai()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (22 preceding siblings ...)
2026-11-25 1:44 ` [PATCH v3 23/27] ASoC: soc-component: add snd_soc_component_regmap_multi_reg_write_bypassed() Kuninori Morimoto
@ 2026-11-25 1:44 ` Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 25/27] ASoC: soc-component: add snd_soc_component_connect_dai() Kuninori Morimoto
` (2 subsequent siblings)
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:44 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
This patch adds snd_soc_component_num_dai() to get component->num_dai.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
include/sound/soc-component.h | 1 +
sound/soc/soc-component.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 458fe11a10da3..8314a2e8df55f 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -393,6 +393,7 @@ static inline void *snd_soc_component_get_drvdata(struct snd_soc_component *c)
}
unsigned int snd_soc_component_active(struct snd_soc_component *component);
+int snd_soc_component_num_dai(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 2a82d19b126d2..a0e1a7648b818 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -104,6 +104,12 @@ unsigned int snd_soc_component_active(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_active);
+int snd_soc_component_num_dai(struct snd_soc_component *component)
+{
+ return component->num_dai;
+}
+EXPORT_SYMBOL_GPL(snd_soc_component_num_dai);
+
/*
* 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] 30+ messages in thread* [PATCH v3 25/27] ASoC: soc-component: add snd_soc_component_connect_dai()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (23 preceding siblings ...)
2026-11-25 1:44 ` [PATCH v3 24/27] ASoC: soc-component: add snd_soc_component_num_dai() Kuninori Morimoto
@ 2026-11-25 1:44 ` Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 26/27] ASoC: soc-component: add snd_soc_component_active_update() Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 27/27] ASoC: soc-component: add snd_soc_component_device_link_{add/del}() Kuninori Morimoto
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:44 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
This patch adds snd_soc_component_connect_dai() to connect DAI to
Component.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-component.c | 7 +++++++
sound/soc/soc-dai.c | 3 +--
sound/soc/soc-internal.h | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index a0e1a7648b818..806aa8ab66092 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -110,6 +110,13 @@ int snd_soc_component_num_dai(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_num_dai);
+void snd_soc_component_connect_dai(struct snd_soc_component *component, struct snd_soc_dai *dai)
+{
+ /* dai->list <-> component->dai_list */
+ list_add_tail(snd_soc_dai_to_list(dai), &component->dai_list);
+ component->num_dai++;
+}
+
/*
* We might want to check substream by using list.
* In such case, we can update these macros.
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 9e34f34eac3d8..596180367d9a0 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -1265,8 +1265,7 @@ struct snd_soc_dai *snd_soc_dai_register(struct snd_soc_component *component,
dai->driver = dai_drv;
/* see for_each_component_dais */
- list_add_tail(&dai->list, &component->dai_list);
- component->num_dai++;
+ snd_soc_component_connect_dai(component, dai);
dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name);
return dai;
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index e09d283d443a8..98ff0e2fc2e1d 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -69,6 +69,7 @@ bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
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);
+void snd_soc_component_connect_dai(struct snd_soc_component *component, struct snd_soc_dai *dai);
#define for_each_component(component) \
list_for_each_entry(component, snd_soc_component_get_list_head(), list)
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 26/27] ASoC: soc-component: add snd_soc_component_active_update()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (24 preceding siblings ...)
2026-11-25 1:44 ` [PATCH v3 25/27] ASoC: soc-component: add snd_soc_component_connect_dai() Kuninori Morimoto
@ 2026-11-25 1:44 ` Kuninori Morimoto
2026-11-25 1:44 ` [PATCH v3 27/27] ASoC: soc-component: add snd_soc_component_device_link_{add/del}() Kuninori Morimoto
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:44 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
This patch adds snd_soc_component_active_update() to handle Component
acitive count.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-component.c | 5 +++++
sound/soc/soc-dai.c | 2 +-
sound/soc/soc-internal.h | 1 +
sound/soc/soc-pcm.c | 2 +-
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 806aa8ab66092..5475938f80738 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -104,6 +104,11 @@ unsigned int snd_soc_component_active(struct snd_soc_component *component)
}
EXPORT_SYMBOL_GPL(snd_soc_component_active);
+void snd_soc_component_active_update(struct snd_soc_component *component, int action)
+{
+ component->active += action;
+}
+
int snd_soc_component_num_dai(struct snd_soc_component *component)
{
return component->num_dai;
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 596180367d9a0..73aea7291fa73 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -713,7 +713,7 @@ void snd_soc_dai_active_update(struct snd_soc_dai *dai, int stream, int action)
dai->stream[stream].active += action;
/* see snd_soc_component_active() */
- dai->component->active += action;
+ snd_soc_component_active_update(dai->component, action);
}
int snd_soc_dai_active(const struct snd_soc_dai *dai)
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index 98ff0e2fc2e1d..1190be669eae3 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -70,6 +70,7 @@ 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);
void snd_soc_component_connect_dai(struct snd_soc_component *component, struct snd_soc_dai *dai);
+void snd_soc_component_active_update(struct snd_soc_component *component, int action);
#define for_each_component(component) \
list_for_each_entry(component, snd_soc_component_get_list_head(), list)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index ef8ccf52798eb..dac353fec4bcf 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -374,7 +374,7 @@ void snd_soc_runtime_action(struct snd_soc_pcm_runtime *rtd,
for_each_rtd_components(rtd, i, component) {
if (component->num_dai)
continue;
- component->active += action;
+ snd_soc_component_active_update(component, action);
}
}
EXPORT_SYMBOL_GPL(snd_soc_runtime_action);
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread* [PATCH v3 27/27] ASoC: soc-component: add snd_soc_component_device_link_{add/del}()
2026-11-25 1:41 [PATCH v3 00/27] ASoC: add new Component functions Kuninori Morimoto
` (25 preceding siblings ...)
2026-11-25 1:44 ` [PATCH v3 26/27] ASoC: soc-component: add snd_soc_component_active_update() Kuninori Morimoto
@ 2026-11-25 1:44 ` Kuninori Morimoto
26 siblings, 0 replies; 30+ messages in thread
From: Kuninori Morimoto @ 2026-11-25 1:44 UTC (permalink / raw)
To: Mark Brown; +Cc: linux-sound, Alvin Šipraga
struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.
This patch adds snd_soc_component_device_link_{add/del}() to handle
Component device_link.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
sound/soc/soc-card.c | 22 ++++------------------
sound/soc/soc-component.c | 28 ++++++++++++++++++++++++++++
sound/soc/soc-internal.h | 2 ++
3 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 6544dbf2ee260..079312216a3b2 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -884,12 +884,8 @@ static void snd_soc_remove_device_links(struct snd_soc_card *card)
{
struct snd_soc_component *component;
- for_each_card_components(card, component) {
- if (component->card_device_link) {
- device_link_del(component->card_device_link);
- component->card_device_link = NULL;
- }
- }
+ for_each_card_components(card, component)
+ snd_soc_component_device_link_del(component);
}
void snd_soc_card_unbind(struct snd_soc_card *card, bool reuse)
@@ -1043,18 +1039,8 @@ static int snd_soc_card_bind(struct snd_soc_card *card)
* If a driver pair already have a link in the opposite direction
* they must manage their own suspend order.
*/
- for_each_card_components(card, component) {
- if (card->dev == component->dev)
- continue;
-
- component->card_device_link = device_link_add(card->dev,
- component->dev,
- DL_FLAG_STATELESS);
- if (!component->card_device_link) {
- dev_warn(card->dev, "Could not create device link to %s\n",
- dev_name(component->dev));
- }
- }
+ for_each_card_components(card, component)
+ snd_soc_component_device_link_add(component);
ret = snd_soc_card_late_probe(card);
if (ret < 0)
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 5475938f80738..de3218bb2b2a8 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -122,6 +122,34 @@ void snd_soc_component_connect_dai(struct snd_soc_component *component, struct s
component->num_dai++;
}
+void snd_soc_component_device_link_del(struct snd_soc_component *component)
+{
+ if (component->card_device_link) {
+ device_link_del(component->card_device_link);
+ component->card_device_link = NULL;
+ }
+}
+
+int snd_soc_component_device_link_add(struct snd_soc_component *component)
+{
+ struct snd_soc_card *card = snd_soc_component_to_card(component);
+ struct device *card_dev = card->dev;
+ struct device *component_dev = snd_soc_component_to_dev(component);
+
+ if (card_dev == component_dev)
+ return 0;
+
+ component->card_device_link = device_link_add(card_dev, component_dev,
+ DL_FLAG_STATELESS);
+ if (!component->card_device_link) {
+ dev_warn(card_dev, "Could not create device link to %s\n",
+ dev_name(component_dev));
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
/*
* We might want to check substream by using list.
* In such case, we can update these macros.
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index 1190be669eae3..e713d13543b2d 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -71,6 +71,8 @@ int snd_soc_component_probe(struct snd_soc_component *component, struct snd_soc_
struct list_head *snd_soc_component_get_list_head(void);
void snd_soc_component_connect_dai(struct snd_soc_component *component, struct snd_soc_dai *dai);
void snd_soc_component_active_update(struct snd_soc_component *component, int action);
+void snd_soc_component_device_link_del(struct snd_soc_component *component);
+int snd_soc_component_device_link_add(struct snd_soc_component *component);
#define for_each_component(component) \
list_for_each_entry(component, snd_soc_component_get_list_head(), list)
--
2.53.0
^ permalink raw reply related [flat|nested] 30+ messages in thread