From 19a412b66df7cddbc1fa87e049c56bacf00adb27 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 20 Jan 2026 00:14:18 +0000 Subject: ASoC: soc-component: remove snd_soc_component_xxx() wrapper Now no one is using snd_soc_component_xxx() wrapper for dapm. Remove it. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87ms29qgx2.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'include') diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index d78cda866888..8b34958395ca 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -368,27 +368,6 @@ snd_soc_component_active(struct snd_soc_component *component) return component->active; } -/* component pin */ -int snd_soc_component_enable_pin(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_disable_pin(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_nc_pin(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_get_pin_status(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_force_enable_pin(struct snd_soc_component *component, - const char *pin); -int snd_soc_component_force_enable_pin_unlocked( - struct snd_soc_component *component, - const char *pin); - /* component controls */ struct snd_kcontrol *snd_soc_component_get_kcontrol(struct snd_soc_component *component, const char * const ctl); -- cgit v1.2.3 From d8b795f65217dd033daac5147eba6acb73a9a489 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 20 Jan 2026 00:14:27 +0000 Subject: ASoC: soc-component: remove compatibility definition for component All drivers uses new functions. Remove comaptibility definition. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87ldhtqgws.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 8b34958395ca..e538784746db 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -271,9 +271,6 @@ static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm( return &component->dapm; } -// FIXME -#define snd_soc_component_get_dapm snd_soc_component_to_dapm - /** * snd_soc_component_cache_sync() - Sync the register cache with the hardware * @component: COMPONENT to sync -- cgit v1.2.3 From 40ff409eacac686bda70ce7720d8b0e7c7401635 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 20 Jan 2026 00:14:36 +0000 Subject: ASoC: soc-dapm: remove compatibility definition for dapm All drivers uses new functions. Remove comaptibility definition. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87jyxdqgwk.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'include') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 75941324886b..7d3ba3826076 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -705,16 +705,6 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, co int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, const char *pin); void snd_soc_dapm_mark_endpoints_dirty(struct snd_soc_card *card); -/* - * Marks the specified pin as being not connected, disabling it along - * any parent or child widgets. At present this is identical to - * snd_soc_dapm_disable_pin[_unlocked]() but in future it will be extended to do - * additional things such as disabling controls which only affect - * paths through the pin. - */ -#define snd_soc_dapm_nc_pin snd_soc_dapm_disable_pin -#define snd_soc_dapm_nc_pin_unlocked snd_soc_dapm_disable_pin_unlocked - /* dapm path query */ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, struct snd_soc_dapm_widget_list **list, @@ -730,15 +720,6 @@ int snd_soc_dapm_force_bias_level(struct snd_soc_dapm_context *dapm, enum snd_so enum snd_soc_bias_level snd_soc_dapm_get_bias_level(struct snd_soc_dapm_context *dapm); void snd_soc_dapm_init_bias_level(struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level); -// REMOVE ME !! -#define snd_soc_component_force_bias_level(c, l) snd_soc_dapm_force_bias_level(&(c)->dapm, l) -#define snd_soc_component_get_bias_level(c) snd_soc_dapm_get_bias_level(&(c)->dapm) -#define snd_soc_component_init_bias_level(c, l) snd_soc_dapm_init_bias_level(&(c)->dapm, l) -#define snd_soc_dapm_kcontrol_widget snd_soc_dapm_kcontrol_to_widget -#define snd_soc_dapm_kcontrol_dapm snd_soc_dapm_kcontrol_to_dapm -#define dapm_kcontrol_get_value snd_soc_dapm_kcontrol_get_value -#define snd_soc_dapm_kcontrol_component snd_soc_dapm_kcontrol_to_component - #define for_each_dapm_widgets(list, i, widget) \ for ((i) = 0; \ (i) < list->num_widgets && (widget = list->widgets[i]); \ -- cgit v1.2.3 From cf0e8c555b34b0ea3d2a41edf6dc214239a71c80 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 20 Jan 2026 00:14:46 +0000 Subject: ASoC: soc-dapm: remove dev from snd_soc_dapm_context() We can get dev via snd_soc_dapm_to_dev(). Remove it. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87ikcxqgw9.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 1 - sound/soc/soc-dapm.c | 6 +----- 2 files changed, 1 insertion(+), 6 deletions(-) (limited to 'include') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 7d3ba3826076..010d63db5436 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -585,7 +585,6 @@ struct snd_soc_dapm_context { bool idle_bias; /* Use BIAS_OFF instead of STANDBY when false */ - struct device *dev; /* from parent - for debug */ /* REMOVE ME */ struct snd_soc_component *component; /* parent component */ struct snd_soc_card *card; /* parent card */ diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 4d920a59da3c..4c2007c61ca1 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -4862,12 +4862,8 @@ void snd_soc_dapm_init(struct snd_soc_dapm_context *dapm, dapm->component = component; dapm->bias_level = SND_SOC_BIAS_OFF; - if (component) { - dapm->dev = component->dev; + if (component) dapm->idle_bias = component->driver->idle_bias_on; - } else { - dapm->dev = card->dev; - } INIT_LIST_HEAD(&dapm->list); /* see for_each_card_dapms */ -- cgit v1.2.3 From 13c84b4c6f218c196c9c72286645247996800427 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 20 Jan 2026 00:14:54 +0000 Subject: ASoC: soc-dapm: add snd_soc_dapm_alloc() Because struct snd_soc_dapm_context is soc-dapm framework specific, user driver don't need to access its member directly, we would like to hide them. struct snd_soc_dapm_context will be removed from header in the future. Current card/component are using dapm_context instance. But it will be moved to soc-dapm.c, and we can use will be only pointer. Makes it to pointer. Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87h5shqgw1.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-component.h | 5 ++--- include/sound/soc-dapm.h | 2 ++ include/sound/soc.h | 4 ++-- sound/soc/soc-core.c | 8 ++++++++ sound/soc/soc-dapm.c | 7 ++++++- 5 files changed, 20 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index e538784746db..2a2b74b24a60 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -237,8 +237,7 @@ struct snd_soc_component { * the driver will be marked as BROKEN when these fields are removed. */ - /* Don't use these, use snd_soc_component_get_dapm() */ - struct snd_soc_dapm_context dapm; + struct snd_soc_dapm_context *dapm; /* machine specific init */ int (*init)(struct snd_soc_component *component); @@ -268,7 +267,7 @@ struct snd_soc_component { static inline struct snd_soc_dapm_context *snd_soc_component_to_dapm( struct snd_soc_component *component) { - return &component->dapm; + return component->dapm; } /** diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 010d63db5436..6f3e1b57cda3 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -627,6 +627,8 @@ enum snd_soc_dapm_direction { #define SND_SOC_DAPM_EP_SOURCE SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_IN) #define SND_SOC_DAPM_EP_SINK SND_SOC_DAPM_DIR_TO_EP(SND_SOC_DAPM_DIR_OUT) +struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev); + int snd_soc_dapm_regulator_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); int snd_soc_dapm_clock_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); int snd_soc_dapm_pinctrl_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); diff --git a/include/sound/soc.h b/include/sound/soc.h index aa0fe6b80293..7d8376c8e1be 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1076,7 +1076,7 @@ struct snd_soc_card { struct list_head dobj_list; /* Generic DAPM context for the card */ - struct snd_soc_dapm_context dapm; + struct snd_soc_dapm_context *dapm; struct snd_soc_dapm_stats dapm_stats; #ifdef CONFIG_DEBUG_FS @@ -1136,7 +1136,7 @@ static inline int snd_soc_card_is_instantiated(struct snd_soc_card *card) static inline struct snd_soc_dapm_context *snd_soc_card_to_dapm(struct snd_soc_card *card) { - return &card->dapm; + return card->dapm; } /* SoC machine DAI configuration, glues a codec and cpu DAI together */ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e4b21bf39e59..355ccc95f28b 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2556,6 +2556,10 @@ int snd_soc_register_card(struct snd_soc_card *card) if (!card->name || !card->dev) return -EINVAL; + card->dapm = snd_soc_dapm_alloc(card->dev); + if (!card->dapm) + return -ENOMEM; + dev_set_drvdata(card->dev, card); INIT_LIST_HEAD(&card->widgets); @@ -2840,6 +2844,10 @@ int snd_soc_component_initialize(struct snd_soc_component *component, const struct snd_soc_component_driver *driver, struct device *dev) { + component->dapm = snd_soc_dapm_alloc(dev); + if (!component->dapm) + return -ENOMEM; + INIT_LIST_HEAD(&component->dai_list); INIT_LIST_HEAD(&component->dobj_list); INIT_LIST_HEAD(&component->card_list); diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 4c2007c61ca1..7aef57dcb2a7 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -165,6 +165,11 @@ static void pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...) kfree(buf); } +struct snd_soc_dapm_context *snd_soc_dapm_alloc(struct device *dev) +{ + return devm_kzalloc(dev, sizeof(struct snd_soc_dapm_context), GFP_KERNEL); +} + struct device *snd_soc_dapm_to_dev(struct snd_soc_dapm_context *dapm) { if (dapm->component) @@ -1076,7 +1081,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm, if (ret != 0) goto out; - if (dapm != &card->dapm) + if (dapm != card->dapm) ret = snd_soc_dapm_force_bias_level(dapm, level); if (ret != 0) -- cgit v1.2.3 From 5b517f1a5cace3cba9a48491706e330848ecef86 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 20 Jan 2026 00:15:01 +0000 Subject: ASoC: soc-dapm: move struct snd_soc_dapm_context All drivers are now using new dapm functions. Move struct snd_soc_dapm_context to soc-dapm.c Suggested-by: Cezary Rojewski Link: https://lore.kernel.org/r/87o6x69h4y.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto Link: https://patch.msgid.link/87fr81qgvu.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown --- include/sound/soc-dapm.h | 22 +--------------------- sound/soc/soc-dapm.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'include') diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 6f3e1b57cda3..49f0fe05db01 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h @@ -20,6 +20,7 @@ struct regulator; struct soc_enum; struct snd_pcm_substream; struct snd_soc_pcm_runtime; +struct snd_soc_dapm_context; /* widget has no PM register bit */ #define SND_SOC_NOPM -1 @@ -579,27 +580,6 @@ struct snd_soc_dapm_update { bool has_second_set; }; -/* DAPM context */ -struct snd_soc_dapm_context { - enum snd_soc_bias_level bias_level; - - bool idle_bias; /* Use BIAS_OFF instead of STANDBY when false */ - - struct snd_soc_component *component; /* parent component */ - struct snd_soc_card *card; /* parent card */ - - /* used during DAPM updates */ - enum snd_soc_bias_level target_bias_level; - struct list_head list; - - struct snd_soc_dapm_widget *wcache_sink; - struct snd_soc_dapm_widget *wcache_source; - -#ifdef CONFIG_DEBUG_FS - struct dentry *debugfs_dapm; -#endif -}; - /* A list of widgets associated with an object, typically a snd_kcontrol */ struct snd_soc_dapm_widget_list { int num_widgets; diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7aef57dcb2a7..07370215ea7c 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -40,6 +40,27 @@ #include +/* DAPM context */ +struct snd_soc_dapm_context { + enum snd_soc_bias_level bias_level; + + bool idle_bias; /* Use BIAS_OFF instead of STANDBY when false */ + + struct snd_soc_component *component; /* parent component */ + struct snd_soc_card *card; /* parent card */ + + /* used during DAPM updates */ + enum snd_soc_bias_level target_bias_level; + struct list_head list; + + struct snd_soc_dapm_widget *wcache_sink; + struct snd_soc_dapm_widget *wcache_source; + +#ifdef CONFIG_DEBUG_FS + struct dentry *debugfs_dapm; +#endif +}; + #define DAPM_UPDATE_STAT(widget, val) widget->dapm->card->dapm_stats.val++; #define SND_SOC_DAPM_DIR_REVERSE(x) ((x == SND_SOC_DAPM_DIR_IN) ? \ -- cgit v1.2.3