ad1816.c revision 70134
1/* 2 * Copyright (c) 1999 Cameron Grant <gandalf@vilnya.demon.co.uk> 3 * Copyright Luigi Rizzo, 1997,1998 4 * Copyright by Hannu Savolainen 1994, 1995 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 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD: head/sys/dev/sound/isa/ad1816.c 70134 2000-12-18 01:36:41Z cg $ 29 */ 30 31#include <dev/sound/pcm/sound.h> 32#include <dev/sound/isa/ad1816.h> 33 34#include "mixer_if.h" 35 36struct ad1816_info; 37 38struct ad1816_chinfo { 39 struct ad1816_info *parent; 40 pcm_channel *channel; 41 snd_dbuf *buffer; 42 int dir; 43}; 44 45struct ad1816_info { 46 struct resource *io_base; /* primary I/O address for the board */ 47 int io_rid; 48 struct resource *irq; 49 int irq_rid; 50 struct resource *drq1; /* play */ 51 int drq1_rid; 52 struct resource *drq2; /* rec */ 53 int drq2_rid; 54 void *ih; 55 bus_dma_tag_t parent_dmat; 56 57 struct ad1816_chinfo pch, rch; 58}; 59 60static driver_intr_t ad1816_intr; 61static int ad1816_probe(device_t dev); 62static int ad1816_attach(device_t dev); 63 64/* IO primitives */ 65static int ad1816_wait_init(struct ad1816_info *ad1816, int x); 66static u_short ad1816_read(struct ad1816_info *ad1816, u_int reg); 67static void ad1816_write(struct ad1816_info *ad1816, u_int reg, u_short data); 68 69static devclass_t pcm_devclass; 70 71static u_int32_t ad1816_fmt[] = { 72 AFMT_U8, 73 AFMT_STEREO | AFMT_U8, 74 AFMT_S16_LE, 75 AFMT_STEREO | AFMT_S16_LE, 76 AFMT_MU_LAW, 77 AFMT_STEREO | AFMT_MU_LAW, 78 AFMT_A_LAW, 79 AFMT_STEREO | AFMT_A_LAW, 80 0 81}; 82 83static pcmchan_caps ad1816_caps = {4000, 55200, ad1816_fmt, 0}; 84 85#define AD1816_MUTE 31 /* value for mute */ 86 87static int 88port_rd(struct resource *port, int off) 89{ 90 if (port) 91 return bus_space_read_1(rman_get_bustag(port), 92 rman_get_bushandle(port), 93 off); 94 else 95 return -1; 96} 97 98static void 99port_wr(struct resource *port, int off, u_int8_t data) 100{ 101 if (port) 102 return bus_space_write_1(rman_get_bustag(port), 103 rman_get_bushandle(port), 104 off, data); 105} 106 107static int 108io_rd(struct ad1816_info *ad1816, int reg) 109{ 110 return port_rd(ad1816->io_base, reg); 111} 112 113static void 114io_wr(struct ad1816_info *ad1816, int reg, u_int8_t data) 115{ 116 return port_wr(ad1816->io_base, reg, data); 117} 118 119static void 120ad1816_intr(void *arg) 121{ 122 struct ad1816_info *ad1816 = (struct ad1816_info *)arg; 123 unsigned char c, served = 0; 124 125 /* get interupt status */ 126 c = io_rd(ad1816, AD1816_INT); 127 128 /* check for stray interupts */ 129 if (c & ~(AD1816_INTRCI | AD1816_INTRPI)) { 130 printf("pcm: stray int (%x)\n", c); 131 c &= AD1816_INTRCI | AD1816_INTRPI; 132 } 133 /* check for capture interupt */ 134 if (ad1816->rch.buffer->dl && (c & AD1816_INTRCI)) { 135 chn_intr(ad1816->rch.channel); 136 served |= AD1816_INTRCI; /* cp served */ 137 } 138 /* check for playback interupt */ 139 if (ad1816->pch.buffer->dl && (c & AD1816_INTRPI)) { 140 chn_intr(ad1816->pch.channel); 141 served |= AD1816_INTRPI; /* pb served */ 142 } 143 if (served == 0) { 144 /* this probably means this is not a (working) ad1816 chip, */ 145 /* or an error in dma handling */ 146 printf("pcm: int without reason (%x)\n", c); 147 c = 0; 148 } else c &= ~served; 149 io_wr(ad1816, AD1816_INT, c); 150 c = io_rd(ad1816, AD1816_INT); 151 if (c != 0) printf("pcm: int clear failed (%x)\n", c); 152} 153 154static int 155ad1816_wait_init(struct ad1816_info *ad1816, int x) 156{ 157 int n = 0; /* to shut up the compiler... */ 158 159 for (; x--;) 160 if ((n = (io_rd(ad1816, AD1816_ALE) & AD1816_BUSY)) == 0) DELAY(10); 161 else return n; 162 printf("ad1816_wait_init failed 0x%02x.\n", n); 163 return -1; 164} 165 166static unsigned short 167ad1816_read(struct ad1816_info *ad1816, unsigned int reg) 168{ 169 int flags; 170 u_short x = 0; 171 172 /* we don't want to be blocked here */ 173 flags = spltty(); 174 if (ad1816_wait_init(ad1816, 100) == -1) return 0; 175 io_wr(ad1816, AD1816_ALE, 0); 176 io_wr(ad1816, AD1816_ALE, (reg & AD1816_ALEMASK)); 177 if (ad1816_wait_init(ad1816, 100) == -1) return 0; 178 x = (io_rd(ad1816, AD1816_HIGH) << 8) | io_rd(ad1816, AD1816_LOW); 179 splx(flags); 180 return x; 181} 182 183static void 184ad1816_write(struct ad1816_info *ad1816, unsigned int reg, unsigned short data) 185{ 186 int flags; 187 188 flags = spltty(); 189 if (ad1816_wait_init(ad1816, 100) == -1) return; 190 io_wr(ad1816, AD1816_ALE, (reg & AD1816_ALEMASK)); 191 io_wr(ad1816, AD1816_LOW, (data & 0x000000ff)); 192 io_wr(ad1816, AD1816_HIGH, (data & 0x0000ff00) >> 8); 193 splx(flags); 194} 195 196/* -------------------------------------------------------------------- */ 197 198static int 199ad1816mix_init(snd_mixer *m) 200{ 201 mix_setdevs(m, AD1816_MIXER_DEVICES); 202 mix_setrecdevs(m, AD1816_REC_DEVICES); 203 return 0; 204} 205 206static int 207ad1816mix_set(snd_mixer *m, unsigned dev, unsigned left, unsigned right) 208{ 209 struct ad1816_info *ad1816 = mix_getdevinfo(m); 210 u_short reg = 0; 211 212 /* Scale volumes */ 213 left = AD1816_MUTE - (AD1816_MUTE * left) / 100; 214 right = AD1816_MUTE - (AD1816_MUTE * right) / 100; 215 216 reg = (left << 8) | right; 217 218 /* do channel selective muting if volume is zero */ 219 if (left == AD1816_MUTE) reg |= 0x8000; 220 if (right == AD1816_MUTE) reg |= 0x0080; 221 222 switch (dev) { 223 case SOUND_MIXER_VOLUME: /* Register 14 master volume */ 224 ad1816_write(ad1816, 14, reg); 225 break; 226 227 case SOUND_MIXER_CD: /* Register 15 cd */ 228 case SOUND_MIXER_LINE1: 229 ad1816_write(ad1816, 15, reg); 230 break; 231 232 case SOUND_MIXER_SYNTH: /* Register 16 synth */ 233 ad1816_write(ad1816, 16, reg); 234 break; 235 236 case SOUND_MIXER_PCM: /* Register 4 pcm */ 237 ad1816_write(ad1816, 4, reg); 238 break; 239 240 case SOUND_MIXER_LINE: 241 case SOUND_MIXER_LINE3: /* Register 18 line in */ 242 ad1816_write(ad1816, 18, reg); 243 break; 244 245 case SOUND_MIXER_MIC: /* Register 19 mic volume */ 246 ad1816_write(ad1816, 19, reg & ~0xff); /* mic is mono */ 247 break; 248 249 case SOUND_MIXER_IGAIN: 250 /* and now to something completely different ... */ 251 ad1816_write(ad1816, 20, ((ad1816_read(ad1816, 20) & ~0x0f0f) 252 | (((AD1816_MUTE - left) / 2) << 8) /* four bits of adc gain */ 253 | ((AD1816_MUTE - right) / 2))); 254 break; 255 256 default: 257 printf("ad1816_mixer_set(): unknown device.\n"); 258 break; 259 } 260 261 left = ((AD1816_MUTE - left) * 100) / AD1816_MUTE; 262 right = ((AD1816_MUTE - right) * 100) / AD1816_MUTE; 263 264 return left | (right << 8); 265} 266 267static int 268ad1816mix_setrecsrc(snd_mixer *m, u_int32_t src) 269{ 270 struct ad1816_info *ad1816 = mix_getdevinfo(m); 271 int dev; 272 273 switch (src) { 274 case SOUND_MASK_LINE: 275 case SOUND_MASK_LINE3: 276 dev = 0x00; 277 break; 278 279 case SOUND_MASK_CD: 280 case SOUND_MASK_LINE1: 281 dev = 0x20; 282 break; 283 284 case SOUND_MASK_MIC: 285 default: 286 dev = 0x50; 287 src = SOUND_MASK_MIC; 288 } 289 290 dev |= dev << 8; 291 ad1816_write(ad1816, 20, (ad1816_read(ad1816, 20) & ~0x7070) | dev); 292 return src; 293} 294 295static kobj_method_t ad1816mixer_methods[] = { 296 KOBJMETHOD(mixer_init, ad1816mix_init), 297 KOBJMETHOD(mixer_set, ad1816mix_set), 298 KOBJMETHOD(mixer_setrecsrc, ad1816mix_setrecsrc), 299 { 0, 0 } 300}; 301MIXER_DECLARE(ad1816mixer); 302 303/* -------------------------------------------------------------------- */ 304/* channel interface */ 305static void * 306ad1816chan_init(kobj_t obj, void *devinfo, snd_dbuf *b, pcm_channel *c, int dir) 307{ 308 struct ad1816_info *ad1816 = devinfo; 309 struct ad1816_chinfo *ch = (dir == PCMDIR_PLAY)? &ad1816->pch : &ad1816->rch; 310 311 ch->parent = ad1816; 312 ch->channel = c; 313 ch->buffer = b; 314 ch->buffer->bufsize = DSP_BUFFSIZE; 315 if (chn_allocbuf(ch->buffer, ad1816->parent_dmat) == -1) return NULL; 316 return ch; 317} 318 319static int 320ad1816chan_setdir(kobj_t obj, void *data, int dir) 321{ 322 struct ad1816_chinfo *ch = data; 323 struct ad1816_info *ad1816 = ch->parent; 324 325 ch->buffer->chan = rman_get_start((dir == PCMDIR_PLAY)? 326 ad1816->drq1 : ad1816->drq2); 327 ch->dir = dir; 328 return 0; 329} 330 331static int 332ad1816chan_setformat(kobj_t obj, void *data, u_int32_t format) 333{ 334 struct ad1816_chinfo *ch = data; 335 struct ad1816_info *ad1816 = ch->parent; 336 337 int fmt = AD1816_U8, reg; 338 if (ch->dir == PCMDIR_PLAY) { 339 reg = AD1816_PLAY; 340 ad1816_write(ad1816, 8, 0x0000); /* reset base and current counter */ 341 ad1816_write(ad1816, 9, 0x0000); /* for playback and capture */ 342 } else { 343 reg = AD1816_CAPT; 344 ad1816_write(ad1816, 10, 0x0000); 345 ad1816_write(ad1816, 11, 0x0000); 346 } 347 switch (format & ~AFMT_STEREO) { 348 case AFMT_A_LAW: 349 fmt = AD1816_ALAW; 350 break; 351 352 case AFMT_MU_LAW: 353 fmt = AD1816_MULAW; 354 break; 355 356 case AFMT_S16_LE: 357 fmt = AD1816_S16LE; 358 break; 359 360 case AFMT_S16_BE: 361 fmt = AD1816_S16BE; 362 break; 363 364 case AFMT_U8: 365 fmt = AD1816_U8; 366 break; 367 } 368 if (format & AFMT_STEREO) fmt |= AD1816_STEREO; 369 io_wr(ad1816, reg, fmt); 370 return format; 371} 372 373static int 374ad1816chan_setspeed(kobj_t obj, void *data, u_int32_t speed) 375{ 376 struct ad1816_chinfo *ch = data; 377 struct ad1816_info *ad1816 = ch->parent; 378 379 RANGE(speed, 4000, 55200); 380 ad1816_write(ad1816, (ch->dir == PCMDIR_PLAY)? 2 : 3, speed); 381 return speed; 382} 383 384static int 385ad1816chan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize) 386{ 387 return blocksize; 388} 389 390static int 391ad1816chan_trigger(kobj_t obj, void *data, int go) 392{ 393 struct ad1816_chinfo *ch = data; 394 struct ad1816_info *ad1816 = ch->parent; 395 int wr, reg; 396 397 if (go == PCMTRIG_EMLDMAWR || go == PCMTRIG_EMLDMARD) 398 return 0; 399 400 buf_isadma(ch->buffer, go); 401 wr = (ch->dir == PCMDIR_PLAY); 402 reg = wr? AD1816_PLAY : AD1816_CAPT; 403 switch (go) { 404 case PCMTRIG_START: 405 /* start only if not already running */ 406 if (!(io_rd(ad1816, reg) & AD1816_ENABLE)) { 407 int cnt = ((ch->buffer->dl) >> 2) - 1; 408 ad1816_write(ad1816, wr? 8 : 10, cnt); /* count */ 409 ad1816_write(ad1816, wr? 9 : 11, 0); /* reset cur cnt */ 410 ad1816_write(ad1816, 1, ad1816_read(ad1816, 1) | 411 (wr? 0x8000 : 0x4000)); /* enable int */ 412 /* enable playback */ 413 io_wr(ad1816, reg, io_rd(ad1816, reg) | AD1816_ENABLE); 414 if (!(io_rd(ad1816, reg) & AD1816_ENABLE)) 415 printf("ad1816: failed to start %s DMA!\n", 416 wr? "play" : "rec"); 417 } 418 break; 419 420 case PCMTRIG_STOP: 421 case PCMTRIG_ABORT: /* XXX check this... */ 422 /* we don't test here if it is running... */ 423 if (wr) { 424 ad1816_write(ad1816, 1, ad1816_read(ad1816, 1) & 425 ~(wr? 0x8000 : 0x4000)); 426 /* disable int */ 427 io_wr(ad1816, reg, io_rd(ad1816, reg) & ~AD1816_ENABLE); 428 /* disable playback */ 429 if (io_rd(ad1816, reg) & AD1816_ENABLE) 430 printf("ad1816: failed to stop %s DMA!\n", 431 wr? "play" : "rec"); 432 ad1816_write(ad1816, wr? 8 : 10, 0); /* reset base cnt */ 433 ad1816_write(ad1816, wr? 9 : 11, 0); /* reset cur cnt */ 434 } 435 break; 436 } 437 return 0; 438} 439 440static int 441ad1816chan_getptr(kobj_t obj, void *data) 442{ 443 struct ad1816_chinfo *ch = data; 444 return buf_isadmaptr(ch->buffer); 445} 446 447static pcmchan_caps * 448ad1816chan_getcaps(kobj_t obj, void *data) 449{ 450 return &ad1816_caps; 451} 452 453static kobj_method_t ad1816chan_methods[] = { 454 KOBJMETHOD(channel_init, ad1816chan_init), 455 KOBJMETHOD(channel_setdir, ad1816chan_setdir), 456 KOBJMETHOD(channel_setformat, ad1816chan_setformat), 457 KOBJMETHOD(channel_setspeed, ad1816chan_setspeed), 458 KOBJMETHOD(channel_setblocksize, ad1816chan_setblocksize), 459 KOBJMETHOD(channel_trigger, ad1816chan_trigger), 460 KOBJMETHOD(channel_getptr, ad1816chan_getptr), 461 KOBJMETHOD(channel_getcaps, ad1816chan_getcaps), 462 { 0, 0 } 463}; 464CHANNEL_DECLARE(ad1816chan); 465 466/* -------------------------------------------------------------------- */ 467 468static void 469ad1816_release_resources(struct ad1816_info *ad1816, device_t dev) 470{ 471 if (ad1816->irq) { 472 if (ad1816->ih) 473 bus_teardown_intr(dev, ad1816->irq, ad1816->ih); 474 bus_release_resource(dev, SYS_RES_IRQ, ad1816->irq_rid, 475 ad1816->irq); 476 ad1816->irq = 0; 477 } 478 if (ad1816->drq1) { 479 bus_release_resource(dev, SYS_RES_DRQ, ad1816->drq1_rid, 480 ad1816->drq1); 481 ad1816->drq1 = 0; 482 } 483 if (ad1816->drq2) { 484 bus_release_resource(dev, SYS_RES_DRQ, ad1816->drq2_rid, 485 ad1816->drq2); 486 ad1816->drq2 = 0; 487 } 488 if (ad1816->io_base) { 489 bus_release_resource(dev, SYS_RES_IOPORT, ad1816->io_rid, 490 ad1816->io_base); 491 ad1816->io_base = 0; 492 } 493 if (ad1816->parent_dmat) { 494 bus_dma_tag_destroy(ad1816->parent_dmat); 495 ad1816->parent_dmat = 0; 496 } 497 free(ad1816, M_DEVBUF); 498} 499 500static int 501ad1816_alloc_resources(struct ad1816_info *ad1816, device_t dev) 502{ 503 int ok = 1, pdma, rdma; 504 if (!ad1816->io_base) 505 ad1816->io_base = bus_alloc_resource(dev, SYS_RES_IOPORT, &ad1816->io_rid, 506 0, ~0, 1, RF_ACTIVE); 507 if (!ad1816->irq) 508 ad1816->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &ad1816->irq_rid, 509 0, ~0, 1, RF_ACTIVE); 510 if (!ad1816->drq1) 511 ad1816->drq1 = bus_alloc_resource(dev, SYS_RES_DRQ, &ad1816->drq1_rid, 512 0, ~0, 1, RF_ACTIVE); 513 if (!ad1816->drq2) 514 ad1816->drq2 = bus_alloc_resource(dev, SYS_RES_DRQ, &ad1816->drq2_rid, 515 0, ~0, 1, RF_ACTIVE); 516 517 if (!ad1816->io_base || !ad1816->drq1 || !ad1816->irq) ok = 0; 518 519 if (ok) { 520 pdma = rman_get_start(ad1816->drq1); 521 isa_dma_acquire(pdma); 522 isa_dmainit(pdma, DSP_BUFFSIZE); 523 if (ad1816->drq2) { 524 rdma = rman_get_start(ad1816->drq2); 525 isa_dma_acquire(rdma); 526 isa_dmainit(rdma, DSP_BUFFSIZE); 527 } else rdma = pdma; 528 if (pdma == rdma) 529 pcm_setflags(dev, pcm_getflags(dev) | SD_F_SIMPLEX); 530 } 531 return ok; 532} 533 534static int 535ad1816_init(struct ad1816_info *ad1816, device_t dev) 536{ 537 ad1816_write(ad1816, 1, 0x2); /* disable interrupts */ 538 ad1816_write(ad1816, 32, 0x90F0); /* SoundSys Mode, split fmt */ 539 540 ad1816_write(ad1816, 5, 0x8080); /* FM volume mute */ 541 ad1816_write(ad1816, 6, 0x8080); /* I2S1 volume mute */ 542 ad1816_write(ad1816, 7, 0x8080); /* I2S0 volume mute */ 543 ad1816_write(ad1816, 17, 0x8888); /* VID Volume mute */ 544 ad1816_write(ad1816, 20, 0x5050); /* recsrc mic, agc off */ 545 /* adc gain is set to 0 */ 546 547 return 0; 548} 549 550static int 551ad1816_probe(device_t dev) 552{ 553 char *s = NULL; 554 u_int32_t logical_id = isa_get_logicalid(dev); 555 556 switch (logical_id) { 557 case 0x80719304: /* ADS7180 */ 558 s = "AD1816"; 559 break; 560 } 561 562 if (s) { 563 device_set_desc(dev, s); 564 return 0; 565 } 566 return ENXIO; 567} 568 569static int 570ad1816_attach(device_t dev) 571{ 572 struct ad1816_info *ad1816; 573 char status[SND_STATUSLEN]; 574 575 ad1816 = (struct ad1816_info *)malloc(sizeof *ad1816, M_DEVBUF, M_NOWAIT); 576 if (!ad1816) return ENXIO; 577 bzero(ad1816, sizeof *ad1816); 578 579 ad1816->io_rid = 2; 580 ad1816->irq_rid = 0; 581 ad1816->drq1_rid = 0; 582 ad1816->drq2_rid = 1; 583 584 if (!ad1816_alloc_resources(ad1816, dev)) goto no; 585 ad1816_init(ad1816, dev); 586 if (mixer_init(dev, &ad1816mixer_class, ad1816)) goto no; 587 588 bus_setup_intr(dev, ad1816->irq, INTR_TYPE_TTY, ad1816_intr, ad1816, &ad1816->ih); 589 if (bus_dma_tag_create(/*parent*/NULL, /*alignment*/2, /*boundary*/0, 590 /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, 591 /*highaddr*/BUS_SPACE_MAXADDR, 592 /*filter*/NULL, /*filterarg*/NULL, 593 /*maxsize*/DSP_BUFFSIZE, /*nsegments*/1, 594 /*maxsegz*/0x3ffff, 595 /*flags*/0, &ad1816->parent_dmat) != 0) { 596 device_printf(dev, "unable to create dma tag\n"); 597 goto no; 598 } 599 snprintf(status, SND_STATUSLEN, "at io 0x%lx irq %ld drq %ld", 600 rman_get_start(ad1816->io_base), 601 rman_get_start(ad1816->irq), 602 rman_get_start(ad1816->drq1)); 603 if (ad1816->drq2) snprintf(status + strlen(status), 604 SND_STATUSLEN - strlen(status), ":%ld", 605 rman_get_start(ad1816->drq2)); 606 607 if (pcm_register(dev, ad1816, 1, 1)) goto no; 608 pcm_addchan(dev, PCMDIR_REC, &ad1816chan_class, ad1816); 609 pcm_addchan(dev, PCMDIR_PLAY, &ad1816chan_class, ad1816); 610 pcm_setstatus(dev, status); 611 612 return 0; 613no: 614 ad1816_release_resources(ad1816, dev); 615 return ENXIO; 616 617} 618 619static int 620ad1816_detach(device_t dev) 621{ 622 int r; 623 struct ad1816_info *ad1816; 624 625 r = pcm_unregister(dev); 626 if (r) 627 return r; 628 629 ad1816 = pcm_getdevinfo(dev); 630 ad1816_release_resources(ad1816, dev); 631 return 0; 632} 633 634static device_method_t ad1816_methods[] = { 635 /* Device interface */ 636 DEVMETHOD(device_probe, ad1816_probe), 637 DEVMETHOD(device_attach, ad1816_attach), 638 DEVMETHOD(device_detach, ad1816_detach), 639 640 { 0, 0 } 641}; 642 643static driver_t ad1816_driver = { 644 "pcm", 645 ad1816_methods, 646 sizeof(snddev_info), 647}; 648 649DRIVER_MODULE(snd_ad1816, isa, ad1816_driver, pcm_devclass, 0, 0); 650MODULE_DEPEND(snd_ad1816, snd_pcm, PCM_MINVER, PCM_PREFVER, PCM_MAXVER); 651MODULE_VERSION(snd_ad1816, 1); 652 653 654