- Fix headphone jack sensing support for Olivetti Olibook 610-430 XPSE.
authorHasso Tepper <hasso@dragonflybsd.org>
Tue, 26 Jun 2007 11:04:50 +0000 (11:04 +0000)
committerHasso Tepper <hasso@dragonflybsd.org>
Tue, 26 Jun 2007 11:04:50 +0000 (11:04 +0000)
- Drain all callout handlers during driver detach appropriately.
- M_NOWAIT -> M_WAITOK

Obtained-from: FreeBSD

sys/dev/sound/pci/hda/hdac.c

index 8a00f74..dae054b 100644 (file)
@@ -24,8 +24,8 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/sound/pci/hda/hdac.c,v 1.36.2.2 2007/06/13 01:52:26 ariff Exp $
- * $DragonFly: src/sys/dev/sound/pci/hda/hdac.c,v 1.4 2007/06/16 19:48:05 hasso Exp $
+ * $FreeBSD: src/sys/dev/sound/pci/hda/hdac.c,v 1.36.2.3 2007/06/21 20:58:44 ariff Exp $
+ * $DragonFly: src/sys/dev/sound/pci/hda/hdac.c,v 1.5 2007/06/26 11:04:50 hasso Exp $
  */
 
 /*
 
 #include "mixer_if.h"
 
-#define HDA_DRV_TEST_REV       "20070611_0045"
+#define HDA_DRV_TEST_REV       "20070619_0045"
 #define HDA_WIDGET_PARSER_REV  1
 
-SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/hda/hdac.c,v 1.4 2007/06/16 19:48:05 hasso Exp $");
+SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/hda/hdac.c,v 1.5 2007/06/26 11:04:50 hasso Exp $");
 
 #define HDA_BOOTVERBOSE(stmt)  do {                    \
        if (bootverbose != 0) {                         \
@@ -272,6 +272,7 @@ SND_DECLARE_FILE("$DragonFly: src/sys/dev/sound/pci/hda/hdac.c,v 1.4 2007/06/16
 /* Uniwill ? */
 #define UNIWILL_VENDORID       0x1584
 #define UNIWILL_9075_SUBVENDOR HDA_MODEL_CONSTRUCT(UNIWILL, 0x9075)
+#define UNIWILL_9080_SUBVENDOR HDA_MODEL_CONSTRUCT(UNIWILL, 0x9080)
 
 
 /* Misc constants.. */
@@ -650,6 +651,8 @@ static const struct {
            0, 0, -1, 20, { 21, -1 }, -1 },
        { ACER_3681WXM_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL,
            0, 0, -1, 20, { 21, -1 }, -1 },
+       { UNIWILL_9080_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL,
+           0, 0, -1, 20, { 21, -1 }, -1 },
        { MSI_MS1034_SUBVENDOR, HDA_CODEC_ALC883, HDAC_HP_SWITCH_CTL,
            0, 0, -1, 20, { 27, -1 }, -1 },
        /*
@@ -3613,12 +3616,7 @@ hdac_attach(device_t dev)
        uint16_t vendor;
        uint8_t v;
 
-       sc = kmalloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO);
-       if (sc == NULL) {
-               device_printf(dev, "cannot allocate softc\n");
-               return (ENOMEM);
-       }
-
+       sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
        sc->lock = snd_mtxcreate(device_get_nameunit(dev), HDAC_MTX_NAME);
        sc->dev = dev;
        sc->pci_subvendor = (uint32_t)pci_get_subdevice(sc->dev) << 16;
@@ -5643,14 +5641,17 @@ hdac_release_resources(struct hdac_softc *sc)
        hdac_lock(sc);
        sc->polling = 0;
        sc->poll_ival = 0;
+       callout_stop(&sc->poll_hda);
        callout_stop(&sc->poll_hdac);
        callout_stop(&sc->poll_jack);
        hdac_reset(sc);
        hdac_unlock(sc);
 #if 0 /* TODO: No callout_drain() in DragonFly. */
+       callout_drain(&sc->poll_hda);
        callout_drain(&sc->poll_hdac);
        callout_drain(&sc->poll_jack);
 #else
+       callout_stop(&sc->poll_hda);
        callout_stop(&sc->poll_hdac);
        callout_stop(&sc->poll_jack);
 #endif