]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - src/patches/suse-2.6.27.31/patches.drivers/alsa-post-ga-hda-codec-limit-verb-retry
Merge branch 'master' into next
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.drivers / alsa-post-ga-hda-codec-limit-verb-retry
CommitLineData
2cb7cef9
BS
1From: Takashi Iwai <tiwai@suse.de>
2Subject: ALSA: hda - Limit codec-verb retry to limited hardwares
3Patch-mainline:
4References: bnc#502903
5
6The reset of a BUS controller during operations is somehow risky and
7shouldn't be done inevitably for devices that have apparently no such
8codec-communication problems.
9
10This patch adds the check of the hardware and limits the bus-reset
11capability.
12
13Signed-off-by: Takashi Iwai <tiwai@suse.de>
14
15---
16 sound/pci/hda/hda_codec.c | 12 ++----------
17 sound/pci/hda/hda_codec.h | 3 +++
18 sound/pci/hda/hda_intel.c | 2 +-
19 sound/pci/hda/patch_sigmatel.c | 9 +++++++++
20 4 files changed, 15 insertions(+), 11 deletions(-)
21
22--- a/sound/pci/hda/hda_codec.h
23+++ b/sound/pci/hda/hda_codec.h
24@@ -588,6 +588,9 @@
25
26 /* misc op flags */
27 unsigned int needs_damn_long_delay :1;
28+ unsigned int allow_bus_reset:1; /* allow bus reset at fatal error */
29+ unsigned int sync_write:1; /* sync after verb write */
30+ /* status for codec/controller */
31 unsigned int rirb_error:1; /* error in codec communication */
32 unsigned int response_reset:1; /* controller was reset */
33 unsigned int in_reset:1; /* during reset operation */
34--- a/sound/pci/hda/hda_intel.c
35+++ b/sound/pci/hda/hda_intel.c
36@@ -645,7 +645,7 @@
37 * to the single_cmd mode
38 */
39 bus->rirb_error = 1;
40- if (!bus->response_reset && !bus->in_reset) {
41+ if (bus->allow_bus_reset && !bus->response_reset && !bus->in_reset) {
42 bus->response_reset = 1;
43 return -1; /* give a chance to retry */
44 }
45--- a/sound/pci/hda/hda_codec.c
46+++ b/sound/pci/hda/hda_codec.c
47@@ -229,11 +229,6 @@
48 return res;
49 }
50
51-/* Define the below to send and receive verbs synchronously.
52- * If you often get any codec communication errors, this is worth to try.
53- */
54-#define SND_HDA_SUPPORT_SYNC_WRITE
55-
56 /**
57 * snd_hda_codec_write - send a single command without waiting for response
58 * @codec: the HDA codec
59@@ -250,12 +245,9 @@
60 unsigned int verb, unsigned int parm)
61 {
62 unsigned int cmd = make_codec_cmd(codec, nid, direct, verb, parm);
63-#ifdef SND_HDA_SUPPORT_SYNC_WRITE
64 unsigned int res;
65- return codec_exec_verb(codec, cmd, &res);
66-#else
67- return codec_exec_verb(codec, cmd, NULL);
68-#endif
69+ return codec_exec_verb(codec, cmd,
70+ codec->bus->sync_write ? &res : NULL);
71 }
72
73 /**
74--- a/sound/pci/hda/patch_sigmatel.c
75+++ b/sound/pci/hda/patch_sigmatel.c
76@@ -4804,6 +4804,15 @@
77 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
78 }
79
80+ /* Some HP machines seem to have unstable codec communications
81+ * especially with ATI fglrx driver. For recovering from the
82+ * CORB/RIRB stall, allow the BUS reset and keep always sync
83+ */
84+ if (spec->board_config == STAC_HP_DV5) {
85+ codec->bus->sync_write = 1;
86+ codec->bus->allow_bus_reset = 1;
87+ }
88+
89 spec->aloopback_mask = 0x50;
90 spec->aloopback_shift = 0;
91