hdac.c (bdfbdcec6a165c8edff78f3666f757173c56c954) hdac.c (5d75db4f00df60db6f30ae40772b52be2aebb1f8)
1/*-
2 * Copyright (c) 2006 Stephane E. Potvin <sepotvin@videotron.ca>
3 * Copyright (c) 2006 Ariff Abdullah <ariff@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 3562 unchanged lines hidden (view full) ---

3571hdac_attach(device_t dev)
3572{
3573 struct hdac_softc *sc;
3574 int result;
3575 int i;
3576 uint16_t vendor;
3577 uint8_t v;
3578
1/*-
2 * Copyright (c) 2006 Stephane E. Potvin <sepotvin@videotron.ca>
3 * Copyright (c) 2006 Ariff Abdullah <ariff@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 3562 unchanged lines hidden (view full) ---

3571hdac_attach(device_t dev)
3572{
3573 struct hdac_softc *sc;
3574 int result;
3575 int i;
3576 uint16_t vendor;
3577 uint8_t v;
3578
3579 sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT | M_ZERO);
3580 if (sc == NULL) {
3581 device_printf(dev, "cannot allocate softc\n");
3582 return (ENOMEM);
3583 }
3584
3579 sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
3585 sc->lock = snd_mtxcreate(device_get_nameunit(dev), HDAC_MTX_NAME);
3586 sc->dev = dev;
3587 sc->pci_subvendor = (uint32_t)pci_get_subdevice(sc->dev) << 16;
3588 sc->pci_subvendor |= (uint32_t)pci_get_subvendor(sc->dev) & 0x0000ffff;
3589 vendor = pci_get_vendor(dev);
3590
3591 if (sc->pci_subvendor == HP_NX6325_SUBVENDORX) {
3592 /* Screw nx6325 - subdevice/subvendor swapped */

--- 2010 unchanged lines hidden (view full) ---

5603 int i, devcount;
5604
5605 if (sc == NULL)
5606 return;
5607
5608 hdac_lock(sc);
5609 sc->polling = 0;
5610 sc->poll_ival = 0;
3580 sc->lock = snd_mtxcreate(device_get_nameunit(dev), HDAC_MTX_NAME);
3581 sc->dev = dev;
3582 sc->pci_subvendor = (uint32_t)pci_get_subdevice(sc->dev) << 16;
3583 sc->pci_subvendor |= (uint32_t)pci_get_subvendor(sc->dev) & 0x0000ffff;
3584 vendor = pci_get_vendor(dev);
3585
3586 if (sc->pci_subvendor == HP_NX6325_SUBVENDORX) {
3587 /* Screw nx6325 - subdevice/subvendor swapped */

--- 2010 unchanged lines hidden (view full) ---

5598 int i, devcount;
5599
5600 if (sc == NULL)
5601 return;
5602
5603 hdac_lock(sc);
5604 sc->polling = 0;
5605 sc->poll_ival = 0;
5606 callout_stop(&sc->poll_hda);
5611 callout_stop(&sc->poll_hdac);
5612 callout_stop(&sc->poll_jack);
5613 hdac_reset(sc);
5614 hdac_unlock(sc);
5607 callout_stop(&sc->poll_hdac);
5608 callout_stop(&sc->poll_jack);
5609 hdac_reset(sc);
5610 hdac_unlock(sc);
5611 callout_drain(&sc->poll_hda);
5615 callout_drain(&sc->poll_hdac);
5616 callout_drain(&sc->poll_jack);
5617
5618 hdac_irq_free(sc);
5619
5620 device_get_children(sc->dev, &devlist, &devcount);
5621 for (i = 0; devlist != NULL && i < devcount; i++) {
5622 devinfo = (struct hdac_devinfo *)device_get_ivars(devlist[i]);

--- 628 unchanged lines hidden ---
5612 callout_drain(&sc->poll_hdac);
5613 callout_drain(&sc->poll_jack);
5614
5615 hdac_irq_free(sc);
5616
5617 device_get_children(sc->dev, &devlist, &devcount);
5618 for (i = 0; devlist != NULL && i < devcount; i++) {
5619 devinfo = (struct hdac_devinfo *)device_get_ivars(devlist[i]);

--- 628 unchanged lines hidden ---