module_adapter: Extend the module interface for endpoint devices

Introduce a new struct module_endpoint_ops which contains all the ops
that are relevant for endpoint devices (host copier and DAI copier) and
add a new field for setting the endpoint_ops.

These will be needed when the copier component is converted to use the
module adapter interface.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
This commit is contained in:
Ranjani Sridharan 2023-05-31 09:06:57 -07:00 committed by Liam Girdwood
parent 5433e371b8
commit 9cc6454df6
1 changed files with 75 additions and 0 deletions

View File

@ -67,6 +67,79 @@ struct output_stream_buffer {
uint32_t size; /* size of data in the buffer */
};
/**
* \struct module_endpoint_ops
* \brief Ops relevant only for the endpoint devices such as the host copier or DAI copier.
* Other modules should not implement these.
*/
struct module_endpoint_ops {
/**
* Returns total data processed in number bytes.
* @param dev Component device
* @param stream_no Index of input/output stream
* @param input Selects between input (true) or output (false) stream direction
* @return total data processed if succeeded, 0 otherwise.
*/
uint64_t (*get_total_data_processed)(struct comp_dev *dev, uint32_t stream_no, bool input);
/**
* Retrieves component rendering position.
* @param dev Component device.
* @param posn Receives reported position.
*/
int (*position)(struct comp_dev *dev, struct sof_ipc_stream_posn *posn);
/**
* Configures timestamping in attached DAI.
* @param dev Component device.
*
* Mandatory for components that allocate DAI.
*/
int (*dai_ts_config)(struct comp_dev *dev);
/**
* Starts timestamping.
* @param dev Component device.
*
* Mandatory for components that allocate DAI.
*/
int (*dai_ts_start)(struct comp_dev *dev);
/**
* Stops timestamping.
* @param dev Component device.
*
* Mandatory for components that allocate DAI.
*/
int (*dai_ts_stop)(struct comp_dev *dev);
/**
* Gets timestamp.
* @param dev Component device.
* @param tsd Receives timestamp data.
*
* Mandatory for components that allocate DAI.
*/
int (*dai_ts_get)(struct comp_dev *dev, struct timestamp_data *tsd);
/**
* Fetches hardware stream parameters.
* @param dev Component device.
* @param params Receives copy of stream parameters retrieved from
* DAI hw settings.
* @param dir Stream direction (see enum sof_ipc_stream_direction).
*
* Mandatory for components that allocate DAI.
*/
int (*dai_get_hw_params)(struct comp_dev *dev,
struct sof_ipc_stream_params *params, int dir);
/**
* Triggers device state.
* @param dev Component device.
* @param cmd Trigger command.
*/
int (*trigger)(struct comp_dev *dev, int cmd);
};
struct processing_module;
/**
* \struct module_interface
@ -197,6 +270,8 @@ struct module_interface {
* Module specific unbind procedure, called when modules are disconnected from one another
*/
int (*unbind)(struct processing_module *mod, void *data);
const struct module_endpoint_ops *endpoint_ops;
};
/* Convert first_block/last_block indicator to fragment position */