Skip to content

Commit 0dcdf84

Browse files
lyakhbroonie
authored andcommitted
ASoC: SOF: add a "core" parameter to widget loading functions
We want to be able to explicitly assign cores to individual pipeline components. This patch adds a "core" parameter to widget loading functions to be sent to the DSP for appropriate component scheduling. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20200902140756.1427005-2-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent f4c4b1b commit 0dcdf84

2 files changed

Lines changed: 50 additions & 27 deletions

File tree

‎sound/soc/sof/sof-priv.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ extern int sof_core_debug;
5454
(IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_ENABLE_DEBUGFS_CACHE) || \
5555
IS_ENABLED(CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST))
5656

57+
/* So far the primary core on all DSPs has ID 0 */
58+
#define SOF_DSP_PRIMARY_CORE 0
59+
5760
/* DSP power state */
5861
enum sof_dsp_power_states {
5962
SOF_DSP_PM_D0,

‎sound/soc/sof/topology.c‎

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp,
13601360
}
13611361

13621362
static int sof_widget_load_dai(struct snd_soc_component *scomp, int index,
1363-
struct snd_sof_widget *swidget,
1363+
struct snd_sof_widget *swidget, int core,
13641364
struct snd_soc_tplg_dapm_widget *tw,
13651365
struct sof_ipc_comp_reply *r,
13661366
struct snd_sof_dai *dai)
@@ -1377,6 +1377,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index,
13771377
comp_dai.comp.id = swidget->comp_id;
13781378
comp_dai.comp.type = SOF_COMP_DAI;
13791379
comp_dai.comp.pipeline_id = index;
1380+
comp_dai.comp.core = core;
13801381
comp_dai.config.hdr.size = sizeof(comp_dai.config);
13811382

