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>
This commit is contained in:

committed by
Mark Brown

parent
4f39514f36
commit
e1bafa828e
@@ -426,9 +426,6 @@ int snd_soc_component_open(struct snd_soc_component *component,
|
|||||||
struct snd_pcm_substream *substream);
|
struct snd_pcm_substream *substream);
|
||||||
int snd_soc_component_close(struct snd_soc_component *component,
|
int snd_soc_component_close(struct snd_soc_component *component,
|
||||||
struct snd_pcm_substream *substream);
|
struct snd_pcm_substream *substream);
|
||||||
int snd_soc_component_hw_params(struct snd_soc_component *component,
|
|
||||||
struct snd_pcm_substream *substream,
|
|
||||||
struct snd_pcm_hw_params *params);
|
|
||||||
int snd_soc_component_hw_free(struct snd_soc_component *component,
|
int snd_soc_component_hw_free(struct snd_soc_component *component,
|
||||||
struct snd_pcm_substream *substream);
|
struct snd_pcm_substream *substream);
|
||||||
int snd_soc_component_trigger(struct snd_soc_component *component,
|
int snd_soc_component_trigger(struct snd_soc_component *component,
|
||||||
@@ -459,5 +456,8 @@ int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
|
|||||||
int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd);
|
int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd);
|
||||||
void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd);
|
void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd);
|
||||||
int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream);
|
int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream);
|
||||||
|
int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
|
||||||
|
struct snd_pcm_hw_params *params,
|
||||||
|
struct snd_soc_component **last);
|
||||||
|
|
||||||
#endif /* __SOC_COMPONENT_H */
|
#endif /* __SOC_COMPONENT_H */
|
||||||
|
@@ -275,19 +275,6 @@ int snd_soc_component_close(struct snd_soc_component *component,
|
|||||||
return soc_component_ret(component, ret);
|
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,
|
int snd_soc_component_hw_free(struct snd_soc_component *component,
|
||||||
struct snd_pcm_substream *substream)
|
struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
@@ -575,3 +562,26 @@ int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream)
|
|||||||
|
|
||||||
return 0;
|
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;
|
||||||
|
}
|
||||||
|
@@ -1009,16 +1009,9 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||||||
snd_soc_dapm_update_dai(substream, params, cpu_dai);
|
snd_soc_dapm_update_dai(substream, params, cpu_dai);
|
||||||
}
|
}
|
||||||
|
|
||||||
for_each_rtd_components(rtd, i, component) {
|
ret = snd_soc_pcm_component_hw_params(substream, params, &component);
|
||||||
ret = snd_soc_component_hw_params(component, substream, params);
|
if (ret < 0)
|
||||||
if (ret < 0) {
|
goto component_err;
|
||||||
dev_err(component->dev,
|
|
||||||
"ASoC: %s hw params failed: %d\n",
|
|
||||||
component->name, ret);
|
|
||||||
goto component_err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
component = NULL;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&rtd->card->pcm_mutex);
|
mutex_unlock(&rtd->card->pcm_mutex);
|
||||||
|
Reference in New Issue
Block a user