public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: Justin Forbes <jmforbes@linuxtx.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	"Theodore Ts'o" <tytso@mit.edu>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Dave Jones <davej@redhat.com>,
	Chuck Wolber <chuckw@quantumlinux.com>,
	Chris Wedgwood <reviews@ml.cw.f00f.org>,
	Michael Krufky <mkrufky@linuxtv.org>,
	Chuck Ebbert <cebbert@redhat.com>,
	Domenico Andreoli <cavokz@gmail.com>, Willy Tarreau <w@1wt.eu>,
	Rodrigo Rubira Branco <rbranco@la.checkpoint.com>,
	Jake Edge <jake@lwn.net>, Eugene Teo <eteo@redhat.com>,
	torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Takashi Iwai <tiwai@suse.de>
Subject: [patch 55/83] ALSA: hda - Restore default pin configs for realtek codecs
Date: Thu, 11 Dec 2008 11:15:49 -0800	[thread overview]
Message-ID: <20081211191549.GC5894@kroah.com> (raw)
In-Reply-To: <20081211191014.GA5759@suse.de>

[-- Attachment #1: alsa-hda-restore-default-pin-configs-for-realtek-codecs.patch --]
[-- Type: text/plain, Size: 4612 bytes --]

2.6.27-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Takashi Iwai <tiwai@suse.de>

commit e044c39ae258678d6ebb09fccb2a0fdf7ec51847 upstream

Some machines have broken BIOS resume that doesn't restore the default
pin configuration properly, which results in a wrong detection of HP
pin.  This causes a silent speaker output due to missing HP detection.
Related bug: Novell bug#406101
	https://bugzilla.novell.com/show_bug.cgi?id=406101

This patch fixes the issue by saving/restoring the default pin configs
by the driver itself.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 sound/pci/hda/patch_realtek.c |   77 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -292,6 +292,13 @@ struct alc_spec {
 	/* for PLL fix */
 	hda_nid_t pll_nid;
 	unsigned int pll_coef_idx, pll_coef_bit;
+
+#ifdef SND_HDA_NEEDS_RESUME
+#define ALC_MAX_PINS	16
+	unsigned int num_pins;
+	hda_nid_t pin_nids[ALC_MAX_PINS];
+	unsigned int pin_cfgs[ALC_MAX_PINS];
+#endif
 };
 
 /*
@@ -2723,6 +2730,64 @@ static void alc_free(struct hda_codec *c
 	codec->spec = NULL; /* to be sure */
 }
 
