NetBSD-Bugs archive

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

Re: kern/45701: hdaudio stops working after suspend/resume and then detach/reattach



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Does this patch help?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (NetBSD)

iQEcBAEBAgAGBQJO43tDAAoJEKdMfxFXhnemwE4IAICaQ0rvI5uwOeG+wvGGfZSb
LhMIXbMZy2HfaPF8jehUHRPwl1ZB4lnkROJh2cU4/L+hRbWEqKc9c3FS+WjcLXTm
tXUjlfWm+m35OFKeKHHmirL/Zbli3JaRQ6AcJbNnKedd30UgBFKzVUoyZ/IswDRY
GgtKbw5CPoWaJDGlPijHtoWlg41qX8kqB78UlCB+ePVbBWLNGKXT4Rwq6SkiWr81
ng52CIckmgaQ06PG6fmJ0AaKwB+MgKX1q8WyoEDz4pnM5frCuOKfWFjVpyesjmA2
iDpYBuEpx5Rp9nDStpdKwh6KU8qxwPz0HXRiGfs2FafkT1ipjwWS4kIG6KFma+4=
=fsTw
-----END PGP SIGNATURE-----
Index: hdafg.c
===================================================================
RCS file: /cvsroot/src/sys/dev/pci/hdaudio/hdafg.c,v
retrieving revision 1.11
diff -u -p -r1.11 hdafg.c
--- hdafg.c     23 Nov 2011 23:07:36 -0000      1.11
+++ hdafg.c     10 Dec 2011 15:27:08 -0000
@@ -552,6 +552,21 @@ hdafg_widget_pin_dump(struct hdafg_softc
        }
 }
 
+static void
+hdafg_widget_setconfig(struct hdaudio_widget *w)
+{
+       struct hdafg_softc *sc = w->w_afg;
+
+       hdaudio_command(sc->sc_codec, w->w_nid,
+           CORB_SET_CONFIGURATION_DEFAULT_1, w->w_pin.config & 0xff);
+       hdaudio_command(sc->sc_codec, w->w_nid,
+           CORB_SET_CONFIGURATION_DEFAULT_2, (w->w_pin.config >> 8) & 0xff);
+       hdaudio_command(sc->sc_codec, w->w_nid,
+           CORB_SET_CONFIGURATION_DEFAULT_3, (w->w_pin.config >> 16) & 0xff);
+       hdaudio_command(sc->sc_codec, w->w_nid,
+           CORB_SET_CONFIGURATION_DEFAULT_4, (w->w_pin.config >> 24) & 0xff);
+}
+
 static uint32_t
 hdafg_widget_getconfig(struct hdaudio_widget *w)
 {
@@ -732,6 +747,7 @@ hdafg_widget_parse(struct hdaudio_widget
                break;
        case COP_AWCAP_TYPE_PIN_COMPLEX:
                hdafg_widget_pin_parse(w);
+               hdafg_widget_setconfig(w);
                break;
        }
 }
@@ -3752,14 +3768,24 @@ static bool
 hdafg_resume(device_t self, const pmf_qual_t *qual)
 {
        struct hdafg_softc *sc = device_private(self);
+       struct hdaudio_widget *w;
        int nid;
 
        hdaudio_command(sc->sc_codec, sc->sc_nid,
            CORB_SET_POWER_STATE, COP_POWER_STATE_D0);
        hda_delay(100);
-       for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++)
+       for (nid = sc->sc_startnode; nid < sc->sc_endnode; nid++) {
                hdaudio_command(sc->sc_codec, nid,
                    CORB_SET_POWER_STATE, COP_POWER_STATE_D0);
+               w = hdafg_widget_lookup(sc, nid);               
+
+               /* restore pin widget configuration */
+               if (w == NULL || w->w_enable == false)
+                       continue;
+               if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX)
+                       continue;
+               hdafg_widget_setconfig(w);
+       }
        hda_delay(1000);
 
        hdafg_commit(sc);


Home | Main Index | Thread Index | Old Index