mirror of
https://github.com/torvalds/linux
synced 2024-10-07 11:53:31 +00:00
ASoC: soc-dapm.c random cleanups
Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>: These are random cleanup for soc-dpam.c/h. Basically, these are just cleanup, nothing changed.
This commit is contained in:
commit
af7b5657e3
|
@ -450,7 +450,6 @@ int snd_soc_dapm_del_routes(struct snd_soc_dapm_context *dapm,
|
|||
int snd_soc_dapm_weak_routes(struct snd_soc_dapm_context *dapm,
|
||||
const struct snd_soc_dapm_route *route, int num);
|
||||
void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w);
|
||||
void snd_soc_dapm_reset_cache(struct snd_soc_dapm_context *dapm);
|
||||
|
||||
/* dapm events */
|
||||
void snd_soc_dapm_stream_event(struct snd_soc_pcm_runtime *rtd, int stream,
|
||||
|
@ -680,10 +679,6 @@ struct snd_soc_dapm_update {
|
|||
bool has_second_set;
|
||||
};
|
||||
|
||||
struct snd_soc_dapm_wcache {
|
||||
struct snd_soc_dapm_widget *widget;
|
||||
};
|
||||
|
||||
/* DAPM context */
|
||||
struct snd_soc_dapm_context {
|
||||
enum snd_soc_bias_level bias_level;
|
||||
|
@ -699,8 +694,8 @@ struct snd_soc_dapm_context {
|
|||
enum snd_soc_bias_level target_bias_level;
|
||||
struct list_head list;
|
||||
|
||||
struct snd_soc_dapm_wcache path_sink_cache;
|
||||
struct snd_soc_dapm_wcache path_source_cache;
|
||||
struct snd_soc_dapm_widget *wcache_sink;
|
||||
struct snd_soc_dapm_widget *wcache_source;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
struct dentry *debugfs_dapm;
|
||||
|
|
|
@ -130,10 +130,8 @@ static void hda_codec_unregister_dais(struct hda_codec *codec,
|
|||
if (strcmp(dai->driver->name, pcm->name))
|
||||
continue;
|
||||
|
||||
if (dai->playback_widget)
|
||||
snd_soc_dapm_free_widget(dai->playback_widget);
|
||||
if (dai->capture_widget)
|
||||
snd_soc_dapm_free_widget(dai->capture_widget);
|
||||
snd_soc_dapm_free_widget(dai->playback_widget);
|
||||
snd_soc_dapm_free_widget(dai->capture_widget);
|
||||
snd_soc_unregister_dai(dai);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1016,10 +1016,8 @@ static void avs_component_hda_unregister_dais(struct snd_soc_component *componen
|
|||
if (!strstr(dai->driver->name, name))
|
||||
continue;
|
||||
|
||||
if (dai->playback_widget)
|
||||
snd_soc_dapm_free_widget(dai->playback_widget);
|
||||
if (dai->capture_widget)
|
||||
snd_soc_dapm_free_widget(dai->capture_widget);
|
||||
snd_soc_dapm_free_widget(dai->playback_widget);
|
||||
snd_soc_dapm_free_widget(dai->capture_widget);
|
||||
snd_soc_unregister_dai(dai);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -652,10 +652,8 @@ static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm)
|
|||
}
|
||||
|
||||
static struct snd_soc_dapm_widget *
|
||||
dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, const char *name)
|
||||
dapm_wcache_lookup(struct snd_soc_dapm_widget *w, const char *name)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w = wcache->widget;
|
||||
|
||||
if (w) {
|
||||
struct list_head *wlist = &w->dapm->card->widgets;
|
||||
const int depth = 2;
|
||||
|
@ -673,12 +671,6 @@ dapm_wcache_lookup(struct snd_soc_dapm_wcache *wcache, const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline void dapm_wcache_update(struct snd_soc_dapm_wcache *wcache,
|
||||
struct snd_soc_dapm_widget *w)
|
||||
{
|
||||
wcache->widget = w;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_dapm_force_bias_level() - Sets the DAPM bias level
|
||||
* @dapm: The DAPM context for which to set the level
|
||||
|
@ -1892,18 +1884,19 @@ static void dapm_widget_set_power(struct snd_soc_dapm_widget *w, bool power,
|
|||
|
||||
trace_snd_soc_dapm_widget_power(w, power);
|
||||
|
||||
/* If we changed our power state perhaps our neigbours changed
|
||||
* also.
|
||||
/*
|
||||
* If we changed our power state perhaps our neigbours
|
||||
* changed also.
|
||||
*/
|
||||
snd_soc_dapm_widget_for_each_source_path(w, path)
|
||||
dapm_widget_set_peer_power(path->source, power, path->connect);
|
||||
|
||||
/* Supplies can't affect their outputs, only their inputs */
|
||||
if (!w->is_supply) {
|
||||
/*
|
||||
* Supplies can't affect their outputs, only their inputs
|
||||
*/
|
||||
if (!w->is_supply)
|
||||
snd_soc_dapm_widget_for_each_sink_path(w, path)
|
||||
dapm_widget_set_peer_power(path->sink, power,
|
||||
path->connect);
|
||||
}
|
||||
dapm_widget_set_peer_power(path->sink, power, path->connect);
|
||||
|
||||
if (power)
|
||||
dapm_seq_insert(w, up_list, true);
|
||||
|
@ -2497,6 +2490,9 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
|
|||
struct snd_soc_dapm_path *p, *next_p;
|
||||
enum snd_soc_dapm_direction dir;
|
||||
|
||||
if (!w)
|
||||
return;
|
||||
|
||||
list_del(&w->list);
|
||||
list_del(&w->dirty);
|
||||
/*
|
||||
|
@ -2516,12 +2512,6 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_free_widget);
|
||||
|
||||
void snd_soc_dapm_reset_cache(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
dapm->path_sink_cache.widget = NULL;
|
||||
dapm->path_source_cache.widget = NULL;
|
||||
}
|
||||
|
||||
/* free all dapm widgets and resources */
|
||||
static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
|
@ -2532,7 +2522,9 @@ static void dapm_free_widgets(struct snd_soc_dapm_context *dapm)
|
|||
continue;
|
||||
snd_soc_dapm_free_widget(w);
|
||||
}
|
||||
snd_soc_dapm_reset_cache(dapm);
|
||||
|
||||
dapm->wcache_sink = NULL;
|
||||
dapm->wcache_source = NULL;
|
||||
}
|
||||
|
||||
static struct snd_soc_dapm_widget *dapm_find_widget(
|
||||
|
@ -2838,7 +2830,6 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm,
|
|||
int (*connected)(struct snd_soc_dapm_widget *source,
|
||||
struct snd_soc_dapm_widget *sink))
|
||||
{
|
||||
struct snd_soc_dapm_widget *widgets[2];
|
||||
enum snd_soc_dapm_direction dir;
|
||||
struct snd_soc_dapm_path *path;
|
||||
int ret;
|
||||
|
@ -2874,8 +2865,6 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm,
|
|||
|
||||
path->node[SND_SOC_DAPM_DIR_IN] = wsource;
|
||||
path->node[SND_SOC_DAPM_DIR_OUT] = wsink;
|
||||
widgets[SND_SOC_DAPM_DIR_IN] = wsource;
|
||||
widgets[SND_SOC_DAPM_DIR_OUT] = wsink;
|
||||
|
||||
path->connected = connected;
|
||||
INIT_LIST_HEAD(&path->list);
|
||||
|
@ -2917,12 +2906,13 @@ static int snd_soc_dapm_add_path(struct snd_soc_dapm_context *dapm,
|
|||
}
|
||||
|
||||
list_add(&path->list, &dapm->card->paths);
|
||||
|
||||
snd_soc_dapm_for_each_direction(dir)
|
||||
list_add(&path->list_node[dir], &widgets[dir]->edges[dir]);
|
||||
list_add(&path->list_node[dir], &path->node[dir]->edges[dir]);
|
||||
|
||||
snd_soc_dapm_for_each_direction(dir) {
|
||||
dapm_update_widget_flags(widgets[dir]);
|
||||
dapm_mark_dirty(widgets[dir], "Route added");
|
||||
dapm_update_widget_flags(path->node[dir]);
|
||||
dapm_mark_dirty(path->node[dir], "Route added");
|
||||
}
|
||||
|
||||
if (dapm->card->instantiated && path->connect)
|
||||
|
@ -2961,8 +2951,8 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
|
|||
source = route->source;
|
||||
}
|
||||
|
||||
wsource = dapm_wcache_lookup(&dapm->path_source_cache, source);
|
||||
wsink = dapm_wcache_lookup(&dapm->path_sink_cache, sink);
|
||||
wsource = dapm_wcache_lookup(dapm->wcache_source, source);
|
||||
wsink = dapm_wcache_lookup(dapm->wcache_sink, sink);
|
||||
|
||||
if (wsink && wsource)
|
||||
goto skip_search;
|
||||
|
@ -3006,30 +2996,27 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
|
|||
if (!wsource)
|
||||
wsource = wtsource;
|
||||
|
||||
if (wsource == NULL) {
|
||||
dev_err(dapm->dev, "ASoC: no source widget found for %s\n",
|
||||
route->source);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (wsink == NULL) {
|
||||
dev_err(dapm->dev, "ASoC: no sink widget found for %s\n",
|
||||
route->sink);
|
||||
return -ENODEV;
|
||||
}
|
||||
ret = -ENODEV;
|
||||
if (!wsource)
|
||||
goto err;
|
||||
if (!wsink)
|
||||
goto err;
|
||||
|
||||
skip_search:
|
||||
dapm_wcache_update(&dapm->path_sink_cache, wsink);
|
||||
dapm_wcache_update(&dapm->path_source_cache, wsource);
|
||||
/* update cache */
|
||||
dapm->wcache_sink = wsink;
|
||||
dapm->wcache_source = wsource;
|
||||
|
||||
ret = snd_soc_dapm_add_path(dapm, wsource, wsink, route->control,
|
||||
route->connected);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
dev_warn(dapm->dev, "ASoC: no dapm match for %s --> %s --> %s\n",
|
||||
source, route->control, sink);
|
||||
if (ret)
|
||||
dev_err(dapm->dev, "ASoC: Failed to add route %s%s -%s%s%s> %s%s\n",
|
||||
source, !wsource ? "(*)" : "",
|
||||
!route->control ? "" : "> [",
|
||||
!route->control ? "" : route->control,
|
||||
!route->control ? "" : "] -",
|
||||
sink, !wsink ? "(*)" : "");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -3115,13 +3102,8 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
|
|||
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
|
||||
for (i = 0; i < num; i++) {
|
||||
int r = snd_soc_dapm_add_route(dapm, route);
|
||||
if (r < 0) {
|
||||
dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
|
||||
route->source,
|
||||
route->control ? route->control : "direct",
|
||||
route->sink);
|
||||
if (r < 0)
|
||||
ret = r;
|
||||
}
|
||||
route++;
|
||||
}
|
||||
mutex_unlock(&dapm->card->dapm_mutex);
|
||||
|
|
Loading…
Reference in a new issue