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 <rf@opensource.wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
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 <raviv@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Richard Fitzgerald 2015-03-23 10:18:35 +00:00 • committed by Ravikumar Vembu
commit ea4e2b8f67

View file

@ -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",