Commit 218e5087 authored by Richard Fitzgerald's avatar Richard Fitzgerald Committed by Mark Brown

ASoC: wm_adsp: create ALSA controls from wm_adsp driver

Now that we have a codec_probe stage initialization in the wm_adsp
driver, we can make the wm_adsp driver create its own ALSA controls
instead of having that responsibility pushed to every codec driver.
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent f5e2ce92
...@@ -1879,10 +1879,6 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec) ...@@ -1879,10 +1879,6 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
if (ret) if (ret)
return ret; return ret;
ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 2);
if (ret != 0)
return ret;
arizona_init_spk(codec); arizona_init_spk(codec);
arizona_init_gpio(codec); arizona_init_gpio(codec);
......
...@@ -1613,10 +1613,6 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec) ...@@ -1613,10 +1613,6 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
return ret; return ret;
} }
ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 8);
if (ret != 0)
return ret;
snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS"); snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
priv->core.arizona->dapm = &codec->dapm; priv->core.arizona->dapm = &codec->dapm;
......
...@@ -298,7 +298,6 @@ const struct snd_kcontrol_new wm_adsp1_fw_controls[] = { ...@@ -298,7 +298,6 @@ const struct snd_kcontrol_new wm_adsp1_fw_controls[] = {
}; };
EXPORT_SYMBOL_GPL(wm_adsp1_fw_controls); EXPORT_SYMBOL_GPL(wm_adsp1_fw_controls);
#if IS_ENABLED(CONFIG_SND_SOC_ARIZONA)
static const struct soc_enum wm_adsp2_rate_enum[] = { static const struct soc_enum wm_adsp2_rate_enum[] = {
SOC_VALUE_ENUM_SINGLE(ARIZONA_DSP1_CONTROL_1, SOC_VALUE_ENUM_SINGLE(ARIZONA_DSP1_CONTROL_1,
ARIZONA_DSP1_RATE_SHIFT, 0xf, ARIZONA_DSP1_RATE_SHIFT, 0xf,
...@@ -318,22 +317,28 @@ static const struct soc_enum wm_adsp2_rate_enum[] = { ...@@ -318,22 +317,28 @@ static const struct soc_enum wm_adsp2_rate_enum[] = {
arizona_rate_text, arizona_rate_val), arizona_rate_text, arizona_rate_val),
}; };
const struct snd_kcontrol_new wm_adsp2_fw_controls[] = { static const struct snd_kcontrol_new wm_adsp2_fw_controls[4][2] = {
SOC_ENUM_EXT("DSP1 Firmware", wm_adsp_fw_enum[0], {
wm_adsp_fw_get, wm_adsp_fw_put), SOC_ENUM_EXT("DSP1 Firmware", wm_adsp_fw_enum[0],
SOC_ENUM("DSP1 Rate", wm_adsp2_rate_enum[0]), wm_adsp_fw_get, wm_adsp_fw_put),
SOC_ENUM_EXT("DSP2 Firmware", wm_adsp_fw_enum[1], SOC_ENUM("DSP1 Rate", wm_adsp2_rate_enum[0]),
wm_adsp_fw_get, wm_adsp_fw_put), },
SOC_ENUM("DSP2 Rate", wm_adsp2_rate_enum[1]), {
SOC_ENUM_EXT("DSP3 Firmware", wm_adsp_fw_enum[2], SOC_ENUM_EXT("DSP2 Firmware", wm_adsp_fw_enum[1],
wm_adsp_fw_get, wm_adsp_fw_put), wm_adsp_fw_get, wm_adsp_fw_put),
SOC_ENUM("DSP3 Rate", wm_adsp2_rate_enum[2]), SOC_ENUM("DSP2 Rate", wm_adsp2_rate_enum[1]),
SOC_ENUM_EXT("DSP4 Firmware", wm_adsp_fw_enum[3], },
wm_adsp_fw_get, wm_adsp_fw_put), {
SOC_ENUM("DSP4 Rate", wm_adsp2_rate_enum[3]), SOC_ENUM_EXT("DSP3 Firmware", wm_adsp_fw_enum[2],
wm_adsp_fw_get, wm_adsp_fw_put),
SOC_ENUM("DSP3 Rate", wm_adsp2_rate_enum[2]),
},
{
SOC_ENUM_EXT("DSP4 Firmware", wm_adsp_fw_enum[3],
wm_adsp_fw_get, wm_adsp_fw_put),
SOC_ENUM("DSP4 Rate", wm_adsp2_rate_enum[3]),
},
}; };
EXPORT_SYMBOL_GPL(wm_adsp2_fw_controls);
#endif
static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp, static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp,
int type) int type)
...@@ -1935,7 +1940,9 @@ EXPORT_SYMBOL_GPL(wm_adsp2_event); ...@@ -1935,7 +1940,9 @@ EXPORT_SYMBOL_GPL(wm_adsp2_event);
int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec) int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec)
{ {
return 0; return snd_soc_add_codec_controls(codec,
wm_adsp2_fw_controls[dsp->num - 1],
ARRAY_SIZE(wm_adsp2_fw_controls[0]));
} }
EXPORT_SYMBOL_GPL(wm_adsp2_codec_probe); EXPORT_SYMBOL_GPL(wm_adsp2_codec_probe);
......
...@@ -75,7 +75,6 @@ struct wm_adsp { ...@@ -75,7 +75,6 @@ struct wm_adsp {
WM_ADSP2_E(wname, num, wm_adsp2_early_event) WM_ADSP2_E(wname, num, wm_adsp2_early_event)
extern const struct snd_kcontrol_new wm_adsp1_fw_controls[]; extern const struct snd_kcontrol_new wm_adsp1_fw_controls[];
extern const struct snd_kcontrol_new wm_adsp2_fw_controls[];
int wm_adsp1_init(struct wm_adsp *dsp); int wm_adsp1_init(struct wm_adsp *dsp);
int wm_adsp2_init(struct wm_adsp *dsp); int wm_adsp2_init(struct wm_adsp *dsp);
......
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