Skip to content

Commit

Permalink
lib: dai: Expose Zephyr DAI device retrieval function
Browse files Browse the repository at this point in the history
This patch exposes the function to retrieve a pointer to the Zephyr
device structure for a DAI of a given type and index. Previously, the
function `dai_get_zephyr_device` was static and only usable within
`dai.c`. By introducing `dai_get_device`, other parts of the SOF
codebase can now access the Zephyr DAI device pointers, facilitating
integration with Zephyr native DAI drivers.

Signed-off-by: Tomasz Leman <[email protected]>
  • Loading branch information
tmleman committed Jul 29, 2024
1 parent 9bc0d04 commit 64ce0b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/include/sof/lib/dai-zephyr.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,11 @@ void dai_dma_position_update(struct dai_data *dd, struct comp_dev *dev);
* \brief release llp slot
*/
void dai_release_llp_slot(struct dai_data *dd);

/**
* \brief Retrieve a pointer to the Zephyr device structure for a DAI of a given type and index.
*/
const struct device *dai_get_device(uint32_t type, uint32_t index);
/** @}*/

#endif /* __SOF_LIB_DAI_ZEPHYR_H__ */
4 changes: 2 additions & 2 deletions src/lib/dai.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const struct device *zephyr_dev[] = {
#endif
};

static const struct device *dai_get_zephyr_device(uint32_t type, uint32_t index)
const struct device *dai_get_device(uint32_t type, uint32_t index)
{
struct dai_config cfg;
int dir;
Expand Down Expand Up @@ -211,7 +211,7 @@ struct dai *dai_get(uint32_t type, uint32_t index, uint32_t flags)
const struct device *dev;
struct dai *d;

dev = dai_get_zephyr_device(type, index);
dev = dai_get_device(type, index);
if (!dev) {
tr_err(&dai_tr, "dai_get: failed to get dai with index %d type %d",
index, type);
Expand Down

0 comments on commit 64ce0b9

Please sign in to comment.