[ALSA] hda: STAC92xx Line In/Mic as output check

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Thursday, January 31, 2008 - 5:04 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=b5895d...
Commit:     b5895dc8b467a2457f4d33bef51f9879cf780a07
Parent:     628ed1333a9d2a7c7d3dc53641ea59af511e5fe5
Author:     Matthew Ranostay <mranostay@embededalley.com>
AuthorDate: Fri Jan 25 15:24:50 2008 +0100
Committer:  Jaroslav Kysela <perex@perex.cz>
CommitDate: Thu Jan 31 17:30:16 2008 +0100

    [ALSA] hda: STAC92xx Line In/Mic as output check
    
    This patch checks to see the Line In/Mic port have the ability
    to do output before creating the the control switches.
    The 92hd71bxx series of codecs has this issue with the port 0xe,
    which only allows input.
    
    Signed-off-by: Matthew Ranostay <mranostay@embededalley.com>
    Signed-off-by: Takashi Iwai <tiwai@suse.de>
    Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 sound/pci/hda/patch_sigmatel.c |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 3b8b860..34890c5 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2226,7 +2226,7 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
 	int i, err;
 
 	struct sigmatel_spec *spec = codec->spec;
-	unsigned int wid_caps;
+	unsigned int wid_caps, pincap;
 
 
 	for (i = 0; i < cfg->line_outs; i++) {
@@ -2262,13 +2262,31 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec,
 		}
 	}
 
-	if (spec->line_switch)
-		if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Line In as Output Switch", cfg->input_pins[AUTO_PIN_LINE] << 8)) < 0)
-			return err;
+	if (spec->line_switch) {
+		nid = cfg->input_pins[AUTO_PIN_LINE];
+		pincap = snd_hda_param_read(codec, nid,
+						AC_PAR_PIN_CAP);
+		if (pincap & AC_PINCAP_OUT) {
+			err = stac92xx_add_control(spec,
+				STAC_CTL_WIDGET_IO_SWITCH,
+				"Line In as Output Switch", nid << 8);
+			if (err < 0)
+				return err;
+		}
+	}
 
-	if (spec->mic_switch)
-		if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, "Mic as Output Switch", (cfg->input_pins[AUTO_PIN_MIC] << 8) | 1)) < 0)
-			return err;
+	if (spec->mic_switch) {
+		nid = cfg->input_pins[AUTO_PIN_MIC];
+		pincap = snd_hda_param_read(codec, nid,
+						AC_PAR_PIN_CAP);
+		if (pincap & AC_PINCAP_OUT) {
+			err = stac92xx_add_control(spec,
+				STAC_CTL_WIDGET_IO_SWITCH,
+				"Mic as Output Switch", (nid << 8) | 1);
+			if (err < 0)
+				return err;
+		}
+	}
 
 	return 0;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[ALSA] hda: STAC92xx Line In/Mic as output check, Linux Kernel Mailing ..., (Thu Jan 31, 5:04 pm)