alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Oleksandr Müller" <sanj3k@gmail.com>
To: alsa-devel@alsa-project.org
Subject: SOC_DAPM_MUX implementation, routes missing and do I need more dapm definitions?
Date: Thu, 7 Sep 2017 18:33:42 +0200	[thread overview]
Message-ID: <81326d89-262b-b79c-31fb-13671c314b81@gmail.com> (raw)

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" },
};

                 reply	other threads:[~2017-09-07 16:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=81326d89-262b-b79c-31fb-13671c314b81@gmail.com \
    --to=sanj3k@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).