#define __SOC_LINK_H
int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd);
-int snd_soc_link_startup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream);
-void snd_soc_link_shutdown(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream);
-int snd_soc_link_prepare(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream);
-int snd_soc_link_hw_params(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream,
+int snd_soc_link_startup(struct snd_pcm_substream *substream);
+void snd_soc_link_shutdown(struct snd_pcm_substream *substream);
+int snd_soc_link_prepare(struct snd_pcm_substream *substream);
+int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params);
-void snd_soc_link_hw_free(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream);
-int snd_soc_link_trigger(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream, int cmd);
+void snd_soc_link_hw_free(struct snd_pcm_substream *substream);
+int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd);
#endif /* __SOC_LINK_H */
return soc_link_ret(rtd, ret);
}
-int snd_soc_link_startup(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream)
+int snd_soc_link_startup(struct snd_pcm_substream *substream)
{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
int ret = 0;
if (rtd->dai_link->ops &&
return soc_link_ret(rtd, ret);
}
-void snd_soc_link_shutdown(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream)
+void snd_soc_link_shutdown(struct snd_pcm_substream *substream)
{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
if (rtd->dai_link->ops &&
rtd->dai_link->ops->shutdown)
rtd->dai_link->ops->shutdown(substream);
}
-int snd_soc_link_prepare(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream)
+int snd_soc_link_prepare(struct snd_pcm_substream *substream)
{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
int ret = 0;
if (rtd->dai_link->ops &&
return soc_link_ret(rtd, ret);
}
-int snd_soc_link_hw_params(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream,
+int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
int ret = 0;
if (rtd->dai_link->ops &&
return soc_link_ret(rtd, ret);
}
-void snd_soc_link_hw_free(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream)
+void snd_soc_link_hw_free(struct snd_pcm_substream *substream)
{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
if (rtd->dai_link->ops &&
rtd->dai_link->ops->hw_free)
rtd->dai_link->ops->hw_free(substream);
}
-int snd_soc_link_trigger(struct snd_soc_pcm_runtime *rtd,
- struct snd_pcm_substream *substream, int cmd)
+int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd)
{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
int ret = 0;
if (rtd->dai_link->ops &&
for_each_rtd_dais(rtd, i, dai)
snd_soc_dai_shutdown(dai, substream);
- snd_soc_link_shutdown(rtd, substream);
+ snd_soc_link_shutdown(substream);
soc_pcm_components_close(substream);
if (ret < 0)
goto component_err;
- ret = snd_soc_link_startup(rtd, substream);
+ ret = snd_soc_link_startup(substream);
if (ret < 0)
goto rtd_startup_err;
for_each_rtd_dais(rtd, i, dai)
snd_soc_dai_shutdown(dai, substream);
- snd_soc_link_shutdown(rtd, substream);
+ snd_soc_link_shutdown(substream);
rtd_startup_err:
soc_pcm_components_close(substream);
component_err:
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
- ret = snd_soc_link_prepare(rtd, substream);
+ ret = snd_soc_link_prepare(substream);
if (ret < 0)
goto out;
if (ret)
goto out;
- ret = snd_soc_link_hw_params(rtd, substream, params);
+ ret = snd_soc_link_hw_params(substream, params);
if (ret < 0)
goto out;
codec_dai->rate = 0;
}
- snd_soc_link_hw_free(rtd, substream);
+ snd_soc_link_hw_free(substream);
mutex_unlock(&rtd->card->pcm_mutex);
return ret;
}
/* free any machine hw params */
- snd_soc_link_hw_free(rtd, substream);
+ snd_soc_link_hw_free(substream);
/* free any component resources */
soc_pcm_components_hw_free(substream, NULL);
struct snd_soc_component *component;
int i, ret;
- ret = snd_soc_link_trigger(rtd, substream, cmd);
+ ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
return ret;
return ret;
}
- ret = snd_soc_link_trigger(rtd, substream, cmd);
+ ret = snd_soc_link_trigger(substream, cmd);
if (ret < 0)
return ret;