summaryrefslogtreecommitdiff
path: root/sound/soc/soc-component.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2020-06-04 17:07:11 +0900
committerMark Brown <broonie@kernel.org>2020-06-15 18:21:23 +0100
commite1bafa828e3a0622ac24d238e00937f3059ed585 (patch)
treeea076ae60369bd946ffccaba9b11726eacd0f7b5 /sound/soc/soc-component.c
parent4f39514f36980a4b20a754a5d51486a5999c8380 (diff)
ASoC: soc-component: add snd_soc_pcm_component_hw_params()
We have 2 type of component functions snd_soc_component_xxx() is focusing to component itself, snd_soc_pcm_component_xxx() is focusing to rtd related component. Now we can update snd_soc_component_hw_params() to snd_soc_pcm_component_hw_params(). This patch do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/87mu5jw8y8.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-component.c')
-rw-r--r--sound/soc/soc-component.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 1bc155bc8e5e..56341968fe6d 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -275,19 +275,6 @@ int snd_soc_component_close(struct snd_soc_component *component,
return soc_component_ret(component, ret);
}
-int snd_soc_component_hw_params(struct snd_soc_component *component,
- struct snd_pcm_substream *substream,
- struct snd_pcm_hw_params *params)
-{
- int ret = 0;
-
- if (component->driver->hw_params)
- ret = component->driver->hw_params(component,
- substream, params);
-
- return soc_component_ret(component, ret);
-}
-
int snd_soc_component_hw_free(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
@@ -575,3 +562,26 @@ int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream)
return 0;
}
+
+int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
+ struct snd_pcm_hw_params *params,
+ struct snd_soc_component **last)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_component *component;
+ int i, ret;
+
+ for_each_rtd_components(rtd, i, component) {
+ if (component->driver->hw_params) {
+ ret = component->driver->hw_params(component,
+ substream, params);
+ if (ret < 0) {
+ *last = component;
+ return soc_component_ret(component, ret);
+ }
+ }
+ }
+
+ *last = NULL;
+ return 0;
+}