Skip to content

Commit

Permalink
platform: posix: remove non-native DMA stub driver
Browse files Browse the repository at this point in the history
Simplify the stub DMA driver in posix builds. As the posix platform is
built on the Zephyr posix support, there's no need to support builds
with XTOS DMA driver interface. Drop the XTOS DMA driver interface
support and default to native Zephyr DMA interface. A minimal dma_info
description needs to be kept as this is (still) used in SOF dma_get() to
choose the right DMA instance to use.

Signed-off-by: Kai Vehmanen <[email protected]>
  • Loading branch information
kv2019i committed Dec 12, 2024
1 parent 96197c0 commit 0afc8ac
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/platform/posix/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@
#include <zephyr/drivers/dma.h>
#include <sof/lib/dma.h>

/* SOF and Zephyr's API seems to have diverged here. But this seems
* like dead code; nothing passes these?
*/
#ifdef CONFIG_ZEPHYR_NATIVE_DRIVERS
#define DMA_ATTR_BUFFER_ALIGNMENT DMA_ATTR_BUFFER_SIZE_ALIGNMENT
#define DMA_ATTR_BUFFER_PERIOD_COUNT 3
#endif

/* Zephyr "DMA" stub device */

#define NUM_CHANS 2
Expand Down Expand Up @@ -184,33 +176,6 @@ DEVICE_DEFINE(pzdma2, "pzdma2", pzdma_init, NULL, &pzdma2_data, &pzdma2_cfg,
DEVICE_DEFINE(pzdma3, "pzdma3", pzdma_init, NULL, &pzdma3_data, &pzdma3_cfg,
POST_KERNEL, 0, &pzdma_api);

/* SOF DMA device definition */

static int posix_dma_get_attribute(struct dma *dma, uint32_t type, uint32_t *val)
{
if (type == DMA_ATTR_BUFFER_ALIGNMENT) {
*val = 4;
} else if (type == DMA_ATTR_COPY_ALIGNMENT) {
*val = 4;
} else if (type == DMA_ATTR_BUFFER_ADDRESS_ALIGNMENT) {
*val = 4;
} else if (type == DMA_ATTR_BUFFER_PERIOD_COUNT) {
/* Not sure clear what this means, seems like a
* built-in lever to control "make the buffer this
* many periods long", not really a hardware
* attribute...
*/
*val = 2;
} else {
return -EINVAL;
}
return 0;
}

const struct dma_ops posix_sof_dma_ops = {
.get_attribute = posix_dma_get_attribute,
};

struct dma posix_sof_dma[4];

const struct dma_info posix_sof_dma_info = {
Expand All @@ -234,7 +199,6 @@ void posix_dma_init(struct sof *sof)
posix_sof_dma[i].plat_data.caps = 0xffffffff;
posix_sof_dma[i].plat_data.devs = 0xffffffff;
posix_sof_dma[i].plat_data.channels = NUM_CHANS;
posix_sof_dma[i].ops = &posix_sof_dma_ops;
posix_sof_dma[i].z_dev = devs[i];
};

Expand Down

0 comments on commit 0afc8ac

Please sign in to comment.