]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.drivers/alsa-post-ga-hda-stac-shutup-at-free
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.drivers / alsa-post-ga-hda-stac-shutup-at-free
CommitLineData
82094b55
AF
1From: Takashi Iwai <tiwai@suse.de>
2Subject: ALSA: hda - Reset pins of IDT/STAC codecs at free
3Patch-mainline:
4References: bnc#544779
5
6Some laptops cause annoying clicks or noises at shutdown/reboot since
7the speaker pin is set still high. Apply the same procedure used for
8the suspend to avoid such clicks/noises for freeing the codec, too.
9
10Signed-off-by: Takashi Iwai <tiwai@suse.de>
11
12---
13 sound/pci/hda/patch_sigmatel.c | 42 +++++++++++++++++++++++------------------
14 1 file changed, 24 insertions(+), 18 deletions(-)
15
16--- a/sound/pci/hda/patch_sigmatel.c
17+++ b/sound/pci/hda/patch_sigmatel.c
18@@ -4058,6 +4058,28 @@
19 snd_array_free(&spec->kctls);
20 }
21
22+static void stac92xx_shutup(struct hda_codec *codec)
23+{
24+ struct sigmatel_spec *spec = codec->spec;
25+ int i;
26+ hda_nid_t nid;
27+
28+ /* reset each pin before powering down DAC/ADC to avoid click noise */
29+ nid = codec->start_nid;
30+ for (i = 0; i < codec->num_nodes; i++, nid++) {
31+ unsigned int wcaps = get_wcaps(codec, nid);
32+ unsigned int wid_type = get_wcaps_type(wcaps);
33+ if (wid_type == AC_WID_PIN)
34+ snd_hda_codec_read(codec, nid, 0,
35+ AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
36+ }
37+
38+ if (spec->eapd_mask)
39+ stac_gpio_set(codec, spec->gpio_mask,
40+ spec->gpio_dir, spec->gpio_data &
41+ ~spec->eapd_mask);
42+}
43+
44 static void stac92xx_free(struct hda_codec *codec)
45 {
46 struct sigmatel_spec *spec = codec->spec;
47@@ -4065,6 +4087,7 @@
48 if (! spec)
49 return;
50
51+ stac92xx_shutup(codec);
52 snd_array_free(&spec->events);
53
54 kfree(spec);
55@@ -4424,24 +4447,7 @@
56
57 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state)
58 {
59- struct sigmatel_spec *spec = codec->spec;
60- int i;
61- hda_nid_t nid;
62-
63- /* reset each pin before powering down DAC/ADC to avoid click noise */
64- nid = codec->start_nid;
65- for (i = 0; i < codec->num_nodes; i++, nid++) {
66- unsigned int wcaps = get_wcaps(codec, nid);
67- unsigned int wid_type = get_wcaps_type(wcaps);
68- if (wid_type == AC_WID_PIN)
69- snd_hda_codec_read(codec, nid, 0,
70- AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
71- }
72-
73- if (spec->eapd_mask)
74- stac_gpio_set(codec, spec->gpio_mask,
75- spec->gpio_dir, spec->gpio_data &
76- ~spec->eapd_mask);
77+ stac92xx_shutup(codec);
78 return 0;
79 }
80 #endif