Commit 6958eb2a authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: wm_adsp: Remove len field from wm_adsp_alg_region

The algorithm region information in the firmware doesn't contain a
length field, explicitly pass this to the create_control function rather
than bundling into wm_adsp_alg_region.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3809f001
...@@ -780,7 +780,8 @@ static void wm_adsp_ctl_work(struct work_struct *work) ...@@ -780,7 +780,8 @@ static void wm_adsp_ctl_work(struct work_struct *work)
} }
static int wm_adsp_create_control(struct wm_adsp *dsp, static int wm_adsp_create_control(struct wm_adsp *dsp,
const struct wm_adsp_alg_region *alg_region) const struct wm_adsp_alg_region *alg_region,
unsigned int len)
{ {
struct wm_coeff_ctl *ctl; struct wm_coeff_ctl *ctl;
struct wmfw_ctl_work *ctl_work; struct wmfw_ctl_work *ctl_work;
...@@ -842,7 +843,12 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, ...@@ -842,7 +843,12 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
ctl->ops.xput = wm_coeff_put; ctl->ops.xput = wm_coeff_put;
ctl->dsp = dsp; ctl->dsp = dsp;
ctl->len = alg_region->len; if (len > 512) {
adsp_warn(dsp, "Truncating control %s from %d\n",
ctl->name, len);
len = 512;
}
ctl->len = len;
ctl->cache = kzalloc(ctl->len, GFP_KERNEL); ctl->cache = kzalloc(ctl->len, GFP_KERNEL);
if (!ctl->cache) { if (!ctl->cache) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -991,13 +997,12 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp) ...@@ -991,13 +997,12 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp)
alg_region->type = WMFW_ADSP1_DM; alg_region->type = WMFW_ADSP1_DM;
alg_region->alg = be32_to_cpu(adsp1_alg[i].alg.id); alg_region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
alg_region->base = be32_to_cpu(adsp1_alg[i].dm); alg_region->base = be32_to_cpu(adsp1_alg[i].dm);
alg_region->len = 0;
list_add_tail(&alg_region->list, &dsp->alg_regions); list_add_tail(&alg_region->list, &dsp->alg_regions);
if (i + 1 < n_algs) { if (i + 1 < n_algs) {
alg_region->len = be32_to_cpu(adsp1_alg[i + 1].dm); len = be32_to_cpu(adsp1_alg[i + 1].dm);
alg_region->len -= be32_to_cpu(adsp1_alg[i].dm); len -= be32_to_cpu(adsp1_alg[i].dm);
alg_region->len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region); wm_adsp_create_control(dsp, alg_region, len);
} else { } else {
adsp_warn(dsp, "Missing length info for region DM with ID %x\n", adsp_warn(dsp, "Missing length info for region DM with ID %x\n",
be32_to_cpu(adsp1_alg[i].alg.id)); be32_to_cpu(adsp1_alg[i].alg.id));
...@@ -1011,13 +1016,12 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp) ...@@ -1011,13 +1016,12 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp)
alg_region->type = WMFW_ADSP1_ZM; alg_region->type = WMFW_ADSP1_ZM;
alg_region->alg = be32_to_cpu(adsp1_alg[i].alg.id); alg_region->alg = be32_to_cpu(adsp1_alg[i].alg.id);
alg_region->base = be32_to_cpu(adsp1_alg[i].zm); alg_region->base = be32_to_cpu(adsp1_alg[i].zm);
alg_region->len = 0;
list_add_tail(&alg_region->list, &dsp->alg_regions); list_add_tail(&alg_region->list, &dsp->alg_regions);
if (i + 1 < n_algs) { if (i + 1 < n_algs) {
alg_region->len = be32_to_cpu(adsp1_alg[i + 1].zm); len = be32_to_cpu(adsp1_alg[i + 1].zm);
alg_region->len -= be32_to_cpu(adsp1_alg[i].zm); len -= be32_to_cpu(adsp1_alg[i].zm);
alg_region->len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region); wm_adsp_create_control(dsp, alg_region, len);
} else { } else {
adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", adsp_warn(dsp, "Missing length info for region ZM with ID %x\n",
be32_to_cpu(adsp1_alg[i].alg.id)); be32_to_cpu(adsp1_alg[i].alg.id));
...@@ -1110,13 +1114,12 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp) ...@@ -1110,13 +1114,12 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp)
alg_region->type = WMFW_ADSP2_XM; alg_region->type = WMFW_ADSP2_XM;
alg_region->alg = be32_to_cpu(adsp2_alg[i].alg.id); alg_region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
alg_region->base = be32_to_cpu(adsp2_alg[i].xm); alg_region->base = be32_to_cpu(adsp2_alg[i].xm);
alg_region->len = 0;
list_add_tail(&alg_region->list, &dsp->alg_regions); list_add_tail(&alg_region->list, &dsp->alg_regions);
if (i + 1 < n_algs) { if (i + 1 < n_algs) {
alg_region->len = be32_to_cpu(adsp2_alg[i + 1].xm); len = be32_to_cpu(adsp2_alg[i + 1].xm);
alg_region->len -= be32_to_cpu(adsp2_alg[i].xm); len -= be32_to_cpu(adsp2_alg[i].xm);
alg_region->len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region); wm_adsp_create_control(dsp, alg_region, len);
} else { } else {
adsp_warn(dsp, "Missing length info for region XM with ID %x\n", adsp_warn(dsp, "Missing length info for region XM with ID %x\n",
be32_to_cpu(adsp2_alg[i].alg.id)); be32_to_cpu(adsp2_alg[i].alg.id));
...@@ -1130,13 +1133,12 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp) ...@@ -1130,13 +1133,12 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp)
alg_region->type = WMFW_ADSP2_YM; alg_region->type = WMFW_ADSP2_YM;
alg_region->alg = be32_to_cpu(adsp2_alg[i].alg.id); alg_region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
alg_region->base = be32_to_cpu(adsp2_alg[i].ym); alg_region->base = be32_to_cpu(adsp2_alg[i].ym);
alg_region->len = 0;
list_add_tail(&alg_region->list, &dsp->alg_regions); list_add_tail(&alg_region->list, &dsp->alg_regions);
if (i + 1 < n_algs) { if (i + 1 < n_algs) {
alg_region->len = be32_to_cpu(adsp2_alg[i + 1].ym); len = be32_to_cpu(adsp2_alg[i + 1].ym);
alg_region->len -= be32_to_cpu(adsp2_alg[i].ym); len -= be32_to_cpu(adsp2_alg[i].ym);
alg_region->len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region); wm_adsp_create_control(dsp, alg_region, len);
} else { } else {
adsp_warn(dsp, "Missing length info for region YM with ID %x\n", adsp_warn(dsp, "Missing length info for region YM with ID %x\n",
be32_to_cpu(adsp2_alg[i].alg.id)); be32_to_cpu(adsp2_alg[i].alg.id));
...@@ -1150,13 +1152,12 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp) ...@@ -1150,13 +1152,12 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp)
alg_region->type = WMFW_ADSP2_ZM; alg_region->type = WMFW_ADSP2_ZM;
alg_region->alg = be32_to_cpu(adsp2_alg[i].alg.id); alg_region->alg = be32_to_cpu(adsp2_alg[i].alg.id);
alg_region->base = be32_to_cpu(adsp2_alg[i].zm); alg_region->base = be32_to_cpu(adsp2_alg[i].zm);
alg_region->len = 0;
list_add_tail(&alg_region->list, &dsp->alg_regions); list_add_tail(&alg_region->list, &dsp->alg_regions);
if (i + 1 < n_algs) { if (i + 1 < n_algs) {
alg_region->len = be32_to_cpu(adsp2_alg[i + 1].zm); len = be32_to_cpu(adsp2_alg[i + 1].zm);
alg_region->len -= be32_to_cpu(adsp2_alg[i].zm); len -= be32_to_cpu(adsp2_alg[i].zm);
alg_region->len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region); wm_adsp_create_control(dsp, alg_region, len);
} else { } else {
adsp_warn(dsp, "Missing length info for region ZM with ID %x\n", adsp_warn(dsp, "Missing length info for region ZM with ID %x\n",
be32_to_cpu(adsp2_alg[i].alg.id)); be32_to_cpu(adsp2_alg[i].alg.id));
......
...@@ -30,7 +30,6 @@ struct wm_adsp_alg_region { ...@@ -30,7 +30,6 @@ struct wm_adsp_alg_region {
unsigned int alg; unsigned int alg;
int type; int type;
unsigned int base; unsigned int base;
size_t len;
}; };
struct wm_adsp { struct wm_adsp {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment