Skip to contentSkip to conversation

hda: Added mono_out_pin to autoconfig

PATCH1/2 Applied Matthew Ranostay 2 participants 2 messages Jan 23, 2008 – Jan 24, 2008

lore
Share & tools
lore
#0 lore raw

Added a mono_out_pin field to autocfg struct, and code to parse for the mono_out_line.

---

pci/hda/hda_codec.c +6 -1
diff -r 5492010913f0 pci/hda/hda_codec.c
@@ -769,7 +769,7 @@ get_alloc_amp_hash(struct hda_codec *cod
 /*
  * query AMP capabilities for the given widget and direction
  */
-static u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
+u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
 {
 	struct hda_amp_info *info;
 
@@ -2708,6 +2708,10 @@ int snd_hda_parse_pin_def_config(struct 
 		case AC_JACK_LINE_OUT:
 			seq = get_defcfg_sequence(def_conf);
 			assoc = get_defcfg_association(def_conf);
+
+			if (!(wid_caps & AC_WCAP_STEREO))
+				if (!cfg->mono_out_pin)
+					cfg->mono_out_pin = nid;
 			if (!assoc)
 				continue;
 			if (!assoc_line_out)
@@ -2856,6 +2860,7 @@ int snd_hda_parse_pin_def_config(struct 
 		   cfg->hp_outs, cfg->hp_pins[0],
 		   cfg->hp_pins[1], cfg->hp_pins[2],
 		   cfg->hp_pins[3], cfg->hp_pins[4]);
+	snd_printd("   mono: mono_out=0x%x\n", cfg->mono_out_pin);
 	snd_printd("   inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x,"
 		   " cd=0x%x, aux=0x%x\n",
 		   cfg->input_pins[AUTO_PIN_MIC],
pci/hda/hda_local.h +2 -0
diff -r 5492010913f0 pci/hda/hda_local.h
@@ -332,6 +332,7 @@ struct auto_pin_cfg {
 	hda_nid_t input_pins[AUTO_PIN_LAST];
 	hda_nid_t dig_out_pin;
 	hda_nid_t dig_in_pin;
+	hda_nid_t mono_out_pin;
 };
 
 #define get_defcfg_connect(cfg) \
@@ -374,6 +375,7 @@ static inline u32 get_wcaps(struct hda_c
 	return codec->wcaps[nid - codec->start_nid];
 }
 
+u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
 			      unsigned int caps);
Applied
#1 lore raw

At Wed, 23 Jan 2008 13:46:15 -0500,

Quoted 4 lines · Matthew Ranostay

Added a mono_out_pin field to autocfg struct, and code to parse for the mono_out_line.

Thanks, applied to ALSA HG tree.

Takashi

Quoted 52 lines

---
diff -r 5492010913f0 pci/hda/hda_codec.c

pci/hda/hda_codec.c +6 -1
@@ -769,7 +769,7 @@ get_alloc_amp_hash(struct hda_codec *cod
 /*
  * query AMP capabilities for the given widget and direction
  */
-static u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
+u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction)
 {
 	struct hda_amp_info *info;
 
@@ -2708,6 +2708,10 @@ int snd_hda_parse_pin_def_config(struct 
 		case AC_JACK_LINE_OUT:
 			seq = get_defcfg_sequence(def_conf);
 			assoc = get_defcfg_association(def_conf);
+
+			if (!(wid_caps & AC_WCAP_STEREO))
+				if (!cfg->mono_out_pin)
+					cfg->mono_out_pin = nid;
 			if (!assoc)
 				continue;
 			if (!assoc_line_out)
@@ -2856,6 +2860,7 @@ int snd_hda_parse_pin_def_config(struct 
 		   cfg->hp_outs, cfg->hp_pins[0],
 		   cfg->hp_pins[1], cfg->hp_pins[2],
 		   cfg->hp_pins[3], cfg->hp_pins[4]);
+	snd_printd("   mono: mono_out=0x%x\n", cfg->mono_out_pin);
 	snd_printd("   inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x,"
 		   " cd=0x%x, aux=0x%x\n",
 		   cfg->input_pins[AUTO_PIN_MIC],

diff -r 5492010913f0 pci/hda/hda_local.h

pci/hda/hda_local.h +2 -0
@@ -332,6 +332,7 @@ struct auto_pin_cfg {
 	hda_nid_t input_pins[AUTO_PIN_LAST];
 	hda_nid_t dig_out_pin;
 	hda_nid_t dig_in_pin;
+	hda_nid_t mono_out_pin;
 };
 
 #define get_defcfg_connect(cfg) \
@@ -374,6 +375,7 @@ static inline u32 get_wcaps(struct hda_c
 	return codec->wcaps[nid - codec->start_nid];
 }
 
+u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
 			      unsigned int caps);