via8233.c (170521) | via8233.c (170721) |
---|---|
1/*- 2 * Copyright (c) 2002 Orion Hodson <orion@freebsd.org> 3 * Portions of this code derived from via82c686.c: 4 * Copyright (c) 2000 David Jones <dej@ox.org> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 30 unchanged lines hidden (view full) --- 39#include <dev/sound/pcm/ac97.h> 40 41#include <dev/pci/pcireg.h> 42#include <dev/pci/pcivar.h> 43#include <sys/sysctl.h> 44 45#include <dev/sound/pci/via8233.h> 46 | 1/*- 2 * Copyright (c) 2002 Orion Hodson <orion@freebsd.org> 3 * Portions of this code derived from via82c686.c: 4 * Copyright (c) 2000 David Jones <dej@ox.org> 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 30 unchanged lines hidden (view full) --- 39#include <dev/sound/pcm/ac97.h> 40 41#include <dev/pci/pcireg.h> 42#include <dev/pci/pcivar.h> 43#include <sys/sysctl.h> 44 45#include <dev/sound/pci/via8233.h> 46 |
47SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/via8233.c 170521 2007-06-11 00:49:46Z ariff $"); | 47SND_DECLARE_FILE("$FreeBSD: head/sys/dev/sound/pci/via8233.c 170721 2007-06-14 11:13:38Z ariff $"); |
48 49#define VIA8233_PCI_ID 0x30591106 50 51#define VIA8233_REV_ID_8233PRE 0x10 52#define VIA8233_REV_ID_8233C 0x20 53#define VIA8233_REV_ID_8233 0x30 54#define VIA8233_REV_ID_8233A 0x40 55#define VIA8233_REV_ID_8235 0x50 --- 1110 unchanged lines hidden (view full) --- 1166via_attach(device_t dev) 1167{ 1168 struct via_info *via = 0; 1169 char status[SND_STATUSLEN]; 1170 int i, via_dxs_disabled, via_dxs_src, via_dxs_chnum, via_sgd_chnum; 1171 int nsegs; 1172 uint32_t revid; 1173 | 48 49#define VIA8233_PCI_ID 0x30591106 50 51#define VIA8233_REV_ID_8233PRE 0x10 52#define VIA8233_REV_ID_8233C 0x20 53#define VIA8233_REV_ID_8233 0x30 54#define VIA8233_REV_ID_8233A 0x40 55#define VIA8233_REV_ID_8235 0x50 --- 1110 unchanged lines hidden (view full) --- 1166via_attach(device_t dev) 1167{ 1168 struct via_info *via = 0; 1169 char status[SND_STATUSLEN]; 1170 int i, via_dxs_disabled, via_dxs_src, via_dxs_chnum, via_sgd_chnum; 1171 int nsegs; 1172 uint32_t revid; 1173 |
1174 if ((via = malloc(sizeof *via, M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) { 1175 device_printf(dev, "cannot allocate softc\n"); 1176 return (ENXIO); 1177 } | 1174 via = malloc(sizeof *via, M_DEVBUF, M_WAITOK | M_ZERO); |
1178 via->lock = snd_mtxcreate(device_get_nameunit(dev), 1179 "snd_via8233 softc"); 1180 via->dev = dev; 1181 1182 callout_init(&via->poll_timer, CALLOUT_MPSAFE); 1183 via->poll_ticks = 1; 1184 1185 if (resource_int_value(device_get_name(dev), --- 211 unchanged lines hidden (view full) --- 1397 free(via, M_DEVBUF); 1398 return (ENXIO); 1399} 1400 1401static int 1402via_detach(device_t dev) 1403{ 1404 int r; | 1175 via->lock = snd_mtxcreate(device_get_nameunit(dev), 1176 "snd_via8233 softc"); 1177 via->dev = dev; 1178 1179 callout_init(&via->poll_timer, CALLOUT_MPSAFE); 1180 via->poll_ticks = 1; 1181 1182 if (resource_int_value(device_get_name(dev), --- 211 unchanged lines hidden (view full) --- 1394 free(via, M_DEVBUF); 1395 return (ENXIO); 1396} 1397 1398static int 1399via_detach(device_t dev) 1400{ 1401 int r; |
1405 struct via_info *via = 0; | 1402 struct via_info *via; |
1406 1407 r = pcm_unregister(dev); 1408 if (r) 1409 return (r); 1410 1411 via = pcm_getdevinfo(dev); | 1403 1404 r = pcm_unregister(dev); 1405 if (r) 1406 return (r); 1407 1408 via = pcm_getdevinfo(dev); |
1409 1410 if (via != NULL && (via->play_num != 0 || via->rec_num != 0)) { 1411 snd_mtxlock(via->lock); 1412 via->polling = 0; 1413 callout_stop(&via->poll_timer); 1414 snd_mtxunlock(via->lock); 1415 callout_drain(&via->poll_timer); 1416 } 1417 |
|
1412 bus_release_resource(dev, SYS_RES_IOPORT, via->regid, via->reg); 1413 bus_teardown_intr(dev, via->irq, via->ih); 1414 bus_release_resource(dev, SYS_RES_IRQ, via->irqid, via->irq); 1415 bus_dma_tag_destroy(via->parent_dmat); 1416 bus_dmamap_unload(via->sgd_dmat, via->sgd_dmamap); 1417 bus_dmamem_free(via->sgd_dmat, via->sgd_table, via->sgd_dmamap); 1418 bus_dma_tag_destroy(via->sgd_dmat); 1419 snd_mtxfree(via->lock); --- 21 unchanged lines hidden --- | 1418 bus_release_resource(dev, SYS_RES_IOPORT, via->regid, via->reg); 1419 bus_teardown_intr(dev, via->irq, via->ih); 1420 bus_release_resource(dev, SYS_RES_IRQ, via->irqid, via->irq); 1421 bus_dma_tag_destroy(via->parent_dmat); 1422 bus_dmamap_unload(via->sgd_dmat, via->sgd_dmamap); 1423 bus_dmamem_free(via->sgd_dmat, via->sgd_table, via->sgd_dmamap); 1424 bus_dma_tag_destroy(via->sgd_dmat); 1425 snd_mtxfree(via->lock); --- 21 unchanged lines hidden --- |