diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2019-07-26 00:51:39 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-08-05 11:23:51 -0400 |
commit | 8e2a990d76aced95c6f01c2d67d8835c86f0ca67 (patch) | |
tree | 7110f3600a3bf124ce90ff67bbfb3dad3d75889d | |
parent | 9d415fbf773f162a5c274e671741c6fa94b74287 (diff) |
ASoC: soc-component: move snd_soc_component_stream_event()
Current soc-dapm / soc-core are using a long way round to call
.stream_event.
if (driver->stream_event)
dapm->stream_event = ...;
...
if (dapm->stream_event)
ret = dapm->stream_event(...);
We can directly call it via driver->stream_event.
One note here is that both Card and Component have dapm,
but, Card's dapm doesn't have dapm->component.
We need to check it.
This patch moves snd_soc_component_stream_event() to soc-component.c
and updates parameters.
dapm->stream_event is no longer needed
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v9vp4d0r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/soc-component.h | 2 | ||||
-rw-r--r-- | include/sound/soc-dapm.h | 1 | ||||
-rw-r--r-- | sound/soc/soc-component.c | 9 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 10 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 9 |
5 files changed, 18 insertions, 13 deletions
diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 7ac903c1e33f..1f84f04e2670 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h | |||
@@ -283,6 +283,8 @@ int snd_soc_component_set_jack(struct snd_soc_component *component, | |||
283 | 283 | ||
284 | void snd_soc_component_seq_notifier(struct snd_soc_component *component, | 284 | void snd_soc_component_seq_notifier(struct snd_soc_component *component, |
285 | enum snd_soc_dapm_type type, int subseq); | 285 | enum snd_soc_dapm_type type, int subseq); |
286 | int snd_soc_component_stream_event(struct snd_soc_component *component, | ||
287 | int event); | ||
286 | 288 | ||
287 | #ifdef CONFIG_REGMAP | 289 | #ifdef CONFIG_REGMAP |
288 | void snd_soc_component_init_regmap(struct snd_soc_component *component, | 290 | void snd_soc_component_init_regmap(struct snd_soc_component *component, |
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h index a03db6f8faa8..c2f14a335891 100644 --- a/include/sound/soc-dapm.h +++ b/include/sound/soc-dapm.h | |||
@@ -670,7 +670,6 @@ struct snd_soc_dapm_context { | |||
670 | enum snd_soc_bias_level target_bias_level; | 670 | enum snd_soc_bias_level target_bias_level; |
671 | struct list_head list; | 671 | struct list_head list; |
672 | 672 | ||
673 | int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); | ||
674 | int (*set_bias_level)(struct snd_soc_dapm_context *dapm, | 673 | int (*set_bias_level)(struct snd_soc_dapm_context *dapm, |
675 | enum snd_soc_bias_level level); | 674 | enum snd_soc_bias_level level); |
676 | 675 | ||
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index ca0b28b1d918..f33dda8023ec 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c | |||
@@ -59,6 +59,15 @@ void snd_soc_component_seq_notifier(struct snd_soc_component *component, | |||
59 | component->driver->seq_notifier(component, type, subseq); | 59 | component->driver->seq_notifier(component, type, subseq); |
60 | } | 60 | } |
61 | 61 | ||
62 | int snd_soc_component_stream_event(struct snd_soc_component *component, | ||
63 | int event) | ||
64 | { | ||
65 | if (component->driver->stream_event) | ||
66 | return component->driver->stream_event(component, event); | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | |||
62 | int snd_soc_component_enable_pin(struct snd_soc_component *component, | 71 | int snd_soc_component_enable_pin(struct snd_soc_component *component, |
63 | const char *pin) | 72 | const char *pin) |
64 | { | 73 | { |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c618fecc3d45..8cfbe5fb5921 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -2646,14 +2646,6 @@ int snd_soc_register_dai(struct snd_soc_component *component, | |||
2646 | } | 2646 | } |
2647 | EXPORT_SYMBOL_GPL(snd_soc_register_dai); | 2647 | EXPORT_SYMBOL_GPL(snd_soc_register_dai); |
2648 | 2648 | ||
2649 | static int snd_soc_component_stream_event(struct snd_soc_dapm_context *dapm, | ||
2650 | int event) | ||
2651 | { | ||
2652 | struct snd_soc_component *component = dapm->component; | ||
2653 | |||
2654 | return component->driver->stream_event(component, event); | ||
2655 | } | ||
2656 | |||
2657 | static int snd_soc_component_set_bias_level(struct snd_soc_dapm_context *dapm, | 2649 | static int snd_soc_component_set_bias_level(struct snd_soc_dapm_context *dapm, |
2658 | enum snd_soc_bias_level level) | 2650 | enum snd_soc_bias_level level) |
2659 | { | 2651 | { |
@@ -2682,8 +2674,6 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, | |||
2682 | dapm->bias_level = SND_SOC_BIAS_OFF; | 2674 | dapm->bias_level = SND_SOC_BIAS_OFF; |
2683 | dapm->idle_bias_off = !driver->idle_bias_on; | 2675 | dapm->idle_bias_off = !driver->idle_bias_on; |
2684 | dapm->suspend_bias_off = driver->suspend_bias_off; | 2676 | dapm->suspend_bias_off = driver->suspend_bias_off; |
2685 | if (driver->stream_event) | ||
2686 | dapm->stream_event = snd_soc_component_stream_event; | ||
2687 | if (driver->set_bias_level) | 2677 | if (driver->set_bias_level) |
2688 | dapm->set_bias_level = snd_soc_component_set_bias_level; | 2678 | dapm->set_bias_level = snd_soc_component_set_bias_level; |
2689 | 2679 | ||
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 0b60f688b433..9288b2b43f98 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1913,6 +1913,7 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) | |||
1913 | LIST_HEAD(down_list); | 1913 | LIST_HEAD(down_list); |
1914 | ASYNC_DOMAIN_EXCLUSIVE(async_domain); | 1914 | ASYNC_DOMAIN_EXCLUSIVE(async_domain); |
1915 | enum snd_soc_bias_level bias; | 1915 | enum snd_soc_bias_level bias; |
1916 | int ret; | ||
1916 | 1917 | ||
1917 | lockdep_assert_held(&card->dapm_mutex); | 1918 | lockdep_assert_held(&card->dapm_mutex); |
1918 | 1919 | ||
@@ -2029,8 +2030,12 @@ static int dapm_power_widgets(struct snd_soc_card *card, int event) | |||
2029 | 2030 | ||
2030 | /* do we need to notify any clients that DAPM event is complete */ | 2031 | /* do we need to notify any clients that DAPM event is complete */ |
2031 | list_for_each_entry(d, &card->dapm_list, list) { | 2032 | list_for_each_entry(d, &card->dapm_list, list) { |
2032 | if (d->stream_event) | 2033 | if (!d->component) |
2033 | d->stream_event(d, event); | 2034 | continue; |
2035 | |||
2036 | ret = snd_soc_component_stream_event(d->component, event); | ||
2037 | if (ret < 0) | ||
2038 | return ret; | ||
2034 | } | 2039 | } |
2035 | 2040 | ||
2036 | pop_dbg(card->dev, card->pop_time, | 2041 | pop_dbg(card->dev, card->pop_time, |