Skip to content

Commit

Permalink
Audio: ASRC: Add IPC4 DAI timestamp ops
Browse files Browse the repository at this point in the history
Add IPC4 DAI timestamp ops for ASRC.

Signed-off-by: Andrula Song <[email protected]>
  • Loading branch information
andrula-song committed Nov 7, 2023
1 parent f8a9591 commit 07ad21d
Showing 1 changed file with 52 additions and 5 deletions.
57 changes: 52 additions & 5 deletions src/audio/asrc/asrc.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,56 @@ static int asrc_dai_find(struct comp_dev *dev, struct comp_data *cd)
return 0;
}

#if CONFIG_IPC_MAJOR_4
static int asrc_dai_configure_timestamp(struct comp_data *cd)
{
if (cd->dai_dev) {
struct processing_module *mod = comp_get_drvdata(cd->dai_dev);
struct module_data *md = &mod->priv;

return md->ops->endpoint_ops->dai_ts_config(cd->dai_dev);
}

return -EINVAL;
}

static int asrc_dai_start_timestamp(struct comp_data *cd)
{
if (cd->dai_dev) {
struct processing_module *mod = comp_get_drvdata(cd->dai_dev);
struct module_data *md = &mod->priv;

return md->ops->endpoint_ops->dai_ts_start(cd->dai_dev);
}

return -EINVAL;
}

static int asrc_dai_stop_timestamp(struct comp_data *cd)
{
if (cd->dai_dev) {
struct processing_module *mod = comp_get_drvdata(cd->dai_dev);
struct module_data *md = &mod->priv;

return md->ops->endpoint_ops->dai_ts_stop(cd->dai_dev);
}

return -EINVAL;
}

static int asrc_dai_get_timestamp(struct comp_data *cd,
struct dai_ts_data *tsd)
{
if (cd->dai_dev) {
struct processing_module *mod = comp_get_drvdata(cd->dai_dev);
struct module_data *md = &mod->priv;

return md->ops->endpoint_ops->dai_ts_get(cd->dai_dev, tsd);
}

return -EINVAL;
}
#else
static int asrc_dai_configure_timestamp(struct comp_data *cd)
{
if (cd->dai_dev)
Expand All @@ -669,17 +719,14 @@ static int asrc_dai_stop_timestamp(struct comp_data *cd)
return -EINVAL;
}

#if CONFIG_ZEPHYR_NATIVE_DRIVERS
static int asrc_dai_get_timestamp(struct comp_data *cd, struct dai_ts_data *tsd)
#else
static int asrc_dai_get_timestamp(struct comp_data *cd, struct timestamp_data *tsd)
#endif
static int asrc_dai_get_timestamp(struct comp_data *cd, struct timestamp_data *tsd)
{
if (!cd->dai_dev)
return -EINVAL;

return cd->dai_dev->drv->ops.dai_ts_get(cd->dai_dev, tsd);
}
#endif

static int asrc_trigger(struct comp_dev *dev, int cmd)
{
Expand Down

0 comments on commit 07ad21d

Please sign in to comment.