> > +static struct snd_soc_dapm_widget simple_widgets[] = { > > + SND_SOC_DAPM_MIC("Mic", NULL), > > + SND_SOC_DAPM_LINE("Line", NULL), > > + SND_SOC_DAPM_HP("Hp", NULL), > > + SND_SOC_DAPM_SPK("Spk", NULL), > > +}; >
This is the templates for "Microphone XXX", "Line XXX", "Headphone XXX" and "Spk XXX" . > Does this mean we're restricted to a particular set of names? That > seems sad and won't work if there's a desire for more than one of a > given widget - the main use case I can see is multiple microphones with > separate microphone biases. How about having some templates that we > copy and then replace the name with the one the user supplied? > This code has already supplied this I think. Using this API, the only limitation is that, for example if the user has multiple Microphones, it should set the name in DT file like: "Mic XXX", "Mic YYY", "Mic ZZZ"... And these widgets will use the template of : SND_SOC_DAPM_MIC("Mic", NULL), And the widgets' names will be replaced with "Mic XXX", "Mic YYY", "Mic ZZZ"... from the user's DT node. Or your suggestion is : The templates is: +static struct snd_soc_dapm_widget simple_widgets[] = { + SND_SOC_DAPM_MIC("Mic", NULL), + SND_SOC_DAPM_LINE("Line", NULL), + SND_SOC_DAPM_HP("Hp", NULL), + SND_SOC_DAPM_SPK("Spk", NULL), +}; And in the DT node: simple-off-codec-widgets = /* template-name user-supplied-name */ "Mic", "Microphone XXX", "Mic", "UUU Microphone YYY", "Hp", "TTT Headphone XXX", "Hp", "Headphone YYY"; And then just replace the template's name with the user supplied name? Thanks, Best Regards, Xiubo