+#ifdef SND_HDA_NEEDS_RESUME
+static void store_pin_configs(struct hda_codec *codec)
+{
+	struct alc_spec *spec = codec->spec;
+	hda_nid_t nid, end_nid;
+
+	end_nid = codec->start_nid + codec->num_nodes;
+	for (nid = codec->start_nid; nid < end_nid; nid++) {
+		unsigned int wid_caps = get_wcaps(codec, nid);
+		unsigned int wid_type =
+			(wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
+		if (wid_type != AC_WID_PIN)
+			continue;
+		if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))
+			break;
+		spec->pin_nids[spec->num_pins] = nid;
+		spec->pin_cfgs[spec->num_pins] =
+			snd_hda_codec_read(codec, nid, 0,
+					   AC_VERB_GET_CONFIG_DEFAULT, 0);
+		spec->num_pins++;
+	}
+}
+
+static void resume_pin_configs(struct hda_codec *codec)
+{
+	struct alc_spec *spec = codec->spec;
+	int i;
+
+	for (i = 0; i < spec->num_pins; i++) {
+		hda_nid_t pin_nid = spec->pin_nids[i];
+		unsigned int pin_config = spec->pin_cfgs[i];
+		snd_hda_codec_write(codec, pin_nid, 0,
+				    AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
+				    pin_config & 0x000000ff);
+		snd_hda_codec_write(codec, pin_nid, 0,
+				    AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
+				    (pin_config & 0x0000ff00) >> 8);
+		snd_hda_codec_write(codec, pin_nid, 0,
+				    AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
+				    (pin_config & 0x00ff0000) >> 16);
+		snd_hda_codec_write(codec, pin_nid, 0,
+				    AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
+				    pin_config >> 24);
+	}
+}
+
+static int alc_resume(struct hda_codec *codec)
+{
+	resume_pin_configs(codec);
+	codec->patch_ops.init(codec);
+	snd_hda_codec_resume_amp(codec);
+	snd_hda_codec_resume_cache(codec);
+	return 0;
+}
+#else
+#define store_pin_configs(codec)
+#endif
+
 /*
  */
 static struct hda_codec_ops alc_patch_ops = {
@@ -2731,6 +2796,9 @@ static struct hda_codec_ops alc_patch_op
 	.init = alc_init,
 	.free = alc_free,
 	.unsol_event = alc_unsol_event,
+#ifdef SND_HDA_NEEDS_RESUME
+	.resume = alc_resume,
+#endif
 #ifdef CONFIG_SND_HDA_POWER_SAVE
 	.check_power_status = alc_check_power_status,
 #endif
@@ -3777,6 +3845,7 @@ static int alc880_parse_auto_config(stru
 	spec->num_mux_defs = 1;
 	spec->input_mux = &spec->private_imux;
 
+	store_pin_configs(codec);
 	return 1;
 }
 
@@ -5125,6 +5194,7 @@ static int alc260_parse_auto_config(stru
 	}
 	spec->num_mixers++;
 
+	store_pin_configs(codec);
 	return 1;
 }
 
@@ -9731,6 +9801,7 @@ static int alc262_parse_auto_config(stru
 	if (err < 0)
 		return err;
 
+	store_pin_configs(codec);
 	return 1;
 }
 
@@ -10762,6 +10833,7 @@ static int alc268_parse_auto_config(stru
 	if (err < 0)
 		return err;
 
+	store_pin_configs(codec);
 	return 1;
 }
 
@@ -11427,6 +11499,7 @@ static int alc269_parse_auto_config(stru
 	spec->mixers[spec->num_mixers] = alc269_capture_mixer;
 	spec->num_mixers++;
 
+	store_pin_configs(codec);
 	return 1;
 }
 
@@ -12495,6 +12568,7 @@ static int alc861_parse_auto_config(stru
 	spec->mixers[spec->num_mixers] = alc861_capture_mixer;
 	spec->num_mixers++;
 
+	store_pin_configs(codec);
 	return 1;
 }
 
@@ -13606,6 +13680,7 @@ static int alc861vd_parse_auto_config(st
 	if (err < 0)
 		return err;
 
+	store_pin_configs(codec);
 	return 1;
 }
 
