aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/sound/pci/hda/hdac.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/sound/pci/hda/hdac.c')
-rw-r--r--sys/dev/sound/pci/hda/hdac.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/sys/dev/sound/pci/hda/hdac.c b/sys/dev/sound/pci/hda/hdac.c
index 900578b73de4..d1de81e7ba29 100644
--- a/sys/dev/sound/pci/hda/hdac.c
+++ b/sys/dev/sound/pci/hda/hdac.c
@@ -51,9 +51,9 @@
#define HDA_DRV_TEST_REV "20120126_0002"
-#define hdac_lock(sc) snd_mtxlock((sc)->lock)
-#define hdac_unlock(sc) snd_mtxunlock((sc)->lock)
-#define hdac_lockassert(sc) snd_mtxassert((sc)->lock)
+#define hdac_lock(sc) mtx_lock(&(sc)->lock)
+#define hdac_unlock(sc) mtx_unlock(&(sc)->lock)
+#define hdac_lockassert(sc) mtx_assert(&(sc)->lock, MA_OWNED)
#define HDAC_QUIRK_64BIT (1 << 0)
#define HDAC_QUIRK_DMAPOS (1 << 1)
@@ -133,6 +133,7 @@ static const struct {
{ HDA_INTEL_PCH, "Intel Ibex Peak", 0, 0 },
{ HDA_INTEL_PCH2, "Intel Ibex Peak", 0, 0 },
{ HDA_INTEL_ELLK, "Intel Elkhart Lake", 0, 0 },
+ { HDA_INTEL_ELLK2, "Intel Elkhart Lake", 0, 0 },
{ HDA_INTEL_JLK2, "Intel Jasper Lake", 0, 0 },
{ HDA_INTEL_BXTNP, "Intel Broxton-P", 0, 0 },
{ HDA_INTEL_SCH, "Intel SCH", 0, 0 },
@@ -169,6 +170,7 @@ static const struct {
{ HDA_NVIDIA_GF119, "NVIDIA GF119", 0, 0 },
{ HDA_NVIDIA_GF110_1, "NVIDIA GF110", 0, HDAC_QUIRK_MSI },
{ HDA_NVIDIA_GF110_2, "NVIDIA GF110", 0, HDAC_QUIRK_MSI },
+ { HDA_ATI_RAVEN, "ATI Raven", 0, 0 },
{ HDA_ATI_SB450, "ATI SB450", 0, 0 },
{ HDA_ATI_SB600, "ATI SB600", 0, 0 },
{ HDA_ATI_RS600, "ATI RS600", 0, 0 },
@@ -1169,7 +1171,8 @@ hdac_attach(device_t dev)
}
}
- sc->lock = snd_mtxcreate(device_get_nameunit(dev), "HDA driver mutex");
+ mtx_init(&sc->lock, device_get_nameunit(dev), "HDA driver mutex",
+ MTX_DEF);
sc->dev = dev;
TASK_INIT(&sc->unsolq_task, 0, hdac_unsolq_task, sc);
callout_init(&sc->poll_callout, 1);
@@ -1372,7 +1375,7 @@ hdac_attach_fail:
hdac_dma_free(sc, &sc->rirb_dma);
hdac_dma_free(sc, &sc->corb_dma);
hdac_mem_free(sc);
- snd_mtxfree(sc->lock);
+ mtx_destroy(&sc->lock);
return (ENXIO);
}
@@ -1773,17 +1776,17 @@ hdac_detach(device_t dev)
struct hdac_softc *sc = device_get_softc(dev);
int i, error;
+ callout_drain(&sc->poll_callout);
+ hdac_irq_free(sc);
+ taskqueue_drain(taskqueue_thread, &sc->unsolq_task);
+
error = bus_generic_detach(dev);
if (error != 0)
return (error);
hdac_lock(sc);
- callout_stop(&sc->poll_callout);
hdac_reset(sc, false);
hdac_unlock(sc);
- callout_drain(&sc->poll_callout);
- taskqueue_drain(taskqueue_thread, &sc->unsolq_task);
- hdac_irq_free(sc);
for (i = 0; i < sc->num_ss; i++)
hdac_dma_free(sc, &sc->streams[i].bdl);
@@ -1796,7 +1799,7 @@ hdac_detach(device_t dev)
sc->chan_dmat = NULL;
}
hdac_mem_free(sc);
- snd_mtxfree(sc->lock);
+ mtx_destroy(&sc->lock);
return (0);
}
@@ -1886,7 +1889,7 @@ hdac_get_mtx(device_t dev, device_t child)
{
struct hdac_softc *sc = device_get_softc(dev);
- return (sc->lock);
+ return (&sc->lock);
}
static uint32_t
@@ -2206,4 +2209,4 @@ static driver_t hdac_driver = {
sizeof(struct hdac_softc),
};
-DRIVER_MODULE(snd_hda, pci, hdac_driver, NULL, NULL);
+DRIVER_MODULE_ORDERED(snd_hda, pci, hdac_driver, NULL, NULL, SI_ORDER_ANY);