[Sound-open-firmware] [PATCH] component: host: Add support for passing host buffer size as param
Liam Girdwood
liam.r.girdwood at linux.intel.com
Thu Dec 22 14:05:10 CET 2016
The host buffer may not be a multiple of host PHY page size, so provide
so pass this value as part of our host buffer init.
Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
src/audio/host.c | 5 +++--
src/audio/pipeline.c | 4 ++--
src/include/reef/audio/component.h | 4 ++--
src/include/reef/audio/pipeline.h | 2 +-
src/ipc/intel-ipc.c | 3 ++-
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/audio/host.c b/src/audio/host.c
index e76fe81..521380a 100644
--- a/src/audio/host.c
+++ b/src/audio/host.c
@@ -473,7 +473,8 @@ static int host_cmd(struct comp_dev *dev, int cmd, void *data)
return ret;
}
-static int host_buffer(struct comp_dev *dev, struct dma_sg_elem *elem)
+static int host_buffer(struct comp_dev *dev, struct dma_sg_elem *elem,
+ uint32_t host_size)
{
struct host_data *hd = comp_get_drvdata(dev);
struct dma_sg_elem *e;
@@ -484,7 +485,7 @@ static int host_buffer(struct comp_dev *dev, struct dma_sg_elem *elem)
return -ENOMEM;
*e = *elem;
- hd->host_size += e->size;
+ hd->host_size = host_size;
list_item_append(&e->list, &hd->host.elem_list);
return 0;
diff --git a/src/audio/pipeline.c b/src/audio/pipeline.c
index f42fa15..0026048 100644
--- a/src/audio/pipeline.c
+++ b/src/audio/pipeline.c
@@ -553,11 +553,11 @@ int pipeline_reset(struct pipeline *p, struct comp_dev *host)
/* TODO: remove ?? configure pipelines host DMA buffer */
int pipeline_host_buffer(struct pipeline *p, struct comp_dev *host,
- struct dma_sg_elem *elem)
+ struct dma_sg_elem *elem, uint32_t host_size)
{
trace_pipe("PBr");
- return comp_host_buffer(host, elem);
+ return comp_host_buffer(host, elem, host_size);
}
/* copy audio data from DAI buffer to host PCM buffer via pipeline */
diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h
index 850165b..fbd29e4 100644
--- a/src/include/reef/audio/component.h
+++ b/src/include/reef/audio/component.h
@@ -254,10 +254,10 @@ static inline int comp_params(struct comp_dev *dev,
* mandatory for host components, optional for the others.
*/
static inline int comp_host_buffer(struct comp_dev *dev,
- struct dma_sg_elem *elem)
+ struct dma_sg_elem *elem, uint32_t host_size)
{
if (dev->drv->ops.host_buffer)
- return dev->drv->ops.host_buffer(dev, elem);
+ return dev->drv->ops.host_buffer(dev, elem, host_size);
return 0;
}
diff --git a/src/include/reef/audio/pipeline.h b/src/include/reef/audio/pipeline.h
index f0f77fa..26c1dd6 100644
--- a/src/include/reef/audio/pipeline.h
+++ b/src/include/reef/audio/pipeline.h
@@ -89,7 +89,7 @@ int pipeline_params(struct pipeline *p, struct comp_dev *cd,
/* pipeline parameters */
int pipeline_host_buffer(struct pipeline *p, struct comp_dev *cd,
- struct dma_sg_elem *elem);
+ struct dma_sg_elem *elem, uint32_t host_size);
/* prepare the pipeline for usage */
int pipeline_prepare(struct pipeline *p, struct comp_dev *cd);
diff --git a/src/ipc/intel-ipc.c b/src/ipc/intel-ipc.c
index d735f26..b7ecbba 100644
--- a/src/ipc/intel-ipc.c
+++ b/src/ipc/intel-ipc.c
@@ -244,7 +244,8 @@ static int parse_page_descriptors(struct intel_ipc_data *iipc,
else
elem.dest = phy_addr;
- err = pipeline_host_buffer(pipeline_static, host, &elem);
+ err = pipeline_host_buffer(pipeline_static, host, &elem,
+ req->ringinfo.ring_size);
if (err < 0) {
trace_ipc_error("ePb");
return err;
--
2.9.3
More information about the Sound-open-firmware
mailing list