From 07ad21df435bca3bd4b6fdd4db5e0decbf78a042 Mon Sep 17 00:00:00 2001 From: Andrula Song Date: Tue, 31 Oct 2023 10:12:56 +0800 Subject: [PATCH] Audio: ASRC: Add IPC4 DAI timestamp ops Add IPC4 DAI timestamp ops for ASRC. Signed-off-by: Andrula Song --- src/audio/asrc/asrc.c | 57 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/src/audio/asrc/asrc.c b/src/audio/asrc/asrc.c index fae2cc1f08b9..9dc4c965cdc5 100644 --- a/src/audio/asrc/asrc.c +++ b/src/audio/asrc/asrc.c @@ -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) @@ -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) {