Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Introduce 'fixup_controls' card method

The new method is called just before the card is registered, providing
an opportune time for machine-level drivers to do some final controls
amending: deactivating individual controls or obtaining control
references for later use.

Some controls can be created by DAPM after 'late_probe' has been called,
hence the need for this new method.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220606191910.16580-5-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Martin Povišer and committed by
Mark Brown
df4d27b1 142d4562

+9
+1
include/sound/soc-card.h
··· 29 29 30 30 int snd_soc_card_probe(struct snd_soc_card *card); 31 31 int snd_soc_card_late_probe(struct snd_soc_card *card); 32 + void snd_soc_card_fixup_controls(struct snd_soc_card *card); 32 33 int snd_soc_card_remove(struct snd_soc_card *card); 33 34 34 35 int snd_soc_card_set_bias_level(struct snd_soc_card *card,
+1
include/sound/soc.h
··· 916 916 917 917 int (*probe)(struct snd_soc_card *card); 918 918 int (*late_probe)(struct snd_soc_card *card); 919 + void (*fixup_controls)(struct snd_soc_card *card); 919 920 int (*remove)(struct snd_soc_card *card); 920 921 921 922 /* the pre and post PM functions are used to do any PM work before and
+6
sound/soc/soc-card.c
··· 197 197 return 0; 198 198 } 199 199 200 + void snd_soc_card_fixup_controls(struct snd_soc_card *card) 201 + { 202 + if (card->fixup_controls) 203 + card->fixup_controls(card); 204 + } 205 + 200 206 int snd_soc_card_remove(struct snd_soc_card *card) 201 207 { 202 208 int ret = 0;
+1
sound/soc/soc-core.c
··· 2066 2066 goto probe_end; 2067 2067 2068 2068 snd_soc_dapm_new_widgets(card); 2069 + snd_soc_card_fixup_controls(card); 2069 2070 2070 2071 ret = snd_card_register(card->snd_card); 2071 2072 if (ret < 0) {