All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zidan Wang <zidan.wang@freescale.com>
To: <broonie@kernel.org>
Cc: <lgirdwood@gmail.com>, <perex@perex.cz>, <tiwai@suse.de>,
	<ckeepax@opensource.wolfsonmicro.com>, <lars@metafoo.de>,
	<patches@opensource.wolfsonmicro.com>,
	<alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>,
	Zidan Wang <zidan.wang@freescale.com>
Subject: [alsa-devel][PATCH v2] ASoC: wm8960: add dapm kcontrols to select left/right ADC input source
Date: Tue, 16 Jun 2015 14:23:19 +0800	[thread overview]
Message-ID: <1434435799-26829-1-git-send-email-zidan.wang@freescale.com> (raw)

Add dapm kcontrols to select left/right ADC input source, one to select
the left ADC input source and one for the right ADC input source.

In default, the left ADC will select the left input, and the right ADC will
select the right input. When the left(right) ADC select the right(left) input,
the left(right) input path will be powered down.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/codecs/wm8960.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 023e898..3ea12b7 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -141,6 +141,8 @@ static const char *wm8960_3d_upper_cutoff[] = {"High", "Low"};
 static const char *wm8960_3d_lower_cutoff[] = {"Low", "High"};
 static const char *wm8960_alcfunc[] = {"Off", "Right", "Left", "Stereo"};
 static const char *wm8960_alcmode[] = {"ALC", "Limiter"};
+static const char *wm8960_adcl_src_text[] = {"Left", "Right"};
+static const char *wm8960_adcr_src_text[] = {"Right", "Left"};
 
 static const struct soc_enum wm8960_enum[] = {
 	SOC_ENUM_SINGLE(WM8960_DACCTL1, 5, 4, wm8960_polarity),
@@ -150,6 +152,10 @@ static const struct soc_enum wm8960_enum[] = {
 	SOC_ENUM_SINGLE(WM8960_ALC1, 7, 4, wm8960_alcfunc),
 	SOC_ENUM_SINGLE(WM8960_ALC3, 8, 2, wm8960_alcmode),
 };
+static SOC_ENUM_SINGLE_DECL(wm8960_adcl_src_enum,
+			    WM8960_ADDCTL1, 3, wm8960_adcl_src_text);
+static SOC_ENUM_SINGLE_DECL(wm8960_adcr_src_enum,
+			    WM8960_ADDCTL1, 2, wm8960_adcr_src_text);
 
 static const int deemph_settings[] = { 0, 32000, 44100, 48000 };
 
@@ -281,6 +287,11 @@ SOC_SINGLE_TLV("Right Output Mixer RINPUT3 Volume",
 	       WM8960_ROUTMIX, 4, 7, 1, bypass_tlv),
 };
 
