Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2012 18:12:53 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229973 - stable/9/sys/dev/sound/pci/hda
Message-ID:  <201201111812.q0BICrWZ070904@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Jan 11 18:12:53 2012
New Revision: 229973
URL: http://svn.freebsd.org/changeset/base/229973

Log:
  MFC r228726, r228727:
  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.

Modified:
  stable/9/sys/dev/sound/pci/hda/hdac.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/dev/sound/pci/hda/hdac.c
==============================================================================
--- stable/9/sys/dev/sound/pci/hda/hdac.c	Wed Jan 11 17:51:56 2012	(r229972)
+++ stable/9/sys/dev/sound/pci/hda/hdac.c	Wed Jan 11 18:12:53 2012	(r229973)
@@ -4971,6 +4971,30 @@ hdac_vendor_patch_parse(struct hdac_devi
 		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 *d
 	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,24 @@ hdac_audio_commit(struct hdac_devinfo *d
 	if (sc->pci_subvendor == APPLE_INTEL_MAC)
 		hdac_command(sc, HDA_CMD_12BIT(cad, devinfo->nid,
 		    0x7e7, 0), cad);
+	id = hdac_codec_id(devinfo->codec);
+	switch (id) {
+	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:
+		/* 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);
+		break;
+	}
 
 	/* Commit controls. */
 	hdac_audio_ctl_commit(devinfo);
@@ -7768,10 +7810,6 @@ hdac_attach2(void *arg)
 			);
 			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");
 			);
 			hdac_vendor_patch_parse(devinfo);
@@ -7779,6 +7817,10 @@ hdac_attach2(void *arg)
 			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");
 			);
 			hdac_audio_disable_nonaudio(devinfo);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201111812.q0BICrWZ070904>