From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: No recording on hda-intel (AD1981HD) Date: Fri, 08 Feb 2008 16:57:37 +0100 Message-ID: References: <200802032017.38614.grzegorz.chwesewicz@chilan.com> <200802061209.35651.grzegorz.chwesewicz@chilan.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="Multipart_Fri_Feb__8_16:57:37_2008-1" Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 226B924499 for ; Fri, 8 Feb 2008 16:57:38 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Grzegorz Chwesewicz Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org --Multipart_Fri_Feb__8_16:57:37_2008-1 Content-Type: text/plain; charset=US-ASCII 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 --Multipart_Fri_Feb__8_16:57:37_2008-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="ad1981-hp-automute-fix" Content-Transfer-Encoding: 7bit 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, --Multipart_Fri_Feb__8_16:57:37_2008-1 Content-Type: application/octet-stream Content-Disposition: attachment; filename="ad1981-hp-master-amp-fix" Content-Transfer-Encoding: 7bit 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; --Multipart_Fri_Feb__8_16:57:37_2008-1 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel --Multipart_Fri_Feb__8_16:57:37_2008-1--