dai-zephyr/dai-legacy: Expose dai_zephyr_trigger()

Expose and use the function in the single endpoint DAI case in the
copier device in preparation to remove the creation of DAI component.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
Baofeng Tian 2023-03-13 21:45:17 +08:00 committed by Kai Vehmanen
parent 89764c048f
commit 066e7d70f4
4 changed files with 34 additions and 14 deletions

View File

@ -1083,23 +1083,41 @@ static int copier_comp_trigger(struct comp_dev *dev, int cmd)
if (ret == COMP_STATUS_STATE_ALREADY_SET)
return PPL_STATUS_PATH_STOP;
if (dev->ipc_config.type == SOF_COMP_HOST && !cd->ipc_gtw) {
ret = host_zephyr_trigger(cd->hd, dev, cmd);
if (ret < 0)
return ret;
}
for (i = 0; i < cd->endpoint_num; i++) {
if (dev->ipc_config.type != SOF_COMP_HOST || cd->ipc_gtw) {
ret = cd->endpoint[i]->drv->ops.trigger(cd->endpoint[i], cmd);
switch (dev->ipc_config.type) {
case SOF_COMP_HOST:
if (!cd->ipc_gtw) {
ret = host_zephyr_trigger(cd->hd, dev, cmd);
if (ret < 0)
break;
return ret;
} else {
/* handle gtw case */
for (i = 0; i < cd->endpoint_num; i++) {
ret = cd->endpoint[i]->drv->ops.trigger(cd->endpoint[i], cmd);
if (ret < 0)
return ret;
}
}
break;
case SOF_COMP_DAI:
if (cd->endpoint_num == 1) {
ret = dai_zephyr_trigger(cd->dd[0], cd->endpoint[0], cmd);
if (ret < 0)
return ret;
} else {
for (i = 0; i < cd->endpoint_num; i++) {
ret = cd->endpoint[i]->drv->ops.trigger(cd->endpoint[i], cmd);
if (ret < 0)
return ret;
}
}
break;
default:
break;
}
/* For capture cd->pipeline_reg_offset == 0 */
if (ret < 0 || !cd->endpoint_num || !cd->pipeline_reg_offset)
return ret;
if (!cd->endpoint_num || !cd->pipeline_reg_offset)
return 0;
dai_copier = pipeline_get_dai_comp_latency(dev->pipeline->pipeline_id, &latency);
if (!dai_copier) {

View File

@ -866,7 +866,7 @@ static int dai_comp_trigger_internal(struct dai_data *dd, struct comp_dev *dev,
return ret;
}
static int dai_zephyr_trigger(struct dai_data *dd, struct comp_dev *dev, int cmd)
int dai_zephyr_trigger(struct dai_data *dd, struct comp_dev *dev, int cmd)
{
struct dai_group *group = dd->group;
uint32_t irq_flags;

View File

@ -1153,7 +1153,7 @@ static int dai_comp_trigger_internal(struct dai_data *dd, struct comp_dev *dev,
return ret;
}
static int dai_zephyr_trigger(struct dai_data *dd, struct comp_dev *dev, int cmd)
int dai_zephyr_trigger(struct dai_data *dd, struct comp_dev *dev, int cmd)
{
struct dai_group *group = dd->group;
uint32_t irq_flags;

View File

@ -27,4 +27,6 @@ int dai_zephyr_config_prepare(struct dai_data *dd, struct comp_dev *dev);
int dai_zephyr_prepare(struct dai_data *dd, struct comp_dev *dev);
void dai_zephyr_reset(struct dai_data *dd, struct comp_dev *dev);
int dai_zephyr_trigger(struct dai_data *dd, struct comp_dev *dev, int cmd);
#endif /* __SOF_LIB_DAI_COPIER_H__ */