diff options
| author | Mark Brown <broonie@kernel.org> | 2026-01-28 00:37:54 +0000 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-01-28 00:37:54 +0000 |
| commit | b4ee17729a11f13fbb15cd1fb54549642cd1c44c (patch) | |
| tree | 80686e8b69bfcc821af5945c14ad5514ab537043 | |
| parent | 1924bd68a0c06f9f2c06cf35e60dfc55cdc34a91 (diff) | |
| parent | af6d53db28e6448b1e0ce9aa314bc5da494d35ab (diff) | |
ASoC: capsuling struct snd_soc_dapm_context
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Now, all DAPM users are using function to handling it.
We can capsuling it. This patchset moves struct snd_soc_dapm_context into
soc-dapm.c, and remove un-used functions.
Link: https://lore.kernel.org/r/87zf7jrx52.wl-kuninori.morimoto.gx@renesas.com
| -rw-r--r-- | include/sound/soc-component.h | 29 | ||||
| -rw-r--r-- | include/sound/soc-dapm.h | 44 | ||||
| -rw-r--r-- | include/sound/soc.h | 4 | ||||
| -rw-r--r-- | sound/soc/codecs/tlv320adcx140.c | 4 | ||||
| -rw-r--r-- | sound/soc/soc-component.c | 82 | ||||
| -rw-r--r-- | sound/soc/soc-core.c | 8 | ||||
| -rw-r--r-- | sound/soc/soc-dapm.c | 352 |
7 files changed, 202 insertions, 321 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index d78cda866888..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,12 +267,9 @@ 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; } -// 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 @@ -368,27 +364,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); diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index 75941324886b..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,28 +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 device *dev; /* from parent - for debug */ /* REMOVE ME */ - 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; @@ -628,6 +607,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); @@ -705,16 +686,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 +701,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]); \ 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/codecs/tlv320adcx140.c b/sound/soc/codecs/tlv320adcx140.c index ac6aab8d7224..e4f27a734501 100644 --- a/sound/soc/codecs/tlv320adcx140.c +++ b/sound/soc/codecs/tlv320adcx140.c @@ -1188,8 +1188,8 @@ static int adcx140_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { struct adcx140_priv *adcx140 = snd_soc_component_get_drvdata(component); - enum snd_soc_bias_level prev_level - = snd_soc_component_get_bias_level(component); + struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); + enum snd_soc_bias_level prev_level = snd_soc_dapm_get_bias_level(dapm); switch (level) { case SND_SOC_BIAS_ON: diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index c815fd1b3fd1..89f236ab3034 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -142,88 +142,6 @@ int snd_soc_component_set_bias_level(struct snd_soc_component *component, return soc_component_ret(component, ret); } -int snd_soc_component_enable_pin(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_enable_pin(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin); - -int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_enable_pin_unlocked(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked); - -int snd_soc_component_disable_pin(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_disable_pin(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin); - -int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_disable_pin_unlocked(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked); - -int snd_soc_component_nc_pin(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_nc_pin(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin); - -int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_nc_pin_unlocked(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked); - -int snd_soc_component_get_pin_status(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_get_pin_status(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status); - -int snd_soc_component_force_enable_pin(struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_force_enable_pin(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin); - -int snd_soc_component_force_enable_pin_unlocked( - struct snd_soc_component *component, - const char *pin) -{ - struct snd_soc_dapm_context *dapm = - snd_soc_component_get_dapm(component); - return snd_soc_dapm_force_enable_pin_unlocked(dapm, pin); -} -EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked); - static void soc_get_kcontrol_name(struct snd_soc_component *component, char *buf, int size, const char * const ctl) { 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 4d920a59da3c..c23ccf4a602d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -40,12 +40,33 @@ #include <trace/events/asoc.h> +/* 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) ? \ +#define DAPM_DIR_REVERSE(x) ((x == SND_SOC_DAPM_DIR_IN) ? \ SND_SOC_DAPM_DIR_OUT : SND_SOC_DAPM_DIR_IN) -#define snd_soc_dapm_for_each_direction(dir) \ +#define dapm_for_each_direction(dir) \ for ((dir) = SND_SOC_DAPM_DIR_IN; (dir) <= SND_SOC_DAPM_DIR_OUT; \ (dir)++) @@ -138,14 +159,14 @@ static void dapm_assert_locked(struct snd_soc_dapm_context *dapm) snd_soc_dapm_mutex_assert_held(dapm); } -static void pop_wait(u32 pop_time) +static void dapm_pop_wait(u32 pop_time) { if (pop_time) schedule_timeout_uninterruptible(msecs_to_jiffies(pop_time)); } __printf(3, 4) -static void pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...) +static void dapm_pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...) { va_list args; char *buf; @@ -165,6 +186,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) @@ -214,7 +240,7 @@ static void dapm_mark_dirty(struct snd_soc_dapm_widget *w, const char *reason) static __always_inline void dapm_widget_invalidate_paths( struct snd_soc_dapm_widget *w, enum snd_soc_dapm_direction dir) { - enum snd_soc_dapm_direction rdir = SND_SOC_DAPM_DIR_REVERSE(dir); + enum snd_soc_dapm_direction rdir = DAPM_DIR_REVERSE(dir); struct snd_soc_dapm_widget *node; struct snd_soc_dapm_path *p; LIST_HEAD(list); @@ -361,7 +387,7 @@ struct dapm_kcontrol_data { struct snd_soc_dapm_widget_list *wlist; }; -static unsigned int soc_dapm_read(struct snd_soc_dapm_context *dapm, int reg) +static unsigned int dapm_read(struct snd_soc_dapm_context *dapm, int reg) { if (!dapm->component) return -EIO; @@ -381,7 +407,7 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_path *p, int i, unsigned int shift = mc->shift; unsigned int max = mc->max; unsigned int mask = (1 << fls(max)) - 1; - unsigned int val = soc_dapm_read(p->sink->dapm, reg); + unsigned int val = dapm_read(p->sink->dapm, reg); /* * The nth_path argument allows this function to know @@ -397,7 +423,7 @@ static void dapm_set_mixer_path_status(struct snd_soc_dapm_path *p, int i, */ if (snd_soc_volsw_is_stereo(mc) && nth_path > 0) { if (reg != mc->rreg) - val = soc_dapm_read(p->sink->dapm, mc->rreg); + val = dapm_read(p->sink->dapm, mc->rreg); val = (val >> mc->rshift) & mask; } else { val = (val >> shift) & mask; @@ -429,7 +455,7 @@ static int dapm_connect_mux(struct snd_soc_dapm_context *dapm, if (e->reg != SND_SOC_NOPM) { unsigned int val; - val = soc_dapm_read(dapm, e->reg); + val = dapm_read(dapm, e->reg); val = (val >> e->shift_l) & e->mask; item = snd_soc_enum_val_to_item(e, val); } else { @@ -517,7 +543,7 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w) break; case snd_soc_dapm_line: ep = 0; - snd_soc_dapm_for_each_direction(dir) { + dapm_for_each_direction(dir) { if (!list_empty(&w->edges[dir])) ep |= SND_SOC_DAPM_DIR_TO_EP(dir); } @@ -529,7 +555,7 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w) w->is_ep = ep; } -static int snd_soc_dapm_check_dynamic_path( +static int dapm_check_dynamic_path( struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_widget *source, struct snd_soc_dapm_widget *sink, const char *control) @@ -575,7 +601,7 @@ static int snd_soc_dapm_check_dynamic_path( return 0; } -static int snd_soc_dapm_add_path( +static int dapm_add_path( struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_widget *wsource, struct snd_soc_dapm_widget *wsink, const char *control, @@ -608,7 +634,7 @@ static int snd_soc_dapm_add_path( return -EINVAL; } - ret = snd_soc_dapm_check_dynamic_path(dapm, wsource, wsink, control); + ret = dapm_check_dynamic_path(dapm, wsource, wsink, control); if (ret) return ret; @@ -660,10 +686,10 @@ static int snd_soc_dapm_add_path( list_add(&path->list, &dapm->card->paths); - snd_soc_dapm_for_each_direction(dir) + dapm_for_each_direction(dir) list_add(&path->list_node[dir], &path->node[dir]->edges[dir]); - snd_soc_dapm_for_each_direction(dir) { + dapm_for_each_direction(dir) { dapm_update_widget_flags(path->node[dir]); dapm_mark_dirty(path->node[dir], "Route added"); } @@ -771,10 +797,10 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget, goto err_data; } - snd_soc_dapm_add_path(widget->dapm, data->widget, - widget, NULL, NULL); + dapm_add_path(widget->dapm, data->widget, + widget, NULL, NULL); } else if (e->reg != SND_SOC_NOPM) { - data->value = soc_dapm_read(widget->dapm, e->reg) & + data->value = dapm_read(widget->dapm, e->reg) & (e->mask << e->shift_l); } break; @@ -954,14 +980,14 @@ static void dapm_reset(struct snd_soc_card *card) } } -static const char *soc_dapm_prefix(struct snd_soc_dapm_context *dapm) +static const char *dapm_prefix(struct snd_soc_dapm_context *dapm) { if (!dapm->component) return NULL; return dapm->component->name_prefix; } -static int soc_dapm_update_bits(struct snd_soc_dapm_context *dapm, +static int dapm_update_bits(struct snd_soc_dapm_context *dapm, int reg, unsigned int mask, unsigned int value) { if (!dapm->component) @@ -970,7 +996,7 @@ static int soc_dapm_update_bits(struct snd_soc_dapm_context *dapm, mask, value); } -static int soc_dapm_test_bits(struct snd_soc_dapm_context *dapm, +static int dapm_test_bits(struct snd_soc_dapm_context *dapm, int reg, unsigned int mask, unsigned int value) { if (!dapm->component) @@ -978,7 +1004,7 @@ static int soc_dapm_test_bits(struct snd_soc_dapm_context *dapm, return snd_soc_component_test_bits(dapm->component, reg, mask, value); } -static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm) +static void dapm_async_complete(struct snd_soc_dapm_context *dapm) { if (dapm->component) snd_soc_component_async_complete(dapm->component); @@ -1076,7 +1102,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) @@ -1149,7 +1175,7 @@ static int dapm_create_or_share_kcontrol(struct snd_soc_dapm_widget *w, const char *name; int ret = 0; - prefix = soc_dapm_prefix(dapm); + prefix = dapm_prefix(dapm); if (prefix) prefix_len = strlen(prefix) + 1; else @@ -1269,10 +1295,10 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w) data = snd_kcontrol_chip(w->kcontrols[i]); if (data->widget) - snd_soc_dapm_add_path(data->widget->dapm, - data->widget, - path->source, - NULL, NULL); + dapm_add_path(data->widget->dapm, + data->widget, + path->source, + NULL, NULL); } } @@ -1376,7 +1402,7 @@ static int dapm_new_dai_link(struct snd_soc_dapm_widget *w) * the ALSA card - when we are suspending the ALSA state for the card * is set to D3. */ -static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget) +static int dapm_suspend_check(struct snd_soc_dapm_widget *widget) { struct device *dev = snd_soc_dapm_to_dev(widget->dapm); int level = snd_power_get_state(widget->dapm->card->snd_card); @@ -1428,10 +1454,10 @@ static int dapm_widget_list_create(struct snd_soc_dapm_widget_list **list, * widget and all widgets that can be reached via incoming or outcoming paths * from the widget. */ -static void invalidate_paths_ep(struct snd_soc_dapm_widget *widget, +static void dapm_invalidate_paths_ep(struct snd_soc_dapm_widget *widget, enum snd_soc_dapm_direction dir) { - enum snd_soc_dapm_direction rdir = SND_SOC_DAPM_DIR_REVERSE(dir); + enum snd_soc_dapm_direction rdir = DAPM_DIR_REVERSE(dir); struct snd_soc_dapm_path *path; widget->endpoints[dir] = -1; @@ -1445,7 +1471,7 @@ static void invalidate_paths_ep(struct snd_soc_dapm_widget *widget, if (path->connect) { path->walking = 1; - invalidate_paths_ep(path->node[dir], dir); + dapm_invalidate_paths_ep(path->node[dir], dir); path->walking = 0; } } @@ -1458,7 +1484,7 @@ static void invalidate_paths_ep(struct snd_soc_dapm_widget *widget, * generic function and at the same time the fast path of the specialized * functions is significantly smaller than the generic function. */ -static __always_inline int is_connected_ep(struct snd_soc_dapm_widget *widget, +static __always_inline int dapm_is_connected_ep(struct snd_soc_dapm_widget *widget, struct list_head *list, enum snd_soc_dapm_direction dir, int (*fn)(struct snd_soc_dapm_widget *, struct list_head *, bool (*custom_stop_condition)(struct snd_soc_dapm_widget *, @@ -1466,7 +1492,7 @@ static __always_inline int is_connected_ep(struct snd_soc_dapm_widget *widget, bool (*custom_stop_condition)(struct snd_soc_dapm_widget *, enum snd_soc_dapm_direction)) { - enum snd_soc_dapm_direction rdir = SND_SOC_DAPM_DIR_REVERSE(dir); + enum snd_soc_dapm_direction rdir = DAPM_DIR_REVERSE(dir); struct snd_soc_dapm_path *path; int con = 0; @@ -1485,7 +1511,7 @@ static __always_inline int is_connected_ep(struct snd_soc_dapm_widget *widget, } if ((widget->is_ep & SND_SOC_DAPM_DIR_TO_EP(dir)) && widget->connected) { - widget->endpoints[dir] = snd_soc_dapm_suspend_check(widget); + widget->endpoints[dir] = dapm_suspend_check(widget); return widget->endpoints[dir]; } @@ -1521,13 +1547,13 @@ static __always_inline int is_connected_ep(struct snd_soc_dapm_widget *widget, * direction as an arguments, it should return true if widgets from that point * in the graph onwards should not be added to the widget list. */ -static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, +static int dapm_is_connected_output_ep(struct snd_soc_dapm_widget *widget, struct list_head *list, bool (*custom_stop_condition)(struct snd_soc_dapm_widget *i, enum snd_soc_dapm_direction)) { - return is_connected_ep(widget, list, SND_SOC_DAPM_DIR_OUT, - is_connected_output_ep, custom_stop_condition); + return dapm_is_connected_ep(widget, list, SND_SOC_DAPM_DIR_OUT, + dapm_is_connected_output_ep, custom_stop_condition); } /* @@ -1539,13 +1565,13 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget, * direction as an arguments, it should return true if the walk should be * stopped and false otherwise. */ -static int is_connected_input_ep(struct snd_soc_dapm_widget *widget, +static int dapm_is_connected_input_ep(struct snd_soc_dapm_widget *widget, struct list_head *list, bool (*custom_stop_condition)(struct snd_soc_dapm_widget *i, enum snd_soc_dapm_direction)) { - return is_connected_ep(widget, list, SND_SOC_DAPM_DIR_IN, - is_connected_input_ep, custom_stop_condition); + return dapm_is_connected_ep(widget, list, SND_SOC_DAPM_DIR_IN, + dapm_is_connected_input_ep, custom_stop_condition); } /** @@ -1581,12 +1607,12 @@ int snd_soc_dapm_dai_get_connected_widgets(struct snd_soc_dai *dai, int stream, snd_soc_dapm_mutex_lock(card); if (stream == SNDRV_PCM_STREAM_PLAYBACK) { - invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT); - paths = is_connected_output_ep(w, &widgets, + dapm_invalidate_paths_ep(w, SND_SOC_DAPM_DIR_OUT); + paths = dapm_is_connected_output_ep(w, &widgets, custom_stop_condition); } else { - invalidate_paths_ep(w, SND_SOC_DAPM_DIR_IN); - paths = is_connected_input_ep(w, &widgets, + dapm_invalidate_paths_ep(w, SND_SOC_DAPM_DIR_IN); + paths = dapm_is_connected_input_ep(w, &widgets, custom_stop_condition); } @@ -1619,7 +1645,7 @@ int snd_soc_dapm_regulator_event(struct snd_soc_dapm_widget *w, struct device *dev = snd_soc_dapm_to_dev(w->dapm); int ret; - soc_dapm_async_complete(w->dapm); + dapm_async_complete(w->dapm); if (SND_SOC_DAPM_EVENT_ON(event)) { if (w->on_val & SND_SOC_DAPM_REGULATOR_BYPASS) { @@ -1679,7 +1705,7 @@ int snd_soc_dapm_clock_event(struct snd_soc_dapm_widget *w, if (!w->clk) return -EIO; - soc_dapm_async_complete(w->dapm); + dapm_async_complete(w->dapm); if (SND_SOC_DAPM_EVENT_ON(event)) { return clk_prepare_enable(w->clk); @@ -1714,8 +1740,8 @@ static int dapm_generic_check_power(struct snd_soc_dapm_widget *w) DAPM_UPDATE_STAT(w, power_checks); - in = is_connected_input_ep(w, NULL, NULL); - out = is_connected_output_ep(w, NULL, NULL); + in = dapm_is_connected_input_ep(w, NULL, NULL); + out = dapm_is_connected_output_ep(w, NULL, NULL); return out != 0 && in != 0; } @@ -1838,9 +1864,9 @@ static void dapm_seq_check_event(struct snd_soc_card *card, if (w->event && (w->event_flags & event)) { int ret; - pop_dbg(dev, card->pop_time, "pop test : %s %s\n", + dapm_pop_dbg(dev, card->pop_time, "pop test : %s %s\n", w->name, ev_name); - soc_dapm_async_complete(w->dapm); + dapm_async_complete(w->dapm); trace_snd_soc_dapm_widget_event_start(w, event); ret = w->event(w, NULL, event); trace_snd_soc_dapm_widget_event_done(w, event); @@ -1875,7 +1901,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card, else value |= w->off_val << w->shift; - pop_dbg(dev, card->pop_time, + dapm_pop_dbg(dev, card->pop_time, "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", w->name, reg, value, mask); @@ -1889,11 +1915,11 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card, * same register. */ - pop_dbg(dev, card->pop_time, + dapm_pop_dbg(dev, card->pop_time, "pop test : Applying 0x%x/0x%x to %x in %dms\n", value, mask, reg, card->pop_time); - pop_wait(card->pop_time); - soc_dapm_update_bits(dapm, reg, mask, value); + dapm_pop_wait(card->pop_time); + dapm_update_bits(dapm, reg, mask, value); } list_for_each_entry(w, pending, power_list) { @@ -1947,7 +1973,7 @@ static void dapm_seq_run(struct snd_soc_card *card, } if (cur_dapm && w->dapm != cur_dapm) - soc_dapm_async_complete(cur_dapm); + dapm_async_complete(cur_dapm); INIT_LIST_HEAD(&pending); cur_sort = -1; @@ -2008,7 +2034,7 @@ static void dapm_seq_run(struct snd_soc_card *card, } for_each_card_dapms(card, d) - soc_dapm_async_complete(d); + dapm_async_complete(d); } static void dapm_widget_update(struct snd_soc_card *card, struct snd_soc_dapm_update *update) @@ -2036,14 +2062,14 @@ static void dapm_widget_update(struct snd_soc_card *card, struct snd_soc_dapm_up if (!w) return; - ret = soc_dapm_update_bits(w->dapm, update->reg, update->mask, + ret = dapm_update_bits(w->dapm, update->reg, update->mask, update->val); if (ret < 0) dev_err(dev, "ASoC: %s DAPM update failed: %d\n", w->name, ret); if (update->has_second_set) { - ret = soc_dapm_update_bits(w->dapm, update->reg2, + ret = dapm_update_bits(w->dapm, update->reg2, update->mask2, update->val2); if (ret < 0) dev_err(dev, @@ -2358,9 +2384,9 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event, return ret; } - pop_dbg(card->dev, card->pop_time, + dapm_pop_dbg(card->dev, card->pop_time, "DAPM sequencing finished, waiting %dms\n", card->pop_time); - pop_wait(card->pop_time); + dapm_pop_wait(card->pop_time); trace_snd_soc_dapm_done(card, event); @@ -2369,7 +2395,7 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event, #ifdef CONFIG_DEBUG_FS -static const char * const snd_soc_dapm_type_name[] = { +static const char * const dapm_type_name[] = { [snd_soc_dapm_input] = "input", [snd_soc_dapm_output] = "output", [snd_soc_dapm_mux] = "mux", @@ -2422,7 +2448,7 @@ static ssize_t dapm_widget_power_read_file(struct file *file, struct snd_soc_dapm_path *p = NULL; const char *c_name; - BUILD_BUG_ON(ARRAY_SIZE(snd_soc_dapm_type_name) != SND_SOC_DAPM_TYPE_COUNT); + BUILD_BUG_ON(ARRAY_SIZE(dapm_type_name) != SND_SOC_DAPM_TYPE_COUNT); buf = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!buf) @@ -2430,13 +2456,13 @@ static ssize_t dapm_widget_power_read_file(struct file *file, snd_soc_dapm_mutex_lock_root(w->dapm); - /* Supply widgets are not handled by is_connected_{input,output}_ep() */ + /* Supply widgets are not handled by dapm_is_connected_{input,output}_ep() */ if (w->is_supply) { in = 0; out = 0; } else { - in = is_connected_input_ep(w, NULL, NULL); - out = is_connected_output_ep(w, NULL, NULL); + in = dapm_is_connected_input_ep(w, NULL, NULL); + out = dapm_is_connected_output_ep(w, NULL, NULL); } ret = scnprintf(buf, PAGE_SIZE, "%s: %s%s in %d out %d", @@ -2456,10 +2482,10 @@ static ssize_t dapm_widget_power_read_file(struct file *file, w->active ? "active" : "inactive"); ret += scnprintf(buf + ret, PAGE_SIZE - ret, " widget-type %s\n", - snd_soc_dapm_type_name[w->id]); + dapm_type_name[w->id]); - snd_soc_dapm_for_each_direction(dir) { - rdir = SND_SOC_DAPM_DIR_REVERSE(dir); + dapm_for_each_direction(dir) { + rdir = DAPM_DIR_REVERSE(dir); snd_soc_dapm_widget_for_each_path(w, dir, p) { if (p->connected && !p->connected(p->source, p->sink)) continue; @@ -2586,13 +2612,13 @@ static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) #endif /* - * soc_dapm_connect_path() - Connects or disconnects a path + * dapm_connect_path() - Connects or disconnects a path * @path: The path to update * @connect: The new connect state of the path. True if the path is connected, * false if it is disconnected. * @reason: The reason why the path changed (for debugging only) */ -static void soc_dapm_connect_path(struct snd_soc_dapm_path *path, +static void dapm_connect_path(struct snd_soc_dapm_path *path, bool connect, const char *reason) { if (path->connect == connect) @@ -2605,10 +2631,10 @@ static void soc_dapm_connect_path(struct snd_soc_dapm_path *path, } /* test and update the power status of a mux widget */ -static int soc_dapm_mux_update_power(struct snd_soc_card *card, - struct snd_kcontrol *kcontrol, - struct snd_soc_dapm_update *update, - int mux, struct soc_enum *e) +static int dapm_mux_update_power(struct snd_soc_card *card, + struct snd_kcontrol *kcontrol, + struct snd_soc_dapm_update *update, + int mux, struct soc_enum *e) { struct snd_soc_dapm_path *path; int found = 0; @@ -2625,7 +2651,7 @@ static int soc_dapm_mux_update_power(struct snd_soc_card *card, else connect = false; - soc_dapm_connect_path(path, connect, "mux update"); + dapm_connect_path(path, connect, "mux update"); } if (found) @@ -2642,7 +2668,7 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, int ret; snd_soc_dapm_mutex_lock(card); - ret = soc_dapm_mux_update_power(card, kcontrol, update, mux, e); + ret = dapm_mux_update_power(card, kcontrol, update, mux, e); snd_soc_dapm_mutex_unlock(card); if (ret > 0) snd_soc_dpcm_runtime_update(card); @@ -2651,10 +2677,10 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm, EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power); /* test and update the power status of a mixer or switch widget */ -static int soc_dapm_mixer_update_power(struct snd_soc_card *card, - struct snd_kcontrol *kcontrol, - struct snd_soc_dapm_update *update, - int connect, int rconnect) +static int dapm_mixer_update_power(struct snd_soc_card *card, + struct snd_kcontrol *kcontrol, + struct snd_soc_dapm_update *update, + int connect, int rconnect) { struct snd_soc_dapm_path *path; int found = 0; @@ -2686,9 +2712,9 @@ static int soc_dapm_mixer_update_power(struct snd_soc_card *card, * channel. */ if (found && rconnect >= 0) - soc_dapm_connect_path(path, rconnect, "mixer update"); + dapm_connect_path(path, rconnect, "mixer update"); else - soc_dapm_connect_path(path, connect, "mixer update"); + dapm_connect_path(path, connect, "mixer update"); found = 1; } @@ -2706,7 +2732,7 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm, int ret; snd_soc_dapm_mutex_lock(card); - ret = soc_dapm_mixer_update_power(card, kcontrol, update, connect, -1); + ret = dapm_mixer_update_power(card, kcontrol, update, connect, -1); snd_soc_dapm_mutex_unlock(card); if (ret > 0) snd_soc_dpcm_runtime_update(card); @@ -2836,7 +2862,7 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w) * While removing the path, remove reference to it from both * source and sink widgets so that path is removed only once. */ - snd_soc_dapm_for_each_direction(dir) { + dapm_for_each_direction(dir) { snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p) dapm_free_path(p); } @@ -2873,7 +2899,7 @@ static struct snd_soc_dapm_widget *dapm_find_widget( struct snd_soc_dapm_widget *fallback = NULL; char prefixed_pin[80]; const char *pin_name; - const char *prefix = soc_dapm_prefix(dapm); + const char *prefix = dapm_prefix(dapm); if (prefix) { snprintf(prefixed_pin, sizeof(prefixed_pin), "%s %s", @@ -2903,8 +2929,8 @@ static struct snd_soc_dapm_widget *dapm_find_widget( * returns 1 when the value has been updated, 0 when unchanged, or a negative * error code; called from kcontrol put callback */ -static int __snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, - const char *pin, int status) +static int __dapm_set_pin(struct snd_soc_dapm_context *dapm, + const char *pin, int status) { struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); struct device *dev = snd_soc_dapm_to_dev(dapm); @@ -2932,13 +2958,13 @@ static int __snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, } /* - * similar as __snd_soc_dapm_set_pin(), but returns 0 when successful; + * similar as __dapm_set_pin(), but returns 0 when successful; * called from several API functions below */ -static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm, +static int dapm_set_pin(struct snd_soc_dapm_context *dapm, const char *pin, int status) { - int ret = __snd_soc_dapm_set_pin(dapm, pin, status); + int ret = __dapm_set_pin(dapm, pin, status); return ret < 0 ? ret : 0; } @@ -3006,9 +3032,9 @@ static int dapm_update_dai_chan(struct snd_soc_dapm_path *p, p->source->name, p->sink->name); if (w->channel < channels) - soc_dapm_connect_path(p, true, "dai update"); + dapm_connect_path(p, true, "dai update"); else - soc_dapm_connect_path(p, false, "dai update"); + dapm_connect_path(p, false, "dai update"); return 0; } @@ -3086,7 +3112,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm, unsigned int source_ref = 0; int ret; - prefix = soc_dapm_prefix(dapm); + prefix = dapm_prefix(dapm); if (prefix) { snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s", prefix, route->sink); @@ -3155,7 +3181,7 @@ skip_search: dapm->wcache_sink = wsink; dapm->wcache_source = wsource; - ret = snd_soc_dapm_add_path(dapm, wsource, wsink, route->control, + ret = dapm_add_path(dapm, wsource, wsink, route->control, route->connected); err: if (ret) @@ -3185,7 +3211,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm, return -EINVAL; } - prefix = soc_dapm_prefix(dapm); + prefix = dapm_prefix(dapm); if (prefix) { snprintf(prefixed_sink, sizeof(prefixed_sink), "%s %s", prefix, route->sink); @@ -3339,7 +3365,7 @@ int snd_soc_dapm_new_widgets(struct snd_soc_card *card) /* Read the initial power state from the device */ if (w->reg >= 0) { - val = soc_dapm_read(w->dapm, w->reg); + val = dapm_read(w->dapm, w->reg); val = val >> w->shift; val &= w->mask; if (val == w->on_val) @@ -3383,11 +3409,11 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol, snd_soc_dapm_mutex_lock(dapm); if (dapm_kcontrol_is_powered(kcontrol) && reg != SND_SOC_NOPM) { - reg_val = soc_dapm_read(dapm, reg); + reg_val = dapm_read(dapm, reg); val = (reg_val >> shift) & mask; if (reg != mc->rreg) - reg_val = soc_dapm_read(dapm, mc->rreg); + reg_val = dapm_read(dapm, mc->rreg); if (snd_soc_volsw_is_stereo(mc)) rval = (reg_val >> mc->rshift) & mask; @@ -3471,12 +3497,12 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, val = val << shift; rval = rval << mc->rshift; - reg_change = soc_dapm_test_bits(dapm, reg, mask << shift, val); + reg_change = dapm_test_bits(dapm, reg, mask << shift, val); if (snd_soc_volsw_is_stereo(mc)) - reg_change |= soc_dapm_test_bits(dapm, mc->rreg, - mask << mc->rshift, - rval); + reg_change |= dapm_test_bits(dapm, mc->rreg, + mask << mc->rshift, + rval); } if (change || reg_change) { @@ -3493,7 +3519,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, update.val = val; pupdate = &update; } - ret = soc_dapm_mixer_update_power(card, kcontrol, pupdate, connect, rconnect); + ret = dapm_mixer_update_power(card, kcontrol, pupdate, connect, rconnect); } snd_soc_dapm_mutex_unlock(card); @@ -3523,7 +3549,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol, snd_soc_dapm_mutex_lock(dapm); if (e->reg != SND_SOC_NOPM && dapm_kcontrol_is_powered(kcontrol)) { - reg_val = soc_dapm_read(dapm, e->reg); + reg_val = dapm_read(dapm, e->reg); } else { reg_val = snd_soc_dapm_kcontrol_get_value(kcontrol); } @@ -3580,7 +3606,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, change = dapm_kcontrol_set_value(kcontrol, val); if (e->reg != SND_SOC_NOPM) - reg_change = soc_dapm_test_bits(dapm, e->reg, mask, val); + reg_change = dapm_test_bits(dapm, e->reg, mask, val); if (change || reg_change) { if (reg_change) { @@ -3590,7 +3616,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; pupdate = &update; } - ret = soc_dapm_mux_update_power(card, kcontrol, pupdate, item[0], e); + ret = dapm_mux_update_power(card, kcontrol, pupdate, item[0], e); } snd_soc_dapm_mutex_unlock(card); @@ -3673,14 +3699,14 @@ int snd_soc_dapm_get_component_pin_switch(struct snd_kcontrol *kcontrol, } EXPORT_SYMBOL_GPL(snd_soc_dapm_get_component_pin_switch); -static int __snd_soc_dapm_put_pin_switch(struct snd_soc_dapm_context *dapm, - const char *pin, - struct snd_ctl_elem_value *ucontrol) +static int __dapm_put_pin_switch(struct snd_soc_dapm_context *dapm, + const char *pin, + struct snd_ctl_elem_value *ucontrol) { int ret; snd_soc_dapm_mutex_lock(dapm); - ret = __snd_soc_dapm_set_pin(dapm, pin, !!ucontrol->value.integer.value[0]); + ret = __dapm_set_pin(dapm, pin, !!ucontrol->value.integer.value[0]); snd_soc_dapm_mutex_unlock(dapm); snd_soc_dapm_sync(dapm); @@ -3704,7 +3730,7 @@ int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol, struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); const char *pin = (const char *)kcontrol->private_value; - return __snd_soc_dapm_put_pin_switch(dapm, pin, ucontrol); + return __dapm_put_pin_switch(dapm, pin, ucontrol); } EXPORT_SYMBOL_GPL(snd_soc_dapm_put_pin_switch); @@ -3724,7 +3750,7 @@ int snd_soc_dapm_put_component_pin_switch(struct snd_kcontrol *kcontrol, struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component); const char *pin = (const char *)kcontrol->private_value; - return __snd_soc_dapm_put_pin_switch(dapm, pin, ucontrol); + return __dapm_put_pin_switch(dapm, pin, ucontrol); } EXPORT_SYMBOL_GPL(snd_soc_dapm_put_component_pin_switch); @@ -3737,7 +3763,7 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, struct snd_soc_dapm_widget *w; int ret = -ENOMEM; - w = dapm_cnew_widget(widget, soc_dapm_prefix(dapm)); + w = dapm_cnew_widget(widget, dapm_prefix(dapm)); if (!w) goto cnew_failed; @@ -3852,7 +3878,7 @@ snd_soc_dapm_new_control_unlocked(struct snd_soc_dapm_context *dapm, /* see for_each_card_widgets */ list_add_tail(&w->list, &dapm->card->widgets); - snd_soc_dapm_for_each_direction(dir) { + dapm_for_each_direction(dir) { INIT_LIST_HEAD(&w->edges[dir]); w->endpoints[dir] = -1; } @@ -3925,9 +3951,8 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm, } EXPORT_SYMBOL_GPL(snd_soc_dapm_new_controls); -static int -snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, - struct snd_pcm_substream *substream) +static int dapm_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, + struct snd_pcm_substream *substream) { struct device *dev = snd_soc_dapm_to_dev(w->dapm); struct snd_soc_dapm_path *path; @@ -4042,8 +4067,8 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w, return 0; } -static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, - struct snd_kcontrol *kcontrol, int event) +static int dapm_dai_link_event(struct snd_soc_dapm_widget *w, + struct snd_kcontrol *kcontrol, int event) { struct snd_soc_dapm_path *path; struct snd_soc_dai *source, *sink; @@ -4056,7 +4081,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w, switch (event) { case SND_SOC_DAPM_PRE_PMU: - ret = snd_soc_dai_link_event_pre_pmu(w, substream); + ret = dapm_dai_link_event_pre_pmu(w, substream); if (ret < 0) goto out; @@ -4134,8 +4159,8 @@ out: return ret; } -static int snd_soc_dapm_dai_link_get(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int dapm_dai_link_get(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct snd_soc_dapm_widget *w = snd_kcontrol_chip(kcontrol); struct snd_soc_pcm_runtime *rtd = w->priv; @@ -4145,8 +4170,8 @@ static int snd_soc_dapm_dai_link_get(struct snd_kcontrol *kcontrol, return 0; } -static int snd_soc_dapm_dai_link_put(struct snd_kcontrol *kcontrol, - struct snd_ctl_elem_value *ucontrol) +static int dapm_dai_link_put(struct snd_kcontrol *kcontrol, + struct snd_ctl_elem_value *ucontrol) { struct snd_soc_dapm_widget *w = snd_kcontrol_chip(kcontrol); struct snd_soc_pcm_runtime *rtd = w->priv; @@ -4166,11 +4191,10 @@ static int snd_soc_dapm_dai_link_put(struct snd_kcontrol *kcontrol, return 1; } -static void -snd_soc_dapm_free_kcontrol(struct snd_soc_card *card, - unsigned long *private_value, - int num_c2c_params, - const char **w_param_text) +static void dapm_free_kcontrol(struct snd_soc_card *card, + unsigned long *private_value, + int num_c2c_params, + const char **w_param_text) { int count; @@ -4185,7 +4209,7 @@ snd_soc_dapm_free_kcontrol(struct snd_soc_card *card, } static struct snd_kcontrol_new * -snd_soc_dapm_alloc_kcontrol(struct snd_soc_card *card, +dapm_alloc_kcontrol(struct snd_soc_card *card, char *link_name, const struct snd_soc_pcm_stream *c2c_params, int num_c2c_params, const char **w_param_text, @@ -4196,8 +4220,8 @@ snd_soc_dapm_alloc_kcontrol(struct snd_soc_card *card, }; struct snd_kcontrol_new kcontrol_dai_link[] = { SOC_ENUM_EXT(NULL, w_param_enum[0], - snd_soc_dapm_dai_link_get, - snd_soc_dapm_dai_link_put), + dapm_dai_link_get, + dapm_dai_link_put), }; struct snd_kcontrol_new *kcontrol_news; const struct snd_soc_pcm_stream *config = c2c_params; @@ -4248,14 +4272,14 @@ snd_soc_dapm_alloc_kcontrol(struct snd_soc_card *card, return kcontrol_news; outfree_w_param: - snd_soc_dapm_free_kcontrol(card, private_value, num_c2c_params, w_param_text); + dapm_free_kcontrol(card, private_value, num_c2c_params, w_param_text); + return NULL; } -static struct snd_soc_dapm_widget * -snd_soc_dapm_new_dai(struct snd_soc_card *card, - struct snd_pcm_substream *substream, - char *id) +static struct snd_soc_dapm_widget *dapm_new_dai(struct snd_soc_card *card, + struct snd_pcm_substream *substream, + char *id) { struct snd_soc_dapm_context *dapm = snd_soc_card_to_dapm(card); struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); @@ -4285,10 +4309,10 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, goto param_fail; num_kcontrols = 1; - kcontrol_news = snd_soc_dapm_alloc_kcontrol(card, link_name, - rtd->dai_link->c2c_params, - rtd->dai_link->num_c2c_params, - w_param_text, &private_value); + kcontrol_news = dapm_alloc_kcontrol(card, link_name, + rtd->dai_link->c2c_params, + rtd->dai_link->num_c2c_params, + w_param_text, &private_value); if (!kcontrol_news) goto param_fail; } @@ -4297,7 +4321,7 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, template.reg = SND_SOC_NOPM; template.id = snd_soc_dapm_dai_link; template.name = link_name; - template.event = snd_soc_dai_link_event; + template.event = dapm_dai_link_event; template.event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD; template.kcontrol_news = kcontrol_news; @@ -4317,7 +4341,7 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, outfree_kcontrol_news: devm_kfree(card->dev, (void *)template.kcontrol_news); - snd_soc_dapm_free_kcontrol(card, &private_value, + dapm_free_kcontrol(card, &private_value, rtd->dai_link->num_c2c_params, w_param_text); param_fail: devm_kfree(card->dev, link_name); @@ -4431,7 +4455,7 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card) sink = dai_w; } dev_dbg(dai->dev, "%s -> %s\n", src->name, sink->name); - snd_soc_dapm_add_path(w->dapm, src, sink, NULL, NULL); + dapm_add_path(w->dapm, src, sink, NULL, NULL); } } @@ -4452,11 +4476,11 @@ static void dapm_connect_dai_routes(struct snd_soc_dapm_context *dapm, sink_dai->component->name, sink->name); if (dai) { - snd_soc_dapm_add_path(dapm, src, dai, NULL, NULL); + dapm_add_path(dapm, src, dai, NULL, NULL); src = dai; } - snd_soc_dapm_add_path(dapm, src, sink, NULL, NULL); + dapm_add_path(dapm, src, sink, NULL, NULL); } static void dapm_connect_dai_pair(struct snd_soc_card *card, @@ -4490,8 +4514,8 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card, /* special handling for [Codec2Codec] */ if (dai_link->c2c_params && !rtd->c2c_widget[stream]) { struct snd_pcm_substream *substream = rtd->pcm->streams[stream].substream; - struct snd_soc_dapm_widget *dai = snd_soc_dapm_new_dai(card, substream, - widget_name[stream]); + struct snd_soc_dapm_widget *dai = dapm_new_dai(card, substream, + widget_name[stream]); if (IS_ERR(dai)) continue; @@ -4505,8 +4529,7 @@ static void dapm_connect_dai_pair(struct snd_soc_card *card, } } -static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream, - int event) +static void dapm_dai_stream_event(struct snd_soc_dai *dai, int stream, int event) { struct snd_soc_dapm_widget *w; @@ -4574,14 +4597,13 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card) } } -static void soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, - int event) +static void dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, int event) { struct snd_soc_dai *dai; int i; for_each_rtd_dais(rtd, i, dai) - soc_dapm_dai_stream_event(dai, stream, event); + dapm_dai_stream_event(dai, stream, event); dapm_power_widgets(rtd->card, event, NULL); } @@ -4603,7 +4625,7 @@ void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream, struct snd_soc_card *card = rtd->card; snd_soc_dapm_mutex_lock(card); - soc_dapm_stream_event(rtd, stream, event); + dapm_stream_event(rtd, stream, event); snd_soc_dapm_mutex_unlock(card); } @@ -4646,7 +4668,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_stream_stop); int snd_soc_dapm_enable_pin_unlocked(struct snd_soc_dapm_context *dapm, const char *pin) { - return snd_soc_dapm_set_pin(dapm, pin, 1); + return dapm_set_pin(dapm, pin, 1); } EXPORT_SYMBOL_GPL(snd_soc_dapm_enable_pin_unlocked); @@ -4667,7 +4689,7 @@ int snd_soc_dapm_enable_pin(struct snd_soc_dapm_context *dapm, const char *pin) snd_soc_dapm_mutex_lock(dapm); - ret = snd_soc_dapm_set_pin(dapm, pin, 1); + ret = dapm_set_pin(dapm, pin, 1); snd_soc_dapm_mutex_unlock(dapm); @@ -4763,7 +4785,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); int snd_soc_dapm_disable_pin_unlocked(struct snd_soc_dapm_context *dapm, const char *pin) { - return snd_soc_dapm_set_pin(dapm, pin, 0); + return dapm_set_pin(dapm, pin, 0); } EXPORT_SYMBOL_GPL(snd_soc_dapm_disable_pin_unlocked); @@ -4784,7 +4806,7 @@ int snd_soc_dapm_disable_pin(struct snd_soc_dapm_context *dapm, snd_soc_dapm_mutex_lock(dapm); - ret = snd_soc_dapm_set_pin(dapm, pin, 0); + ret = dapm_set_pin(dapm, pin, 0); snd_soc_dapm_mutex_unlock(dapm); @@ -4862,19 +4884,15 @@ 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 */ list_add(&dapm->list, &card->dapm_list); } -static void soc_dapm_shutdown_dapm(struct snd_soc_dapm_context *dapm) +static void dapm_shutdown(struct snd_soc_dapm_context *dapm) { struct snd_soc_card *card = dapm->card; struct snd_soc_dapm_widget *w; @@ -4919,13 +4937,13 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card) for_each_card_dapms(card, dapm) { if (dapm != card_dapm) { - soc_dapm_shutdown_dapm(dapm); + dapm_shutdown(dapm); if (dapm->bias_level == SND_SOC_BIAS_STANDBY) snd_soc_dapm_set_bias_level(dapm, SND_SOC_BIAS_OFF); } } - soc_dapm_shutdown_dapm(card_dapm); + dapm_shutdown(card_dapm); if (card_dapm->bias_level == SND_SOC_BIAS_STANDBY) snd_soc_dapm_set_bias_level(card_dapm, SND_SOC_BIAS_OFF); } |
