aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm_adsp.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f9fd56444a14..937af6f31ffa 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -684,24 +684,38 @@ static int wm_adsp_load(struct wm_adsp *dsp)
684 } 684 }
685 685
686 if (reg) { 686 if (reg) {
687 buf = wm_adsp_buf_alloc(region->data, 687 size_t to_write = PAGE_SIZE;
688 le32_to_cpu(region->len), 688 size_t remain = le32_to_cpu(region->len);
689 &buf_list); 689 const u8 *data = region->data;
690 if (!buf) { 690
691 adsp_err(dsp, "Out of memory\n"); 691 while (remain > 0) {
692 ret = -ENOMEM; 692 if (remain < PAGE_SIZE)
693 goto out_fw; 693 to_write = remain;
694 } 694
695 buf = wm_adsp_buf_alloc(data,
696 to_write,
697 &buf_list);
698 if (!buf) {
699 adsp_err(dsp, "Out of memory\n");
700 ret = -ENOMEM;
701 goto out_fw;
702 }
695 703
696 ret = regmap_raw_write_async(regmap, reg, buf->buf, 704 ret = regmap_raw_write_async(regmap, reg,
697 le32_to_cpu(region->len)); 705 buf->buf,
698 if (ret != 0) { 706 to_write);
699 adsp_err(dsp, 707 if (ret != 0) {
700 "%s.%d: Failed to write %d bytes at %d in %s: %d\n", 708 adsp_err(dsp,
701 file, regions, 709 "%s.%d: Failed to write %d bytes at %d in %s: %d\n",
702 le32_to_cpu(region->len), offset, 710 file, regions,
703 region_name, ret); 711 to_write, offset,
704 goto out_fw; 712 region_name, ret);
713 goto out_fw;
714 }
715
716 data += to_write;
717 reg += to_write / 2;
718 remain -= to_write;
705 } 719 }
706 } 720 }
707 721