Skip to contentSkip to conversation

hda: Mic in as output changes

PATCH Applied Matthew Ranostay 2 participants 4 messages Jan 29, 2008 – Jan 30, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hda: Mic in as output changes

Some laptop has an internal analog microphone that is 'fixed'. This patch prevents creating a 'Mic In as Output' switch for ports that can't be outputs.

---

pci/hda/patch_sigmatel.c +20 -8
diff -r ec0316a4d108 pci/hda/patch_sigmatel.c
@@ -288,6 +288,10 @@ static hda_nid_t stac927x_adc_nids[3] = 
 
 static hda_nid_t stac927x_mux_nids[3] = {
         0x15, 0x16, 0x17
+};
+
+static hda_nid_t stac927x_dac_nids[5] = {
+	0x02, 0x03, 0x04, 0x05, 0x06
 };
 
 static hda_nid_t stac927x_dmux_nids[1] = {
@@ -2283,15 +2287,23 @@ static int stac92xx_auto_create_multi_ou
 	}
 
 	if (spec->mic_switch) {
+		unsigned int def_conf;
 		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;
+		def_conf = snd_hda_codec_read(codec, nid, 0,
+						AC_VERB_GET_CONFIG_DEFAULT, 0);
+
+		/* some laptops have an internal analog microphone
+ 		 * which can't be used as a output */
+		if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
+			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;
+			}
 		}
 	}
#1 lore raw

At Tue, 29 Jan 2008 17:41:18 -0500,

Quoted 5 lines · Matthew Ranostay

Some laptop has an internal analog microphone that is 'fixed'. This patch prevents creating a 'Mic In as Output' switch for ports that can't be outputs.

This patch causes a compile warning:

CC [M] pci/hda/patch_sigmatel.o
pci/hda/patch_sigmatel.c:293:
warning: ‘stac927x_dac_nids’ defined but not used

Could you fix this?

thanks,

Takashi

Quoted 38 lines

---
diff -r ec0316a4d108 pci/hda/patch_sigmatel.c

pci/hda/patch_sigmatel.c +13 -8
@@ -288,6 +288,10 @@ static hda_nid_t stac927x_adc_nids[3] = 
 
 static hda_nid_t stac927x_mux_nids[3] = {
         0x15, 0x16, 0x17
+};
+
+static hda_nid_t stac927x_dac_nids[5] = {
+	0x02, 0x03, 0x04, 0x05, 0x06
 };
 
 static hda_nid_t stac927x_dmux_nids[1] = {
@@ -2283,15 +2287,23 @@ static int stac92xx_auto_create_multi_ou
 	}
 
 	if (spec->mic_switch) {
+		unsigned int def_conf;
 		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;
+		def_conf = snd_hda_codec_read(codec, nid, 0,
+						AC_VERB_GET_CONFIG_DEFAULT, 0);
+
+		/* some laptops have an internal analog microphone
+ 		 * which can't be used as a output */
+		if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
+			pincap = snd_hda_param_read(codec, nid,
+							AC_PAR_PIN_CAP);

pci/hda/patch_sigmatel.c static int stac92xx_auto_create_multi_ou · line 2309

Quoted 10 lines
pci/hda/patch_sigmatel.c +7 -0
+			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;
+			}
 		}
 	}
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 60 lines · Takashi Iwai

At Tue, 29 Jan 2008 17:41:18 -0500,

Quoted 4 lines · Matthew Ranostay

Some laptop has an internal analog microphone that is 'fixed'. This patch prevents creating a 'Mic In as Output' switch for ports that can't be outputs.

This patch causes a compile warning:

CC [M] pci/hda/patch_sigmatel.o
pci/hda/patch_sigmatel.c:293:
warning: stac927x_dac_nids defined but not used

Could you fix this?

thanks,

Takashi

Quoted 40 lines

---
diff -r ec0316a4d108 pci/hda/patch_sigmatel.c

