[alsa-devel] SOC_DAPM_MUX implementation, routes missing and do I need more dapm definitions?
Oleksandr Müller
sanj3k at gmail.com
Thu Sep 7 18:33:42 CEST 2017
Hello guys,
I began with the implementation of a dapm mux and am almost done but I
don't get how to configure the routes and I am not sure if I need more
dapm definitions. As the capture stream is the source into the
SE_IN_L/SE_IN_R I would say this should be the source for the left/right
mux (right side of the route definition). Then I would need a switch in
the middle and on the left side as the output should be the ADC1 (left
side).
{ "ADC1", ADC1VINSWITCHLEFT, "SE_IN_L" }, I would think it should look
something like this. But then I would need some SOC_DAPM_SINGLE, I think
you can see I am clearly confused right now :)
I would like to have a mux where I can switch the vin source from vin1
to vin4 in alsamixer and then its saved as a default. Because in the
layout plan the vin4 is connected and needs to be selected...
My code so far looks like this:
static const char * const pcm1863_adc_vinl_src[] = {
"VIN1l", "VIN4l"
};
static const char * const pcm1863_adc_vinr_src[] = {
"VIN1r", "VIN4r"
};
/*Stereo ADC Source VIN1 left/right */
static SOC_ENUM_SINGLE_DECL(
pcm1863_adc_vin1l_enum, PCM1863_ADC1_INPUT_SEL_L,
PCM1863_SEL_L_VIN1_SFT, pcm1863_adc_vinl_src);
static SOC_ENUM_SINGLE_DECL(
pcm1863_adc_vin1r_enum, PCM1863_ADC1_INPUT_SEL_R,
PCM1863_SEL_R_VIN1_SFT, pcm1863_adc_vinr_src);
/*Stereo ADC Source VIN4 left/right */
static SOC_ENUM_SINGLE_DECL(
pcm1863_adc_vin4l_enum, PCM1863_ADC1_INPUT_SEL_L,
PCM1863_SEL_L_VIN4_SFT, pcm1863_adc_vinl_src);
static SOC_ENUM_SINGLE_DECL(
pcm1863_adc_vin4r_enum, PCM1863_ADC1_INPUT_SEL_R,
PCM1863_SEL_R_VIN4_SFT, pcm1863_adc_vinr_src);
static const struct snd_kcontrol_new pcm1863_adc_vin1l_mux =
SOC_DAPM_ENUM("ADC VIN1l Source", pcm1863_adc_vin1l_enum);
static const struct snd_kcontrol_new pcm1863_adc_vin1r_mux =
SOC_DAPM_ENUM("ADC VIN1r Source", pcm1863_adc_vin1r_enum);
static const struct snd_kcontrol_new pcm1863_adc_vin4l_mux =
SOC_DAPM_ENUM("ADC VIN4l Source", pcm1863_adc_vin4l_enum);
static const struct snd_kcontrol_new pcm1863_adc_vin4r_mux =
SOC_DAPM_ENUM("ADC VIN4r Source", pcm1863_adc_vin4r_enum);
static const struct snd_soc_dapm_widget pcm1863_dapm_widgets[] = {
SND_SOC_DAPM_ADC("ADC1", NULL, SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_INPUT("SE_IN_L"),
SND_SOC_DAPM_INPUT("SE_IN_R"),
SND_SOC_DAPM_MUX("ADC VIN1l Mux", SND_SOC_NOPM, 0, 0,
&pcm1863_adc_vin1l_mux),
SND_SOC_DAPM_MUX("ADC VIN1r Mux", SND_SOC_NOPM, 0, 0,
&pcm1863_adc_vin1r_mux),
SND_SOC_DAPM_MUX("ADC VIN1l Mux", SND_SOC_NOPM, 0, 0,
&pcm1863_adc_vin4l_mux),
SND_SOC_DAPM_MUX("ADC VIN1r Mux", SND_SOC_NOPM, 0, 0,
&pcm1863_adc_vin4r_mux),
};
static const struct snd_soc_dapm_route pcm1863_dapm_routes[] = {
{ "ADC1", NULL, "SE_IN_L" },
{ "ADC1", NULL, "SE_IN_R" },
{ "SE_IN_L", NULL, "Capture" },
{ "SE_IN_R", NULL, "Capture" },
};
More information about the Alsa-devel
mailing list