mirror of https://github.com/thesofproject/sof.git
ipc4: dai: Expose dai_zephyr_position()
Expose and use the function in the copier. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
parent
8dd0adcd33
commit
20d84ce4ea
|
@ -1925,17 +1925,27 @@ static int copier_get_attribute(struct comp_dev *dev, uint32_t type, void *value
|
|||
static int copier_position(struct comp_dev *dev, struct sof_ipc_stream_posn *posn)
|
||||
{
|
||||
struct copier_data *cd = comp_get_drvdata(dev);
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
/* Exit if no endpoints */
|
||||
if (!cd->endpoint_num)
|
||||
return -EINVAL;
|
||||
|
||||
if (dev->ipc_config.type == SOF_COMP_HOST && !cd->ipc_gtw) {
|
||||
posn->host_posn = cd->hd->local_pos;
|
||||
ret = posn->host_posn;
|
||||
} else {
|
||||
ret = comp_position(cd->endpoint[IPC4_COPIER_GATEWAY_PIN], posn);
|
||||
switch (dev->ipc_config.type) {
|
||||
case SOF_COMP_HOST:
|
||||
if (!cd->ipc_gtw) {
|
||||
posn->host_posn = cd->hd->local_pos;
|
||||
ret = posn->host_posn;
|
||||
} else {
|
||||
/* handle gtw case */
|
||||
ret = comp_position(cd->endpoint[IPC4_COPIER_GATEWAY_PIN], posn);
|
||||
}
|
||||
break;
|
||||
case SOF_COMP_DAI:
|
||||
ret = dai_zephyr_position(cd->dd[0], cd->endpoint[IPC4_COPIER_GATEWAY_PIN], posn);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
/* Return position from the default gateway pin */
|
||||
return ret;
|
||||
|
|
|
@ -29,4 +29,7 @@ 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);
|
||||
|
||||
int dai_zephyr_position(struct dai_data *dd, struct comp_dev *dev,
|
||||
struct sof_ipc_stream_posn *posn);
|
||||
#endif /* __SOF_LIB_DAI_COPIER_H__ */
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <sof/audio/buffer.h>
|
||||
#include <sof/audio/component_ext.h>
|
||||
#include <sof/audio/dai_copier.h>
|
||||
#include <sof/audio/ipc-config.h>
|
||||
#include <sof/common.h>
|
||||
#include <sof/drivers/alh.h>
|
||||
|
@ -346,8 +347,8 @@ int dai_config(struct comp_dev *dev, struct ipc_config_dai *common_config,
|
|||
}
|
||||
|
||||
#if CONFIG_ZEPHYR_NATIVE_DRIVERS
|
||||
static int dai_zephyr_position(struct dai_data *dd, struct comp_dev *dev,
|
||||
struct sof_ipc_stream_posn *posn)
|
||||
int dai_zephyr_position(struct dai_data *dd, struct comp_dev *dev,
|
||||
struct sof_ipc_stream_posn *posn)
|
||||
{
|
||||
struct dma_status status;
|
||||
int ret;
|
||||
|
@ -399,8 +400,8 @@ void dai_dma_position_update(struct comp_dev *dev)
|
|||
mailbox_sw_regs_write(dd->slot_info.reg_offset, &slot, sizeof(slot));
|
||||
}
|
||||
#else
|
||||
static int dai_zephyr_position(struct dai_data *dd, struct comp_dev *dev,
|
||||
struct sof_ipc_stream_posn *posn)
|
||||
int dai_zephyr_position(struct dai_data *dd, struct comp_dev *dev,
|
||||
struct sof_ipc_stream_posn *posn)
|
||||
{
|
||||
struct dma_chan_status status;
|
||||
|
||||
|
|
Loading…
Reference in New Issue