+static const struct snd_kcontrol_new wm8960_adcl_mux =
+	SOC_DAPM_ENUM("ADCL Source", wm8960_adcl_src_enum);
+static const struct snd_kcontrol_new wm8960_adcr_mux =
+	SOC_DAPM_ENUM("ADCR Source", wm8960_adcr_src_enum);
+
 static const struct snd_kcontrol_new wm8960_lin_boost[] = {
 SOC_DAPM_SINGLE("LINPUT2 Switch", WM8960_LINPATH, 6, 1, 0),
 SOC_DAPM_SINGLE("LINPUT3 Switch", WM8960_LINPATH, 7, 1, 0),
@@ -344,6 +355,9 @@ SND_SOC_DAPM_ADC("Right ADC", "Capture", WM8960_POWER1, 2, 0),
 SND_SOC_DAPM_DAC("Left DAC", "Playback", WM8960_POWER2, 8, 0),
 SND_SOC_DAPM_DAC("Right DAC", "Playback", WM8960_POWER2, 7, 0),
 
+SND_SOC_DAPM_MUX("ADCL Source", SND_SOC_NOPM, 0, 0, &wm8960_adcl_mux),
+SND_SOC_DAPM_MUX("ADCR Source", SND_SOC_NOPM, 0, 0, &wm8960_adcr_mux),
+
 SND_SOC_DAPM_MIXER("Left Output Mixer", WM8960_POWER3, 3, 0,
 	&wm8960_loutput_mixer[0],
 	ARRAY_SIZE(wm8960_loutput_mixer)),
@@ -399,8 +413,14 @@ static const struct snd_soc_dapm_route audio_paths[] = {
 	{ "Right Input Mixer", NULL, "RINPUT2" },
 	{ "Right Input Mixer", NULL, "RINPUT3" },
 
-	{ "Left ADC", NULL, "Left Input Mixer" },
-	{ "Right ADC", NULL, "Right Input Mixer" },
+	{ "ADCL Source", "Left", "Left Input Mixer" },
+	{ "ADCL Source", "Right", "Right Input Mixer" },
+
+	{ "ADCR Source", "Left", "Left Input Mixer" },
+	{ "ADCR Source", "Right", "Right Input Mixer" },
+
+	{ "Left ADC", NULL, "ADCL Source" },
+	{ "Right ADC", NULL, "ADCR Source" },
 
 	{ "Left Output Mixer", "LINPUT3 Switch", "LINPUT3" },
 	{ "Left Output Mixer", "Boost Bypass Switch", "Left Boost Mixer"} ,
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Zidan Wang <zidan.wang@freescale.com>
To: broonie@kernel.org
Cc: alsa-devel@alsa-project.org, lars@metafoo.de,
	Zidan Wang <zidan.wang@freescale.com>,
	tiwai@suse.de, linux-kernel@vger.kernel.org,
	patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com,
	ckeepax@opensource.wolfsonmicro.com
Subject: [PATCH v2] ASoC: wm8960: add dapm kcontrols to select left/right ADC input source
Date: Tue, 16 Jun 2015 14:23:19 +0800	[thread overview]
Message-ID: <1434435799-26829-1-git-send-email-zidan.wang@freescale.com> (raw)

Add dapm kcontrols to select left/right ADC input source, one to select
the left ADC input source and one for the right ADC input source.

In default, the left ADC will select the left input, and the right ADC will
select the right input. When the left(right) ADC select the right(left) input,
the left(right) input path will be powered down.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/codecs/wm8960.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 023e898..3ea12b7 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -141,6 +141,8 @@ static const char *wm8960_3d_upper_cutoff[] = {"High", "Low"};
 static const char *wm8960_3d_lower_cutoff[] = {"Low", "High"};
 static const char *wm8960_alcfunc[] = {"Off", "Right", "Left", "Stereo"};
 static const char *wm8960_alcmode[] = {"ALC", "Limiter"};
+static const char *wm8960_adcl_src_text[] = {"Left", "Right"};
+static const char *wm8960_adcr_src_text[] = {"Right", "Left"};
 
 static const struct soc_enum wm8960_enum[] = {
 	SOC_ENUM_SINGLE(WM8960_DACCTL1, 5, 4, wm8960_polarity),
@@ -150,6 +152,10 @@ static const struct soc_enum wm8960_enum[] = {
 	SOC_ENUM_SINGLE(WM8960_ALC1, 7, 4, wm8960_alcfunc),
 	SOC_ENUM_SINGLE(WM8960_ALC3, 8, 2, wm8960_alcmode),
 };
+static SOC_ENUM_SINGLE_DECL(wm8960_adcl_src_enum,
+			    WM8960_ADDCTL1, 3, wm8960_adcl_src_text);
+static SOC_ENUM_SINGLE_DECL(wm8960_adcr_src_enum,
+			    WM8960_ADDCTL1, 2, wm8960_adcr_src_text);
 
 static const int deemph_settings[] = { 0, 32000, 44100, 48000 };
 
@@ -281,6 +287,11 @@ SOC_SINGLE_TLV("Right Output Mixer RINPUT3 Volume",
 	       WM8960_ROUTMIX, 4, 7, 1, bypass_tlv),
 };
 
+static const struct snd_kcontrol_new wm8960_adcl_mux =
+	SOC_DAPM_ENUM("ADCL Source", wm8960_adcl_src_enum);
+static const struct snd_kcontrol_new wm8960_adcr_mux =
+	SOC_DAPM_ENUM("ADCR Source", wm8960_adcr_src_enum);
+
 static const struct snd_kcontrol_new wm8960_lin_boost[] = {
 SOC_DAPM_SINGLE("LINPUT2 Switch", WM8960_LINPATH, 6, 1, 0),
 SOC_DAPM_SINGLE("LINPUT3 Switch", WM8960_LINPATH, 7, 1, 0),
@@ -344,6 +355,9 @@ SND_SOC_DAPM_ADC("Right ADC", "Capture", WM8960_POWER1, 2, 0),
 SND_SOC_DAPM_DAC("Left DAC", "Playback", WM8960_POWER2, 8, 0),
 SND_SOC_DAPM_DAC("Right DAC", "Playback", WM8960_POWER2, 7, 0),
 
+SND_SOC_DAPM_MUX("ADCL Source", SND_SOC_NOPM, 0, 0, &wm8960_adcl_mux),
+SND_SOC_DAPM_MUX("ADCR Source", SND_SOC_NOPM, 0, 0, &wm8960_adcr_mux),
+
 SND_SOC_DAPM_MIXER("Left Output Mixer", WM8960_POWER3, 3, 0,
 	&wm8960_loutput_mixer[0],
 	ARRAY_SIZE(wm8960_loutput_mixer)),
@@ -399,8 +413,14 @@ static const struct snd_soc_dapm_route audio_paths[] = {
 	{ "Right Input Mixer", NULL, "RINPUT2" },
 	{ "Right Input Mixer", NULL, "RINPUT3" },
 
-	{ "Left ADC", NULL, "Left Input Mixer" },
-	{ "Right ADC", NULL, "Right Input Mixer" },
+	{ "ADCL Source", "Left", "Left Input Mixer" },
+	{ "ADCL Source", "Right", "Right Input Mixer" },
+
+	{ "ADCR Source", "Left", "Left Input Mixer" },
+	{ "ADCR Source", "Right", "Right Input Mixer" },
+
+	{ "Left ADC", NULL, "ADCL Source" },
+	{ "Right ADC", NULL, "ADCR Source" },
 
 	{ "Left Output Mixer", "LINPUT3 Switch", "LINPUT3" },
 	{ "Left Output Mixer", "Boost Bypass Switch", "Left Boost Mixer"} ,
-- 
1.9.1

             reply	other threads:[~2015-06-16  6:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-16  6:23 Zidan Wang [this message]
2015-06-16  6:23 ` [PATCH v2] ASoC: wm8960: add dapm kcontrols to select left/right ADC input source Zidan Wang
2015-06-16 12:18 ` [alsa-devel][PATCH " Charles Keepax
2015-06-16 12:18   ` [PATCH " Charles Keepax
2015-06-17  8:58   ` [alsa-devel][PATCH " Zidan Wang
2015-06-17  8:58     ` Zidan Wang
2015-06-17 13:09     ` Charles Keepax

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=1434435799-26829-1-git-send-email-zidan.wang@freescale.com \
    --to=zidan.wang@freescale.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.