Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jul 2019 04:13:47 +0000 (UTC)
From:      Sean Bruno <sbruno@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r350078 - in head: share/man/man4 sys/dev/sound/pci/hda
Message-ID:  <201907170413.x6H4Dlvd059436@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sbruno
Date: Wed Jul 17 04:13:46 2019
New Revision: 350078
URL: https://svnweb.freebsd.org/changeset/base/350078

Log:
  I add the ability to accept the default pin widget configuration to help
  with various laptops using hdaa(4) sound devices.  We don't seem to know
  the "correct" configurations for these devices and the defaults are far
  superiour, e.g. they work if you don't nuke the default configs.
  
  PR:	200526
  Differential Revision:	https://reviews.freebsd.org/D17772

Modified:
  head/share/man/man4/snd_hda.4
  head/sys/dev/sound/pci/hda/hdaa.c
  head/sys/dev/sound/pci/hda/hdaa.h

Modified: head/share/man/man4/snd_hda.4
==============================================================================
--- head/share/man/man4/snd_hda.4	Wed Jul 17 03:19:30 2019	(r350077)
+++ head/share/man/man4/snd_hda.4	Wed Jul 17 04:13:46 2019	(r350078)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 1, 2018
+.Dd July 16, 2019
 .Dt SND_HDA 4
 .Os
 .Sh NAME
@@ -153,6 +153,12 @@ The
 and
 .Dq Li ovref Ns Ar X
 options control the voltage used to power external microphones.
+.It Va dev.hdaa.%d.init_clear
+Zero out the pin widget config setup by the system.
+Some systems seem to have unuseable audio devices if the pin widgit
+configuration is cleared.
+Set this value to 0 to accept the default configuration values setup by the
+BIOS.
 .It Va hint.hdaa.%d.gpio_config
 Overrides audio function GPIO pins configuration set by BIOS.
 May be specified as a set of space-separated

Modified: head/sys/dev/sound/pci/hda/hdaa.c
==============================================================================
--- head/sys/dev/sound/pci/hda/hdaa.c	Wed Jul 17 03:19:30 2019	(r350077)
+++ head/sys/dev/sound/pci/hda/hdaa.c	Wed Jul 17 04:13:46 2019	(r350078)
@@ -5034,11 +5034,13 @@ hdaa_audio_prepare_pin_ctrl(struct hdaa_devinfo *devin
 		pincap = w->wclass.pin.cap;
 
 		/* Disable everything. */
-		w->wclass.pin.ctrl &= ~(
-		    HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE |
-		    HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE |
-		    HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE |
-		    HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK);
+		if (devinfo->init_clear) {
+			w->wclass.pin.ctrl &= ~(
+		    	HDA_CMD_SET_PIN_WIDGET_CTRL_HPHN_ENABLE |
+		    	HDA_CMD_SET_PIN_WIDGET_CTRL_OUT_ENABLE |
+		    	HDA_CMD_SET_PIN_WIDGET_CTRL_IN_ENABLE |
+		    	HDA_CMD_SET_PIN_WIDGET_CTRL_VREF_ENABLE_MASK);
+		}
 
 		if (w->enable == 0) {
 			/* Pin is unused so left it disabled. */
@@ -6671,6 +6673,10 @@ hdaa_attach(device_t dev)
 	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
 	    "reconfig", CTLTYPE_INT | CTLFLAG_RW,
 	    dev, 0, hdaa_sysctl_reconfig, "I", "Reprocess configuration");
+	SYSCTL_ADD_INT(device_get_sysctl_ctx(dev),
+	    SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO,
+	    "init_clear", CTLFLAG_RW,
+	    &devinfo->init_clear, 1,"Clear initial pin widget configuration");
 	bus_generic_attach(dev);
 	return (0);
 }

Modified: head/sys/dev/sound/pci/hda/hdaa.h
==============================================================================
--- head/sys/dev/sound/pci/hda/hdaa.h	Wed Jul 17 03:19:30 2019	(r350077)
+++ head/sys/dev/sound/pci/hda/hdaa.h	Wed Jul 17 04:13:46 2019	(r350078)
@@ -214,6 +214,7 @@ struct hdaa_devinfo {
 	struct hdaa_chan	*chans;
 	struct callout		poll_jack;
 	int			poll_ival;
+	uint32_t		init_clear;
 };
 
 #define HDAA_CHN_RUNNING	0x00000001



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