forked from Minki/linux
ASoC: SOF: set swidget's core for scheduler widget
Set the swidget's core for scheduler type widgets to match that of the pipeline core. This simplifies the flow for core get/put during widget setup/free. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220307181111.49392-4-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
80df222626
commit
3a790f3a7c
@ -103,7 +103,7 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
|
|||||||
.id = swidget->comp_id,
|
.id = swidget->comp_id,
|
||||||
};
|
};
|
||||||
struct sof_ipc_reply reply;
|
struct sof_ipc_reply reply;
|
||||||
int ret, ret1, core;
|
int ret, ret1;
|
||||||
|
|
||||||
if (!swidget->private)
|
if (!swidget->private)
|
||||||
return 0;
|
return 0;
|
||||||
@ -112,14 +112,9 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
|
|||||||
if (--swidget->use_count)
|
if (--swidget->use_count)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
core = swidget->core;
|
|
||||||
|
|
||||||
switch (swidget->id) {
|
switch (swidget->id) {
|
||||||
case snd_soc_dapm_scheduler:
|
case snd_soc_dapm_scheduler:
|
||||||
{
|
{
|
||||||
const struct sof_ipc_pipe_new *pipeline = swidget->private;
|
|
||||||
|
|
||||||
core = pipeline->core;
|
|
||||||
ipc_free.hdr.cmd |= SOF_IPC_TPLG_PIPE_FREE;
|
ipc_free.hdr.cmd |= SOF_IPC_TPLG_PIPE_FREE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -149,10 +144,10 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
|
|||||||
* disable widget core. continue to route setup status and complete flag
|
* disable widget core. continue to route setup status and complete flag
|
||||||
* even if this fails and return the appropriate error
|
* even if this fails and return the appropriate error
|
||||||
*/
|
*/
|
||||||
ret1 = snd_sof_dsp_core_put(sdev, core);
|
ret1 = snd_sof_dsp_core_put(sdev, swidget->core);
|
||||||
if (ret1 < 0) {
|
if (ret1 < 0) {
|
||||||
dev_err(sdev->dev, "error: failed to disable target core: %d for widget %s\n",
|
dev_err(sdev->dev, "error: failed to disable target core: %d for widget %s\n",
|
||||||
core, swidget->widget->name);
|
swidget->core, swidget->widget->name);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
ret = ret1;
|
ret = ret1;
|
||||||
}
|
}
|
||||||
@ -177,7 +172,6 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
|
|||||||
struct snd_sof_dai *dai;
|
struct snd_sof_dai *dai;
|
||||||
size_t ipc_size;
|
size_t ipc_size;
|
||||||
int ret;
|
int ret;
|
||||||
int core;
|
|
||||||
|
|
||||||
/* skip if there is no private data */
|
/* skip if there is no private data */
|
||||||
if (!swidget->private)
|
if (!swidget->private)
|
||||||
@ -187,15 +181,8 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
|
|||||||
if (++swidget->use_count > 1)
|
if (++swidget->use_count > 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* set core ID */
|
|
||||||
core = swidget->core;
|
|
||||||
if (swidget->id == snd_soc_dapm_scheduler) {
|
|
||||||
pipeline = swidget->private;
|
|
||||||
core = pipeline->core;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* enable widget core */
|
/* enable widget core */
|
||||||
ret = snd_sof_dsp_core_get(sdev, core);
|
ret = snd_sof_dsp_core_get(sdev, swidget->core);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(sdev->dev, "error: failed to enable target core for widget %s\n",
|
dev_err(sdev->dev, "error: failed to enable target core for widget %s\n",
|
||||||
swidget->widget->name);
|
swidget->widget->name);
|
||||||
@ -275,7 +262,7 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
core_put:
|
core_put:
|
||||||
snd_sof_dsp_core_put(sdev, core);
|
snd_sof_dsp_core_put(sdev, swidget->core);
|
||||||
use_count_dec:
|
use_count_dec:
|
||||||
swidget->use_count--;
|
swidget->use_count--;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1707,6 +1707,7 @@ static int sof_widget_load_pipeline(struct snd_soc_component *scomp, int index,
|
|||||||
pipeline->period_mips, pipeline->core, pipeline->frames_per_sched,
|
pipeline->period_mips, pipeline->core, pipeline->frames_per_sched,
|
||||||
swidget->dynamic_pipeline_widget);
|
swidget->dynamic_pipeline_widget);
|
||||||
|
|
||||||
|
swidget->core = pipeline->core;
|
||||||
swidget->private = pipeline;
|
swidget->private = pipeline;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user