pci/hda/patch_sigmatel.c +16 -8
@@ -288,6 +288,10 @@ static hda_nid_t stac927x_adc_nids[3] = 
 
 static hda_nid_t stac927x_mux_nids[3] = {
         0x15, 0x16, 0x17
+};
+
+static hda_nid_t stac927x_dac_nids[5] = {
+	0x02, 0x03, 0x04, 0x05, 0x06
 };
 
 static hda_nid_t stac927x_dmux_nids[1] = {
@@ -2283,15 +2287,23 @@ static int stac92xx_auto_create_multi_ou
 	}
 
 	if (spec->mic_switch) {
+		unsigned int def_conf;
 		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;
+		def_conf = snd_hda_codec_read(codec, nid, 0,
+						AC_VERB_GET_CONFIG_DEFAULT, 0);
+
+		/* some laptops have an internal analog microphone
+ 		 * which can't be used as a output */
+		if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
+			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,
Quoted 9 lines

pci/hda/patch_sigmatel.c static int stac92xx_auto_create_multi_ou · line 2309

Quoted 8 lines
pci/hda/patch_sigmatel.c +4 -0
+					"Mic as Output Switch", (nid << 8) | 1);
+				if (err < 0)
+					return err;
+			}
 		}
 	}
 

Ooops patch of another patch got merged in this.
Here it is cleaned up.

---

pci/hda/patch_sigmatel.c +16 -8
diff -r 86c8c0a82bb9 pci/hda/patch_sigmatel.c
@@ -2283,15 +2283,23 @@ static int stac92xx_auto_create_multi_ou
 	}
 
 	if (spec->mic_switch) {
+		unsigned int def_conf;
 		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;
+		def_conf = snd_hda_codec_read(codec, nid, 0,
+						AC_VERB_GET_CONFIG_DEFAULT, 0);
+
+		/* some laptops have an internal analog microphone
+ 		 * which can't be used as a output */
+		if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
+			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;
+			}
 		}
 	}
Applied
#3 lore raw

At Wed, 30 Jan 2008 08:50:05 -0500,

Quoted 72 lines · Matthew Ranostay
Quoted 60 lines · Takashi Iwai

At Tue, 29 Jan 2008 17:41:18 -0500,

Quoted 4 lines · Matthew Ranostay

Some laptop has an internal analog microphone that is 'fixed'. This patch prevents creating a 'Mic In as Output' switch for ports that can't be outputs.

This patch causes a compile warning:

CC [M] pci/hda/patch_sigmatel.o
pci/hda/patch_sigmatel.c:293:
warning: stac927x_dac_nids defined but not used

Could you fix this?

thanks,

Takashi

Quoted 40 lines

---
diff -r ec0316a4d108 pci/hda/patch_sigmatel.c

pci/hda/patch_sigmatel.c +16 -8
@@ -288,6 +288,10 @@ static hda_nid_t stac927x_adc_nids[3] = 
 
 static hda_nid_t stac927x_mux_nids[3] = {
         0x15, 0x16, 0x17
+};
+
+static hda_nid_t stac927x_dac_nids[5] = {
+	0x02, 0x03, 0x04, 0x05, 0x06
 };
 
 static hda_nid_t stac927x_dmux_nids[1] = {
@@ -2283,15 +2287,23 @@ static int stac92xx_auto_create_multi_ou
 	}
 
 	if (spec->mic_switch) {
+		unsigned int def_conf;
 		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;
+		def_conf = snd_hda_codec_read(codec, nid, 0,
+						AC_VERB_GET_CONFIG_DEFAULT, 0);
+
+		/* some laptops have an internal analog microphone
+ 		 * which can't be used as a output */
+		if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
+			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,
Quoted 9 lines

pci/hda/patch_sigmatel.c static int stac92xx_auto_create_multi_ou

Quoted 8 lines
pci/hda/patch_sigmatel.c +4 -0
+					"Mic as Output Switch", (nid << 8) | 1);
+				if (err < 0)
+					return err;
+			}
 		}
 	}
 
Quoted 2 lines

Ooops patch of another patch got merged in this.
Here it is cleaned up.

Thanks, applied now to HG tree.

Takashi