Skip to content

Commit 3288000

Browse files
committed
treewide: zephyr: add sof_ prefix to dma_get/put() and struct dma
Add "sof_" namespace to dma_get()/put() in the Zephyr native drivers builds. The main "struct dma" is also renamed, so this touches quite many places in code. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 9132233 commit 3288000

File tree

11 files changed

+29
-21
lines changed

11 files changed

+29
-21
lines changed

src/audio/chain_dma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ struct chain_dma_data {
6161
#endif
6262

6363
/* local host DMA config */
64-
struct dma *dma_host;
64+
struct sof_dma *dma_host;
6565
struct dma_chan_data *chan_host;
6666
struct dma_config z_config_host;
6767
struct dma_block_config dma_block_cfg_host;
6868

6969
/* local link DMA config */
70-
struct dma *dma_link;
70+
struct sof_dma *dma_link;
7171
struct dma_chan_data *chan_link;
7272
struct dma_config z_config_link;
7373
struct dma_block_config dma_block_cfg_link;

src/audio/copier/host_copier.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ struct hc_buf {
4848
*/
4949
struct host_data {
5050
/* local DMA config */
51+
#if CONFIG_ZEPHYR_NATIVE_DRIVERS
52+
struct sof_dma *dma;
53+
#else
5154
struct dma *dma;
55+
#endif
5256
struct dma_chan_data *chan;
5357
struct dma_sg_config config;
5458
#ifdef __ZEPHYR__

src/include/sof/ipc/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ void ipc_free(struct ipc *ipc);
125125
*/
126126
struct ipc_data_host_buffer {
127127
/* DMA */
128+
#if CONFIG_ZEPHYR_NATIVE_DRIVERS
129+
struct sof_dma *dmac;
130+
#else
128131
struct dma *dmac;
132+
#endif
129133
uint8_t *page_table;
130134
};
131135

src/include/sof/lib/dai-zephyr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct dai_data {
125125
struct comp_buffer *local_buffer;
126126
struct dai_ts_cfg ts_config;
127127
struct dai *dai;
128-
struct dma *dma;
128+
struct sof_dma *dma;
129129
struct dai_group *group; /* NULL if no group assigned */
130130
int xrun; /* true if we are doing xrun recovery */
131131

src/ipc/ipc3/host-page-table.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static int ipc_parse_page_descriptors(uint8_t *page_table,
8585
/*
8686
* Copy the audio buffer page tables from the host to the DSP max of 4K.
8787
*/
88-
static int ipc_get_page_descriptors(struct dma *dmac, uint8_t *page_table,
88+
static int ipc_get_page_descriptors(struct sof_dma *dmac, uint8_t *page_table,
8989
struct sof_ipc_host_buffer *ring)
9090
{
9191
struct dma_config cfg;

src/lib/dma.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ SOF_DEFINE_REG_UUID(dma);
3434
DECLARE_TR_CTX(dma_tr, SOF_UUID(dma_uuid), LOG_LEVEL_INFO);
3535

3636
#if CONFIG_ZEPHYR_NATIVE_DRIVERS
37-
static int dma_init(struct dma *dma);
37+
static int dma_init(struct sof_dma *dma);
3838

39-
struct dma *sof_dma_get(uint32_t dir, uint32_t cap, uint32_t dev, uint32_t flags)
39+
struct sof_dma *sof_dma_get(uint32_t dir, uint32_t cap, uint32_t dev, uint32_t flags)
4040
{
4141
const struct dma_info *info = dma_info_get();
4242
int users, ret = 0;
4343
int min_users = INT32_MAX;
44-
struct dma *d = NULL, *dmin = NULL;
44+
struct sof_dma *d = NULL, *dmin = NULL;
4545
k_spinlock_key_t key;
4646

4747
if (!info->num_dmas) {
@@ -129,7 +129,7 @@ struct dma *sof_dma_get(uint32_t dir, uint32_t cap, uint32_t dev, uint32_t flags
129129
return !ret ? dmin : NULL;
130130
}
131131

132-
void sof_dma_put(struct dma *dma)
132+
void sof_dma_put(struct sof_dma *dma)
133133
{
134134
k_spinlock_key_t key;
135135

@@ -144,7 +144,7 @@ void sof_dma_put(struct dma *dma)
144144
k_spin_unlock(&dma->lock, key);
145145
}
146146

147-
static int dma_init(struct dma *dma)
147+
static int dma_init(struct sof_dma *dma)
148148
{
149149
struct dma_chan_data *chan;
150150
int i;

src/library_manager/lib_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ SOF_DEFINE_REG_UUID(lib_manager);
5353
DECLARE_TR_CTX(lib_manager_tr, SOF_UUID(lib_manager_uuid), LOG_LEVEL_INFO);
5454

5555
struct lib_manager_dma_ext {
56-
struct dma *dma;
56+
struct sof_dma *dma;
5757
struct dma_chan_data *chan;
5858
uintptr_t dma_addr; /**< buffer start pointer */
5959
uint32_t addr_align;

src/platform/imx8m/lib/dma.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static SHARED_DATA struct dma dma[PLATFORM_NUM_DMACS] = {
4242
};
4343

4444
static const struct dma_info lib_dma = {
45-
.dma_array = cache_to_uncache_init((struct dma *)dma),
45+
.dma_array = cache_to_uncache_init((void *)dma),
4646
.num_dmas = ARRAY_SIZE(dma)
4747
};
4848

src/platform/posix/dma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ DEVICE_DEFINE(pzdma2, "pzdma2", pzdma_init, NULL, &pzdma2_data, &pzdma2_cfg,
176176
DEVICE_DEFINE(pzdma3, "pzdma3", pzdma_init, NULL, &pzdma3_data, &pzdma3_cfg,
177177
POST_KERNEL, 0, &pzdma_api);
178178

179-
struct dma posix_sof_dma[4];
179+
struct sof_dma posix_sof_dma[4];
180180

181181
const struct dma_info posix_sof_dma_info = {
182182
.dma_array = posix_sof_dma,
@@ -194,7 +194,7 @@ void posix_dma_init(struct sof *sof)
194194
};
195195

196196
for (int i = 0; i < ARRAY_SIZE(posix_sof_dma); i++) {
197-
posix_sof_dma[i] = (struct dma) {};
197+
posix_sof_dma[i] = (struct sof_dma) {};
198198
posix_sof_dma[i].plat_data.dir = 0xffffffff;
199199
posix_sof_dma[i].plat_data.caps = 0xffffffff;
200200
posix_sof_dma[i].plat_data.devs = 0xffffffff;

zephyr/include/sof/lib/dma.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ enum sof_dma_cb_status {
122122
/* Attributes have been ported to Zephyr. This condition is necessary until full support of
123123
* CONFIG_SOF_ZEPHYR_STRICT_HEADERS.
124124
*/
125-
struct dma;
125+
struct sof_dma;
126126

127127
/**
128128
* \brief Element of SG list (as array item).
@@ -194,7 +194,7 @@ struct dma_plat_data {
194194
uint32_t period_count;
195195
};
196196

197-
struct dma {
197+
struct sof_dma {
198198
struct dma_plat_data plat_data;
199199
struct k_spinlock lock; /**< locking mechanism */
200200
int sref; /**< simple ref counter, guarded by lock */
@@ -206,7 +206,7 @@ struct dma {
206206
};
207207

208208
struct dma_chan_data {
209-
struct dma *dma;
209+
struct sof_dma *dma;
210210

211211
uint32_t status;
212212
uint32_t direction;
@@ -224,14 +224,14 @@ struct dma_chan_data {
224224
};
225225

226226
struct dma_info {
227-
struct dma *dma_array;
227+
struct sof_dma *dma_array;
228228
size_t num_dmas;
229229
};
230230

231231
/* generic DMA DSP <-> Host copier */
232232
struct dma_copy {
233233
struct dma_chan_data *chan;
234-
struct dma *dmac;
234+
struct sof_dma *dmac;
235235
};
236236

237237
struct audio_stream;
@@ -254,14 +254,14 @@ int dmac_init(struct sof *sof);
254254
* For exclusive access, ret DMAC with no channels draining.
255255
* For shared access, ret DMAC with the least number of channels draining.
256256
*/
257-
struct dma *sof_dma_get(uint32_t dir, uint32_t caps, uint32_t dev, uint32_t flags);
257+
struct sof_dma *sof_dma_get(uint32_t dir, uint32_t caps, uint32_t dev, uint32_t flags);
258258

259259
/**
260260
* \brief API to release a platform DMAC.
261261
*
262262
* @param[in] dma DMAC to relese.
263263
*/
264-
void sof_dma_put(struct dma *dma);
264+
void sof_dma_put(struct sof_dma *dma);
265265

266266
#ifndef CONFIG_ZEPHYR_NATIVE_DRIVERS
267267
#include "dma-legacy.h"

0 commit comments

Comments
 (0)