+ if (spec->autocfg.mono_out_pin) {
+ int dir = (get_wcaps(codec, spec->autocfg.mono_out_pin)
+ & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT;
+ u32 caps = query_amp_caps(codec,
+ spec->autocfg.mono_out_pin, dir);
+ hda_nid_t conn_list[1];
+
+ /* get the mixer node and then the mono mux if it exists */
+ if (snd_hda_get_connections(codec,
+ spec->autocfg.mono_out_pin, conn_list, 1) &&
+ snd_hda_get_connections(codec, conn_list[0],
+ conn_list, 1)) {
+
+ int wcaps = get_wcaps(codec, conn_list[0]);
+ int wid_type = (wcaps & AC_WCAP_TYPE)
+ >> AC_WCAP_TYPE_SHIFT;
+ /* LR swap check, some stac925x have a mux that
+ * changes the DACs output path instead of the
+ * mono-mux path.
+ */
+ if (wid_type == AC_WID_AUD_SEL &&
+ !(wcaps & AC_WCAP_LR_SWAP))
+ spec->mono_nid = conn_list[0];
+ }
+ /* all mono outs have a least a mute/unmute switch */
+ err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE,
+ "Mono Playback Switch",
+ HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
+ 1, 0, dir));
+ if (err < 0)
+ return err;
+ /* check to see if there is volume support for the amp */
+ if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) {
+ err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL,
+ "Mono Playback Volume",
+ HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin,
+ 1, 0, dir));
+ if (err < 0)
+ return err;
+ }
+
+ stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin,
+ AC_PINCTL_OUT_EN);
+ }