[Sound-open-firmware] [RFC PATCH 4/6] dma: use newly defined API for request DMAC
Ranjani Sridharan
ranjani.sridharan at linux.intel.com
Tue Jun 5 06:23:18 CEST 2018
Use the new dma_get() API to procure DMAC's for all the users.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
---
src/audio/dai.c | 7 ++++++-
src/audio/host.c | 28 +++++++++++++++++++++++-----
src/host/common_test.c | 2 +-
src/ipc/apl-ipc.c | 3 ++-
src/ipc/byt-ipc.c | 4 ++--
src/ipc/cnl-ipc.c | 4 ++--
src/ipc/dma-copy.c | 7 ++++++-
src/ipc/hsw-ipc.c | 4 ++--
8 files changed, 44 insertions(+), 15 deletions(-)
diff --git a/src/audio/dai.c b/src/audio/dai.c
index 1eeecd2..715e4c6 100644
--- a/src/audio/dai.c
+++ b/src/audio/dai.c
@@ -201,7 +201,12 @@ static struct comp_dev *dai_new(struct sof_ipc_comp *comp)
goto error;
}
- dd->dma = dma_get(ipc_dai->dmac_id);
+ /*
+ * request DMAC with DAI_DMA user type, DUPLEX copy direction
+ * shared access flag
+ */
+ dd->dma = dma_get(DMAC_USER_GP_LP_DMA, DMAC_DIR_DUPLEX,
+ DMAC_FLAGS_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..6c5076b 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -530,12 +530,30 @@ 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);
+ /*
+ * request DMAC with HOST_DMA user type, duplex copy direction
+ * and shared access flag
+ */
+ hd->dma = dma_get(DMAC_USER_HOST_DMA, DMAC_DIR_DUPLEX,
+ DMAC_FLAGS_SHARED);
#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);
+ if (ipc_host->direction == SOF_IPC_STREAM_PLAYBACK) {
+
+ /*
+ * request DMAC with HOST_DMA user type, READ copy direction
+ * and shared access flag
+ */
+ hd->dma = dma_get(DMAC_USER_HOST_DMA, DMAC_DIR_READ,
+ DMAC_FLAGS_SHARED);
+ } else {
+
+ /*
+ * request DMAC with HOST_DMA user type, WRITE copy direction
+ * and shared access flag
+ */
+ hd->dma = dma_get(DMAC_USER_HOST_DMA, DMAC_DIR_WRITE,
+ DMAC_FLAGS_SHARED);
+ }
#endif
if (hd->dma == NULL) {
trace_host_error("eDM");
diff --git a/src/host/common_test.c b/src/host/common_test.c
index e286883..155c81b 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(enum dmac_user, enum dmac_copy_dir, int flags)
{
return NULL;
}
diff --git a/src/ipc/apl-ipc.c b/src/ipc/apl-ipc.c
index 78291d0..c7d7305 100644
--- a/src/ipc/apl-ipc.c
+++ b/src/ipc/apl-ipc.c
@@ -199,7 +199,8 @@ int platform_ipc_init(struct ipc *ipc)
bzero(iipc->page_table, HOST_PAGE_SIZE);
/* dma */
- iipc->dmac = dma_get(DMA_GP_LP_DMAC0);
+ iipc->dmac = dma_get(DMAC_USER_GP_LP_DMA, DMAC_DIR_DUPLEX,
+ DMAC_FLAGS_SHARED);
/* PM */
iipc->pm_prepare_D3 = 0;
diff --git a/src/ipc/byt-ipc.c b/src/ipc/byt-ipc.c
index 87e7949..7c9feba 100644
--- a/src/ipc/byt-ipc.c
+++ b/src/ipc/byt-ipc.c
@@ -225,8 +225,8 @@ 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 DMAC with shared access flag */
+ iipc->dmac = dma_get(0, 0, DMAC_FLAGS_SHARED);
/* PM */
iipc->pm_prepare_D3 = 0;
diff --git a/src/ipc/cnl-ipc.c b/src/ipc/cnl-ipc.c
index ba65164..fa71aa3 100644
--- a/src/ipc/cnl-ipc.c
+++ b/src/ipc/cnl-ipc.c
@@ -199,8 +199,8 @@ int platform_ipc_init(struct ipc *ipc)
bzero(iipc->page_table, HOST_PAGE_SIZE);
/* dma */
- iipc->dmac = dma_get(DMA_GP_LP_DMAC0);
-
+ iipc->dmac = dma_get(DMAC_USER_GP_LP_DMA, DMAC_DIR_DUPLEX,
+ DMAC_FLAGS_SHARED);
/* PM */
iipc->pm_prepare_D3 = 0;
diff --git a/src/ipc/dma-copy.c b/src/ipc/dma-copy.c
index be72eb8..7fd8449 100644
--- a/src/ipc/dma-copy.c
+++ b/src/ipc/dma-copy.c
@@ -375,7 +375,12 @@ 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);
+ /*
+ * request DMAC with HOST_DMA user type, WRITE copy direction
+ * with shared access and high perf flags
+ */
+ dc->dmac = dma_get(DMAC_USER_HOST_DMA, DMAC_DIR_WRITE,
+ DMAC_FLAGS_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..bbfc10b 100644
--- a/src/ipc/hsw-ipc.c
+++ b/src/ipc/hsw-ipc.c
@@ -221,8 +221,8 @@ 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 DMAC with shared access flag */
+ iipc->dmac = dma_get(0, 0, DMAC_FLAGS_SHARED);
/* PM */
iipc->pm_prepare_D3 = 0;
--
2.17.0
More information about the Sound-open-firmware
mailing list