13821383
ret = sof_parse_tokens(scomp, &comp_dai, dai_tokens,
@@ -1417,7 +1418,7 @@ static int sof_widget_load_dai(struct snd_soc_component *scomp, int index,
14171418
*/
14181419

14191420
static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index,
1420-
struct snd_sof_widget *swidget,
1421+
struct snd_sof_widget *swidget, int core,
14211422
struct snd_soc_tplg_dapm_widget *tw,
14221423
struct sof_ipc_comp_reply *r)
14231424
{
@@ -1436,6 +1437,7 @@ static int sof_widget_load_buffer(struct snd_soc_component *scomp, int index,
14361437
buffer->comp.id = swidget->comp_id;
14371438
buffer->comp.type = SOF_COMP_BUFFER;
14381439
buffer->comp.pipeline_id = index;
1440+
buffer->comp.core = core;
14391441

14401442
ret = sof_parse_tokens(scomp, buffer, buffer_tokens,
14411443
ARRAY_SIZE(buffer_tokens), private->array,
@@ -1487,7 +1489,7 @@ static int spcm_bind(struct snd_soc_component *scomp, struct snd_sof_pcm *spcm,
14871489
*/
14881490

14891491
static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index,
1490-
struct snd_sof_widget *swidget,
1492+
struct snd_sof_widget *swidget, int core,
14911493
enum sof_ipc_stream_direction dir,
14921494
struct snd_soc_tplg_dapm_widget *tw,
14931495
struct sof_ipc_comp_reply *r)
@@ -1507,6 +1509,7 @@ static int sof_widget_load_pcm(struct snd_soc_component *scomp, int index,
15071509
host->comp.id = swidget->comp_id;
15081510
host->comp.type = SOF_COMP_HOST;
15091511
host->comp.pipeline_id = index;
1512+
host->comp.core = core;
15101513
host->direction = dir;
15111514
host->config.hdr.size = sizeof(host->config);
15121515

@@ -1592,8 +1595,8 @@ int sof_load_pipeline_ipc(struct device *dev,
15921595
return ret;
15931596
}
15941597

1595-
static int sof_widget_load_pipeline(struct snd_soc_component *scomp,
1596-
int index, struct snd_sof_widget *swidget,
1598+
static int sof_widget_load_pipeline(struct snd_soc_component *scomp, int index,
1599+
struct snd_sof_widget *swidget,
15971600
struct snd_soc_tplg_dapm_widget *tw,
15981601
struct sof_ipc_comp_reply *r)
15991602
{
@@ -1655,7 +1658,7 @@ static int sof_widget_load_pipeline(struct snd_soc_component *scomp,
16551658
*/
16561659

16571660
static int sof_widget_load_mixer(struct snd_soc_component *scomp, int index,
1658-
struct snd_sof_widget *swidget,
1661+
struct snd_sof_widget *swidget, int core,
16591662
struct snd_soc_tplg_dapm_widget *tw,
16601663
struct sof_ipc_comp_reply *r)
16611664
{
@@ -1674,6 +1677,7 @@ static int sof_widget_load_mixer(struct snd_soc_component *scomp, int index,
16741677
mixer->comp.id = swidget->comp_id;
16751678
mixer->comp.type = SOF_COMP_MIXER;
16761679
mixer->comp.pipeline_id = index;
1680+
mixer->comp.core = core;
16771681
mixer->config.hdr.size = sizeof(mixer->config);
16781682

16791683
ret = sof_parse_tokens(scomp, &mixer->config, comp_tokens,
@@ -1702,7 +1706,7 @@ static int sof_widget_load_mixer(struct snd_soc_component *scomp, int index,
17021706
* Mux topology
17031707
*/
17041708
static int sof_widget_load_mux(struct snd_soc_component *scomp, int index,
1705-
struct snd_sof_widget *swidget,
1709+
struct snd_sof_widget *swidget, int core,
17061710
struct snd_soc_tplg_dapm_widget *tw,
17071711
struct sof_ipc_comp_reply *r)
17081712
{
@@ -1721,6 +1725,7 @@ static int sof_widget_load_mux(struct snd_soc_component *scomp, int index,
17211725
mux->comp.id = swidget->comp_id;
17221726
mux->comp.type = SOF_COMP_MUX;
17231727
mux->comp.pipeline_id = index;
1728+
mux->comp.core = core;
17241729
mux->config.hdr.size = sizeof(mux->config);
17251730

17261731
ret = sof_parse_tokens(scomp, &mux->config, comp_tokens,
@@ -1750,7 +1755,7 @@ static int sof_widget_load_mux(struct snd_soc_component *scomp, int index,
17501755
*/
17511756

17521757
static int sof_widget_load_pga(struct snd_soc_component *scomp, int index,
1753-
struct snd_sof_widget *swidget,
1758+
struct snd_sof_widget *swidget, int core,
17541759
struct snd_soc_tplg_dapm_widget *tw,
17551760
struct sof_ipc_comp_reply *r)
17561761
{
@@ -1779,6 +1784,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index,
17791784
volume->comp.id = swidget->comp_id;
17801785
volume->comp.type = SOF_COMP_VOLUME;
17811786
volume->comp.pipeline_id = index;
1787+
volume->comp.core = core;
17821788
volume->config.hdr.size = sizeof(volume->config);
17831789

17841790
ret = sof_parse_tokens(scomp, volume, volume_tokens,
@@ -1828,7 +1834,7 @@ static int sof_widget_load_pga(struct snd_soc_component *scomp, int index,
18281834
*/
18291835

18301836
static int sof_widget_load_src(struct snd_soc_component *scomp, int index,
1831-
struct snd_sof_widget *swidget,
1837+
struct snd_sof_widget *swidget, int core,
18321838
struct snd_soc_tplg_dapm_widget *tw,
18331839
struct sof_ipc_comp_reply *r)
18341840
{
@@ -1847,6 +1853,7 @@ static int sof_widget_load_src(struct snd_soc_component *scomp, int index,
18471853
src->comp.id = swidget->comp_id;
18481854
src->comp.type = SOF_COMP_SRC;
18491855
src->comp.pipeline_id = index;
1856+
src->comp.core = core;
18501857
src->config.hdr.size = sizeof(src->config);
18511858

18521859
ret = sof_parse_tokens(scomp, src, src_tokens,
@@ -1887,7 +1894,7 @@ static int sof_widget_load_src(struct snd_soc_component *scomp, int index,
18871894
*/
18881895

18891896
static int sof_widget_load_asrc(struct snd_soc_component *scomp, int index,
1890-
struct snd_sof_widget *swidget,
1897+
struct snd_sof_widget *swidget, int core,
18911898
struct snd_soc_tplg_dapm_widget *tw,
18921899
struct sof_ipc_comp_reply *r)
18931900
{
@@ -1906,6 +1913,7 @@ static int sof_widget_load_asrc(struct snd_soc_component *scomp, int index,
19061913
asrc->comp.id = swidget->comp_id;
19071914
asrc->comp.type = SOF_COMP_ASRC;
19081915
asrc->comp.pipeline_id = index;
1916+
asrc->comp.core = core;
19091917
asrc->config.hdr.size = sizeof(asrc->config);
19101918

19111919
ret = sof_parse_tokens(scomp, asrc, asrc_tokens,
@@ -1948,7 +1956,7 @@ static int sof_widget_load_asrc(struct snd_soc_component *scomp, int index,
19481956
*/
19491957

19501958
static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index,
1951-
struct snd_sof_widget *swidget,
1959+
struct snd_sof_widget *swidget, int core,
19521960
struct snd_soc_tplg_dapm_widget *tw,
19531961
struct sof_ipc_comp_reply *r)
19541962
{
@@ -1967,6 +1975,7 @@ static int sof_widget_load_siggen(struct snd_soc_component *scomp, int index,
19671975
tone->comp.id = swidget->comp_id;
19681976
tone->comp.type = SOF_COMP_TONE;
19691977
tone->comp.pipeline_id = index;
1978+
tone->comp.core = core;
19701979
tone->config.hdr.size = sizeof(tone->config);
19711980

19721981
ret = sof_parse_tokens(scomp, tone, tone_tokens,
@@ -2204,7 +2213,7 @@ static int sof_process_load(struct snd_soc_component *scomp, int index,
22042213
*/
22052214

22062215
static int sof_widget_load_process(struct snd_soc_component *scomp, int index,
2207-
struct snd_sof_widget *swidget,
2216+
struct snd_sof_widget *swidget, int core,
22082217
struct snd_soc_tplg_dapm_widget *tw,
22092218
struct sof_ipc_comp_reply *r)
22102219
{
@@ -2219,6 +2228,7 @@ static int sof_widget_load_process(struct snd_soc_component *scomp, int index,
22192228
}
22202229

22212230
memset(&config, 0, sizeof(config));
2231+
config.comp.core = core;
22222232

22232233
/* get the process token */
22242234
ret = sof_parse_tokens(scomp, &config, process_tokens,
@@ -2283,6 +2293,9 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
22832293
struct snd_sof_dai *dai;
22842294
struct sof_ipc_comp_reply reply;
22852295
struct snd_sof_control *scontrol;
2296+
struct sof_ipc_comp comp = {
2297+
.core = SOF_DSP_PRIMARY_CORE,
2298+
};
22862299
int ret = 0;
22872300

22882301
swidget = kzalloc(sizeof(*swidget), GFP_KERNEL);
@@ -2313,8 +2326,8 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
23132326
return -ENOMEM;
23142327
}
23152328

2316-
ret = sof_widget_load_dai(scomp, index, swidget, tw, &reply,
2317-
dai);
2329+
ret = sof_widget_load_dai(scomp, index, swidget, comp.core,
2330+
tw, &reply, dai);
23182331
if (ret == 0) {
23192332
sof_connect_dai_widget(scomp, w, tw, dai);
23202333
list_add(&dai->list, &sdev->dai_list);
@@ -2324,10 +2337,12 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
23242337
}
23252338
break;
23262339
case snd_soc_dapm_mixer:
2327-
ret = sof_widget_load_mixer(scomp, index, swidget, tw, &reply);
2340+
ret = sof_widget_load_mixer(scomp, index, swidget, comp.core,
2341+
tw, &reply);
23282342
break;
23292343
case snd_soc_dapm_pga:
2330-
ret = sof_widget_load_pga(scomp, index, swidget, tw, &reply);
2344+
ret = sof_widget_load_pga(scomp, index, swidget, comp.core,
2345+
tw, &reply);
23312346
/* Find scontrol for this pga and set readback offset*/
23322347
list_for_each_entry(scontrol, &sdev->kcontrol_list, list) {
23332348
if (scontrol->comp_id == swidget->comp_id) {
@@ -2337,36 +2352,41 @@ static int sof_widget_ready(struct snd_soc_component *scomp, int index,
23372352
}
23382353
break;
23392354
case snd_soc_dapm_buffer:
2340-
ret = sof_widget_load_buffer(scomp, index, swidget, tw, &reply);
2355+
ret = sof_widget_load_buffer(scomp, index, swidget, comp.core,
2356+
tw, &reply);
23412357
break;
23422358
case snd_soc_dapm_scheduler:
2343-
ret = sof_widget_load_pipeline(scomp, index, swidget, tw,
2344-
&reply);
2359+
ret = sof_widget_load_pipeline(scomp, index, swidget,
2360+
tw, &reply);
23452361
break;
23462362
case snd_soc_dapm_aif_out:
2347-
ret = sof_widget_load_pcm(scomp, index, swidget,
2363+
ret = sof_widget_load_pcm(scomp, index, swidget, comp.core,
23482364
SOF_IPC_STREAM_CAPTURE, tw, &reply);
23492365
break;
23502366
case snd_soc_dapm_aif_in:
2351-
ret = sof_widget_load_pcm(scomp, index, swidget,
2367+
ret = sof_widget_load_pcm(scomp, index, swidget, comp.core,
23522368
SOF_IPC_STREAM_PLAYBACK, tw, &reply);
23532369
break;
23542370
case snd_soc_dapm_src:
2355-
ret = sof_widget_load_src(scomp, index, swidget, tw, &reply);
2371+
ret = sof_widget_load_src(scomp, index, swidget, comp.core,
2372+
tw, &reply);
23562373
break;
23572374
case snd_soc_dapm_asrc:
2358-
ret = sof_widget_load_asrc(scomp, index, swidget, tw, &reply);
2375+
ret = sof_widget_load_asrc(scomp, index, swidget, comp.core,
2376+
tw, &reply);
23592377
break;
23602378
case snd_soc_dapm_siggen:
2361-
ret = sof_widget_load_siggen(scomp, index, swidget, tw, &reply);
2379+
ret = sof_widget_load_siggen(scomp, index, swidget, comp.core,
2380+
tw, &reply);
23622381
break;
23632382
case snd_soc_dapm_effect:
2364-
ret = sof_widget_load_process(scomp, index, swidget, tw,
2365-
&reply);
2383+
ret = sof_widget_load_process(scomp, index, swidget, comp.core,
2384+
tw, &reply);
23662385
break;
23672386
case snd_soc_dapm_mux:
23682387
case snd_soc_dapm_demux:
2369-
ret = sof_widget_load_mux(scomp, index, swidget, tw, &reply);
2388+
ret = sof_widget_load_mux(scomp, index, swidget, comp.core,
2389+
tw, &reply);
23702390
break;
23712391
case snd_soc_dapm_switch:
23722392
case snd_soc_dapm_dai_link:

0 commit comments

Comments
 (0)