Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src/sys/dev/hdaudio Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/e854aefa7039
branches:  netbsd-8
changeset: 434435:e854aefa7039
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Nov 24 08:35:34 2017 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #388):
        sys/dev/hdaudio/hdaudio.c: revision 1.6
Enter link reset even if GCTL says we are already in reset state. Fixes
hdaudio codec detection under VirtualBox on a "cold" boot.
XXX pullup

diffstat:

 sys/dev/hdaudio/hdaudio.c |  30 ++++++++++++++++--------------
 1 files changed, 16 insertions(+), 14 deletions(-)

diffs (61 lines):

diff -r aef5ae34f251 -r e854aefa7039 sys/dev/hdaudio/hdaudio.c
--- a/sys/dev/hdaudio/hdaudio.c Thu Nov 23 13:42:09 2017 +0000
+++ b/sys/dev/hdaudio/hdaudio.c Fri Nov 24 08:35:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.4.10.1 2017/06/05 08:13:05 snj Exp $ */
+/* $NetBSD: hdaudio.c,v 1.4.10.2 2017/11/24 08:35:34 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4.10.1 2017/06/05 08:13:05 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.4.10.2 2017/11/24 08:35:34 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -612,21 +612,21 @@
        hda_write1(sc, HDAUDIO_MMIO_RIRBSTS,
            hda_read1(sc, HDAUDIO_MMIO_RIRBSTS));
 
-       /* If the controller isn't in reset state, initiate the transition */
+       /* Put the controller into reset state */
        gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL);
-       if (gctl & HDAUDIO_GCTL_CRST) {
-               gctl &= ~HDAUDIO_GCTL_CRST;
-               hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl);
-               do {
-                       hda_delay(10);
-                       gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL);
-               } while (--retry > 0 && (gctl & HDAUDIO_GCTL_CRST) != 0);
-               if (retry == 0) {
-                       hda_error(sc, "timeout entering reset state\n");
-                       return ETIME;
-               }
+       gctl &= ~HDAUDIO_GCTL_CRST;
+       hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl);
+       do {
+               hda_delay(10);
+               gctl = hda_read4(sc, HDAUDIO_MMIO_GCTL);
+       } while (--retry > 0 && (gctl & HDAUDIO_GCTL_CRST) != 0);
+       if (retry == 0) {
+               hda_error(sc, "timeout entering reset state\n");
+               return ETIME;
        }
 
+       hda_delay(1000);
+
        /* Now the controller is in reset state, so bring it out */
        retry = HDAUDIO_RESET_TIMEOUT;
        hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl | HDAUDIO_GCTL_CRST);
@@ -639,6 +639,8 @@
                return ETIME;
        }
 
+       hda_delay(2000);
+
        /* Accept unsolicited responses */
        hda_write4(sc, HDAUDIO_MMIO_GCTL, gctl | HDAUDIO_GCTL_UNSOL_EN);
 



Home | Main Index | Thread Index | Old Index