Skip to contentSkip to conversation

hda: default dmuxes to first entry in dinput_mux

PATCH In review Matthew Ranostay 2 participants 2 messages Jan 20, 2009 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hda: default dmuxes to first entry in dinput_mux

When using a custom spec->dinput_mux sometimes the value selected is incorrect due to not have a previously selected default. To remedy this patch selects the first items index in spec->dinput_mux and sets all the dmuxes thusly to it.

---

sound/pci/hda/patch_sigmatel.c +11 -1
index e2b673a..3f5dc1b 100644
@@ -3663,7 +3663,17 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
 		spec->mixers[spec->num_mixers++] = spec->kctls.list;
 
 	spec->input_mux = &spec->private_imux;
-	if (!spec->dinput_mux)
+	if (spec->dinput_mux) {
+		int idx = spec->dinput_mux->items[0].index;
+		int i;
+
+		/* sometimes using a custom dinput_mux causes the incorrect
+ 		 * value to selected on startup, but sure a valid one is
+ 		 * selected by default */
+		for (i = 0; i < spec->num_dmuxes; i++)
+			snd_hda_codec_write_cache(codec, spec->dmux_nids[i], 0,
+				 AC_VERB_SET_CONNECT_SEL, idx);
+	} else
 		spec->dinput_mux = &spec->private_dimux;
 	spec->sinput_mux = &spec->private_smux;
 	spec->mono_mux = &spec->private_mono_mux;
#1 lore raw

At Mon, 19 Jan 2009 22:41:56 -0500,

Quoted 5 lines · Matthew Ranostay

When using a custom spec->dinput_mux sometimes the value selected is incorrect due to not have a previously selected default. To remedy this patch selects the first items index in spec->dinput_mux and sets all the dmuxes thusly to it.

Shouldn't we initialize the item selection even for the BIOS dinput_mux? (Who can trust BIOS setup? ;)

thanks,

Takashi

Quoted 28 lines

---

sound/pci/hda/patch_sigmatel.c +11 -1
index e2b673a..3f5dc1b 100644
@@ -3663,7 +3663,17 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
 		spec->mixers[spec->num_mixers++] = spec->kctls.list;
 
 	spec->input_mux = &spec->private_imux;
-	if (!spec->dinput_mux)
+	if (spec->dinput_mux) {
+		int idx = spec->dinput_mux->items[0].index;
+		int i;
+
+		/* sometimes using a custom dinput_mux causes the incorrect
+ 		 * value to selected on startup, but sure a valid one is
+ 		 * selected by default */
+		for (i = 0; i < spec->num_dmuxes; i++)
+			snd_hda_codec_write_cache(codec, spec->dmux_nids[i], 0,
+				 AC_VERB_SET_CONNECT_SEL, idx);
+	} else
 		spec->dinput_mux = &spec->private_dimux;
 	spec->sinput_mux = &spec->private_smux;
 	spec->mono_mux = &spec->private_mono_mux;