@@ -14853,6 +14928,8 @@ static int alc662_parse_auto_config(stru
 
 	spec->mixers[spec->num_mixers] = alc662_capture_mixer;
 	spec->num_mixers++;
+
+	store_pin_configs(codec);
 	return 1;
 }
 


  parent reply	other threads:[~2008-12-11 19:37 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20081211190201.612240183@mini.kroah.org>
2008-12-11 19:10 ` [patch 00/83] 2.6.27.9-stable review Greg KH
2008-12-11 19:13   ` [patch 01/83] libata: improve phantom device detection Greg KH
2008-12-11 19:13   ` [patch 02/83] af_unix: netns: fix problem of return value Greg KH
2008-12-11 19:13   ` [patch 03/83] cxgb3: Fix kernel crash caused by uninitialized l2t_entry.arpq Greg KH
2008-12-11 21:12     ` Stefan Lippers-Hollmann
2008-12-11 23:41       ` Greg KH
2008-12-12  3:49         ` David Miller
2008-12-12  4:00       ` Greg KH
2008-12-12  5:11         ` David Miller
2008-12-11 19:13   ` [patch 04/83] niu: Fix readq implementation when architecture does not provide one Greg KH
2008-12-11 19:13   ` [patch 05/83] pppol2tp: Add missing sock_put() in pppol2tp_release() Greg KH
2008-12-11 19:13   ` [patch 06/83] udp: multicast packets need to check namespace Greg KH
2008-12-11 19:13   ` [patch 07/83] sparc64: Fix offset calculation in compute_size() Greg KH
2008-12-11 19:13   ` [patch 08/83] sparc64: Fix __copy_{to,from}_user_inatomic defines Greg KH
2008-12-11 19:13   ` [patch 09/83] sparc64: Fix PCI resource mapping on sparc64 Greg KH
2008-12-11 19:13   ` [patch 10/83] sparc64: Fix bug in PTRACE_SETFPREGS64 handling Greg KH
2008-12-11 19:13   ` [patch 11/83] sparc64: Fix VIS emulation bugs Greg KH
2008-12-11 19:13   ` [patch 12/83] sparc64: Sync FPU state in VIS emulation handler Greg KH
2008-12-11 19:13   ` [patch 13/83] Enforce a minimum SG_IO timeout Greg KH
2008-12-11 19:14   ` [patch 14/83] Fix a race condition in FASYNC handling Greg KH
2008-12-11 19:14   ` [patch 15/83] ACPI suspend: Blacklist boxes that require us to set SCI_EN directly on resume Greg KH
2008-12-11 19:14   ` [patch 16/83] jbd: fix error handling for checkpoint io Greg KH
2008-12-11 19:14   ` [patch 17/83] jbd: test BH_Write_EIO to detect errors on metadata buffers Greg KH
2008-12-11 19:14   ` [patch 18/83] spi: avoid spidev crash when device is removed Greg KH
2008-12-11 19:14   ` [patch 19/83] ATM: CVE-2008-5079: duplicate listen() on socket corrupts the vcc table Greg KH
2008-12-11 19:14   ` [patch 20/83] powerpc/mpic: Dont reset affinity for secondary MPIC on boot Greg KH
2008-12-11 19:14   ` [patch 21/83] Input: i8042 - add Thinkpad R31 to nomux list Greg KH
2008-12-11 19:14   ` [patch 22/83] Input: i8042 - add Blue FB5601 to noloop exception table Greg KH
2008-12-11 19:14   ` [patch 23/83] Input: i8042 - add Dell XPS M1530 to nomux list Greg KH
2008-12-11 19:14   ` [patch 24/83] Input: i8042 - add Compal Hel80 laptop to nomux blacklist Greg KH
2008-12-11 19:14   ` [patch 25/83] edac: fix enabling of polling cell module Greg KH
2008-12-11 19:14   ` [patch 26/83] USB: option: add Ericsson F3507g and Dell 5530 Greg KH
2008-12-11 19:14   ` [patch 27/83] USB: option.c remove duplicate device ids now supported in hso.c Greg KH
2008-12-11 19:14   ` [patch 28/83] USB: Option / AnyData new modem, same ID Greg KH
2008-12-11 19:14   ` [patch 29/83] USB: option: add Pantech cards Greg KH
2008-12-11 19:14   ` [patch 30/83] USB: add ZTE MF626 USB GSM modem entry Greg KH
2008-12-11 19:14   ` [patch 31/83] USB: support Huawei data card product IDs Greg KH
2008-12-11 19:14   ` [patch 32/83] USB: Add YISO u893 usb modem vendor and product IDs to option driver Greg KH
2008-12-11 19:14   ` [patch 33/83] USB: serial: add more Onda device ids " Greg KH
2008-12-11 19:14   ` [patch 34/83] USB: unusual-devs: support Huawei data card product IDs Greg KH
2008-12-11 19:14   ` [patch 35/83] USB: Unusual dev for Mio moov 330 gps Greg KH
2008-12-11 19:14   ` [patch 36/83] USB: Unusual dev for the "Kyocera / Contax SL300R T*" digital camera Greg KH
2008-12-11 19:14   ` [patch 37/83] USB: add Nikon D300 camera to unusual_devs Greg KH
2008-12-11 19:29     ` Chris Wedgwood
2008-12-11 19:51       ` Alan Stern
2008-12-11 23:42       ` Greg KH
2008-12-11 19:14   ` [patch 38/83] USB: unusual devs patch for Nokia 7610 Supernova Greg KH
2008-12-11 19:14   ` [patch 39/83] USB: storage: updates unusual_devs entry for the Nokia 6300 Greg KH
2008-12-11 19:15   ` [patch 40/83] USB: storage: update unusual_devs entries for Nokia 5300 and 5310 Greg KH
2008-12-11 19:15   ` [patch 41/83] USB: storage: unusual_devs entry for Mio C520-GPS Greg KH
2008-12-11 19:15   ` [patch 42/83] USB: usb-storage: unusual_devs entry for Nikon D2H Greg KH
2008-12-11 19:15   ` [patch 43/83] ALSA: HDA: hda_proc: Fix printf format specifier Greg KH
2008-12-11 19:15   ` [patch 44/83] ALSA: hda - Fix sound on NEC Versa S9100 Greg KH
2008-12-11 19:15   ` [patch 45/83] ALSA: hda: Add support for ECS/PC Chips boards with Sigmatel codecs Greg KH
2008-12-11 19:15   ` [patch 46/83] ALSA: hda - Fix ALC269 capture source Greg KH
2008-12-11 19:15   ` [patch 47/83] ALSA: hda - Add model for Toshiba L305 laptop Greg KH
2008-12-11 19:15   ` [patch 48/83] ALSA: hda: fixed hp_nid DAC for DELL_M6 Greg KH
2008-12-11 19:15   ` [patch 49/83] ALSA: HDA: patch_analog: Fix SPDIF output on AD1989B Greg KH
2008-12-11 19:15   ` [patch 50/83] ALSA: HDA: patch_analog: Quirk for Asus P5Q Premium/Pro boards Greg KH
2008-12-11 19:15   ` [patch 51/83] ALSA: hda: appletv support Greg KH
2008-12-11 19:15   ` [patch 52/83] ALSA: hda - Fix another ALC889A (rev 0x100101) Greg KH
2008-12-11 19:15   ` [patch 53/83] ALSA: hda - Add ALC887 support Greg KH
2008-12-11 19:15   ` [patch 54/83] ALSA: hda - Add support of ALC272 Greg KH
2008-12-11 19:15   ` Greg KH [this message]
2008-12-11 19:15   ` [patch 56/83] ALSA: hda - Add another HP model for AD1884A Greg KH
2008-12-11 19:15   ` [patch 57/83] ALSA: hda - Add a quirk for another Acer Aspire (1025:0090) Greg KH
2008-12-11 19:15   ` [patch 58/83] ALSA: hda - Add a quirk for MEDION MD96630 Greg KH
2008-12-11 19:15   ` [patch 59/83] ALSA: hda - Add another HP model (6730s) for AD1884A Greg KH
2008-12-11 19:16   ` [patch 60/83] ALSA: hda - Make the HP EliteBook 8530p use AD1884A model laptop Greg KH
2008-12-11 19:16   ` [patch 61/83] ALSA: hda - Add a quirk for Dell Studio 15 Greg KH
2008-12-11 19:16   ` [patch 62/83] ALSA: hda - No Headphone as Line-out swich without line-outs Greg KH
2008-12-11 19:16   ` [patch 63/83] ALSA: hda - mark Dell studio 1535 quirk Greg KH
2008-12-11 19:16   ` [patch 64/83] ALSA: emu10k1 - Add more invert_shared_spdif flag to Audigy models Greg KH
2008-12-11 19:16   ` [patch 65/83] cxgb3 - fix race in EEH Greg KH
2008-12-11 19:16   ` [patch 66/83] cxgb3 - remove duplicate tests in lro Greg KH
2008-12-11 19:16   ` [patch 67/83] sched: fix a bug in sched domain degenerate Greg KH
2008-12-11 19:16   ` [patch 68/83] x86: HPET: convert WARN_ON to WARN_ON_ONCE Greg KH
2008-12-17 11:26     ` Matt Fleming
2008-12-17 11:33       ` Takashi Iwai
2008-12-17 12:03         ` Matt Fleming
2008-12-17 18:42           ` Greg KH
2008-12-17 19:51             ` Matt Fleming
2008-12-17 19:54               ` Greg KH
2008-12-18 11:37             ` Thomas Gleixner
2008-12-18 19:01               ` Greg KH
2008-12-11 19:16   ` [patch 69/83] x86, memory hotplug: remove wrong -1 in calling init_memory_mapping() Greg KH
2008-12-11 19:16   ` [patch 70/83] x86: remove debug code from arch_add_memory() Greg KH
2008-12-11 19:16   ` [patch 71/83] sched: CPU remove deadlock fix Greg KH
2008-12-11 19:16   ` [patch 72/83] PCI: stop leaking slot_name in pci_create_slot Greg KH
2008-12-11 19:16   ` [patch 73/83] PCIe: ASPM: Break out of endless loop waiting for PCI config bits to switch Greg KH
2008-12-11 19:16   ` [patch 74/83] uml: boot broken due to buffer overrun Greg KH
2008-12-11 19:16   ` [patch 75/83] pagemap: fix 32-bit pagemap regression Greg KH
2008-12-11 19:16   ` [patch 76/83] fix mapping_writably_mapped() Greg KH
2008-12-11 19:16   ` [patch 77/83] atv: hid quirk for appletv IR receiver Greg KH
2008-12-11 19:16   ` [patch 78/83] Allow recursion in binfmt_script and binfmt_misc Greg KH
2008-12-11 19:16   ` [patch 79/83] tracehook: exec double-reporting fix Greg KH
2008-12-11 19:16   ` [patch 80/83] powerpc/virtex5: Fix Virtex5 machine check handling Greg KH
2008-12-11 19:16   ` [patch 81/83] ACPI: delete OSI(Linux) DMI dmesg spam Greg KH
2008-12-11 19:16   ` [patch 82/83] cifs: fix a regression in cifs umount codepath Greg KH
2008-12-11 19:16   ` [patch 83/83] pnp: make the resource type an unsigned long Greg KH
2008-12-12  5:19   ` [stable] [patch 00/83] 2.6.27.9-stable review Greg KH
2008-12-12  5:21   ` [patch 84/83] powerpc: Use cpu_thread_in_core in smp_init for of_spin_map Greg KH
2008-12-12  5:24   ` [patch 85/83] XFS: Fix hang after disallowed rename across directory quota domains Greg KH
2008-12-13  9:29   ` [patch 00/83] 2.6.27.9-stable review François Valenduc
2008-12-16 23:25     ` Greg KH
2008-12-17 18:58       ` François Valenduc
2008-12-18 19:00         ` Greg KH

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=20081211191549.GC5894@kroah.com \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=cavokz@gmail.com \
    --cc=cebbert@redhat.com \
    --cc=chuckw@quantumlinux.com \
    --cc=davej@redhat.com \
    --cc=eteo@redhat.com \
    --cc=jake@lwn.net \
    --cc=jmforbes@linuxtx.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkrufky@linuxtv.org \
    --cc=rbranco@la.checkpoint.com \
    --cc=rdunlap@xenotime.net \
    --cc=reviews@ml.cw.f00f.org \
    --cc=stable@kernel.org \
    --cc=tiwai@suse.de \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=w@1wt.eu \
    --cc=zwane@arm.linux.org.uk \
    /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