mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-05-07 15:53:49 +00:00
ASoC: Intel: sof_sdw: add dailink .prepare and .hw_free callback
Add .prepare and .hw_free callback to dailink. The companion patch for this patch is the removal of stream operations in the .prepare and .hw_free callbacks at the DAI level in drivers/soundwire/intel.c Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Link: https://lore.kernel.org/r/20200904182854.3944-4-yung-chuan.liao@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ae3a3918ed
commit
06998d49bc
1 changed files with 40 additions and 0 deletions
|
@ -225,6 +225,25 @@ int sdw_startup(struct snd_pcm_substream *substream)
|
||||||
return sdw_startup_stream(substream);
|
return sdw_startup_stream(substream);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sdw_prepare(struct snd_pcm_substream *substream)
|
||||||
|
{
|
||||||
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||||
|
struct sdw_stream_runtime *sdw_stream;
|
||||||
|
struct snd_soc_dai *dai;
|
||||||
|
|
||||||
|
/* Find stream from first CPU DAI */
|
||||||
|
dai = asoc_rtd_to_cpu(rtd, 0);
|
||||||
|
|
||||||
|
sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
|
||||||
|
|
||||||
|
if (IS_ERR(sdw_stream)) {
|
||||||
|
dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
|
||||||
|
return PTR_ERR(sdw_stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sdw_prepare_stream(sdw_stream);
|
||||||
|
}
|
||||||
|
|
||||||
static int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
|
static int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||||
|
@ -265,6 +284,25 @@ static int sdw_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int sdw_hw_free(struct snd_pcm_substream *substream)
|
||||||
|
{
|
||||||
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
||||||
|
struct sdw_stream_runtime *sdw_stream;
|
||||||
|
struct snd_soc_dai *dai;
|
||||||
|
|
||||||
|
/* Find stream from first CPU DAI */
|
||||||
|
dai = asoc_rtd_to_cpu(rtd, 0);
|
||||||
|
|
||||||
|
sdw_stream = snd_soc_dai_get_sdw_stream(dai, substream->stream);
|
||||||
|
|
||||||
|
if (IS_ERR(sdw_stream)) {
|
||||||
|
dev_err(rtd->dev, "no stream found for DAI %s", dai->name);
|
||||||
|
return PTR_ERR(sdw_stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sdw_deprepare_stream(sdw_stream);
|
||||||
|
}
|
||||||
|
|
||||||
void sdw_shutdown(struct snd_pcm_substream *substream)
|
void sdw_shutdown(struct snd_pcm_substream *substream)
|
||||||
{
|
{
|
||||||
sdw_shutdown_stream(substream);
|
sdw_shutdown_stream(substream);
|
||||||
|
@ -272,7 +310,9 @@ void sdw_shutdown(struct snd_pcm_substream *substream)
|
||||||
|
|
||||||
static const struct snd_soc_ops sdw_ops = {
|
static const struct snd_soc_ops sdw_ops = {
|
||||||
.startup = sdw_startup,
|
.startup = sdw_startup,
|
||||||
|
.prepare = sdw_prepare,
|
||||||
.trigger = sdw_trigger,
|
.trigger = sdw_trigger,
|
||||||
|
.hw_free = sdw_hw_free,
|
||||||
.shutdown = sdw_shutdown,
|
.shutdown = sdw_shutdown,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue