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