Cast some vendor-specific spell on VIA VT1708S codecs to:

- make analog input loopback work;
 - get access to the mics boost controls.

Sponsored by:	iXsystems, Inc.
MFC after:	1 month
This commit is contained in:
mav 2011-12-20 02:00:27 +00:00
parent d143e961c0
commit 4b4071a045

View File

@ -4971,6 +4971,30 @@ hdac_vendor_patch_parse(struct hdac_devinfo *devinfo)
if (w != NULL)
w->connsenable[0] = 0;
break;
case HDA_CODEC_VT1708S_0:
case HDA_CODEC_VT1708S_1:
case HDA_CODEC_VT1708S_2:
case HDA_CODEC_VT1708S_3:
case HDA_CODEC_VT1708S_4:
case HDA_CODEC_VT1708S_5:
case HDA_CODEC_VT1708S_6:
case HDA_CODEC_VT1708S_7:
/*
* These codecs have hidden mic boost controls.
*/
w = hdac_widget_get(devinfo, 26);
if (w != NULL)
w->param.inamp_cap =
(40 << HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT) |
(3 << HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT) |
(0 << HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT);
w = hdac_widget_get(devinfo, 30);
if (w != NULL)
w->param.inamp_cap =
(40 << HDA_PARAM_OUTPUT_AMP_CAP_STEPSIZE_SHIFT) |
(3 << HDA_PARAM_OUTPUT_AMP_CAP_NUMSTEPS_SHIFT) |
(0 << HDA_PARAM_OUTPUT_AMP_CAP_OFFSET_SHIFT);
break;
}
}
@ -6458,7 +6482,7 @@ hdac_audio_commit(struct hdac_devinfo *devinfo)
struct hdac_softc *sc = devinfo->codec->sc;
struct hdac_widget *w;
nid_t cad;
uint32_t gdata, gmask, gdir;
uint32_t id, gdata, gmask, gdir;
int commitgpio, numgpio;
int i;
@ -6467,6 +6491,16 @@ hdac_audio_commit(struct hdac_devinfo *devinfo)
if (sc->pci_subvendor == APPLE_INTEL_MAC)
hdac_command(sc, HDA_CMD_12BIT(cad, devinfo->nid,
0x7e7, 0), cad);
/* Cast some spells for VIA VT1708S. */
id = hdac_codec_id(devinfo->codec);
if (id >= HDA_CODEC_VT1708S_0 && id <= HDA_CODEC_VT1708S_7) {
/* Enable Mic Boost Volume controls. */
hdac_command(sc, HDA_CMD_12BIT(cad, devinfo->nid,
0xf98, 0x01), cad);
/* Don't bypass mixer. */
hdac_command(sc, HDA_CMD_12BIT(cad, devinfo->nid,
0xf88, 0xc0), cad);
}
/* Commit controls. */
hdac_audio_ctl_commit(devinfo);
@ -7767,10 +7801,6 @@ hdac_attach2(void *arg)
device_printf(sc->dev, "Parsing audio FG...\n");
);
hdac_audio_parse(devinfo);
HDA_BOOTHVERBOSE(
device_printf(sc->dev, "Parsing Ctls...\n");
);
hdac_audio_ctl_parse(devinfo);
HDA_BOOTHVERBOSE(
device_printf(sc->dev, "Parsing vendor patch...\n");
);
@ -7778,6 +7808,10 @@ hdac_attach2(void *arg)
devinfo->function.audio.quirks |= quirks_on;
devinfo->function.audio.quirks &= ~quirks_off;
HDA_BOOTHVERBOSE(
device_printf(sc->dev, "Parsing Ctls...\n");
);
hdac_audio_ctl_parse(devinfo);
HDA_BOOTHVERBOSE(
device_printf(sc->dev, "Disabling nonaudio...\n");
);