Module Name:    src
Committed By:   manu
Date:           Thu Sep 27 01:18:11 UTC 2018

Modified Files:
        src/sys/dev/hdaudio: hdafg.c

Log Message:
Fix hdaudio device configuration

When disabling unassociated devices, we have a special handling
for pins of type COP_AWCAP_TYPE_PIN_COMPLEX, but it came after code
that may disable any pins, including the ones that should be handled
as COP_AWCAP_TYPE_PIN_COMPLEX.

The result was that hdaudio could fail to detect some devices.  We
fix the situation by making sure that COP_AWCAP_TYPE_PIN_COMPLEX
pins always get their specific handling.

The change makes the built-in speaker work on Dell OptiPlex 5060


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/hdaudio/hdafg.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.15 src/sys/dev/hdaudio/hdafg.c:1.16
--- src/sys/dev/hdaudio/hdafg.c:1.15	Wed Feb 14 18:28:43 2018
+++ src/sys/dev/hdaudio/hdafg.c	Thu Sep 27 01:18:11 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.15 2018/02/14 18:28:43 maya Exp $ */
+/* $NetBSD: hdafg.c,v 1.16 2018/09/27 01:18:11 manu Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <supp...@precedence.co.uk>
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.15 2018/02/14 18:28:43 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.16 2018/09/27 01:18:11 manu Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -2102,25 +2102,25 @@ hdafg_disable_unassoc(struct hdafg_softc
 	struct hdaudio_control *ctl;
 	int i, j, k;
 
-	/* Disable unassociated widgets */
 	for (i = sc->sc_startnode; i < sc->sc_endnode; i++) {
 		w = hdafg_widget_lookup(sc, i);
 		if (w == NULL || w->w_enable == false)
 			continue;
-		if (w->w_bindas == -1) {
-			w->w_enable = 0;
-			hda_trace(sc, "disable %02X [unassociated]\n",
-			    w->w_nid);
+		
+		/* Disable unassociated widgets */
+		if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) {
+			if (w->w_bindas == -1) {
+				w->w_enable = 0;
+				hda_trace(sc, "disable %02X [unassociated]\n",
+				    w->w_nid);
+			}
+			continue;
 		}
-	}
 
-	/* Disable input connections on input pin and output on output */
-	for (i = sc->sc_startnode; i < sc->sc_endnode; i++) {
-		w = hdafg_widget_lookup(sc, i);
-		if (w == NULL || w->w_enable == false)
-			continue;
-		if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX)
-			continue;
+		/*
+		 * Disable input connections on input pin
+		 * and output on output pin
+		 */
 		if (w->w_bindas < 0)
 			continue;
 		if (as[w->w_bindas].as_dir == HDAUDIO_PINDIR_IN) {

Reply via email to