[Sound-open-firmware] [PATCH v3 0/6] Introducing new dma_get() API
This set of patches proposes a new API for dma_get() that procures a DMAC based on the requested copy capability and flags indicating shared/exclusive access. It also updates the existing user of dma_get() to use the new API based on the specific usage. The API uses the number of channels draning in each DMAC to balance the load between the platform DMAC's for users requesting shared access privilege. This provides a primitive level of QoS and prevents overloading any DMAC.
The platform DMAC definitions have also been updated to include information about copy capabilities supported and the type of DMA.
Test Results: 1. Minnowboard Turbot w 5651: Sanity test Score 10/11. Failed Simultaneous playback & capture feature test. This issue is unrelated to this patch.
2. Up Squared Board w Hifiberry DAC+: Sanity Test Score: 6/11 Failed Capture feature tests as the hifiberry doesnt support capture but passed all other feature tests.
Kernel: https://github.com/thesofproject/linux branch: topic/dev SOF Repo: https://github.com/thesofproject/linux/sof branch:master SOFT: https://github.com/thesofproject/linux/sof branch: master
v2 changes: 1. dma_get() consolidated for all platforms 2. dmac definitions include copy capability 3. Added some helper api's to retreive platform DMAC info
v3 changes: 1. Not RFC anymore. First set of real patches with new API. 2. Added type of DMA to platform DMAC definitions 3. Updated atomic arithmetic calls
Ranjani Sridharan (6): platform: dma: move dmac initialization dma: update platform DMAC definitions with capabilities dma: introduce parameter to store the number of channels draining dma: Introduce new API for dma_get() dma: update dma users with the new API dma: trace: dma_copy_new() does not need DMAC ID anymore
src/arch/xtensa/Makefile.am | 1 + src/audio/dai.c | 5 +- src/audio/host.c | 18 +++-- src/drivers/dw-dma.c | 11 +++ src/drivers/hda-dma.c | 8 ++ src/host/common_test.c | 2 +- src/include/sof/dma.h | 29 ++++++- src/ipc/apl-ipc.c | 6 +- src/ipc/byt-ipc.c | 7 +- src/ipc/cnl-ipc.c | 6 +- src/ipc/dma-copy.c | 7 +- src/ipc/hsw-ipc.c | 7 +- src/lib/Makefile.am | 11 +++ src/lib/dma-trace.c | 2 +- src/lib/dma.c | 80 +++++++++++++++++++ src/platform/apollolake/dma.c | 28 +++++-- .../apollolake/include/platform/dma.h | 5 ++ .../apollolake/include/platform/platform.h | 3 - src/platform/apollolake/platform.c | 22 +---- src/platform/baytrail/dma.c | 33 ++++++-- src/platform/baytrail/include/platform/dma.h | 9 +++ .../baytrail/include/platform/platform.h | 3 - src/platform/baytrail/platform.c | 23 +----- src/platform/cannonlake/dma.c | 28 +++++-- .../cannonlake/include/platform/dma.h | 6 ++ .../cannonlake/include/platform/platform.h | 3 - src/platform/cannonlake/platform.c | 23 +----- src/platform/haswell/dma.c | 38 ++++++--- src/platform/haswell/include/platform/dma.h | 5 ++ .../haswell/include/platform/platform.h | 3 - src/platform/haswell/platform.c | 21 +---- 31 files changed, 312 insertions(+), 141 deletions(-) create mode 100644 src/lib/dma.c
This patch proposes to move the platform DMAC initialization code to the dmac_init() routine.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- src/include/sof/dma.h | 3 +++ src/platform/apollolake/dma.c | 18 ++++++++++++++++++ src/platform/apollolake/platform.c | 22 +++------------------- src/platform/baytrail/dma.c | 18 ++++++++++++++++++ src/platform/baytrail/platform.c | 23 +++-------------------- src/platform/cannonlake/dma.c | 18 ++++++++++++++++++ src/platform/cannonlake/platform.c | 23 +++-------------------- src/platform/haswell/dma.c | 25 +++++++++++++++++++++++++ src/platform/haswell/platform.c | 21 +++------------------ 9 files changed, 94 insertions(+), 77 deletions(-)
diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index 7ba1298..af15d14 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -140,6 +140,9 @@ struct dma_int {
struct dma *dma_get(int dmac_id);
+/* initialize all platform DMAC's */ +int dmac_init(void); + #define dma_set_drvdata(dma, data) \ dma->private = data #define dma_get_drvdata(dma) \ diff --git a/src/platform/apollolake/dma.c b/src/platform/apollolake/dma.c index 90dde96..39cde9e 100644 --- a/src/platform/apollolake/dma.c +++ b/src/platform/apollolake/dma.c @@ -181,3 +181,21 @@ struct dma *dma_get(int dmac_id)
return NULL; } + +/* Initialize all platform DMAC's */ +int dmac_init(void) +{ + int i, ret; + + for (i = 0; i < ARRAY_SIZE(dma); i++) { + ret = dma_probe(&dma[i]); + if (ret < 0) { + + /* trace failed DMAC ID */ + trace_error_value(dma[i].plat_data.id); + return ret; + } + } + + return 0; +} diff --git a/src/platform/apollolake/platform.c b/src/platform/apollolake/platform.c index 0b26ae5..a523b46 100644 --- a/src/platform/apollolake/platform.c +++ b/src/platform/apollolake/platform.c @@ -186,10 +186,9 @@ static void platform_memory_windows_init(void)
int platform_init(struct sof *sof) { - struct dma *dmac; struct dai *ssp; struct dai *dmic0; - int i; + int i, ret;
platform_interrupt_init();
@@ -244,25 +243,10 @@ int platform_init(struct sof *sof)
/* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); - dmac = dma_get(DMA_GP_LP_DMAC0); - if (dmac == NULL) + ret = dmac_init(); + if (ret < 0) return -ENODEV; - dma_probe(dmac);
- dmac = dma_get(DMA_GP_LP_DMAC1); - if (dmac == NULL) - return -ENODEV; - dma_probe(dmac); - - dmac = dma_get(DMA_HOST_OUT_DMAC); - if (dmac == NULL) - return -ENODEV; - dma_probe(dmac); - - dmac = dma_get(DMA_HOST_IN_DMAC); - if (dmac == NULL) - return -ENODEV; - dma_probe(dmac);
/* init SSP ports */ trace_point(TRACE_BOOT_PLATFORM_SSP); diff --git a/src/platform/baytrail/dma.c b/src/platform/baytrail/dma.c index 53602f5..1e84402 100644 --- a/src/platform/baytrail/dma.c +++ b/src/platform/baytrail/dma.c @@ -186,3 +186,21 @@ struct dma *dma_get(int dmac_id)
return NULL; } + +/* Initialize all platform DMAC's */ +int dmac_init(void) +{ + int i, ret; + + for (i = 0; i < ARRAY_SIZE(dma); i++) { + ret = dma_probe(&dma[i]); + if (ret < 0) { + + /* trace failed DMAC ID */ + trace_error_value(dma[i].plat_data.id); + return ret; + } + } + + return 0; +} diff --git a/src/platform/baytrail/platform.c b/src/platform/baytrail/platform.c index 562fabf..3b0d381 100644 --- a/src/platform/baytrail/platform.c +++ b/src/platform/baytrail/platform.c @@ -290,15 +290,10 @@ void platform_interrupt_unmask(uint32_t irq, uint32_t mask) int platform_init(struct sof *sof) { #if defined CONFIG_BAYTRAIL - struct dma *dmac0; - struct dma *dmac1; struct dai *ssp0; struct dai *ssp1; struct dai *ssp2; #elif defined CONFIG_CHERRYTRAIL - struct dma *dmac0; - struct dma *dmac1; - struct dma *dmac2; struct dai *ssp0; struct dai *ssp1; struct dai *ssp2; @@ -308,6 +303,7 @@ int platform_init(struct sof *sof) #else #error Undefined platform #endif + int ret;
trace_point(TRACE_BOOT_PLATFORM_MBOX);
@@ -356,22 +352,9 @@ int platform_init(struct sof *sof)
/* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); - dmac0 = dma_get(DMA_ID_DMAC0); - if (dmac0 == NULL) + ret = dmac_init(); + if (ret < 0) return -ENODEV; - dma_probe(dmac0); - - dmac1 = dma_get(DMA_ID_DMAC1); - if (dmac1 == NULL) - return -ENODEV; - dma_probe(dmac1); - -#if defined CONFIG_CHERRYTRAIL - dmac2 = dma_get(DMA_ID_DMAC1); - if (dmac2 == NULL) - return -ENODEV; - dma_probe(dmac2); -#endif
/* mask SSP 0 - 2 interrupts */ shim_write(SHIM_PIMR, shim_read(SHIM_PIMR) | 0x00000038); diff --git a/src/platform/cannonlake/dma.c b/src/platform/cannonlake/dma.c index 3f9d6cb..e8d0938 100644 --- a/src/platform/cannonlake/dma.c +++ b/src/platform/cannonlake/dma.c @@ -182,3 +182,21 @@ struct dma *dma_get(int dmac_id)
return NULL; } + +/* Initialize all platform DMAC's */ +int dmac_init(void) +{ + int i, ret; + + for (i = 0; i < ARRAY_SIZE(dma); i++) { + ret = dma_probe(&dma[i]); + if (ret < 0) { + + /* trace failed DMAC ID */ + trace_error_value(dma[i].plat_data.id); + return ret; + } + } + + return 0; +} diff --git a/src/platform/cannonlake/platform.c b/src/platform/cannonlake/platform.c index 2e85088..54c146c 100644 --- a/src/platform/cannonlake/platform.c +++ b/src/platform/cannonlake/platform.c @@ -208,10 +208,9 @@ static struct timer platform_ext_timer = {
int platform_init(struct sof *sof) { - struct dma *dmac; struct dai *ssp; struct dai *dmic0; - int i; + int i, ret;
trace_point(TRACE_BOOT_PLATFORM_ENTRY); platform_init_hw(); @@ -261,25 +260,9 @@ int platform_init(struct sof *sof)
/* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); - dmac = dma_get(DMA_GP_LP_DMAC0); - if (!dmac) + ret = dmac_init(); + if (ret < 0) return -ENODEV; - dma_probe(dmac); - - dmac = dma_get(DMA_GP_LP_DMAC1); - if (!dmac) - return -ENODEV; - dma_probe(dmac); - - dmac = dma_get(DMA_HOST_OUT_DMAC); - if (!dmac) - return -ENODEV; - dma_probe(dmac); - - dmac = dma_get(DMA_HOST_IN_DMAC); - if (!dmac) - return -ENODEV; - dma_probe(dmac);
/* init SSP ports */ trace_point(TRACE_BOOT_PLATFORM_SSP); diff --git a/src/platform/haswell/dma.c b/src/platform/haswell/dma.c index 42df546..5beb086 100644 --- a/src/platform/haswell/dma.c +++ b/src/platform/haswell/dma.c @@ -135,3 +135,28 @@ struct dma *dma_get(int dmac_id) return NULL; } } + +/* Initialize all platform DMAC's */ +int dmac_init(void) +{ + int i, ret; + + for (i = 0; i < ARRAY_SIZE(dma); i++) { + ret = dma_probe(&dma[i]); + if (ret < 0) { + + /* trace failed DMAC ID */ + trace_error_value(dma[i].plat_data.id); + return ret; + } + } + + /* clear the masks for dsp of the dmacs */ + io_reg_update_bits(SHIM_BASE + SHIM_IMRD, + SHIM_IMRD_DMAC0, 0); + + io_reg_update_bits(SHIM_BASE + SHIM_IMRD, + SHIM_IMRD_DMAC1, 0); + + return 0; +} diff --git a/src/platform/haswell/platform.c b/src/platform/haswell/platform.c index 81ce67a..0c0bf06 100644 --- a/src/platform/haswell/platform.c +++ b/src/platform/haswell/platform.c @@ -240,10 +240,9 @@ static void platform_init_shim(void)
int platform_init(struct sof *sof) { - struct dma *dmac0; - struct dma *dmac1; struct dai *ssp0; struct dai *ssp1; + int ret;
trace_point(TRACE_BOOT_PLATFORM_MBOX);
@@ -280,23 +279,9 @@ int platform_init(struct sof *sof)
/* init DMACs */ trace_point(TRACE_BOOT_PLATFORM_DMA); - dmac0 = dma_get(DMA_ID_DMAC0); - if (dmac0 == NULL) + ret = dmac_init(); + if (ret < 0) return -ENODEV; - dma_probe(dmac0); - - /* clear the masks for dsp of the dmac*/ - io_reg_update_bits(SHIM_BASE + SHIM_IMRD, - SHIM_IMRD_DMAC0, 0); - - dmac1 = dma_get(DMA_ID_DMAC1); - if (dmac1 == NULL) - return -ENODEV; - dma_probe(dmac1); - - /* clear the masks for dsp of the dmac*/ - io_reg_update_bits(SHIM_BASE + SHIM_IMRD, - SHIM_IMRD_DMAC1, 0);
/* init SSP ports */ trace_point(TRACE_BOOT_PLATFORM_SSP);
On Fri, 2018-06-08 at 15:18 -0700, Ranjani Sridharan wrote:
+/* Initialize all platform DMAC's */ +int dmac_init(void) +{
int i, ret;
for (i = 0; i < ARRAY_SIZE(dma); i++) {
ret = dma_probe(&dma[i]);
if (ret < 0) {
/* trace failed DMAC ID */
We also need a trace error string too otherwise the number below is ambiguous.
trace_error_value(dma[i].plat_data.id);
return ret;
}
}
return 0;
+}
This patch defines the DMA copy capabilities bitmasks that will be used to define platform DMAC's.
It also adds a new dma_cap member to the dma structure and updates all platform DMAC definitions to include the capabilities supported.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- src/include/sof/dma.h | 18 +++++++++++++++++- src/platform/apollolake/dma.c | 12 +++++++++++- src/platform/apollolake/include/platform/dma.h | 5 +++++ src/platform/baytrail/dma.c | 17 ++++++++++++++++- src/platform/baytrail/include/platform/dma.h | 9 +++++++++ src/platform/cannonlake/dma.c | 12 +++++++++++- src/platform/cannonlake/include/platform/dma.h | 6 ++++++ src/platform/haswell/dma.c | 9 ++++++++- src/platform/haswell/include/platform/dma.h | 5 +++++ 9 files changed, 88 insertions(+), 5 deletions(-)
diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index af15d14..4bc178e 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -48,6 +48,21 @@ enum dma_copy_dir { DMA_DIR_DEV_TO_DEV, };
+ +/* DMA capabilities bitmasks used to define DMA copy direction */ +#define DMA_CAP_MEM_TO_MEM (1 << 0) +#define DMA_CAP_HMEM_TO_LMEM (1 << 1) +#define DMA_CAP_LMEM_TO_HMEM (1 << 2) +#define DMA_CAP_MEM_TO_DEV (1 << 3) +#define DMA_CAP_DEV_TO_MEM (1 << 4) +#define DMA_CAP_DEV_TO_DEV (1 << 5) + +/* DMA capabilities bitmasks used to define the type of DMA */ +#define DMA_CAP_GP_LP (1 << 6) +#define DMA_CAP_GP_HP (1 << 7) +#define DMA_CAP_HDA_HOST (1 << 8) +#define DMA_CAP_HDA_LINK (1 << 9) + /* DMA IRQ types */ #define DMA_IRQ_TYPE_BLOCK (1 << 0) #define DMA_IRQ_TYPE_LLIST (1 << 1) @@ -118,6 +133,7 @@ struct dma_ops { /* DMA platform data */ struct dma_plat_data { uint32_t id; + uint32_t dma_cap; uint32_t base; uint32_t channels; uint32_t irq; @@ -138,7 +154,7 @@ struct dma_int { uint32_t irq; };
-struct dma *dma_get(int dmac_id); +struct dma *dma_get(uint32_t dma_cap, uint32_t flags);
/* initialize all platform DMAC's */ int dmac_init(void); diff --git a/src/platform/apollolake/dma.c b/src/platform/apollolake/dma.c index 39cde9e..9790ed8 100644 --- a/src/platform/apollolake/dma.c +++ b/src/platform/apollolake/dma.c @@ -108,10 +108,13 @@ static struct dw_drv_plat_data dmac1 = { }, };
-static struct dma dma[] = { +struct dma dma[PLATFORM_NUM_DMACS] = { { /* Low Power GP DMAC 0 */ .plat_data = { .id = DMA_GP_LP_DMAC0, + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM | + DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM | + DMA_CAP_DEV_TO_DEV, .base = LP_GP_DMA_BASE(0), .channels = 8, .irq = IRQ_EXT_LP_GPDMA0_LVL5(0, 0), @@ -122,6 +125,9 @@ static struct dma dma[] = { { /* Low Power GP DMAC 1 */ .plat_data = { .id = DMA_GP_LP_DMAC1, + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM | + DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM | + DMA_CAP_DEV_TO_DEV, .base = LP_GP_DMA_BASE(1), .channels = 8, .irq = IRQ_EXT_LP_GPDMA1_LVL5(0, 0), @@ -132,6 +138,7 @@ static struct dma dma[] = { { /* Host In DMAC */ .plat_data = { .id = DMA_HOST_IN_DMAC, + .dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_LMEM_TO_HMEM, .base = GTW_HOST_IN_STREAM_BASE(0), .channels = 7, .irq = IRQ_EXT_HOST_DMA_IN_LVL3(0, 0), @@ -142,6 +149,7 @@ static struct dma dma[] = { { /* Host out DMAC */ .plat_data = { .id = DMA_HOST_OUT_DMAC, + .dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_HMEM_TO_LMEM, .base = GTW_HOST_OUT_STREAM_BASE(0), .channels = 6, .irq = IRQ_EXT_HOST_DMA_OUT_LVL3(0, 0), @@ -152,6 +160,7 @@ static struct dma dma[] = { { /* Link In DMAC */ .plat_data = { .id = DMA_LINK_IN_DMAC, + .dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_MEM_TO_DEV, .base = GTW_LINK_IN_STREAM_BASE(0), .channels = 8, .irq = IRQ_EXT_LINK_DMA_IN_LVL4(0, 0), @@ -162,6 +171,7 @@ static struct dma dma[] = { { /* Link out DMAC */ .plat_data = { .id = DMA_LINK_OUT_DMAC, + .dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_DEV_TO_MEM, .base = GTW_LINK_OUT_STREAM_BASE(0), .channels = 8, .irq = IRQ_EXT_LINK_DMA_OUT_LVL4(0, 0), diff --git a/src/platform/apollolake/include/platform/dma.h b/src/platform/apollolake/include/platform/dma.h index 916a455..7243c03 100644 --- a/src/platform/apollolake/include/platform/dma.h +++ b/src/platform/apollolake/include/platform/dma.h @@ -35,6 +35,9 @@ #include <stdint.h> #include <sof/io.h> #include <arch/cache.h> +#include <sof/dma.h> + +#define PLATFORM_NUM_DMACS 6
/* available DMACs */ #define DMA_GP_LP_DMAC0 0 @@ -72,4 +75,6 @@ #define DMA_HANDSHAKE_SSP5_TX 12 #define DMA_HANDSHAKE_SSP5_RX 13
+extern struct dma dma[PLATFORM_NUM_DMACS]; + #endif diff --git a/src/platform/baytrail/dma.c b/src/platform/baytrail/dma.c index 1e84402..04ed41a 100644 --- a/src/platform/baytrail/dma.c +++ b/src/platform/baytrail/dma.c @@ -143,10 +143,15 @@ static struct dw_drv_plat_data dmac2 = { }; #endif
-static struct dma dma[] = { +struct dma dma[] = { { .plat_data = { .id = DMA_ID_DMAC0, + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP | + DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK | + DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM | + DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV | + DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV, .base = DMA0_BASE, .irq = IRQ_NUM_EXT_DMAC0, .drv_plat_data = &dmac0, @@ -156,6 +161,11 @@ static struct dma dma[] = { { .plat_data = { .id = DMA_ID_DMAC1, + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP | + DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK | + DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM | + DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV | + DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV, .base = DMA1_BASE, .irq = IRQ_NUM_EXT_DMAC1, .drv_plat_data = &dmac1, @@ -166,6 +176,11 @@ static struct dma dma[] = { { .plat_data = { .id = DMA_ID_DMAC2, + .dmac_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP | + DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK | + DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM | + DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV | + DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV, .base = DMA2_BASE, .irq = IRQ_NUM_EXT_DMAC2, .drv_plat_data = &dmac2, diff --git a/src/platform/baytrail/include/platform/dma.h b/src/platform/baytrail/include/platform/dma.h index eec501a..5084dad 100644 --- a/src/platform/baytrail/include/platform/dma.h +++ b/src/platform/baytrail/include/platform/dma.h @@ -33,6 +33,13 @@ #define __PLATFORM_DMA_H__
#include <stdint.h> +#include <sof/dma.h> + +#if defined CONFIG_CHERRYTRAIL +#define PLATFORM_NUM_DMACS 3 +#else +#define PLATFORM_NUM_DMACS 2 +#endif
#define DMA_ID_DMAC0 0 #define DMA_ID_DMAC1 1 @@ -53,4 +60,6 @@ #define DMA_HANDSHAKE_SSP6_RX 12 #define DMA_HANDSHAKE_SSP6_TX 13
+extern struct dma dma[PLATFORM_NUM_DMACS]; + #endif diff --git a/src/platform/cannonlake/dma.c b/src/platform/cannonlake/dma.c index e8d0938..eadc475 100644 --- a/src/platform/cannonlake/dma.c +++ b/src/platform/cannonlake/dma.c @@ -109,10 +109,13 @@ static struct dw_drv_plat_data dmac1 = { }, };
-static struct dma dma[] = { +struct dma dma[] = { { /* Low Power GP DMAC 0 */ .plat_data = { .id = DMA_GP_LP_DMAC0, + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM | + DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM | + DMA_CAP_DEV_TO_DEV, .base = LP_GP_DMA_BASE(0), .channels = 8, .irq = IRQ_EXT_LP_GPDMA0_LVL5(0, 0), @@ -123,6 +126,9 @@ static struct dma dma[] = { { /* Low Power GP DMAC 1 */ .plat_data = { .id = DMA_GP_LP_DMAC1, + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM | + DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM | + DMA_CAP_DEV_TO_DEV, .base = LP_GP_DMA_BASE(1), .channels = 8, .irq = IRQ_EXT_LP_GPDMA1_LVL5(0, 0), @@ -133,6 +139,7 @@ static struct dma dma[] = { { /* Host In DMAC */ .plat_data = { .id = DMA_HOST_IN_DMAC, + .dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_LMEM_TO_HMEM, .base = GTW_HOST_IN_STREAM_BASE(0), .channels = 7, .irq = IRQ_EXT_HOST_DMA_IN_LVL3(0, 0), @@ -143,6 +150,7 @@ static struct dma dma[] = { { /* Host out DMAC */ .plat_data = { .id = DMA_HOST_OUT_DMAC, + .dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_HMEM_TO_LMEM, .base = GTW_HOST_OUT_STREAM_BASE(0), .channels = 9, .irq = IRQ_EXT_HOST_DMA_OUT_LVL3(0, 0), @@ -153,6 +161,7 @@ static struct dma dma[] = { { /* Link In DMAC */ .plat_data = { .id = DMA_LINK_IN_DMAC, + .dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_MEM_TO_DEV, .base = GTW_LINK_IN_STREAM_BASE(0), .channels = 9, .irq = IRQ_EXT_LINK_DMA_IN_LVL4(0, 0), @@ -163,6 +172,7 @@ static struct dma dma[] = { { /* Link out DMAC */ .plat_data = { .id = DMA_LINK_OUT_DMAC, + .dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_DEV_TO_MEM, .base = GTW_LINK_OUT_STREAM_BASE(0), .channels = 7, .irq = IRQ_EXT_LINK_DMA_OUT_LVL4(0, 0), diff --git a/src/platform/cannonlake/include/platform/dma.h b/src/platform/cannonlake/include/platform/dma.h index 00dcda8..b6366a0 100644 --- a/src/platform/cannonlake/include/platform/dma.h +++ b/src/platform/cannonlake/include/platform/dma.h @@ -33,6 +33,10 @@ #ifndef __PLATFORM_DMA_H__ #define __PLATFORM_DMA_H__
+#include <sof/dma.h> + +#define PLATFORM_NUM_DMACS 6 + /* available DMACs */ #define DMA_GP_LP_DMAC0 0 #define DMA_GP_LP_DMAC1 1 @@ -69,4 +73,6 @@ #define DMA_HANDSHAKE_SSP5_TX 12 #define DMA_HANDSHAKE_SSP5_RX 13
+extern struct dma dma[PLATFORM_NUM_DMACS]; + #endif diff --git a/src/platform/haswell/dma.c b/src/platform/haswell/dma.c index 5beb086..35c88be 100644 --- a/src/platform/haswell/dma.c +++ b/src/platform/haswell/dma.c @@ -106,10 +106,12 @@ static struct dw_drv_plat_data dmac1 = { }, };
-static struct dma dma[] = { +struct dma dma[] = { { .plat_data = { .base = DMA0_BASE, + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP | + DMA_CAP_MEM_TO_MEM, .irq = IRQ_NUM_EXT_DMAC0, .drv_plat_data = &dmac0, }, @@ -117,6 +119,11 @@ static struct dma dma[] = { }, { .plat_data = { + .dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP | + DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK | + DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM | + DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV | + DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV, .base = DMA1_BASE, .irq = IRQ_NUM_EXT_DMAC1, .drv_plat_data = &dmac1, diff --git a/src/platform/haswell/include/platform/dma.h b/src/platform/haswell/include/platform/dma.h index 4780f92..e9c38e6 100644 --- a/src/platform/haswell/include/platform/dma.h +++ b/src/platform/haswell/include/platform/dma.h @@ -32,6 +32,9 @@ #define __PLATFORM_DMA_H__
#include <stdint.h> +#include <sof/dma.h> + +#define PLATFORM_NUM_DMACS 2
#define DMA_ID_DMAC0 0 #define DMA_ID_DMAC1 1 @@ -53,4 +56,6 @@ #define DMA_HANDSHAKE_OBFF_10 14 #define DMA_HANDSHAKE_OBFF_11 15
+extern struct dma dma[PLATFORM_NUM_DMACS]; + #endif
On Fri, 2018-06-08 at 15:18 -0700, Ranjani Sridharan wrote:
This patch defines the DMA copy capabilities bitmasks that will be used to define platform DMAC's.
It also adds a new dma_cap member to the dma structure and updates all platform DMAC definitions to include the capabilities supported.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
src/include/sof/dma.h | 18 +++++++++++++++++- src/platform/apollolake/dma.c | 12 +++++++++++- src/platform/apollolake/include/platform/dma.h | 5 +++++ src/platform/baytrail/dma.c | 17 ++++++++++++++++- src/platform/baytrail/include/platform/dma.h | 9 +++++++++ src/platform/cannonlake/dma.c | 12 +++++++++++- src/platform/cannonlake/include/platform/dma.h | 6 ++++++ src/platform/haswell/dma.c | 9 ++++++++- src/platform/haswell/include/platform/dma.h | 5 +++++ 9 files changed, 88 insertions(+), 5 deletions(-)
diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index af15d14..4bc178e 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -48,6 +48,21 @@ enum dma_copy_dir { DMA_DIR_DEV_TO_DEV, };
+/* DMA capabilities bitmasks used to define DMA copy direction */ +#define DMA_CAP_MEM_TO_MEM (1 << 0) +#define DMA_CAP_HMEM_TO_LMEM (1 << 1) +#define DMA_CAP_LMEM_TO_HMEM (1 << 2) +#define DMA_CAP_MEM_TO_DEV (1 << 3) +#define DMA_CAP_DEV_TO_MEM (1 << 4) +#define DMA_CAP_DEV_TO_DEV (1 << 5)
+/* DMA capabilities bitmasks used to define the type of DMA */ +#define DMA_CAP_GP_LP (1 << 6) +#define DMA_CAP_GP_HP (1 << 7) +#define DMA_CAP_HDA_HOST (1 << 8) +#define DMA_CAP_HDA_LINK (1 << 9)
Thinking more, it may be better to have :-
#define DMA_CAP_HDA #define DMA_CAP_SSP #define DMA_CAP_DMIC
These can be used in conjunction with the other caps when requesting a DMAC since HDA_HOST and HDA_LINK is very Intel specific.
/* DMA IRQ types */ #define DMA_IRQ_TYPE_BLOCK (1 << 0) #define DMA_IRQ_TYPE_LLIST (1 << 1) @@ -118,6 +133,7 @@ struct dma_ops { /* DMA platform data */ struct dma_plat_data { uint32_t id;
- uint32_t dma_cap;
lets just call this caps (since dma is implied already)
uint32_t base; uint32_t channels; uint32_t irq; @@ -138,7 +154,7 @@ struct dma_int { uint32_t irq; };
-struct dma *dma_get(int dmac_id); +struct dma *dma_get(uint32_t dma_cap, uint32_t flags);
/* initialize all platform DMAC's */ int dmac_init(void); diff --git a/src/platform/apollolake/dma.c b/src/platform/apollolake/dma.c index 39cde9e..9790ed8 100644 --- a/src/platform/apollolake/dma.c +++ b/src/platform/apollolake/dma.c @@ -108,10 +108,13 @@ static struct dw_drv_plat_data dmac1 = { }, };
-static struct dma dma[] = { +struct dma dma[PLATFORM_NUM_DMACS] = { { /* Low Power GP DMAC 0 */ .plat_data = { .id = DMA_GP_LP_DMAC0,
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM |
DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM |
.base = LP_GP_DMA_BASE(0), .channels = 8, .irq = IRQ_EXT_LP_GPDMA0_LVL5(0, 0),DMA_CAP_DEV_TO_DEV,
@@ -122,6 +125,9 @@ static struct dma dma[] = { { /* Low Power GP DMAC 1 */ .plat_data = { .id = DMA_GP_LP_DMAC1,
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM |
DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM |
.base = LP_GP_DMA_BASE(1), .channels = 8, .irq = IRQ_EXT_LP_GPDMA1_LVL5(0, 0),DMA_CAP_DEV_TO_DEV,
@@ -132,6 +138,7 @@ static struct dma dma[] = { { /* Host In DMAC */ .plat_data = { .id = DMA_HOST_IN_DMAC,
.base = GTW_HOST_IN_STREAM_BASE(0), .channels = 7, .irq = IRQ_EXT_HOST_DMA_IN_LVL3(0, 0),.dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_LMEM_TO_HMEM,
@@ -142,6 +149,7 @@ static struct dma dma[] = { { /* Host out DMAC */ .plat_data = { .id = DMA_HOST_OUT_DMAC,
.base = GTW_HOST_OUT_STREAM_BASE(0), .channels = 6, .irq = IRQ_EXT_HOST_DMA_OUT_LVL3(0, 0),.dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_HMEM_TO_LMEM,
@@ -152,6 +160,7 @@ static struct dma dma[] = { { /* Link In DMAC */ .plat_data = { .id = DMA_LINK_IN_DMAC,
.base = GTW_LINK_IN_STREAM_BASE(0), .channels = 8, .irq = IRQ_EXT_LINK_DMA_IN_LVL4(0, 0),.dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_MEM_TO_DEV,
@@ -162,6 +171,7 @@ static struct dma dma[] = { { /* Link out DMAC */ .plat_data = { .id = DMA_LINK_OUT_DMAC,
.base = GTW_LINK_OUT_STREAM_BASE(0), .channels = 8, .irq = IRQ_EXT_LINK_DMA_OUT_LVL4(0, 0),.dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_DEV_TO_MEM,
diff --git a/src/platform/apollolake/include/platform/dma.h b/src/platform/apollolake/include/platform/dma.h index 916a455..7243c03 100644 --- a/src/platform/apollolake/include/platform/dma.h +++ b/src/platform/apollolake/include/platform/dma.h @@ -35,6 +35,9 @@ #include <stdint.h> #include <sof/io.h> #include <arch/cache.h> +#include <sof/dma.h>
+#define PLATFORM_NUM_DMACS 6
/* available DMACs */ #define DMA_GP_LP_DMAC0 0 @@ -72,4 +75,6 @@ #define DMA_HANDSHAKE_SSP5_TX 12 #define DMA_HANDSHAKE_SSP5_RX 13
+extern struct dma dma[PLATFORM_NUM_DMACS];
#endif diff --git a/src/platform/baytrail/dma.c b/src/platform/baytrail/dma.c index 1e84402..04ed41a 100644 --- a/src/platform/baytrail/dma.c +++ b/src/platform/baytrail/dma.c @@ -143,10 +143,15 @@ static struct dw_drv_plat_data dmac2 = { }; #endif
-static struct dma dma[] = { +struct dma dma[] = { { .plat_data = { .id = DMA_ID_DMAC0,
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP |
BYT has only HP DMACs
DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK |
DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM |
DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV |
.base = DMA0_BASE, .irq = IRQ_NUM_EXT_DMAC0, .drv_plat_data = &dmac0,DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV,
@@ -156,6 +161,11 @@ static struct dma dma[] = { { .plat_data = { .id = DMA_ID_DMAC1,
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP |
DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK |
DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM |
DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV |
.base = DMA1_BASE, .irq = IRQ_NUM_EXT_DMAC1, .drv_plat_data = &dmac1,DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV,
@@ -166,6 +176,11 @@ static struct dma dma[] = { { .plat_data = { .id = DMA_ID_DMAC2,
.dmac_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP |
DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK |
DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM |
DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV |
.base = DMA2_BASE, .irq = IRQ_NUM_EXT_DMAC2, .drv_plat_data = &dmac2,DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV,
diff --git a/src/platform/baytrail/include/platform/dma.h b/src/platform/baytrail/include/platform/dma.h index eec501a..5084dad 100644 --- a/src/platform/baytrail/include/platform/dma.h +++ b/src/platform/baytrail/include/platform/dma.h @@ -33,6 +33,13 @@ #define __PLATFORM_DMA_H__
#include <stdint.h> +#include <sof/dma.h>
+#if defined CONFIG_CHERRYTRAIL +#define PLATFORM_NUM_DMACS 3 +#else +#define PLATFORM_NUM_DMACS 2 +#endif
#define DMA_ID_DMAC0 0 #define DMA_ID_DMAC1 1 @@ -53,4 +60,6 @@ #define DMA_HANDSHAKE_SSP6_RX 12 #define DMA_HANDSHAKE_SSP6_TX 13
+extern struct dma dma[PLATFORM_NUM_DMACS];
#endif diff --git a/src/platform/cannonlake/dma.c b/src/platform/cannonlake/dma.c index e8d0938..eadc475 100644 --- a/src/platform/cannonlake/dma.c +++ b/src/platform/cannonlake/dma.c @@ -109,10 +109,13 @@ static struct dw_drv_plat_data dmac1 = { }, };
-static struct dma dma[] = { +struct dma dma[] = { { /* Low Power GP DMAC 0 */ .plat_data = { .id = DMA_GP_LP_DMAC0,
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM |
DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM |
.base = LP_GP_DMA_BASE(0), .channels = 8, .irq = IRQ_EXT_LP_GPDMA0_LVL5(0, 0),DMA_CAP_DEV_TO_DEV,
@@ -123,6 +126,9 @@ static struct dma dma[] = { { /* Low Power GP DMAC 1 */ .plat_data = { .id = DMA_GP_LP_DMAC1,
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_MEM |
DMA_CAP_MEM_TO_DEV | DMA_CAP_DEV_TO_MEM |
.base = LP_GP_DMA_BASE(1), .channels = 8, .irq = IRQ_EXT_LP_GPDMA1_LVL5(0, 0),DMA_CAP_DEV_TO_DEV,
@@ -133,6 +139,7 @@ static struct dma dma[] = { { /* Host In DMAC */ .plat_data = { .id = DMA_HOST_IN_DMAC,
.base = GTW_HOST_IN_STREAM_BASE(0), .channels = 7, .irq = IRQ_EXT_HOST_DMA_IN_LVL3(0, 0),.dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_LMEM_TO_HMEM,
@@ -143,6 +150,7 @@ static struct dma dma[] = { { /* Host out DMAC */ .plat_data = { .id = DMA_HOST_OUT_DMAC,
.base = GTW_HOST_OUT_STREAM_BASE(0), .channels = 9, .irq = IRQ_EXT_HOST_DMA_OUT_LVL3(0, 0),.dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_HMEM_TO_LMEM,
@@ -153,6 +161,7 @@ static struct dma dma[] = { { /* Link In DMAC */ .plat_data = { .id = DMA_LINK_IN_DMAC,
.base = GTW_LINK_IN_STREAM_BASE(0), .channels = 9, .irq = IRQ_EXT_LINK_DMA_IN_LVL4(0, 0),.dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_MEM_TO_DEV,
@@ -163,6 +172,7 @@ static struct dma dma[] = { { /* Link out DMAC */ .plat_data = { .id = DMA_LINK_OUT_DMAC,
.base = GTW_LINK_OUT_STREAM_BASE(0), .channels = 7, .irq = IRQ_EXT_LINK_DMA_OUT_LVL4(0, 0),.dma_cap = DMA_CAP_HDA_LINK | DMA_CAP_DEV_TO_MEM,
diff --git a/src/platform/cannonlake/include/platform/dma.h b/src/platform/cannonlake/include/platform/dma.h index 00dcda8..b6366a0 100644 --- a/src/platform/cannonlake/include/platform/dma.h +++ b/src/platform/cannonlake/include/platform/dma.h @@ -33,6 +33,10 @@ #ifndef __PLATFORM_DMA_H__ #define __PLATFORM_DMA_H__
+#include <sof/dma.h>
+#define PLATFORM_NUM_DMACS 6
/* available DMACs */ #define DMA_GP_LP_DMAC0 0 #define DMA_GP_LP_DMAC1 1 @@ -69,4 +73,6 @@ #define DMA_HANDSHAKE_SSP5_TX 12 #define DMA_HANDSHAKE_SSP5_RX 13
+extern struct dma dma[PLATFORM_NUM_DMACS];
#endif diff --git a/src/platform/haswell/dma.c b/src/platform/haswell/dma.c index 5beb086..35c88be 100644 --- a/src/platform/haswell/dma.c +++ b/src/platform/haswell/dma.c @@ -106,10 +106,12 @@ static struct dw_drv_plat_data dmac1 = { }, };
-static struct dma dma[] = { +struct dma dma[] = { { .plat_data = { .base = DMA0_BASE,
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP |
.irq = IRQ_NUM_EXT_DMAC0, .drv_plat_data = &dmac0, },DMA_CAP_MEM_TO_MEM,
@@ -117,6 +119,11 @@ static struct dma dma[] = { }, { .plat_data = {
.dma_cap = DMA_CAP_GP_LP | DMA_CAP_GP_HP |
DMA_CAP_HDA_HOST | DMA_CAP_HDA_LINK |
DMA_CAP_MEM_TO_MEM | DMA_CAP_HMEM_TO_LMEM |
DMA_CAP_LMEM_TO_HMEM | DMA_CAP_MEM_TO_DEV |
.base = DMA1_BASE, .irq = IRQ_NUM_EXT_DMAC1, .drv_plat_data = &dmac1,DMA_CAP_DEV_TO_MEM | DMA_CAP_DEV_TO_DEV,
diff --git a/src/platform/haswell/include/platform/dma.h b/src/platform/haswell/include/platform/dma.h index 4780f92..e9c38e6 100644 --- a/src/platform/haswell/include/platform/dma.h +++ b/src/platform/haswell/include/platform/dma.h @@ -32,6 +32,9 @@ #define __PLATFORM_DMA_H__
#include <stdint.h> +#include <sof/dma.h>
+#define PLATFORM_NUM_DMACS 2
#define DMA_ID_DMAC0 0 #define DMA_ID_DMAC1 1 @@ -53,4 +56,6 @@ #define DMA_HANDSHAKE_OBFF_10 14 #define DMA_HANDSHAKE_OBFF_11 15
+extern struct dma dma[PLATFORM_NUM_DMACS];
#endif
On Sun, 2018-06-10 at 20:51 +0100, Liam Girdwood wrote:
diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index af15d14..4bc178e 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -48,6 +48,21 @@ enum dma_copy_dir { DMA_DIR_DEV_TO_DEV, };
Thinking more on this, I think we just need direction mask, caps mask and device mask.
We can remove the dir enum too.
+/* DMA capabilities bitmasks used to define DMA copy direction */ +#define DMA_CAP_MEM_TO_MEM (1 << 0) +#define DMA_CAP_HMEM_TO_LMEM (1 << 1) +#define DMA_CAP_LMEM_TO_HMEM (1 << 2) +#define DMA_CAP_MEM_TO_DEV (1 << 3) +#define DMA_CAP_DEV_TO_MEM (1 << 4) +#define DMA_CAP_DEV_TO_DEV (1 << 5)
These are direction so would be DMA_DIR_blah
+/* DMA capabilities bitmasks used to define the type of DMA */ +#define DMA_CAP_GP_LP (1 << 6) +#define DMA_CAP_GP_HP (1 << 7)
These two above are caps.
+#define DMA_CAP_HDA_HOST (1 << 8) +#define DMA_CAP_HDA_LINK (1 << 9)
Thinking more, it may be better to have :-
#define DMA_CAP_HDA #define DMA_CAP_SSP #define DMA_CAP_DMIC
These would be DMAC_DEV_HDA, DMA_DEV_SSP, etc
These can be used in conjunction with the other caps when requesting a DMAC since HDA_HOST and HDA_LINK is very Intel specific.
/* DMA IRQ types */ #define DMA_IRQ_TYPE_BLOCK (1 << 0) #define DMA_IRQ_TYPE_LLIST (1 << 1) @@ -118,6 +133,7 @@ struct dma_ops { /* DMA platform data */ struct dma_plat_data { uint32_t id;
uint32_t dma_cap;
uint32_t dir; /* bit mask of directions */ uint32_t caps; /* bitmask of caps */ uint32_t devs; /* bitmask of supported devs */
lets just call this caps (since dma is implied already)
Liam
On Sun, 2018-06-10 at 21:02 +0100, Liam Girdwood wrote:
On Sun, 2018-06-10 at 20:51 +0100, Liam Girdwood wrote:
diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index af15d14..4bc178e 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -48,6 +48,21 @@ enum dma_copy_dir { DMA_DIR_DEV_TO_DEV, };
Thinking more on this, I think we just need direction mask, caps mask and device mask.
We can remove the dir enum too.
+/* DMA capabilities bitmasks used to define DMA copy direction */ +#define DMA_CAP_MEM_TO_MEM (1 << 0) +#define DMA_CAP_HMEM_TO_LMEM (1 << 1) +#define DMA_CAP_LMEM_TO_HMEM (1 << 2) +#define DMA_CAP_MEM_TO_DEV (1 << 3) +#define DMA_CAP_DEV_TO_MEM (1 << 4) +#define DMA_CAP_DEV_TO_DEV (1 << 5)
These are direction so would be DMA_DIR_blah
+/* DMA capabilities bitmasks used to define the type of DMA */ +#define DMA_CAP_GP_LP (1 << 6) +#define DMA_CAP_GP_HP (1 << 7)
These two above are caps.
+#define DMA_CAP_HDA_HOST (1 << 8) +#define DMA_CAP_HDA_LINK (1 << 9)
Thinking more, it may be better to have :-
#define DMA_CAP_HDA #define DMA_CAP_SSP #define DMA_CAP_DMIC
These would be DMAC_DEV_HDA, DMA_DEV_SSP, etc
This makes a lot of sense now. Thanks!
These can be used in conjunction with the other caps when requesting a DMAC since HDA_HOST and HDA_LINK is very Intel specific.
/* DMA IRQ types */ #define DMA_IRQ_TYPE_BLOCK (1 << 0) #define DMA_IRQ_TYPE_LLIST (1 << 1) @@ -118,6 +133,7 @@ struct dma_ops { /* DMA platform data */ struct dma_plat_data { uint32_t id;
uint32_t dma_cap;
uint32_t dir; /* bit mask of directions */ uint32_t caps; /* bitmask of caps */ uint32_t devs; /* bitmask of supported devs */
lets just call this caps (since dma is implied already)
Liam
This patch adds the num_channels_busy member to the dma structure which will be helpful in determining DMAC to be allocated to users based on the number of channels draining. This is help provide a primitive level of QoS and prevent DMAC overuse.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- src/drivers/dw-dma.c | 11 +++++++++++ src/drivers/hda-dma.c | 8 ++++++++ src/include/sof/dma.h | 2 ++ 3 files changed, 21 insertions(+)
diff --git a/src/drivers/dw-dma.c b/src/drivers/dw-dma.c index c064330..932874d 100644 --- a/src/drivers/dw-dma.c +++ b/src/drivers/dw-dma.c @@ -43,6 +43,7 @@ * used to construct the DMA configuration for the host client 1 above. */
+#include <sof/atomic.h> #include <sof/debug.h> #include <sof/sof.h> #include <sof/dma.h> @@ -309,6 +310,8 @@ static int dw_dma_channel_get(struct dma *dma, int req_chan)
p->chan[i].status = COMP_STATE_READY;
+ atomic_add(&dma->num_channels_busy, 1); + /* unmask block, transfer and error interrupts for channel */ dw_write(dma, DW_MASK_TFR, INT_UNMASK(i)); dw_write(dma, DW_MASK_BLOCK, INT_UNMASK(i)); @@ -347,6 +350,8 @@ static void dw_dma_channel_put_unlocked(struct dma *dma, int channel) p->chan[channel].status = COMP_STATE_INIT; p->chan[channel].cb = NULL; p->chan[channel].desc_count = 0; + + atomic_sub(&dma->num_channels_busy, 1); }
/* channel must not be running when this is called */ @@ -1033,6 +1038,9 @@ static int dw_dma_probe(struct dma *dma) interrupt_enable(dma_int[i]->irq); }
+ /* init number of channels draining */ + atomic_init(&dma->num_channels_busy, 0); + return 0; }
@@ -1170,6 +1178,9 @@ static int dw_dma_probe(struct dma *dma) interrupt_register(dma_irq(dma), dw_dma_irq_handler, dma); interrupt_enable(dma_irq(dma));
+ /* init number of channels draining */ + atomic_init(&dma->num_channels_busy, 0); + return 0; } #endif diff --git a/src/drivers/hda-dma.c b/src/drivers/hda-dma.c index 97ea0ef..3b72be4 100644 --- a/src/drivers/hda-dma.c +++ b/src/drivers/hda-dma.c @@ -29,6 +29,7 @@ * Liam Girdwood liam.r.girdwood@linux.intel.com */
+#include <sof/atomic.h> #include <stdint.h> #include <stddef.h> #include <errno.h> @@ -145,6 +146,8 @@ static int hda_dma_channel_get(struct dma *dma, int channel) if (p->chan[channel].status == COMP_STATE_INIT) { p->chan[channel].status = COMP_STATE_READY;
+ atomic_add(&dma->num_channels_busy, 1); + /* return channel */ spin_unlock_irq(&dma->lock, flags); return channel; @@ -173,6 +176,8 @@ static void hda_dma_channel_put(struct dma *dma, int channel) spin_lock_irq(&dma->lock, flags); hda_dma_channel_put_unlocked(dma, channel); spin_unlock_irq(&dma->lock, flags); + + atomic_sub(&dma->num_channels_busy, 1); }
static int hda_dma_start(struct dma *dma, int channel) @@ -400,6 +405,9 @@ static int hda_dma_probe(struct dma *dma) for (i = 0; i < HDA_DMA_MAX_CHANS; i++) hda_pdata->chan[i].status = COMP_STATE_INIT;
+ /* init number of channels draining */ + atomic_init(&dma->num_channels_busy, 0); + return 0; }
diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index 4bc178e..0babbd3 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -37,6 +37,7 @@ #include <sof/lock.h> #include <sof/sof.h> #include <sof/wait.h> +#include <arch/atomic.h>
/* types of DMA directions */ enum dma_copy_dir { @@ -145,6 +146,7 @@ struct dma { struct dma_plat_data plat_data; spinlock_t lock; const struct dma_ops *ops; + atomic_t num_channels_busy; /* number of channels draining */ void *private; };
This patch introduces a new API for allocating DMAC's by taking into account the dma copy capability and access control requested by the user.
At the moment, all users use the shared access privilege for requesting DMAC but this might change in future.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- src/arch/xtensa/Makefile.am | 1 + src/include/sof/dma.h | 4 ++ src/lib/Makefile.am | 11 +++++ src/lib/dma.c | 80 +++++++++++++++++++++++++++++++++++ src/platform/apollolake/dma.c | 12 ------ src/platform/baytrail/dma.c | 12 ------ src/platform/cannonlake/dma.c | 12 ------ src/platform/haswell/dma.c | 12 ------ 8 files changed, 96 insertions(+), 48 deletions(-) create mode 100644 src/lib/dma.c
diff --git a/src/arch/xtensa/Makefile.am b/src/arch/xtensa/Makefile.am index 4ffe15f..88dc8c6 100644 --- a/src/arch/xtensa/Makefile.am +++ b/src/arch/xtensa/Makefile.am @@ -65,6 +65,7 @@ sof_LDADD = \ ../../lib/libcore.a \ ../../platform/$(PLATFORM)/libplatform.a \ ../../ipc/libsof_ipc.a \ + ../../lib/libdma.a \ ../../audio/libaudio.a \ ../../drivers/libdrivers.a \ ../../math/libsof_math.a \ diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index 0babbd3..cef5e02 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -64,6 +64,10 @@ enum dma_copy_dir { #define DMA_CAP_HDA_HOST (1 << 8) #define DMA_CAP_HDA_LINK (1 << 9)
+/* DMA access privilege flag */ +#define DMA_ACCESS_EXCLUSIVE 1 +#define DMA_ACCESS_SHARED 0 + /* DMA IRQ types */ #define DMA_IRQ_TYPE_BLOCK (1 << 0) #define DMA_IRQ_TYPE_LLIST (1 << 1) diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 825bfbd..28f8f6f 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -16,3 +16,14 @@ libcore_a_CFLAGS = \ $(ARCH_INCDIR) \ $(SOF_INCDIR) \ $(PLATFORM_INCDIR) + +noinst_LIBRARIES = libdma.a + +libdma_a_SOURCES = \ + dma.c + +libdma_a_CFLAGS = \ + $(ARCH_CFLAGS) \ + $(ARCH_INCDIR) \ + $(SOF_INCDIR) \ + $(PLATFORM_INCDIR) diff --git a/src/lib/dma.c b/src/lib/dma.c new file mode 100644 index 0000000..f4f9b40 --- /dev/null +++ b/src/lib/dma.c @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2016, Intel Corporation + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Intel Corporation nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * Author: Ranjani Sridharan ranjani.sridharan@linux.intel.com + */ + +#include <sof/dma.h> +#include <sof/atomic.h> +#include <platform/dma.h> + +/* + * API to request a platform DMAC. + * Users can request DMAC based on type, copy capabilities and access privilege. + * 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 dma_cap, uint32_t flags) +{ + int i, ch_count; + int min_ch_count = INT32_MAX; + int dma_index = -1; + + for (i = 0; i < PLATFORM_NUM_DMACS; i++) { + + /* skip if this DMAC does not support the requested cap */ + if ((dma[i].plat_data.dma_cap & dma_cap) != dma_cap) + continue; + + /* if exclusive access is requested */ + if (flags & DMA_ACCESS_EXCLUSIVE) { + + /* ret DMA with no channels draining */ + if (!atomic_read(&dma[i].num_channels_busy)) + return &dma[i]; + } else { + + /* get number of channels draining in this DMAC*/ + ch_count = atomic_read(&dma[i].num_channels_busy); + + /* pick DMAC with the least num of channels draining */ + if (ch_count < min_ch_count) { + dma_index = i; + min_ch_count = ch_count; + } + } + } + + /* return DMAC */ + if (dma_index >= 0) { + tracev_value(dma[dma_index].plat_data.id); + return &dma[dma_index]; + } + + return NULL; +} diff --git a/src/platform/apollolake/dma.c b/src/platform/apollolake/dma.c index 9790ed8..acabc5b 100644 --- a/src/platform/apollolake/dma.c +++ b/src/platform/apollolake/dma.c @@ -180,18 +180,6 @@ struct dma dma[PLATFORM_NUM_DMACS] = { .ops = &hda_link_dma_ops, },};
-struct dma *dma_get(int dmac_id) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(dma); i++) { - if (dma[i].plat_data.id == dmac_id) - return &dma[i]; - } - - return NULL; -} - /* Initialize all platform DMAC's */ int dmac_init(void) { diff --git a/src/platform/baytrail/dma.c b/src/platform/baytrail/dma.c index 04ed41a..ca7350a 100644 --- a/src/platform/baytrail/dma.c +++ b/src/platform/baytrail/dma.c @@ -190,18 +190,6 @@ struct dma dma[] = { #endif };
-struct dma *dma_get(int dmac_id) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(dma); i++) { - if (dma[i].plat_data.id == dmac_id) - return &dma[i]; - } - - return NULL; -} - /* Initialize all platform DMAC's */ int dmac_init(void) { diff --git a/src/platform/cannonlake/dma.c b/src/platform/cannonlake/dma.c index eadc475..9fb50a9 100644 --- a/src/platform/cannonlake/dma.c +++ b/src/platform/cannonlake/dma.c @@ -181,18 +181,6 @@ struct dma dma[] = { .ops = &hda_link_dma_ops, },};
-struct dma *dma_get(int dmac_id) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(dma); i++) { - if (dma[i].plat_data.id == dmac_id) - return &dma[i]; - } - - return NULL; -} - /* Initialize all platform DMAC's */ int dmac_init(void) { diff --git a/src/platform/haswell/dma.c b/src/platform/haswell/dma.c index 35c88be..d1039fb 100644 --- a/src/platform/haswell/dma.c +++ b/src/platform/haswell/dma.c @@ -131,18 +131,6 @@ struct dma dma[] = { .ops = &dw_dma_ops, },};
-struct dma *dma_get(int dmac_id) -{ - switch (dmac_id) { - case DMA_ID_DMAC0: - return &dma[0]; - case DMA_ID_DMAC1: - return &dma[1]; - default: - return NULL; - } -} - /* Initialize all platform DMAC's */ int dmac_init(void) {
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- src/audio/dai.c | 5 ++++- src/audio/host.c | 18 ++++++++++-------- src/host/common_test.c | 2 +- src/ipc/apl-ipc.c | 6 ++++-- src/ipc/byt-ipc.c | 7 ++++--- src/ipc/cnl-ipc.c | 6 ++++-- src/ipc/dma-copy.c | 5 ++++- src/ipc/hsw-ipc.c | 7 ++++--- 8 files changed, 35 insertions(+), 21 deletions(-)
diff --git a/src/audio/dai.c b/src/audio/dai.c index 1eeecd2..6ed1e86 100644 --- a/src/audio/dai.c +++ b/src/audio/dai.c @@ -176,6 +176,7 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) struct sof_ipc_comp_dai *dai; struct sof_ipc_comp_dai *ipc_dai = (struct sof_ipc_comp_dai *)comp; struct dai_data *dd; + uint32_t dma_cap;
trace_dai("new");
@@ -201,7 +202,9 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) goto error; }
- dd->dma = dma_get(ipc_dai->dmac_id); + /* request GP LP DMA with shared access privilege */ + dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_DEV; + dd->dma = dma_get(dma_cap, DMA_ACCESS_SHARED); if (dd->dma == NULL) { trace_dai_error("eDd"); goto error; diff --git a/src/audio/host.c b/src/audio/host.c index c0f4e1b..ab8c20e 100644 --- a/src/audio/host.c +++ b/src/audio/host.c @@ -503,6 +503,7 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp) struct sof_ipc_comp_host *host; struct sof_ipc_comp_host *ipc_host = (struct sof_ipc_comp_host *)comp; struct dma_sg_elem *elem; + uint32_t dma_cap;
trace_host("new");
@@ -529,14 +530,15 @@ static struct comp_dev *host_new(struct sof_ipc_comp *comp)
comp_set_drvdata(dev, hd);
-#if !defined CONFIG_DMA_GW - hd->dma = dma_get(ipc_host->dmac_id); -#else - if (ipc_host->direction == SOF_IPC_STREAM_PLAYBACK) - hd->dma = dma_get(DMA_HOST_OUT_DMAC); - else - hd->dma = dma_get(DMA_HOST_IN_DMAC); -#endif + /* request Host DMA with shared access privilege */ + if (ipc_host->direction == SOF_IPC_STREAM_PLAYBACK) { + dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_HMEM_TO_LMEM; + hd->dma = dma_get(dma_cap, DMA_ACCESS_SHARED); + } else { + dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_LMEM_TO_HMEM; + hd->dma = dma_get(dma_cap, DMA_ACCESS_SHARED); + } + if (hd->dma == NULL) { trace_host_error("eDM"); goto error; diff --git a/src/host/common_test.c b/src/host/common_test.c index e286883..fa4891f 100644 --- a/src/host/common_test.c +++ b/src/host/common_test.c @@ -200,7 +200,7 @@ struct dai *dai_get(uint32_t type, uint32_t index) return NULL; }
-struct dma *dma_get(int dmac_id) +struct dma *dma_get(uint32_t dmac_id, uint32_t flags) { return NULL; } diff --git a/src/ipc/apl-ipc.c b/src/ipc/apl-ipc.c index 78291d0..79c5782 100644 --- a/src/ipc/apl-ipc.c +++ b/src/ipc/apl-ipc.c @@ -177,6 +177,7 @@ out: int platform_ipc_init(struct ipc *ipc) { struct intel_ipc_data *iipc; + uint32_t dma_cap; int i;
_ipc = ipc; @@ -198,8 +199,9 @@ int platform_ipc_init(struct ipc *ipc) if (iipc->page_table) bzero(iipc->page_table, HOST_PAGE_SIZE);
- /* dma */ - iipc->dmac = dma_get(DMA_GP_LP_DMAC0); + /* request GP LP DMA with shared access privilege */ + dma_cap = DMA_CAP_GP_LP | DMA_CAP_HMEM_TO_LMEM; + iipc->dmac = dma_get(dma_cap, DMA_ACCESS_SHARED);
/* PM */ iipc->pm_prepare_D3 = 0; diff --git a/src/ipc/byt-ipc.c b/src/ipc/byt-ipc.c index 87e7949..c541c62 100644 --- a/src/ipc/byt-ipc.c +++ b/src/ipc/byt-ipc.c @@ -202,7 +202,7 @@ out: int platform_ipc_init(struct ipc *ipc) { struct intel_ipc_data *iipc; - uint32_t imrd; + uint32_t imrd, dma_cap; int i;
_ipc = ipc; @@ -225,8 +225,9 @@ int platform_ipc_init(struct ipc *ipc) if (iipc->page_table) bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
- /* dma */ - iipc->dmac = dma_get(DMA_ID_DMAC0); + /* request DMA with shared access privilege */ + dma_cap = DMA_CAP_GP_LP | DMA_CAP_HMEM_TO_LMEM; + iipc->dmac = dma_get(dma_cap, DMA_ACCESS_SHARED);
/* PM */ iipc->pm_prepare_D3 = 0; diff --git a/src/ipc/cnl-ipc.c b/src/ipc/cnl-ipc.c index ba65164..d66d46a 100644 --- a/src/ipc/cnl-ipc.c +++ b/src/ipc/cnl-ipc.c @@ -178,6 +178,7 @@ int platform_ipc_init(struct ipc *ipc) { struct intel_ipc_data *iipc; int i; + uint32_t dma_cap;
_ipc = ipc;
@@ -198,8 +199,9 @@ int platform_ipc_init(struct ipc *ipc) if (iipc->page_table) bzero(iipc->page_table, HOST_PAGE_SIZE);
- /* dma */ - iipc->dmac = dma_get(DMA_GP_LP_DMAC0); + /* request GP LP DMA with shared access privilege */ + dma_cap = DMA_CAP_GP_LP | DMA_CAP_HMEM_TO_LMEM; + iipc->dmac = dma_get(dma_cap, DMA_ACCESS_SHARED);
/* PM */ iipc->pm_prepare_D3 = 0; diff --git a/src/ipc/dma-copy.c b/src/ipc/dma-copy.c index be72eb8..25f891c 100644 --- a/src/ipc/dma-copy.c +++ b/src/ipc/dma-copy.c @@ -375,7 +375,10 @@ int dma_copy_from_host_nowait(struct dma_copy *dc, struct dma_sg_config *host_sg
int dma_copy_new(struct dma_copy *dc, int dmac) { - dc->dmac = dma_get(dmac); + uint32_t dma_cap; + + dma_cap = DMA_CAP_HDA_HOST | DMA_CAP_LMEM_TO_HMEM; + dc->dmac = dma_get(dma_cap, DMA_ACCESS_SHARED); if (dc->dmac == NULL) { trace_dma_error("ec0"); return -ENODEV; diff --git a/src/ipc/hsw-ipc.c b/src/ipc/hsw-ipc.c index aa4d9e1..fd54c0f 100644 --- a/src/ipc/hsw-ipc.c +++ b/src/ipc/hsw-ipc.c @@ -198,7 +198,7 @@ out: int platform_ipc_init(struct ipc *ipc) { struct intel_ipc_data *iipc; - uint32_t imrd; + uint32_t imrd, dma_cap; int i;
_ipc = ipc; @@ -221,8 +221,9 @@ int platform_ipc_init(struct ipc *ipc) if (iipc->page_table) bzero(iipc->page_table, PLATFORM_PAGE_TABLE_SIZE);
- /* dma */ - iipc->dmac = dma_get(DMA_ID_DMAC1); + /* request GP LP DMA with shared access privilege */ + dma_cap = DMA_CAP_GP_LP | DMA_CAP_HMEM_TO_LMEM; + iipc->dmac = dma_get(dma_cap, DMA_ACCESS_SHARED);
/* PM */ iipc->pm_prepare_D3 = 0;
On Fri, 2018-06-08 at 15:18 -0700, Ranjani Sridharan wrote:
@@ -201,7 +202,9 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp) goto error; }
dd->dma = dma_get(ipc_dai->dmac_id);
/* request GP LP DMA with shared access privilege */
dma_cap = DMA_CAP_GP_LP | DMA_CAP_MEM_TO_DEV;
dd->dma = dma_get(dma_cap, DMA_ACCESS_SHARED); if (dd->dma == NULL) { trace_dai_error("eDd"); goto error;
In general these caps we be LP and HP since it would work with either.
Liam
Update dma_copy_new() to be compatible with dma_get(). Remove the DMAC ID argument and the corresponding PLATFORM_TRACE_DMAC definitions.
Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com --- src/include/sof/dma.h | 2 +- src/ipc/dma-copy.c | 2 +- src/lib/dma-trace.c | 2 +- src/platform/apollolake/include/platform/platform.h | 3 --- src/platform/baytrail/include/platform/platform.h | 3 --- src/platform/cannonlake/include/platform/platform.h | 3 --- src/platform/haswell/include/platform/platform.h | 3 --- 7 files changed, 3 insertions(+), 15 deletions(-)
diff --git a/src/include/sof/dma.h b/src/include/sof/dma.h index cef5e02..f285ba0 100644 --- a/src/include/sof/dma.h +++ b/src/include/sof/dma.h @@ -283,7 +283,7 @@ struct dma_copy { };
/* init dma copy context */ -int dma_copy_new(struct dma_copy *dc, int dmac); +int dma_copy_new(struct dma_copy *dc);
/* free dma copy context resources */ static inline void dma_copy_free(struct dma_copy *dc) diff --git a/src/ipc/dma-copy.c b/src/ipc/dma-copy.c index 25f891c..2efee68 100644 --- a/src/ipc/dma-copy.c +++ b/src/ipc/dma-copy.c @@ -373,7 +373,7 @@ int dma_copy_from_host_nowait(struct dma_copy *dc, struct dma_sg_config *host_sg return local_sg_elem.size; }
-int dma_copy_new(struct dma_copy *dc, int dmac) +int dma_copy_new(struct dma_copy *dc) { uint32_t dma_cap;
diff --git a/src/lib/dma-trace.c b/src/lib/dma-trace.c index 01a9925..cff9171 100644 --- a/src/lib/dma-trace.c +++ b/src/lib/dma-trace.c @@ -180,7 +180,7 @@ int dma_trace_init_complete(struct dma_trace_data *d) trace_buffer("dtn");
/* init DMA copy context */ - ret = dma_copy_new(&d->dc, PLATFORM_TRACE_DMAC); + ret = dma_copy_new(&d->dc); if (ret < 0) { trace_buffer_error("edm"); rfree(buffer->addr); diff --git a/src/platform/apollolake/include/platform/platform.h b/src/platform/apollolake/include/platform/platform.h index 1321f1f..eeb5927 100644 --- a/src/platform/apollolake/include/platform/platform.h +++ b/src/platform/apollolake/include/platform/platform.h @@ -105,9 +105,6 @@ struct sof; */ #define DMA_TRACE_RESCHEDULE_TIME 5000
-/* DMAC used for trace DMA */ -#define PLATFORM_TRACE_DMAC DMA_HOST_IN_DMAC - /* DSP should be idle in this time frame */ #define PLATFORM_IDLE_TIME 750000
diff --git a/src/platform/baytrail/include/platform/platform.h b/src/platform/baytrail/include/platform/platform.h index 1defe27..b860356 100644 --- a/src/platform/baytrail/include/platform/platform.h +++ b/src/platform/baytrail/include/platform/platform.h @@ -96,9 +96,6 @@ struct sof; */ #define DMA_TRACE_RESCHEDULE_TIME 5000
-/* DMAC used for trace DMA */ -#define PLATFORM_TRACE_DMAC DMA_ID_DMAC0 - /* DSP should be idle in this time frame */ #define PLATFORM_IDLE_TIME 750000
diff --git a/src/platform/cannonlake/include/platform/platform.h b/src/platform/cannonlake/include/platform/platform.h index c7d4a82..a5d28cf 100644 --- a/src/platform/cannonlake/include/platform/platform.h +++ b/src/platform/cannonlake/include/platform/platform.h @@ -111,9 +111,6 @@ struct sof; */ #define DMA_TRACE_RESCHEDULE_TIME 5000
-/* DMAC used for trace DMA */ -#define PLATFORM_TRACE_DMAC DMA_HOST_IN_DMAC - /* DSP should be idle in this time frame */ #define PLATFORM_IDLE_TIME 750000
diff --git a/src/platform/haswell/include/platform/platform.h b/src/platform/haswell/include/platform/platform.h index c5d8187..c2b9a4c 100644 --- a/src/platform/haswell/include/platform/platform.h +++ b/src/platform/haswell/include/platform/platform.h @@ -95,9 +95,6 @@ struct sof; */ #define DMA_TRACE_RESCHEDULE_TIME 5000
-/* DMAC used for trace DMA */ -#define PLATFORM_TRACE_DMAC DMA_ID_DMAC1 - /* DSP should be idle in this time frame */ #define PLATFORM_IDLE_TIME 750000
participants (2)
-
Liam Girdwood
-
Ranjani Sridharan