The bug reporter reports that setting the speaker pin to D3 before turning off its pinctl fixes the clicking noise on powersave for Thinkpad T61.
Thanks to c4pp4 for doing most of the work with this bug, including reporting and testing, and writing preliminary patches. BugLink: https://bugs.launchpad.net/bugs/886975 Signed-off-by: David Henningsson <[email protected]> --- sound/pci/hda/patch_conexant.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) Note: c4pp4 pointed out that in his case, only the speaker needed to go to D3 before pinctl, but noticed no regressions from the below implementation, so I made the fixup more generic (easier to reuse later). diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index a3a2263..27e6ca7 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -144,6 +144,7 @@ struct conexant_spec { unsigned int asus:1; unsigned int pin_eapd_ctrls:1; unsigned int fixup_stereo_dmic:1; + unsigned int d3_before_shutup:1; /* Needs speaker to go to D3 before pinctl */ unsigned int adc_switching:1; @@ -558,13 +559,22 @@ static int conexant_build_controls(struct hda_codec *codec) return 0; } -#ifdef CONFIG_PM static int conexant_suspend(struct hda_codec *codec) { + struct conexant_spec *spec = codec->spec; + + if (spec->d3_before_shutup) + snd_hda_codec_set_power_to_all(codec, codec->afg, AC_PWRST_D3, + false); snd_hda_shutup_pins(codec); return 0; } -#endif + +static void conexant_reboot_notify(struct hda_codec *codec) +{ + conexant_suspend(codec); +} + static const struct hda_codec_ops conexant_patch_ops = { .build_controls = conexant_build_controls, @@ -575,7 +585,7 @@ static const struct hda_codec_ops conexant_patch_ops = { #ifdef CONFIG_PM .suspend = conexant_suspend, #endif - .reboot_notify = snd_hda_shutup_pins, + .reboot_notify = conexant_reboot_notify, }; #ifdef CONFIG_SND_HDA_INPUT_BEEP @@ -4408,7 +4418,7 @@ static const struct hda_codec_ops cx_auto_patch_ops = { #ifdef CONFIG_PM .suspend = conexant_suspend, #endif - .reboot_notify = snd_hda_shutup_pins, + .reboot_notify = conexant_reboot_notify, }; /* @@ -4421,6 +4431,7 @@ enum { CXT_PINCFG_LEMOTE_A1205, CXT_FIXUP_STEREO_DMIC, CXT_FIXUP_INC_MIC_BOOST, + CXT_FIXUP_D3_BEFORE_SHUTUP, }; static void cxt_fixup_stereo_dmic(struct hda_codec *codec, @@ -4430,6 +4441,13 @@ static void cxt_fixup_stereo_dmic(struct hda_codec *codec, spec->fixup_stereo_dmic = 1; } +static void cxt_fixup_d3_before_shutup(struct hda_codec *codec, + const struct hda_fixup *fix, int action) +{ + struct conexant_spec *spec = codec->spec; + spec->d3_before_shutup = 1; +} + static void cxt5066_increase_mic_boost(struct hda_codec *codec, const struct hda_fixup *fix, int action) { @@ -4499,6 +4517,15 @@ static const struct hda_fixup cxt_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = cxt5066_increase_mic_boost, }, + [CXT_FIXUP_D3_BEFORE_SHUTUP] = { + .type = HDA_FIXUP_FUNC, + .v.func = cxt_fixup_d3_before_shutup, + }, +}; + +static const struct snd_pci_quirk cxt5045_fixups[] = { + SND_PCI_QUIRK(0x17aa, 0x20ac, "Lenovo T61/R61i", CXT_FIXUP_D3_BEFORE_SHUTUP), + {} }; static const struct snd_pci_quirk cxt5051_fixups[] = { @@ -4553,6 +4580,7 @@ static int patch_conexant_auto(struct hda_codec *codec) switch (codec->vendor_id) { case 0x14f15045: codec->single_adc_amp = 1; + snd_hda_pick_fixup(codec, NULL, cxt5045_fixups, cxt_fixups); break; case 0x14f15051: add_cx5051_fake_mutes(codec); -- 1.7.9.5 -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to alsa-driver in Ubuntu. https://bugs.launchpad.net/bugs/886975 Title: [Thinkpad R61i/T61] Lenovo sound chip Conexant CX20549 Venice doesn't work correctly. Status in “alsa-driver” package in Ubuntu: Incomplete Bug description: Computer: IBM Lenovo Thinkpad R61i Card: HDA Intel Sound chip: Conexant CX20549 (Venice) Device: 00:1b.0 Audio device [0403]: Intel Corporation 82801H (ICH8 Family) HD Audio Controller [8086:284b] (rev 03) Subsystem: Lenovo ThinkPad T61 [17aa:20ac] System: Ubuntu Oneiric 11.10 (desktop-i386) Kernel: 3.0.0-12-generic-pae#20-Ubuntu SMP Fri Oct 7 16:37:17 UTC 2011 Problems: 1) Integrated microphone doesn't work at all because the driver uses node 0x14 instead of 0x15 for integrated mic and node 0x12 instead of 0x14 for external mic. 2) Sound output is muted in the "0% <-> unamplified" part of the volume slider and is working in the "unamplified <-> 100% ->" part only; the driver doesn't allow amplified part because sound is distorted over 0dB of the PCM level so there is no need amplified part of the volume slider. Solution: Attached patch is fixing nodes of integrated and external microphone and is removing the amplified part of the volume slider. --- AlsaVersion: Advanced Linux Sound Architecture Driver Version 1.0.24. ApportVersion: 1.23-0ubuntu4 Architecture: i386 ArecordDevices: **** List of CAPTURE Hardware Devices **** card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 AudioDevicesInUse: USER PID ACCESS COMMAND /dev/snd/controlC0: c4pp4 1698 F.... pulseaudio /dev/snd/pcmC0D0p: c4pp4 1698 F...m pulseaudio CRDA: Error: [Errno 2] Adresář nebo soubor neexistuje Card0.Amixer.info: Card hw:0 'Intel'/'HDA Intel at 0xfe100000 irq 48' Mixer name : 'Conexant CX20549 (Venice)' Components : 'HDA:14f15045,17aa20db,00100100' Controls : 19 Simple ctrls : 10 Card29.Amixer.info: Card hw:29 'ThinkPadEC'/'ThinkPad Console Audio Control at EC reg 0x30, fw 7KHT24WW-1.08' Mixer name : 'ThinkPad EC 7KHT24WW-1.08' Components : '' Controls : 1 Simple ctrls : 1 Card29.Amixer.values: Simple mixer control 'Console',0 Capabilities: pswitch pswitch-joined penum Playback channels: Mono Mono: Playback [on] DistroRelease: Ubuntu 11.10 HibernationDevice: RESUME=UUID=6e091b39-d59a-4d75-a7c5-dec246d020e5 InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012) MachineType: LENOVO 89329ZG Package: linux (not installed) PccardctlIdent: Socket 0: no product info available PccardctlStatus: Socket 0: no card ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-3.0.0-12-generic-pae root=UUID=666241df-0a9e-4711-a44e-92d2e6f5eccc ro quiet splash vt.handoff=7 ProcVersionSignature: Ubuntu 3.0.0-12.20-generic-pae 3.0.4 RelatedPackageVersions: linux-restricted-modules-3.0.0-12-generic-pae N/A linux-backports-modules-3.0.0-12-generic-pae N/A linux-firmware 1.60 Tags: oneiric Uname: Linux 3.0.0-12-generic-pae i686 UpgradeStatus: No upgrade log present (probably fresh install) UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare vboxusers dmi.bios.date: 04/09/2010 dmi.bios.vendor: LENOVO dmi.bios.version: 7OETC4WW (2.24 ) dmi.board.name: 89329ZG dmi.board.vendor: LENOVO dmi.board.version: Not Available dmi.chassis.asset.tag: No Asset Information dmi.chassis.type: 10 dmi.chassis.vendor: LENOVO dmi.chassis.version: Not Available dmi.modalias: dmi:bvnLENOVO:bvr7OETC4WW(2.24):bd04/09/2010:svnLENOVO:pn89329ZG:pvrThinkPadR61/R61i:rvnLENOVO:rn89329ZG:rvrNotAvailable:cvnLENOVO:ct10:cvrNotAvailable: dmi.product.name: 89329ZG dmi.product.version: ThinkPad R61/R61i dmi.sys.vendor: LENOVO To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/886975/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : [email protected] Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp

