[alsa-devel] [PATCH] 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.
Signed-off-by: Matthew Ranostay mranostay@embeddedalley.com ---
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e2b673a..3f5dc1b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -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;
At Mon, 19 Jan 2009 22:41:56 -0500, Matthew Ranostay wrote:
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
Signed-off-by: Matthew Ranostay mranostay@embeddedalley.com
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e2b673a..3f5dc1b 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -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;
participants (2)
-
Matthew Ranostay
-
Takashi Iwai