+++ /dev/null
-From: Takashi Iwai <tiwai@suse.de>
-Subject: ALSA: hda - Limit codec-verb retry to limited hardwares
-Patch-mainline:
-References: bnc#502903
-
-The reset of a BUS controller during operations is somehow risky and
-shouldn't be done inevitably for devices that have apparently no such
-codec-communication problems.
-
-This patch adds the check of the hardware and limits the bus-reset
-capability.
-
-Signed-off-by: Takashi Iwai <tiwai@suse.de>
-
----
- sound/pci/hda/hda_codec.c | 12 ++----------
- sound/pci/hda/hda_codec.h | 3 +++
- sound/pci/hda/hda_intel.c | 2 +-
- sound/pci/hda/patch_sigmatel.c | 9 +++++++++
- 4 files changed, 15 insertions(+), 11 deletions(-)
-
---- a/sound/pci/hda/hda_codec.h
-+++ b/sound/pci/hda/hda_codec.h
-@@ -588,6 +588,9 @@
-
- /* misc op flags */
- unsigned int needs_damn_long_delay :1;
-+ unsigned int allow_bus_reset:1; /* allow bus reset at fatal error */
-+ unsigned int sync_write:1; /* sync after verb write */
-+ /* status for codec/controller */
- unsigned int rirb_error:1; /* error in codec communication */
- unsigned int response_reset:1; /* controller was reset */
- unsigned int in_reset:1; /* during reset operation */
---- a/sound/pci/hda/hda_intel.c
-+++ b/sound/pci/hda/hda_intel.c
-@@ -645,7 +645,7 @@
- * to the single_cmd mode
- */
- bus->rirb_error = 1;
-- if (!bus->response_reset && !bus->in_reset) {
-+ if (bus->allow_bus_reset && !bus->response_reset && !bus->in_reset) {
- bus->response_reset = 1;
- return -1; /* give a chance to retry */
- }
---- a/sound/pci/hda/hda_codec.c
-+++ b/sound/pci/hda/hda_codec.c
-@@ -229,11 +229,6 @@
- return res;
- }
-
--/* Define the below to send and receive verbs synchronously.
-- * If you often get any codec communication errors, this is worth to try.
-- */
--#define SND_HDA_SUPPORT_SYNC_WRITE
--
- /**
- * snd_hda_codec_write - send a single command without waiting for response
- * @codec: the HDA codec
-@@ -250,12 +245,9 @@
- unsigned int verb, unsigned int parm)
- {
- unsigned int cmd = make_codec_cmd(codec, nid, direct, verb, parm);
--#ifdef SND_HDA_SUPPORT_SYNC_WRITE
- unsigned int res;
-- return codec_exec_verb(codec, cmd, &res);
--#else
-- return codec_exec_verb(codec, cmd, NULL);
--#endif
-+ return codec_exec_verb(codec, cmd,
-+ codec->bus->sync_write ? &res : NULL);
- }
-
- /**
---- a/sound/pci/hda/patch_sigmatel.c
-+++ b/sound/pci/hda/patch_sigmatel.c
-@@ -4804,6 +4804,15 @@
- codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
- }
-
-+ /* Some HP machines seem to have unstable codec communications
-+ * especially with ATI fglrx driver. For recovering from the
-+ * CORB/RIRB stall, allow the BUS reset and keep always sync
-+ */
-+ if (spec->board_config == STAC_HP_DV5) {
-+ codec->bus->sync_write = 1;
-+ codec->bus->allow_bus_reset = 1;
-+ }
-+
- spec->aloopback_mask = 0x50;
- spec->aloopback_shift = 0;
-