alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
To: Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>,
	Stephen Warren <swarren@nvidia.com>,
	Vitaliy Kulikov <Vitaliy.Kulikov@idt.com>,
	David Henningsson <david.henningsson@canonical.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] ALSA: hda - Fix proc output for ADC amp values of CX20549
Date: Fri,  6 Apr 2012 15:34:15 +0200	[thread overview]
Message-ID: <1333719260-14504-2-git-send-email-kernel@mkarcher.dialup.fu-berlin.de> (raw)
In-Reply-To: <1333719260-14504-1-git-send-email-kernel@mkarcher.dialup.fu-berlin.de>

The CX20549 has only one single input amp on it's input converter
widget. Fix printing of values in the codec file in /proc/asound.

Signed-off-by: Michael Karcher <kernel@mkarcher.dialup.fu-berlin.de>
---
 sound/pci/hda/hda_codec.h      |    3 +++
 sound/pci/hda/hda_proc.c       |   13 ++++++++++---
 sound/pci/hda/patch_conexant.c |    8 ++++----
 3 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 9a9f372..56b4f74 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -851,6 +851,9 @@ struct hda_codec {
 	unsigned int pin_amp_workaround:1; /* pin out-amp takes index
 					    * (e.g. Conexant codecs)
 					    */
+	unsigned int single_adc_amp:1; /* adc in-amp takes no index
+					* (e.g. CX20549 codec)
+					*/
 	unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */
 	unsigned int pins_shutup:1;	/* pins are shut up */
 	unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 254ab52..8c1715a 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -651,9 +651,16 @@ static void print_codec_info(struct snd_info_entry *entry,
 			snd_iprintf(buffer, "  Amp-In caps: ");
 			print_amp_caps(buffer, codec, nid, HDA_INPUT);
 			snd_iprintf(buffer, "  Amp-In vals: ");
-			print_amp_vals(buffer, codec, nid, HDA_INPUT,
-				       wid_caps & AC_WCAP_STEREO,
-				       wid_type == AC_WID_PIN ? 1 : conn_len);
+			if (wid_type == AC_WID_PIN ||
+			    (codec->single_adc_amp &&
+			     wid_type == AC_WID_AUD_IN))
+                                print_amp_vals(buffer, codec, nid, HDA_INPUT,
+                                               wid_caps & AC_WCAP_STEREO,
+                                               1);
+                        else
+                                print_amp_vals(buffer, codec, nid, HDA_INPUT,
+                                               wid_caps & AC_WCAP_STEREO,
+                                               conn_len);
 		}
 		if (wid_caps & AC_WCAP_OUT_AMP) {
 			snd_iprintf(buffer, "  Amp-Out caps: ");
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 8c6523b..60890ef 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -141,7 +141,6 @@ struct conexant_spec {
 	unsigned int hp_laptop:1;
 	unsigned int asus:1;
 	unsigned int pin_eapd_ctrls:1;
-	unsigned int single_adc_amp:1;
 
 	unsigned int adc_switching:1;
 
@@ -1111,6 +1110,7 @@ static int patch_cxt5045(struct hda_codec *codec)
 		return -ENOMEM;
 	codec->spec = spec;
 	codec->pin_amp_workaround = 1;
+	codec->single_adc_amp = 1;
 
 	spec->multiout.max_channels = 2;
 	spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids);
@@ -4220,7 +4220,7 @@ static int cx_auto_add_capture_volume(struct hda_codec *codec, hda_nid_t nid,
 		int idx = get_input_connection(codec, adc_nid, nid);
 		if (idx < 0)
 			continue;
-		if (spec->single_adc_amp)
+		if (codec->single_adc_amp)
 			idx = 0;
 		return cx_auto_add_volume_idx(codec, label, pfx,
 					      cidx, adc_nid, HDA_INPUT, idx);
@@ -4275,7 +4275,7 @@ static int cx_auto_build_input_controls(struct hda_codec *codec)
 		if (cidx < 0)
 			continue;
 		input_conn[i] = spec->imux_info[i].adc;
-		if (!spec->single_adc_amp)
+		if (!codec->single_adc_amp)
 			input_conn[i] |= cidx << 8;
 		if (i > 0 && input_conn[i] != input_conn[0])
 			multi_connection = 1;
@@ -4470,7 +4470,7 @@ static int patch_conexant_auto(struct hda_codec *codec)
 
 	switch (codec->vendor_id) {
 	case 0x14f15045:
-		spec->single_adc_amp = 1;
+		codec->single_adc_amp = 1;
 		break;
 	case 0x14f15051:
 		add_cx5051_fake_mutes(codec);
-- 
1.7.9.1

  reply	other threads:[~2012-04-06 13:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-05 13:29 [PATCH 0/6] sound/pci/hda: CX20549 cleanup/fixes Michael Karcher
2012-04-05 14:27 ` Takashi Iwai
2012-04-05 14:28   ` Takashi Iwai
2012-04-06 13:01     ` Michael Karcher
2012-04-07 10:34       ` Takashi Iwai
2012-04-06 13:34     ` [PATCH 0/6] ALSA: hda - " Michael Karcher
2012-04-06 13:34       ` Michael Karcher [this message]
2012-04-06 13:34       ` [PATCH 2/6] ALSA: hda - Rename capture sources of CX20549 to match common conventions Michael Karcher
2012-04-06 13:34       ` [PATCH 3/6] ALSA: hda - fix record volume controls of CX20459 ("Venice") Michael Karcher
2012-04-06 13:34       ` [PATCH 4/6] ALSA: hda - Remove CD control from model=benq for CX20549 Michael Karcher
2012-04-06 13:34       ` [PATCH 5/6] ALSA: hda - CX20549 doesn't need pin_amp_workaround Michael Karcher
2012-04-06 13:34       ` [PATCH 6/6] ALSA: hda - clean up CX20549 test mixer setup Michael Karcher
2012-04-10  6:54         ` David Henningsson
2012-04-10 12:59           ` Takashi Iwai
2012-04-07 10:36       ` [PATCH 0/6] ALSA: hda - CX20549 cleanup/fixes Takashi Iwai

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=1333719260-14504-2-git-send-email-kernel@mkarcher.dialup.fu-berlin.de \
    --to=kernel@mkarcher.dialup.fu-berlin.de \
    --cc=Vitaliy.Kulikov@idt.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=david.henningsson@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=swarren@nvidia.com \
    --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 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).