diff --git a/src/audio/asrc/asrc.c b/src/audio/asrc/asrc.c index dbefb7ba14c6..ef8e41ee87a4 100644 --- a/src/audio/asrc/asrc.c +++ b/src/audio/asrc/asrc.c @@ -681,8 +681,11 @@ static int asrc_dai_stop_timestamp(struct comp_data *cd) return -EINVAL; } -static int asrc_dai_get_timestamp(struct comp_data *cd, - struct timestamp_data *tsd) +#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 { if (!cd->dai_dev) return -EINVAL; @@ -909,7 +912,11 @@ static int asrc_prepare(struct comp_dev *dev) static int asrc_control_loop(struct comp_dev *dev, struct comp_data *cd) { +#if CONFIG_ZEPHYR_NATIVE_DRIVERS + struct dai_ts_data tsd; +#else struct timestamp_data tsd; +#endif int64_t tmp; int32_t delta_sample; int32_t delta_ts; diff --git a/src/audio/copier/copier.c b/src/audio/copier/copier.c index de45b6273e85..b115a16df212 100644 --- a/src/audio/copier/copier.c +++ b/src/audio/copier/copier.c @@ -940,7 +940,11 @@ static int copier_dai_ts_start_op(struct comp_dev *dev) return dai_common_ts_start(dd, dev); } +#if CONFIG_ZEPHYR_NATIVE_DRIVERS +static int copier_dai_ts_get_op(struct comp_dev *dev, struct dai_ts_data *tsd) +#else static int copier_dai_ts_get_op(struct comp_dev *dev, struct timestamp_data *tsd) +#endif { struct processing_module *mod = comp_get_drvdata(dev); struct copier_data *cd = module_get_private_data(mod); diff --git a/src/audio/dai-zephyr.c b/src/audio/dai-zephyr.c index 96467d044dae..c892873420a1 100644 --- a/src/audio/dai-zephyr.c +++ b/src/audio/dai-zephyr.c @@ -1721,15 +1721,14 @@ static int dai_ts_start_op(struct comp_dev *dev) return dai_common_ts_start(dd, dev); } -int dai_common_ts_get(struct dai_data *dd, struct comp_dev *dev, struct timestamp_data *tsd) +int dai_common_ts_get(struct dai_data *dd, struct comp_dev *dev, struct dai_ts_data *tsd) { - struct dai_ts_data *tsdata = (struct dai_ts_data *)tsd; struct dai_ts_cfg *cfg = (struct dai_ts_cfg *)&dd->ts_config; - return dai_ts_get(dd->dai->dev, cfg, tsdata); + return dai_ts_get(dd->dai->dev, cfg, tsd); } -static int dai_ts_get_op(struct comp_dev *dev, struct timestamp_data *tsd) +static int dai_ts_get_op(struct comp_dev *dev, struct dai_ts_data *tsd) { struct dai_data *dd = comp_get_drvdata(dev); diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index dace298fa5f8..5257d8fa23af 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -1566,7 +1566,11 @@ int module_adapter_ts_stop_op(struct comp_dev *dev) * 0 - success * value < 0 - failure. */ +#if CONFIG_ZEPHYR_NATIVE_DRIVERS +int module_adapter_ts_get_op(struct comp_dev *dev, struct dai_ts_data *tsd) +#else int module_adapter_ts_get_op(struct comp_dev *dev, struct timestamp_data *tsd) +#endif { struct processing_module *mod = comp_get_drvdata(dev); struct module_data *md = &mod->priv; diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index b4a61d765e21..01f004ab9fc9 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -48,6 +48,7 @@ struct comp_dev; struct sof_ipc_stream_posn; struct dai_hw_params; struct timestamp_data; +struct dai_ts_data; /** \addtogroup component_api Component API * @{ @@ -455,8 +456,12 @@ struct comp_ops { * * Mandatory for components that allocate DAI. */ +#if CONFIG_ZEPHYR_NATIVE_DRIVERS + int (*dai_ts_get)(struct comp_dev *dev, struct dai_ts_data *tsd); +#else int (*dai_ts_get)(struct comp_dev *dev, struct timestamp_data *tsd); +#endif /** * Bind, atomic - used to notify component of bind event. diff --git a/src/include/sof/audio/dai_copier.h b/src/include/sof/audio/dai_copier.h index 6219b92fb5b7..67165cb6d265 100644 --- a/src/include/sof/audio/dai_copier.h +++ b/src/include/sof/audio/dai_copier.h @@ -44,7 +44,11 @@ int dai_common_ts_start(struct dai_data *dd, struct comp_dev *dev); int dai_common_ts_stop(struct dai_data *dd, struct comp_dev *dev); +#if CONFIG_ZEPHYR_NATIVE_DRIVERS +int dai_common_ts_get(struct dai_data *dd, struct comp_dev *dev, struct dai_ts_data *tsd); +#else int dai_common_ts_get(struct dai_data *dd, struct comp_dev *dev, struct timestamp_data *tsd); +#endif int dai_common_get_hw_params(struct dai_data *dd, struct comp_dev *dev, struct sof_ipc_stream_params *params, int dir); diff --git a/src/include/sof/audio/module_adapter/module/generic.h b/src/include/sof/audio/module_adapter/module/generic.h index b101e458f6cc..2c9fd2d88afa 100644 --- a/src/include/sof/audio/module_adapter/module/generic.h +++ b/src/include/sof/audio/module_adapter/module/generic.h @@ -313,7 +313,11 @@ int module_adapter_position(struct comp_dev *dev, struct sof_ipc_stream_posn *po int module_adapter_ts_config_op(struct comp_dev *dev); int module_adapter_ts_start_op(struct comp_dev *dev); int module_adapter_ts_stop_op(struct comp_dev *dev); +#if CONFIG_ZEPHYR_NATIVE_DRIVERS +int module_adapter_ts_get_op(struct comp_dev *dev, struct dai_ts_data *tsd); +#else int module_adapter_ts_get_op(struct comp_dev *dev, struct timestamp_data *tsd); +#endif static inline void module_update_buffer_position(struct input_stream_buffer *input_buffers, struct output_stream_buffer *output_buffers, diff --git a/src/include/sof/audio/module_adapter/module/module_interface.h b/src/include/sof/audio/module_adapter/module/module_interface.h index fab3cefdc0ef..70884e493861 100644 --- a/src/include/sof/audio/module_adapter/module/module_interface.h +++ b/src/include/sof/audio/module_adapter/module/module_interface.h @@ -69,6 +69,7 @@ struct output_stream_buffer { struct comp_dev; struct timestamp_data; +struct dai_ts_data; /** * \struct module_endpoint_ops * \brief Ops relevant only for the endpoint devices such as the host copier or DAI copier. @@ -120,7 +121,11 @@ struct module_endpoint_ops { * * Mandatory for components that allocate DAI. */ +#if CONFIG_ZEPHYR_NATIVE_DRIVERS + int (*dai_ts_get)(struct comp_dev *dev, struct dai_ts_data *tsd); +#else int (*dai_ts_get)(struct comp_dev *dev, struct timestamp_data *tsd); +#endif /** * Fetches hardware stream parameters. diff --git a/src/include/sof/drivers/timestamp.h b/src/include/sof/drivers/timestamp.h deleted file mode 100644 index ff867dc1e33b..000000000000 --- a/src/include/sof/drivers/timestamp.h +++ /dev/null @@ -1,36 +0,0 @@ -/* SPDX-License-Identifier: BSD-3-Clause - * - * Copyright(c) 2019 Intel Corporation. All rights reserved. - */ - -#ifndef __SOF_DRIVERS_TIMESTAMP_H__ -#define __SOF_DRIVERS_TIMESTAMP_H__ - -#include - -struct dai; -struct timestamp_cfg; -struct timestamp_data; - -/* HDA */ -int timestamp_hda_config(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_hda_start(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_hda_stop(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_hda_get(struct dai *dai, struct timestamp_cfg *cfg, - struct timestamp_data *tsd); - -/* DMIC */ -int timestamp_dmic_config(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_dmic_start(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_dmic_stop(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_dmic_get(struct dai *dai, struct timestamp_cfg *cfg, - struct timestamp_data *tsd); - -/* SSP */ -int timestamp_ssp_config(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_ssp_start(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_ssp_stop(struct dai *dai, struct timestamp_cfg *cfg); -int timestamp_ssp_get(struct dai *dai, struct timestamp_cfg *cfg, - struct timestamp_data *tsd); - -#endif /* __SOF_DRIVERS_TIMESTAMP_H__ */ diff --git a/src/include/sof/lib/dai-zephyr.h b/src/include/sof/lib/dai-zephyr.h index 49fbd2e02aa8..65ae27ddf9ac 100644 --- a/src/include/sof/lib/dai-zephyr.h +++ b/src/include/sof/lib/dai-zephyr.h @@ -33,6 +33,7 @@ #include #include #include +#include /** \addtogroup sof_dai_drivers DAI Drivers * DAI Drivers API specification. @@ -61,21 +62,6 @@ struct timestamp_cfg { int dma_chan_index; /* Used GPDMA channel */ int dma_chan_count; /* Channels in single GPDMA */ }; - -struct timestamp_data { - uint64_t walclk; /* Wall clock */ - uint64_t sample; /* Sample count */ - uint32_t walclk_rate; /* Rate in Hz, e.g. 19200000 */ -}; - -struct timestamp_ops { - int (*ts_config)(struct dai *dai, struct timestamp_cfg *cfg); - int (*ts_start)(struct dai *dai, struct timestamp_cfg *cfg); - int (*ts_stop)(struct dai *dai, struct timestamp_cfg *cfg); - int (*ts_get)(struct dai *dai, struct timestamp_cfg *cfg, - struct timestamp_data *tsd); -}; - union hdalink_cfg { uint16_t full; struct {