Commit 8eb084d0 authored by Stuart Henderson's avatar Stuart Henderson Committed by Mark Brown

ASoC: wm_adsp: Add support for SYSTEM firmware controls

Add support for firmware controls marked SYSTEM. These are
internal to the driver-firmware interface and do not have
a user-accessible ALSA control.
Signed-off-by: default avatarStuart Henderson <stuarth@opensource.wolfsonmicro.com>
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9ce5e6e6
...@@ -452,6 +452,7 @@ struct wm_coeff_ctl { ...@@ -452,6 +452,7 @@ struct wm_coeff_ctl {
struct snd_kcontrol *kcontrol; struct snd_kcontrol *kcontrol;
struct soc_bytes_ext bytes_ext; struct soc_bytes_ext bytes_ext;
unsigned int flags; unsigned int flags;
unsigned int type;
}; };
static const char *wm_adsp_mem_region_name(unsigned int type) static const char *wm_adsp_mem_region_name(unsigned int type)
...@@ -1159,7 +1160,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, ...@@ -1159,7 +1160,7 @@ 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 offset, unsigned int len, unsigned int offset, unsigned int len,
const char *subname, unsigned int subname_len, const char *subname, unsigned int subname_len,
unsigned int flags) unsigned int flags, unsigned int type)
{ {
struct wm_coeff_ctl *ctl; struct wm_coeff_ctl *ctl;
struct wmfw_ctl_work *ctl_work; struct wmfw_ctl_work *ctl_work;
...@@ -1167,9 +1168,6 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, ...@@ -1167,9 +1168,6 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
const char *region_name; const char *region_name;
int ret; int ret;
if (flags & WMFW_CTL_FLAG_SYS)
return 0;
region_name = wm_adsp_mem_region_name(alg_region->type); region_name = wm_adsp_mem_region_name(alg_region->type);
if (!region_name) { if (!region_name) {
adsp_err(dsp, "Unknown region type: %d\n", alg_region->type); adsp_err(dsp, "Unknown region type: %d\n", alg_region->type);
...@@ -1227,6 +1225,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, ...@@ -1227,6 +1225,7 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
ctl->dsp = dsp; ctl->dsp = dsp;
ctl->flags = flags; ctl->flags = flags;
ctl->type = type;
ctl->offset = offset; ctl->offset = offset;
ctl->len = len; ctl->len = len;
ctl->cache = kzalloc(ctl->len, GFP_KERNEL); ctl->cache = kzalloc(ctl->len, GFP_KERNEL);
...@@ -1237,6 +1236,9 @@ static int wm_adsp_create_control(struct wm_adsp *dsp, ...@@ -1237,6 +1236,9 @@ static int wm_adsp_create_control(struct wm_adsp *dsp,
list_add(&ctl->list, &dsp->ctl_list); list_add(&ctl->list, &dsp->ctl_list);
if (flags & WMFW_CTL_FLAG_SYS)
return 0;
ctl_work = kzalloc(sizeof(*ctl_work), GFP_KERNEL); ctl_work = kzalloc(sizeof(*ctl_work), GFP_KERNEL);
if (!ctl_work) { if (!ctl_work) {
ret = -ENOMEM; ret = -ENOMEM;
...@@ -1451,7 +1453,8 @@ static int wm_adsp_parse_coeff(struct wm_adsp *dsp, ...@@ -1451,7 +1453,8 @@ static int wm_adsp_parse_coeff(struct wm_adsp *dsp,
coeff_blk.len, coeff_blk.len,
coeff_blk.name, coeff_blk.name,
coeff_blk.name_len, coeff_blk.name_len,
coeff_blk.flags); coeff_blk.flags,
coeff_blk.ctl_type);
if (ret < 0) if (ret < 0)
adsp_err(dsp, "Failed to create control: %.*s, %d\n", adsp_err(dsp, "Failed to create control: %.*s, %d\n",
coeff_blk.name_len, coeff_blk.name, ret); coeff_blk.name_len, coeff_blk.name, ret);
...@@ -1851,7 +1854,8 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp) ...@@ -1851,7 +1854,8 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp)
len -= be32_to_cpu(adsp1_alg[i].dm); len -= be32_to_cpu(adsp1_alg[i].dm);
len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region, 0, wm_adsp_create_control(dsp, alg_region, 0,
len, NULL, 0, 0); len, NULL, 0, 0,
SNDRV_CTL_ELEM_TYPE_BYTES);
} 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));
...@@ -1871,7 +1875,8 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp) ...@@ -1871,7 +1875,8 @@ static int wm_adsp1_setup_algs(struct wm_adsp *dsp)
len -= be32_to_cpu(adsp1_alg[i].zm); len -= be32_to_cpu(adsp1_alg[i].zm);
len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region, 0, wm_adsp_create_control(dsp, alg_region, 0,
len, NULL, 0, 0); len, NULL, 0, 0,
SNDRV_CTL_ELEM_TYPE_BYTES);
} 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));
...@@ -1962,7 +1967,8 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp) ...@@ -1962,7 +1967,8 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp)
len -= be32_to_cpu(adsp2_alg[i].xm); len -= be32_to_cpu(adsp2_alg[i].xm);
len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region, 0, wm_adsp_create_control(dsp, alg_region, 0,
len, NULL, 0, 0); len, NULL, 0, 0,
SNDRV_CTL_ELEM_TYPE_BYTES);
} 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));
...@@ -1982,7 +1988,8 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp) ...@@ -1982,7 +1988,8 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp)
len -= be32_to_cpu(adsp2_alg[i].ym); len -= be32_to_cpu(adsp2_alg[i].ym);
len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region, 0, wm_adsp_create_control(dsp, alg_region, 0,
len, NULL, 0, 0); len, NULL, 0, 0,
SNDRV_CTL_ELEM_TYPE_BYTES);
} 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));
...@@ -2002,7 +2009,8 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp) ...@@ -2002,7 +2009,8 @@ static int wm_adsp2_setup_algs(struct wm_adsp *dsp)
len -= be32_to_cpu(adsp2_alg[i].zm); len -= be32_to_cpu(adsp2_alg[i].zm);
len *= 4; len *= 4;
wm_adsp_create_control(dsp, alg_region, 0, wm_adsp_create_control(dsp, alg_region, 0,
len, NULL, 0, 0); len, NULL, 0, 0,
SNDRV_CTL_ELEM_TYPE_BYTES);
} 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));
......
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