All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Grzegorz Chwesewicz <grzegorz.chwesewicz@chilan.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: No recording on hda-intel (AD1981HD)
Date: Fri, 08 Feb 2008 16:57:37 +0100	[thread overview]
Message-ID: <s5hodarwidq.wl%tiwai@suse.de> (raw)
In-Reply-To: <s5h3as3y6sr.wl%tiwai@suse.de>

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

At Fri, 08 Feb 2008 13:24:52 +0100,
I wrote:
> 
> BTW, do you have problems found in below?
> 	https://bugzilla.novell.com/show_bug.cgi?id=297703
> 
> According to the reporter, nc6400 with AD1981 has a problem with
> headphone jack auto-muting and with the non-linear master volume.
> 
> I supplied two test patches there.

For convenience, I attach patches here.


Takashi


[-- Attachment #2: ad1981-hp-automute-fix --]
[-- Type: application/octet-stream, Size: 560 bytes --]

diff -r 4c2f9b149aa8 pci/hda/patch_analog.c
--- a/pci/hda/patch_analog.c	Thu Jan 31 14:50:26 2008 +0100
+++ b/pci/hda/patch_analog.c	Thu Jan 31 16:14:30 2008 +0100
@@ -1406,7 +1406,10 @@ static int ad1981_hp_master_sw_put(struc
 
 	if (! ad198x_eapd_put(kcontrol, ucontrol))
 		return 0;
-
+	/* change speaker pin appropriately */
+	snd_hda_codec_write(codec, 0x05, 0,
+			    AC_VERB_SET_PIN_WIDGET_CONTROL,
+			    spec->cur_eapd ? PIN_OUT : 0);
 	/* toggle HP mute appropriately */
 	snd_hda_codec_amp_stereo(codec, 0x06, HDA_OUTPUT, 0,
 				 HDA_AMP_MUTE,

[-- Attachment #3: ad1981-hp-master-amp-fix --]
[-- Type: application/octet-stream, Size: 2570 bytes --]

diff -r 978cc96cd953 pci/hda/patch_analog.c
--- a/pci/hda/patch_analog.c	Thu Jan 31 16:14:30 2008 +0100
+++ b/pci/hda/patch_analog.c	Thu Jan 31 17:49:46 2008 +0100
@@ -1417,6 +1417,30 @@ static int ad1981_hp_master_sw_put(struc
 	return 1;
 }
 
+/* The volume resolution of 0x05 and 0x06 on HP (at least nc6400)
+ * is between 0x20 and 0x3f. The value below 0x20 is just muting.
+ */
+static int ad1981_hp_pin_vol_get(struct snd_kcontrol *kcontrol,
+				 struct snd_ctl_elem_value *ucontrol)
+{
+	long *valp = ucontrol->value.integer.value;
+	snd_hda_mixer_bind_ctls_get(kcontrol, ucontrol);
+	if (valp[0] > 0x20)
+		valp[0] -= 0x20;
+	if (valp[1] > 0x20)
+		valp[1] -= 0x20;
+	return 0;
+}
+	
+static int ad1981_hp_pin_vol_put(struct snd_kcontrol *kcontrol,
+				 struct snd_ctl_elem_value *ucontrol)
+{
+	long *valp = ucontrol->value.integer.value;
+	valp[0] += 0x20;
+	valp[1] += 0x20;
+	return snd_hda_mixer_bind_ctls_put(kcontrol, ucontrol);
+}
+	
 /* bind volumes of both NID 0x05 and 0x06 */
 static struct hda_bind_ctls ad1981_hp_bind_master_vol = {
 	.ops = &snd_hda_bind_vol,
@@ -1486,7 +1510,18 @@ static struct hda_input_mux ad1981_hp_ca
 };
 
 static struct snd_kcontrol_new ad1981_hp_mixers[] = {
-	HDA_BIND_VOL("Master Playback Volume", &ad1981_hp_bind_master_vol),
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Master Playback Volume",
+		.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+			   SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+			   SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK),
+		.info = snd_hda_mixer_bind_ctls_info,
+		.get =  ad1981_hp_pin_vol_get,
+		.put = ad1981_hp_pin_vol_put,
+		.tlv = { .c = snd_hda_mixer_bind_tlv },
+		.private_value = (long) &ad1981_hp_bind_master_vol,
+	},
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 		.name = "Master Playback Switch",
@@ -1662,6 +1697,19 @@ static int patch_ad1981(struct hda_codec
 
 		codec->patch_ops.init = ad1981_hp_init;
 		codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
+		/* The actual resolution of pin 0x05/0x06 are only
+		 * between 0x20-0x2f
+		 */
+		snd_hda_override_amp_caps(codec, 0x05, HDA_OUTPUT,
+					  (0x1d << AC_AMPCAP_OFFSET_SHIFT) |
+					  (0x1f << AC_AMPCAP_NUM_STEPS_SHIFT) |
+					  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+					  (1 << AC_AMPCAP_MUTE_SHIFT));
+		snd_hda_override_amp_caps(codec, 0x06, HDA_OUTPUT,
+					  (0x1d << AC_AMPCAP_OFFSET_SHIFT) |
+					  (0x1f << AC_AMPCAP_NUM_STEPS_SHIFT) |
+					  (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) |
+					  (1 << AC_AMPCAP_MUTE_SHIFT));
 		break;
 	case AD1981_THINKPAD:
 		spec->mixers[0] = ad1981_thinkpad_mixers;

[-- Attachment #4: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2008-02-08 15:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-03 19:17 No recording on hda-intel (AD1981HD) Grzegorz Chwesewicz
2008-02-06 11:09 ` Grzegorz Chwesewicz
2008-02-07 12:09   ` Takashi Iwai
2008-02-08 12:24     ` Takashi Iwai
2008-02-08 15:57       ` Takashi Iwai [this message]
2008-02-08 18:51         ` Grzegorz Chwesewicz
2008-02-12 10:49           ` Takashi Iwai
2008-02-12 14:00             ` Ustun ERGENOGLU
2008-02-12 14:04               ` Takashi Iwai
2008-02-12 14:36                 ` Ustun ERGENOGLU
2008-02-12 17:59                 ` Grzegorz Chwesewicz
2008-02-12 22:17                   ` Grzegorz Chwesewicz
2008-02-13 15:40                   ` Takashi Iwai
2008-02-12 16:41             ` Grzegorz Chwesewicz

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=s5hodarwidq.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=grzegorz.chwesewicz@chilan.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 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.