From ea4e2b8f672a1c0ea3755461082ad67e9472aa10 Mon Sep 17 00:00:00 2001 From: Richard Fitzgerald Date: Mon, 23 Mar 2015 10:18:35 +0000 Subject: [PATCH] ASoC: wm_adsp: split binfile load into smaller chunks If the binfile contains any large regions and memory is heavily fragmented the allocation of a single buffer for the region data can fail. Avoid this by splitting the data into page-sized chunks. Change-Id: I45c62ae04409bbcfbc5280f89ef0da5e68dc1bf4 Signed-off-by: Richard Fitzgerald Signed-off-by: Charles Keepax Signed-off-by: Richard Fitzgerald Mot-CRs-fixed: (CR) Reviewed-on: https://gerrit.mot.com/1177440 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Rav(CR) Vembu Submit-Approved: Jira Key --- sound/soc/codecs/wm_adsp.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 36417866f1c0..7afa398ac5a0 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -2705,7 +2705,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) const char *region_name; int ret, pos, blocks, type, offset, reg; char *file; - struct wm_adsp_buf *buf; + unsigned int burst_multiple; if (dsp->firmwares[dsp->fw].binfile && !(strcmp(dsp->firmwares[dsp->fw].binfile, "None"))) @@ -2780,6 +2780,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) file, blocks, le32_to_cpu(blk->len), offset, type); reg = 0; + burst_multiple = 4; region_name = "Unknown"; switch (type) { case (WMFW_NAME_TEXT << 8): @@ -2853,20 +2854,14 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp) goto out_fw; } - buf = wm_adsp_buf_alloc(blk->data, - le32_to_cpu(blk->len), - &buf_list); - if (!buf) { - adsp_err(dsp, "Out of memory\n"); - ret = -ENOMEM; - goto out_fw; - } - adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", file, blocks, le32_to_cpu(blk->len), reg); - ret = regmap_raw_write_async(regmap, reg, buf->buf, - le32_to_cpu(blk->len)); + + ret = wm_adsp_write_blocks(dsp, blk->data, + le32_to_cpu(blk->len), + reg, &buf_list, + burst_multiple); if (ret != 0) { adsp_err(dsp, "%s.%d: Failed to write to %x in %s: %d\n",