ASoC: SOF: topology: make sof_route_load() IPC agnostic
The IPC structure can be set up using the fields in struct snd_sof_route when the pipeline connections are established. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220308164344.577647-13-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Родитель
7a976552a4
Коммит
2b4b383f85
|
@ -259,28 +259,25 @@ EXPORT_SYMBOL(sof_widget_setup);
|
|||
|
||||
static int sof_route_setup_ipc(struct snd_sof_dev *sdev, struct snd_sof_route *sroute)
|
||||
{
|
||||
struct sof_ipc_pipe_comp_connect *connect;
|
||||
struct sof_ipc_pipe_comp_connect connect;
|
||||
struct sof_ipc_reply reply;
|
||||
int ret;
|
||||
|
||||
/* skip if there's no private data */
|
||||
if (!sroute->private)
|
||||
return 0;
|
||||
|
||||
/* nothing to do if route is already set up */
|
||||
if (sroute->setup)
|
||||
return 0;
|
||||
|
||||
connect = sroute->private;
|
||||
connect.hdr.size = sizeof(connect);
|
||||
connect.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_COMP_CONNECT;
|
||||
connect.source_id = sroute->src_widget->comp_id;
|
||||
connect.sink_id = sroute->sink_widget->comp_id;
|
||||
|
||||
dev_dbg(sdev->dev, "setting up route %s -> %s\n",
|
||||
sroute->src_widget->widget->name,
|
||||
sroute->sink_widget->widget->name);
|
||||
|
||||
/* send ipc */
|
||||
ret = sof_ipc_tx_message(sdev->ipc,
|
||||
connect->hdr.cmd,
|
||||
connect, sizeof(*connect),
|
||||
ret = sof_ipc_tx_message(sdev->ipc, connect.hdr.cmd, &connect, sizeof(connect),
|
||||
&reply, sizeof(reply));
|
||||
if (ret < 0) {
|
||||
dev_err(sdev->dev, "%s: route setup failed %d\n", __func__, ret);
|
||||
|
|
|
@ -3322,7 +3322,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
|
|||
struct snd_soc_dapm_route *route)
|
||||
{
|
||||
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
|
||||
struct sof_ipc_pipe_comp_connect *connect;
|
||||
struct snd_sof_widget *source_swidget, *sink_swidget;
|
||||
struct snd_soc_dobj *dobj = &route->dobj;
|
||||
struct snd_sof_route *sroute;
|
||||
|
@ -3334,16 +3333,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
|
|||
return -ENOMEM;
|
||||
|
||||
sroute->scomp = scomp;
|
||||
|
||||
connect = kzalloc(sizeof(*connect), GFP_KERNEL);
|
||||
if (!connect) {
|
||||
kfree(sroute);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
connect->hdr.size = sizeof(*connect);
|
||||
connect->hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_COMP_CONNECT;
|
||||
|
||||
dev_dbg(scomp->dev, "sink %s control %s source %s\n",
|
||||
route->sink, route->control ? route->control : "none",
|
||||
route->source);
|
||||
|
@ -3367,8 +3356,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
|
|||
source_swidget->id == snd_soc_dapm_output)
|
||||
goto err;
|
||||
|
||||
connect->source_id = source_swidget->comp_id;
|
||||
|
||||
/* sink component */
|
||||
sink_swidget = snd_sof_find_swidget(scomp, (char *)route->sink);
|
||||
if (!sink_swidget) {
|
||||
|
@ -3386,8 +3373,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
|
|||
sink_swidget->id == snd_soc_dapm_output)
|
||||
goto err;
|
||||
|
||||
connect->sink_id = sink_swidget->comp_id;
|
||||
|
||||
/*
|
||||
* For virtual routes, both sink and source are not
|
||||
* buffer. Since only buffer linked to component is supported by
|
||||
|
@ -3402,7 +3387,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
|
|||
} else {
|
||||
sroute->route = route;
|
||||
dobj->private = sroute;
|
||||
sroute->private = connect;
|
||||
sroute->src_widget = source_swidget;
|
||||
sroute->sink_widget = sink_swidget;
|
||||
|
||||
|
@ -3413,7 +3397,6 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
|
|||
}
|
||||
|
||||
err:
|
||||
kfree(connect);
|
||||
kfree(sroute);
|
||||
return ret;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче