summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.cirrus.com>2018-08-08 12:13:38 -0400
committerMark Brown <broonie@kernel.org>2018-08-08 12:31:48 -0400
commit0a047f07525fecfa8f6fccc5d30afff7e816de8d (patch)
tree559710cf8b8532e459548233674c27a933797400 /sound
parentf861e3e28a3016a2064d9f600eaa92a530b732b4 (diff)
ASoC: wm_adsp: Declare firmware controls from codec driver
To allow for more flexibility in naming of DSP-type cores move the creation of the firmware controls to the codec drivers instead of having a hardcoded list in wm_adsp. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/cs47l24.c3
-rw-r--r--sound/soc/codecs/wm2200.c10
-rw-r--r--sound/soc/codecs/wm5102.c2
-rw-r--r--sound/soc/codecs/wm5110.c5
-rw-r--r--sound/soc/codecs/wm_adsp.c35
-rw-r--r--sound/soc/codecs/wm_adsp.h10
6 files changed, 32 insertions, 33 deletions
diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c
index 0da52ead91e0..45e50fe3bf25 100644
--- a/sound/soc/codecs/cs47l24.c
+++ b/sound/soc/codecs/cs47l24.c
@@ -235,6 +235,9 @@ ARIZONA_MIXER_CONTROLS("AIF2TX6", ARIZONA_AIF2TX6MIX_INPUT_1_SOURCE),
235 235
236ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE), 236ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
237ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), 237ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
238
239WM_ADSP_FW_CONTROL("DSP2", 1),
240WM_ADSP_FW_CONTROL("DSP3", 2),
238}; 241};
239 242
240ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); 243ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index 3663b9fd4d65..deff65161504 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1180,6 +1180,9 @@ SOC_DOUBLE_R_TLV("OUT2 Digital Volume", WM2200_DAC_DIGITAL_VOLUME_2L,
1180SOC_DOUBLE("OUT2 Switch", WM2200_PDM_1, WM2200_SPK1L_MUTE_SHIFT, 1180SOC_DOUBLE("OUT2 Switch", WM2200_PDM_1, WM2200_SPK1L_MUTE_SHIFT,
1181 WM2200_SPK1R_MUTE_SHIFT, 1, 1), 1181 WM2200_SPK1R_MUTE_SHIFT, 1, 1),
1182SOC_ENUM("RxANC Src", wm2200_rxanc_input_sel), 1182SOC_ENUM("RxANC Src", wm2200_rxanc_input_sel),
1183
1184WM_ADSP_FW_CONTROL("DSP1", 0),
1185WM_ADSP_FW_CONTROL("DSP2", 1),
1183}; 1186};
1184 1187
1185WM2200_MIXER_ENUMS(OUT1L, WM2200_OUT1LMIX_INPUT_1_SOURCE); 1188WM2200_MIXER_ENUMS(OUT1L, WM2200_OUT1LMIX_INPUT_1_SOURCE);
@@ -1553,15 +1556,10 @@ static const struct snd_soc_dapm_route wm2200_dapm_routes[] = {
1553static int wm2200_probe(struct snd_soc_component *component) 1556static int wm2200_probe(struct snd_soc_component *component)
1554{ 1557{
1555 struct wm2200_priv *wm2200 = snd_soc_component_get_drvdata(component); 1558 struct wm2200_priv *wm2200 = snd_soc_component_get_drvdata(component);
1556 int ret;
1557 1559
1558 wm2200->component = component; 1560 wm2200->component = component;
1559 1561
1560 ret = snd_soc_add_component_controls(component, wm_adsp_fw_controls, 2); 1562 return 0;
1561 if (ret != 0)
1562 return ret;
1563
1564 return ret;
1565} 1563}
1566 1564
1567static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) 1565static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index a01a0c0e01eb..7e817e1877c2 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -985,6 +985,8 @@ ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
985ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE), 985ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
986ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE), 986ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
987ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE), 987ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
988
989WM_ADSP_FW_CONTROL("DSP1", 0),
988}; 990};
989 991
990ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); 992ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index 00c735c585d9..b0789a03d699 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -927,6 +927,11 @@ ARIZONA_MIXER_CONTROLS("SLIMTX5", ARIZONA_SLIMTX5MIX_INPUT_1_SOURCE),
927ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE), 927ARIZONA_MIXER_CONTROLS("SLIMTX6", ARIZONA_SLIMTX6MIX_INPUT_1_SOURCE),
928ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE), 928ARIZONA_MIXER_CONTROLS("SLIMTX7", ARIZONA_SLIMTX7MIX_INPUT_1_SOURCE),
929ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE), 929ARIZONA_MIXER_CONTROLS("SLIMTX8", ARIZONA_SLIMTX8MIX_INPUT_1_SOURCE),
930
931WM_ADSP_FW_CONTROL("DSP1", 0),
932WM_ADSP_FW_CONTROL("DSP2", 1),
933WM_ADSP_FW_CONTROL("DSP3", 2),
934WM_ADSP_FW_CONTROL("DSP4", 3),
930}; 935};
931 936
932ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); 937ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index e39b0e0b04df..fbd0515c49d7 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -684,8 +684,8 @@ static inline void wm_adsp_debugfs_clear(struct wm_adsp *dsp)
684} 684}
685#endif 685#endif
686 686
687static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol, 687int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
688 struct snd_ctl_elem_value *ucontrol) 688 struct snd_ctl_elem_value *ucontrol)
689{ 689{
690 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 690 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
691 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 691 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
@@ -695,9 +695,10 @@ static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
695 695
696 return 0; 696 return 0;
697} 697}
698EXPORT_SYMBOL_GPL(wm_adsp_fw_get);
698 699
699static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, 700int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
700 struct snd_ctl_elem_value *ucontrol) 701 struct snd_ctl_elem_value *ucontrol)
701{ 702{
702 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); 703 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
703 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 704 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
@@ -721,8 +722,9 @@ static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
721 722
722 return ret; 723 return ret;
723} 724}
725EXPORT_SYMBOL_GPL(wm_adsp_fw_put);
724 726
725static const struct soc_enum wm_adsp_fw_enum[] = { 727const struct soc_enum wm_adsp_fw_enum[] = {
726 SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), 728 SOC_ENUM_SINGLE(0, 0, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
727 SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), 729 SOC_ENUM_SINGLE(0, 1, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
728 SOC_ENUM_SINGLE(0, 2, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), 730 SOC_ENUM_SINGLE(0, 2, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
@@ -731,24 +733,7 @@ static const struct soc_enum wm_adsp_fw_enum[] = {
731 SOC_ENUM_SINGLE(0, 5, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), 733 SOC_ENUM_SINGLE(0, 5, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
732 SOC_ENUM_SINGLE(0, 6, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text), 734 SOC_ENUM_SINGLE(0, 6, ARRAY_SIZE(wm_adsp_fw_text), wm_adsp_fw_text),
733}; 735};
734 736EXPORT_SYMBOL_GPL(wm_adsp_fw_enum);
735const struct snd_kcontrol_new wm_adsp_fw_controls[] = {
736 SOC_ENUM_EXT("DSP1 Firmware", wm_adsp_fw_enum[0],
737 wm_adsp_fw_get, wm_adsp_fw_put),
738 SOC_ENUM_EXT("DSP2 Firmware", wm_adsp_fw_enum[1],
739 wm_adsp_fw_get, wm_adsp_fw_put),
740 SOC_ENUM_EXT("DSP3 Firmware", wm_adsp_fw_enum[2],
741 wm_adsp_fw_get, wm_adsp_fw_put),
742 SOC_ENUM_EXT("DSP4 Firmware", wm_adsp_fw_enum[3],
743 wm_adsp_fw_get, wm_adsp_fw_put),
744 SOC_ENUM_EXT("DSP5 Firmware", wm_adsp_fw_enum[4],
745 wm_adsp_fw_get, wm_adsp_fw_put),
746 SOC_ENUM_EXT("DSP6 Firmware", wm_adsp_fw_enum[5],
747 wm_adsp_fw_get, wm_adsp_fw_put),
748 SOC_ENUM_EXT("DSP7 Firmware", wm_adsp_fw_enum[6],
749 wm_adsp_fw_get, wm_adsp_fw_put),
750};
751EXPORT_SYMBOL_GPL(wm_adsp_fw_controls);
752 737
753static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp, 738static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp,
754 int type) 739 int type)
@@ -2884,9 +2869,7 @@ int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *comp
2884 2869
2885 dsp->component = component; 2870 dsp->component = component;
2886 2871
2887 return snd_soc_add_component_controls(component, 2872 return 0;
2888 &wm_adsp_fw_controls[dsp->num - 1],
2889 1);
2890} 2873}
2891EXPORT_SYMBOL_GPL(wm_adsp2_component_probe); 2874EXPORT_SYMBOL_GPL(wm_adsp2_component_probe);
2892 2875
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
index bc6d359f0533..8d58cb9d9bb9 100644
--- a/sound/soc/codecs/wm_adsp.h
+++ b/sound/soc/codecs/wm_adsp.h
@@ -121,7 +121,11 @@ struct wm_adsp {
121 .reg = SND_SOC_NOPM, .shift = num, .event = wm_adsp2_event, \ 121 .reg = SND_SOC_NOPM, .shift = num, .event = wm_adsp2_event, \
122 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD } 122 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD }
123 123
124extern const struct snd_kcontrol_new wm_adsp_fw_controls[]; 124#define WM_ADSP_FW_CONTROL(dspname, num) \
125 SOC_ENUM_EXT(dspname " Firmware", wm_adsp_fw_enum[num], \
126 wm_adsp_fw_get, wm_adsp_fw_put)
127
128extern const struct soc_enum wm_adsp_fw_enum[];
125 129
126int wm_adsp1_init(struct wm_adsp *dsp); 130int wm_adsp1_init(struct wm_adsp *dsp);
127int wm_adsp2_init(struct wm_adsp *dsp); 131int wm_adsp2_init(struct wm_adsp *dsp);
@@ -144,6 +148,10 @@ int wm_adsp2_preloader_get(struct snd_kcontrol *kcontrol,
144 struct snd_ctl_elem_value *ucontrol); 148 struct snd_ctl_elem_value *ucontrol);
145int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, 149int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
146 struct snd_ctl_elem_value *ucontrol); 150 struct snd_ctl_elem_value *ucontrol);
151int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
152 struct snd_ctl_elem_value *ucontrol);
153int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
154 struct snd_ctl_elem_value *ucontrol);
147 155
148int wm_adsp_compr_open(struct wm_adsp *dsp, struct snd_compr_stream *stream); 156int wm_adsp_compr_open(struct wm_adsp *dsp, struct snd_compr_stream *stream);
149int wm_adsp_compr_free(struct snd_compr_stream *stream); 157int wm_adsp_compr_free(struct snd_compr_stream *stream);