summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm_adsp.c
diff options
context:
space:
mode:
authorMark Brown2013-01-21 09:46:16 +0100
committerMark Brown2013-01-21 09:46:16 +0100
commit69485d3e6d6839b46a56c77d2dffad18cb7d373f (patch)
tree20e9de1d5fd9f6617b05e759f9326eaffaf743ee /sound/soc/codecs/wm_adsp.c
parentASoC: wm_adsp: Use GFP_DMA for algorithm readback (diff)
parentASoC: wm_adsp: Use GFP_DMA for things that may be DMAed (diff)
downloadkernel-qcow2-linux-69485d3e6d6839b46a56c77d2dffad18cb7d373f.tar.gz
kernel-qcow2-linux-69485d3e6d6839b46a56c77d2dffad18cb7d373f.tar.xz
kernel-qcow2-linux-69485d3e6d6839b46a56c77d2dffad18cb7d373f.zip
Merge remote-tracking branch 'asoc/fix/adsp' into asoc-adsp
Diffstat (limited to 'sound/soc/codecs/wm_adsp.c')
-rw-r--r--sound/soc/codecs/wm_adsp.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index edb67138d548..76ca176eac07 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -261,6 +261,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
const struct wm_adsp_region *mem;
const char *region_name;
char *file, *text;
+ void *buf;
unsigned int reg;
int regions = 0;
int ret, offset, type, sizes;
@@ -415,8 +416,18 @@ static int wm_adsp_load(struct wm_adsp *dsp)
}
if (reg) {
- ret = regmap_raw_write(regmap, reg, region->data,
+ buf = kmemdup(region->data, le32_to_cpu(region->len),
+ GFP_KERNEL | GFP_DMA);
+ if (!buf) {
+ adsp_err(dsp, "Out of memory\n");
+ return -ENOMEM;
+ }
+
+ ret = regmap_raw_write(regmap, reg, buf,
le32_to_cpu(region->len));
+
+ kfree(buf);
+
if (ret != 0) {
adsp_err(dsp,
"%s.%d: Failed to write %d bytes at %d in %s: %d\n",
@@ -664,6 +675,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
const char *region_name;
int ret, pos, blocks, type, offset, reg;
char *file;
+ void *buf;
file = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (file == NULL)
@@ -774,6 +786,13 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
}
if (reg) {
+ buf = kmemdup(blk->data, le32_to_cpu(blk->len),
+ GFP_KERNEL | GFP_DMA);
+ if (!buf) {
+ adsp_err(dsp, "Out of memory\n");
+ return -ENOMEM;
+ }
+
ret = regmap_raw_write(regmap, reg, blk->data,
le32_to_cpu(blk->len));
if (ret != 0) {
@@ -781,6 +800,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
"%s.%d: Failed to write to %x in %s\n",
file, blocks, reg, region_name);
}
+
+ kfree(buf);
}
pos += le32_to_cpu(blk->len) + sizeof(*blk);