alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Liam Girdwood <lrg@ti.com>
Cc: alsa-devel@alsa-project.org,
	device-drivers-devel@blackfin.uclinux.org,
	linux-kernel@vger.kernel.org,
	Lars-Peter Clausen <lars@metafoo.de>
Subject: [PATCH 6/6] ASoC: AD1836: Add input gain control for ADC2
Date: Mon,  6 Jun 2011 13:38:40 +0200	[thread overview]
Message-ID: <1307360320-4727-6-git-send-email-lars@metafoo.de> (raw)
In-Reply-To: <1307360320-4727-1-git-send-email-lars@metafoo.de>

The AD1836 has a PGA for its second ADC. This patch adds a control for
adjusting the the gain of the PGA.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/codecs/ad1836.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index 75ff5a5..1e9a801 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -124,6 +124,13 @@ static const struct snd_soc_dapm_route ad183x_dapm_routes[] = {
 	{ "ADC", NULL, "ADC_PWR" },
 };
 
+static const DECLARE_TLV_DB_SCALE(ad1836_in_tlv, 0, 300, 0);
+
+static const struct snd_kcontrol_new ad1836_controls[] = {
+	SOC_DOUBLE_TLV("ADC2 Capture Volume", AD183X_ADC_CTRL1, 3, 0, 4, 0,
+	    ad1836_in_tlv),
+};
+
 /*
  * DAI ops entries
  */
@@ -280,6 +287,10 @@ static int ad1836_probe(struct snd_soc_codec *codec)
 	if (ad1836->type == AD1836) {
 		/* left/right diff:PGA/MUX */
 		snd_soc_write(codec, AD1836_ADC_CTRL3, 0x3A);
+		ret = snd_soc_add_controls(codec, ad1836_controls,
+				ARRAY_SIZE(ad1836_controls));
+		if (ret)
+			return ret;
 	} else {
 		snd_soc_write(codec, AD1836_ADC_CTRL3, 0x00);
 	}
-- 
1.7.2.5

  parent reply	other threads:[~2011-06-06 11:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 11:38 [PATCH 1/6] ASoC: AD1836: Fix setting the PCM format Lars-Peter Clausen
2011-06-06 11:38 ` [PATCH 2/6] ASoC: AD1836: Add ADC/DAC controls helper macros Lars-Peter Clausen
2011-06-06 11:38 ` [PATCH 3/6] ASoC: AD1836: Use snd_soc_update_bits for read-modify-write Lars-Peter Clausen
2011-06-06 11:38 ` [PATCH 4/6] ASoC: AD1836: Add AD1835/AD1837/AD1838/AD1839 support Lars-Peter Clausen
2011-06-06 20:53   ` Mark Brown
2011-06-06 11:38 ` [PATCH 5/6] ASoC: AD1836: Remove unused fields from private struct Lars-Peter Clausen
2011-06-06 11:38 ` Lars-Peter Clausen [this message]
2011-06-06 19:39 ` [PATCH 1/6] ASoC: AD1836: Fix setting the PCM format Liam Girdwood
2011-06-06 20:55 ` Mark Brown

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=1307360320-4727-6-git-send-email-lars@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=device-drivers-devel@blackfin.uclinux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    /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).