Skip to content

Commit 59a7281

Browse files
ranj063plbossart
authored andcommitted
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>
1 parent b74f81f commit 59a7281

2 files changed

Lines changed: 6 additions & 18 deletions

File tree

sound/soc/sof/sof-audio.c

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
8989
.id = swidget->comp_id,
9090
};
9191
struct sof_ipc_reply reply;
92-
int ret, ret1, core;
92+
int ret, ret1;
9393

9494
if (!swidget->private)
9595
return 0;
@@ -98,14 +98,9 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
9898
if (--swidget->use_count)
9999
return 0;
100100

101-
core = swidget->core;
102-
103101
switch (swidget->id) {
104102
case snd_soc_dapm_scheduler:
105103
{
106-
const struct sof_ipc_pipe_new *pipeline = swidget->private;
107-
108-
core = pipeline->core;
109104
ipc_free.hdr.cmd |= SOF_IPC_TPLG_PIPE_FREE;
110105
break;
111106
}
@@ -135,10 +130,10 @@ int sof_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
135130
* disable widget core. continue to route setup status and complete flag
136131
* even if this fails and return the appropriate error
137132
*/
138-
ret1 = snd_sof_dsp_core_put(sdev, core);
133+
ret1 = snd_sof_dsp_core_put(sdev, swidget->core);
139134
if (ret1 < 0) {
140135
dev_err(sdev->dev, "error: failed to disable target core: %d for widget %s\n",
141-
core, swidget->widget->name);
136+
swidget->core, swidget->widget->name);
142137
if (!ret)
143138
ret = ret1;
144139
}
@@ -163,7 +158,6 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
163158
struct snd_sof_dai *dai;
164159
size_t ipc_size;
165160
int ret;
166-
int core;
167161

168162
/* skip if there is no private data */
169163
if (!swidget->private)
@@ -173,15 +167,8 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
173167
if (++swidget->use_count > 1)
174168
return 0;
175169

176-
/* set core ID */
177-
core = swidget->core;
178-
if (swidget->id == snd_soc_dapm_scheduler) {
179-
pipeline = swidget->private;
180-
core = pipeline->core;
181-
}
182-
183170
/* enable widget core */
184-
ret = snd_sof_dsp_core_get(sdev, core);
171+
ret = snd_sof_dsp_core_get(sdev, swidget->core);
185172
if (ret < 0) {
186173
dev_err(sdev->dev, "error: failed to enable target core for widget %s\n",
187174
swidget->widget->name);
@@ -261,7 +248,7 @@ int sof_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget)
261248
return 0;
262249

263250
core_put:
264-
snd_sof_dsp_core_put(sdev, core);
251+
snd_sof_dsp_core_put(sdev, swidget->core);
265252
use_count_dec:
266253
swidget->use_count--;
267254
return ret;

sound/soc/sof/topology.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,7 @@ static int sof_widget_load_pipeline(struct snd_soc_component *scomp, int index,
17071707
pipeline->period_mips, pipeline->core, pipeline->frames_per_sched,
17081708
swidget->dynamic_pipeline_widget);
17091709

1710+
swidget->core = pipeline->core;
17101711
swidget->private = pipeline;
17111712

17121713
return 0;

0 commit comments

Comments
 (0)