-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] treewide: zephyr: add sof_ prefix to dma_get/put() and struct dma #9728
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,8 +207,13 @@ int platform_ipc_init(struct ipc *ipc) | |
PLATFORM_PAGE_TABLE_SIZE); | ||
if (iipc->dh_buffer.page_table) | ||
bzero(iipc->dh_buffer.page_table, PLATFORM_PAGE_TABLE_SIZE); | ||
#if CONFIG_ZEPHYR_NATIVE_DRIVERS | ||
iipc->dh_buffer.dmac = sof_dma_get(SOF_DMA_DIR_HMEM_TO_LMEM, 0, SOF_DMA_DEV_HOST, | ||
SOF_DMA_ACCESS_SHARED); | ||
#else | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be removed with #9608 . |
||
iipc->dh_buffer.dmac = dma_get(SOF_DMA_DIR_HMEM_TO_LMEM, 0, SOF_DMA_DEV_HOST, | ||
SOF_DMA_ACCESS_SHARED); | ||
#endif | ||
if (!iipc->dh_buffer.dmac) { | ||
tr_err(&ipc_tr, "Unable to find DMA for host page table"); | ||
sof_panic(SOF_IPC_PANIC_IPC); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,7 +121,7 @@ enum sof_dma_cb_status { | |
/* Attributes have been ported to Zephyr. This condition is necessary until full support of | ||
* CONFIG_SOF_ZEPHYR_STRICT_HEADERS. | ||
*/ | ||
struct dma; | ||
struct sof_dma; | ||
|
||
/** | ||
* \brief Element of SG list (as array item). | ||
|
@@ -193,7 +193,7 @@ struct dma_plat_data { | |
uint32_t period_count; | ||
}; | ||
|
||
struct dma { | ||
struct sof_dma { | ||
struct dma_plat_data plat_data; | ||
struct k_spinlock lock; /**< locking mechanism */ | ||
int sref; /**< simple ref counter, guarded by lock */ | ||
|
@@ -204,8 +204,20 @@ struct dma { | |
void *priv_data; | ||
}; | ||
|
||
/* | ||
* Note: typedef use like this is generally avoided in SOF, | ||
* but this is an exceptional case to handle SOF platforms | ||
* that can be built with both Zephyr and XTOS drivers (like imx8). | ||
* Once no users left, this can be removed. | ||
*/ | ||
#if CONFIG_ZEPHYR_NATIVE_DRIVERS | ||
typedef struct sof_dma sof_dma; | ||
#else | ||
typedef struct dma sof_dma; | ||
#endif | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK I admit this is starting to get (too?) ugly. This is really only needed for the few cases where SOF Zephyr is built with using XTOS drivers. One alternative is to convert the naming also in all XTOS code, but it is quite massive amount of change as this affects most drivers and most platform code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its going to be short term, so will be removed at some point. |
||
struct dma_chan_data { | ||
struct dma *dma; | ||
sof_dma *dma; | ||
|
||
uint32_t status; | ||
uint32_t direction; | ||
|
@@ -223,14 +235,14 @@ struct dma_chan_data { | |
}; | ||
|
||
struct dma_info { | ||
struct dma *dma_array; | ||
sof_dma *dma_array; | ||
size_t num_dmas; | ||
}; | ||
|
||
/* generic DMA DSP <-> Host copier */ | ||
struct dma_copy { | ||
struct dma_chan_data *chan; | ||
struct dma *dmac; | ||
struct sof_dma *dmac; | ||
}; | ||
|
||
struct audio_stream; | ||
|
@@ -253,14 +265,14 @@ int dmac_init(struct sof *sof); | |
* For exclusive access, ret DMAC with no channels draining. | ||
* For shared access, ret DMAC with the least number of channels draining. | ||
*/ | ||
struct dma *dma_get(uint32_t dir, uint32_t caps, uint32_t dev, uint32_t flags); | ||
struct sof_dma *sof_dma_get(uint32_t dir, uint32_t caps, uint32_t dev, uint32_t flags); | ||
|
||
/** | ||
* \brief API to release a platform DMAC. | ||
* | ||
* @param[in] dma DMAC to relese. | ||
*/ | ||
void dma_put(struct dma *dma); | ||
void sof_dma_put(struct sof_dma *dma); | ||
|
||
#ifndef CONFIG_ZEPHYR_NATIVE_DRIVERS | ||
#include "dma-legacy.h" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good example of code where the namespacing helps readability. If you expand this function you can see calls to e.g. dma_get_attribute() (which is a Zephyr DMA call).