From b861f5deff97c6e6ca116bced0b3cf866a885c69 Mon Sep 17 00:00:00 2001
From: Daniel Chen <crimsun@Box.ncat.edu>
Date: Thu, 31 May 2007 21:51:27 -0400
Subject: [PATCH] [PATCH] sound/pci/hda/: Make mixer capability check more robust (hda_codec.c)
Bug: 83015
Bug: 88570
Bug: 89889
Bug: 118169

Status: Merged in alsa-kernel hg

This changeset is the third of four necessary portions to fix the
above bugs.  The rationale from Takashi Iwai is that mixer elements
may return -EINVAL due to not being able to obtain proper amp_cap
bits.  In these cases, the code should reattempt the query.

Signed-off-by: Daniel T Chen <crimsun@ubuntu.com>
---
 sound/pci/hda/hda_codec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index dcc6087..a3c4259 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -708,7 +708,8 @@ static u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
 			nid = codec->afg;
 		info->amp_caps = snd_hda_param_read(codec, nid, direction == HDA_OUTPUT ?
 						    AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP);
-		info->status |= INFO_AMP_CAPS;
+		if (info->amp_caps)
+			info->status |= INFO_AMP_CAPS;
 	}
 	return info->amp_caps;
 }
-- 
1.5.2

