Home | History | Annotate | Line # | Download | only in isa
wss.c revision 1.12
      1 /*	$NetBSD: wss.c,v 1.12 1996/04/29 19:46:09 christos Exp $	*/
      2 
      3 /*
      4  * Copyright (c) 1994 John Brezak
      5  * Copyright (c) 1991-1993 Regents of the University of California.
      6  * All rights reserved.
      7  *
      8  * Redistribution and use in source and binary forms, with or without
      9  * modification, are permitted provided that the following conditions
     10  * are met:
     11  * 1. Redistributions of source code must retain the above copyright
     12  *    notice, this list of conditions and the following disclaimer.
     13  * 2. Redistributions in binary form must reproduce the above copyright
     14  *    notice, this list of conditions and the following disclaimer in the
     15  *    documentation and/or other materials provided with the distribution.
     16  * 3. All advertising materials mentioning features or use of this software
     17  *    must display the following acknowledgement:
     18  *	This product includes software developed by the Computer Systems
     19  *	Engineering Group at Lawrence Berkeley Laboratory.
     20  * 4. Neither the name of the University nor of the Laboratory may be used
     21  *    to endorse or promote products derived from this software without
     22  *    specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     25  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     26  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     27  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     28  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     29  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     30  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     31  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     33  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     34  * SUCH DAMAGE.
     35  *
     36  */
     37 
     38 #include <sys/param.h>
     39 #include <sys/systm.h>
     40 #include <sys/errno.h>
     41 #include <sys/ioctl.h>
     42 #include <sys/syslog.h>
     43 #include <sys/device.h>
     44 #include <sys/proc.h>
     45 #include <sys/buf.h>
     46 
     47 #include <machine/cpu.h>
     48 #include <machine/pio.h>
     49 
     50 #include <sys/audioio.h>
     51 #include <dev/audio_if.h>
     52 
     53 #include <dev/isa/isavar.h>
     54 #include <dev/isa/isadmavar.h>
     55 
     56 #include <dev/ic/ad1848reg.h>
     57 #include <dev/isa/ad1848var.h>
     58 #include <dev/isa/wssreg.h>
     59 
     60 /*
     61  * Mixer devices
     62  */
     63 #define WSS_MIC_IN_LVL		0
     64 #define WSS_LINE_IN_LVL		1
     65 #define WSS_DAC_LVL		2
     66 #define WSS_REC_LVL		3
     67 #define WSS_MON_LVL		4
     68 #define WSS_MIC_IN_MUTE		5
     69 #define WSS_LINE_IN_MUTE	6
     70 #define WSS_DAC_MUTE		7
     71 
     72 #define WSS_RECORD_SOURCE	8
     73 
     74 /* Classes */
     75 #define WSS_INPUT_CLASS		9
     76 #define WSS_RECORD_CLASS	10
     77 #define WSS_MONITOR_CLASS	11
     78 
     79 #ifdef AUDIO_DEBUG
     80 #define DPRINTF(x)	if (wssdebug) printf x
     81 int	wssdebug = 0;
     82 #else
     83 #define DPRINTF(x)
     84 #endif
     85 
     86 struct wss_softc {
     87 	struct	device sc_dev;		/* base device */
     88 	struct	isadev sc_id;		/* ISA device */
     89 	void	*sc_ih;			/* interrupt vectoring */
     90 
     91 	struct  ad1848_softc sc_ad1848;
     92 #define wss_irq    sc_ad1848.sc_irq
     93 #define wss_drq    sc_ad1848.sc_drq
     94 
     95 	int 	mic_mute, cd_mute, dac_mute;
     96 };
     97 
     98 struct audio_device wss_device = {
     99 	"wss,ad1848",
    100 	"",
    101 	"WSS"
    102 };
    103 
    104 int	wssopen __P((dev_t, int));
    105 int	wss_getdev __P((void *, struct audio_device *));
    106 int	wss_setfd __P((void *, int));
    107 
    108 int	wss_set_out_port __P((void *, int));
    109 int	wss_get_out_port __P((void *));
    110 int	wss_set_in_port __P((void *, int));
    111 int	wss_get_in_port __P((void *));
    112 int	wss_mixer_set_port __P((void *, mixer_ctrl_t *));
    113 int	wss_mixer_get_port __P((void *, mixer_ctrl_t *));
    114 int	wss_query_devinfo __P((void *, mixer_devinfo_t *));
    115 
    116 static int wss_to_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
    117 static int wss_from_vol __P((mixer_ctrl_t *, struct ad1848_volume *));
    118 /*
    119  * Define our interface to the higher level audio driver.
    120  */
    121 
    122 struct audio_hw_if wss_hw_if = {
    123 	wssopen,
    124 	ad1848_close,
    125 	NULL,
    126 	ad1848_set_in_sr,
    127 	ad1848_get_in_sr,
    128 	ad1848_set_out_sr,
    129 	ad1848_get_out_sr,
    130 	ad1848_query_encoding,
    131 	ad1848_set_encoding,
    132 	ad1848_get_encoding,
    133 	ad1848_set_precision,
    134 	ad1848_get_precision,
    135 	ad1848_set_channels,
    136 	ad1848_get_channels,
    137 	ad1848_round_blocksize,
    138 	wss_set_out_port,
    139 	wss_get_out_port,
    140 	wss_set_in_port,
    141 	wss_get_in_port,
    142 	ad1848_commit_settings,
    143 	ad1848_get_silence,
    144 	NULL,
    145 	NULL,
    146 	ad1848_dma_output,
    147 	ad1848_dma_input,
    148 	ad1848_halt_out_dma,
    149 	ad1848_halt_in_dma,
    150 	ad1848_cont_out_dma,
    151 	ad1848_cont_in_dma,
    152 	NULL,
    153 	wss_getdev,
    154 	wss_setfd,
    155 	wss_mixer_set_port,
    156 	wss_mixer_get_port,
    157 	wss_query_devinfo,
    158 	0,	/* not full-duplex */
    159 	0
    160 };
    161 
    162 #ifndef NEWCONFIG
    163 #define at_dma(flags, ptr, cc, chan)	isa_dmastart(flags, ptr, cc, chan)
    164 #endif
    165 
    166 int	wssprobe __P((struct device *, void *, void *));
    167 void	wssattach __P((struct device *, struct device *, void *));
    168 
    169 struct cfattach wss_ca = {
    170 	sizeof(struct wss_softc), wssprobe, wssattach
    171 };
    172 
    173 struct cfdriver wss_cd = {
    174 	NULL, "wss", DV_DULL
    175 };
    176 
    177 /*
    178  * Probe for the Microsoft Sound System hardware.
    179  */
    180 int
    181 wssprobe(parent, match, aux)
    182     struct device *parent;
    183     void *match, *aux;
    184 {
    185     register struct wss_softc *sc = match;
    186     register struct isa_attach_args *ia = aux;
    187     register int iobase = ia->ia_iobase;
    188     static u_char interrupt_bits[12] = {
    189 	-1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20
    190     };
    191     static u_char dma_bits[4] = {1, 2, 0, 3};
    192 
    193     if (!WSS_BASE_VALID(ia->ia_iobase)) {
    194 	printf("wss: configured iobase %x invalid\n", ia->ia_iobase);
    195 	return 0;
    196     }
    197 
    198     sc->sc_ad1848.sc_iobase = iobase;
    199 
    200     /* Is there an ad1848 chip at the WSS iobase ? */
    201     if (ad1848_probe(&sc->sc_ad1848) == 0)
    202 	return 0;
    203 
    204     ia->ia_iosize = WSS_NPORT;
    205 
    206     /* Setup WSS interrupt and DMA */
    207     if (!WSS_DRQ_VALID(ia->ia_drq)) {
    208 	printf("wss: configured dma chan %d invalid\n", ia->ia_drq);
    209 	return 0;
    210     }
    211     sc->wss_drq = ia->ia_drq;
    212 
    213 #ifdef NEWCONFIG
    214     /*
    215      * If the IRQ wasn't compiled in, auto-detect it.
    216      */
    217     if (ia->ia_irq == IRQUNK) {
    218 	ia->ia_irq = isa_discoverintr(ad1848_forceintr, &sc->sc_ad1848);
    219 	if (!WSS_IRQ_VALID(ia->ia_irq)) {
    220 	    printf("wss: couldn't auto-detect interrupt\n");
    221 	    return 0;
    222 	}
    223     }
    224     else
    225 #endif
    226     if (!WSS_IRQ_VALID(ia->ia_irq)) {
    227 	printf("wss: configured interrupt %d invalid\n", ia->ia_irq);
    228 	return 0;
    229     }
    230 
    231     sc->wss_irq = ia->ia_irq;
    232 
    233     outb(iobase+WSS_CONFIG,
    234 	 (interrupt_bits[ia->ia_irq] | dma_bits[ia->ia_drq]));
    235 
    236     return 1;
    237 }
    238 
    239 /*
    240  * Attach hardware to driver, attach hardware driver to audio
    241  * pseudo-device driver .
    242  */
    243 void
    244 wssattach(parent, self, aux)
    245     struct device *parent, *self;
    246     void *aux;
    247 {
    248     register struct wss_softc *sc = (struct wss_softc *)self;
    249     struct isa_attach_args *ia = (struct isa_attach_args *)aux;
    250     register int iobase = ia->ia_iobase;
    251     int err;
    252 
    253     sc->sc_ad1848.sc_recdrq = ia->ia_drq;
    254 
    255 #ifdef NEWCONFIG
    256     isa_establish(&sc->sc_id, &sc->sc_dev);
    257 #endif
    258     sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE, IPL_AUDIO,
    259         ad1848_intr, &sc->sc_ad1848);
    260 
    261     ad1848_attach(&sc->sc_ad1848);
    262 
    263     printf(" (vers %d)", inb(iobase+WSS_STATUS) & WSS_VERSMASK);
    264     printf("\n");
    265 
    266     sc->sc_ad1848.parent = sc;
    267 
    268     if ((err = audio_hardware_attach(&wss_hw_if, &sc->sc_ad1848)) != 0)
    269 	printf("wss: could not attach to audio pseudo-device driver (%d)\n", err);
    270 }
    271 
    272 static int
    273 wss_to_vol(cp, vol)
    274     mixer_ctrl_t *cp;
    275     struct ad1848_volume *vol;
    276 {
    277     if (cp->un.value.num_channels == 1) {
    278 	vol->left = vol->right = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO];
    279 	return(1);
    280     }
    281     else if (cp->un.value.num_channels == 2) {
    282 	vol->left  = cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
    283 	vol->right = cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT];
    284 	return(1);
    285     }
    286     return(0);
    287 }
    288 
    289 static int
    290 wss_from_vol(cp, vol)
    291     mixer_ctrl_t *cp;
    292     struct ad1848_volume *vol;
    293 {
    294     if (cp->un.value.num_channels == 1) {
    295 	cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = vol->left;
    296 	return(1);
    297     }
    298     else if (cp->un.value.num_channels == 2) {
    299 	cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = vol->left;
    300 	cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = vol->right;
    301 	return(1);
    302     }
    303     return(0);
    304 }
    305 
    306 int
    307 wssopen(dev, flags)
    308     dev_t dev;
    309     int flags;
    310 {
    311     struct wss_softc *sc;
    312     int unit = AUDIOUNIT(dev);
    313 
    314     if (unit >= wss_cd.cd_ndevs)
    315 	return ENODEV;
    316 
    317     sc = wss_cd.cd_devs[unit];
    318     if (!sc)
    319 	return ENXIO;
    320 
    321     return ad1848_open(&sc->sc_ad1848, dev, flags);
    322 }
    323 
    324 int
    325 wss_getdev(addr, retp)
    326     void *addr;
    327     struct audio_device *retp;
    328 {
    329     *retp = wss_device;
    330     return 0;
    331 }
    332 
    333 int
    334 wss_setfd(addr, flag)
    335     void *addr;
    336     int flag;
    337 {
    338     /* Can't do full-duplex */
    339     return(ENOTTY);
    340 }
    341 
    342 
    343 int
    344 wss_set_out_port(addr, port)
    345     void *addr;
    346     int port;
    347 {
    348     DPRINTF(("wss_set_out_port:\n"));
    349     return(EINVAL);
    350 }
    351 
    352 int
    353 wss_get_out_port(addr)
    354     void *addr;
    355 {
    356     DPRINTF(("wss_get_out_port:\n"));
    357     return(EINVAL);
    358 }
    359 
    360 int
    361 wss_set_in_port(addr, port)
    362     void *addr;
    363     int port;
    364 {
    365     register struct ad1848_softc *ac = addr;
    366 
    367     DPRINTF(("wss_set_in_port: %d\n", port));
    368 
    369     switch(port) {
    370     case WSS_MIC_IN_LVL:
    371 	port = MIC_IN_PORT;
    372 	break;
    373     case WSS_LINE_IN_LVL:
    374 	port = LINE_IN_PORT;
    375 	break;
    376     case WSS_DAC_LVL:
    377 	port = DAC_IN_PORT;
    378 	break;
    379     default:
    380 	return(EINVAL);
    381 	/*NOTREACHED*/
    382     }
    383 
    384     return(ad1848_set_rec_port(ac, port));
    385 }
    386 
    387 int
    388 wss_get_in_port(addr)
    389     void *addr;
    390 {
    391     register struct ad1848_softc *ac = addr;
    392     int port = WSS_MIC_IN_LVL;
    393 
    394     switch(ad1848_get_rec_port(ac)) {
    395     case MIC_IN_PORT:
    396 	port = WSS_MIC_IN_LVL;
    397 	break;
    398     case LINE_IN_PORT:
    399 	port = WSS_LINE_IN_LVL;
    400 	break;
    401     case DAC_IN_PORT:
    402 	port = WSS_DAC_LVL;
    403 	break;
    404     }
    405 
    406     DPRINTF(("wss_get_in_port: %d\n", port));
    407 
    408     return(port);
    409 }
    410 
    411 int
    412 wss_mixer_set_port(addr, cp)
    413     void *addr;
    414     mixer_ctrl_t *cp;
    415 {
    416     register struct ad1848_softc *ac = addr;
    417     register struct wss_softc *sc = ac->parent;
    418     struct ad1848_volume vol;
    419     int error = EINVAL;
    420 
    421     DPRINTF(("wss_mixer_set_port: dev=%d type=%d\n", cp->dev, cp->type));
    422 
    423     switch (cp->dev) {
    424     case WSS_MIC_IN_LVL:	/* Microphone */
    425 	if (cp->type == AUDIO_MIXER_VALUE) {
    426 	    if (wss_to_vol(cp, &vol))
    427 		error = ad1848_set_aux2_gain(ac, &vol);
    428 	}
    429 	break;
    430 
    431     case WSS_MIC_IN_MUTE:	/* Microphone */
    432 	if (cp->type == AUDIO_MIXER_ENUM) {
    433 	    sc->mic_mute = cp->un.ord;
    434 	    DPRINTF(("mic mute %d\n", cp->un.ord));
    435 	    error = 0;
    436 	}
    437 	break;
    438 
    439     case WSS_LINE_IN_LVL:	/* linein/CD */
    440 	if (cp->type == AUDIO_MIXER_VALUE) {
    441 	    if (wss_to_vol(cp, &vol))
    442 		error = ad1848_set_aux1_gain(ac, &vol);
    443 	}
    444 	break;
    445 
    446     case WSS_LINE_IN_MUTE:	/* linein/CD */
    447 	if (cp->type == AUDIO_MIXER_ENUM) {
    448 	    sc->cd_mute = cp->un.ord;
    449 	    DPRINTF(("CD mute %d\n", cp->un.ord));
    450 	    error = 0;
    451 	}
    452 	break;
    453 
    454     case WSS_DAC_LVL:		/* dac out */
    455 	if (cp->type == AUDIO_MIXER_VALUE) {
    456 	    if (wss_to_vol(cp, &vol))
    457 		error = ad1848_set_out_gain(ac, &vol);
    458 	}
    459 	break;
    460 
    461     case WSS_DAC_MUTE:		/* dac out */
    462 	if (cp->type == AUDIO_MIXER_ENUM) {
    463 	    sc->dac_mute = cp->un.ord;
    464 	    DPRINTF(("DAC mute %d\n", cp->un.ord));
    465 	    error = 0;
    466 	}
    467 	break;
    468 
    469     case WSS_REC_LVL:		/* record level */
    470 	if (cp->type == AUDIO_MIXER_VALUE) {
    471 	    if (wss_to_vol(cp, &vol))
    472 		error = ad1848_set_rec_gain(ac, &vol);
    473 	}
    474 	break;
    475 
    476     case WSS_RECORD_SOURCE:
    477 	if (cp->type == AUDIO_MIXER_ENUM) {
    478 	    error = ad1848_set_rec_port(ac, cp->un.ord);
    479 	}
    480 	break;
    481 
    482     case WSS_MON_LVL:
    483 	if (cp->type == AUDIO_MIXER_VALUE && cp->un.value.num_channels == 1) {
    484 	    vol.left  = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO];
    485 	    error = ad1848_set_mon_gain(ac, &vol);
    486 	}
    487 	break;
    488 
    489     default:
    490 	    return ENXIO;
    491 	    /*NOTREACHED*/
    492     }
    493 
    494     return 0;
    495 }
    496 
    497 int
    498 wss_mixer_get_port(addr, cp)
    499     void *addr;
    500     mixer_ctrl_t *cp;
    501 {
    502     register struct ad1848_softc *ac = addr;
    503     register struct wss_softc *sc = ac->parent;
    504     struct ad1848_volume vol;
    505     int error = EINVAL;
    506 
    507     DPRINTF(("wss_mixer_get_port: port=%d\n", cp->dev));
    508 
    509     switch (cp->dev) {
    510     case WSS_MIC_IN_LVL:	/* Microphone */
    511 	if (cp->type == AUDIO_MIXER_VALUE) {
    512 	    error = ad1848_get_aux2_gain(ac, &vol);
    513 	    if (!error)
    514 		wss_from_vol(cp, &vol);
    515 	}
    516 	break;
    517 
    518     case WSS_MIC_IN_MUTE:
    519 	if (cp->type == AUDIO_MIXER_ENUM) {
    520 	    cp->un.ord = sc->mic_mute;
    521 	    error = 0;
    522 	}
    523 	break;
    524 
    525     case WSS_LINE_IN_LVL:	/* linein/CD */
    526 	if (cp->type == AUDIO_MIXER_VALUE) {
    527 	    error = ad1848_get_aux1_gain(ac, &vol);
    528 	    if (!error)
    529 		wss_from_vol(cp, &vol);
    530 	}
    531 	break;
    532 
    533     case WSS_LINE_IN_MUTE:
    534 	if (cp->type == AUDIO_MIXER_ENUM) {
    535 	    cp->un.ord = sc->cd_mute;
    536 	    error = 0;
    537 	}
    538 	break;
    539 
    540     case WSS_DAC_LVL:		/* dac out */
    541 	if (cp->type == AUDIO_MIXER_VALUE) {
    542 	    error = ad1848_get_out_gain(ac, &vol);
    543 	    if (!error)
    544 		wss_from_vol(cp, &vol);
    545 	}
    546 	break;
    547 
    548     case WSS_DAC_MUTE:
    549 	if (cp->type == AUDIO_MIXER_ENUM) {
    550 	    cp->un.ord = sc->dac_mute;
    551 	    error = 0;
    552 	}
    553 	break;
    554 
    555     case WSS_REC_LVL:		/* record level */
    556 	if (cp->type == AUDIO_MIXER_VALUE) {
    557 	    error = ad1848_get_rec_gain(ac, &vol);
    558 	    if (!error)
    559 		wss_from_vol(cp, &vol);
    560 	}
    561 	break;
    562 
    563     case WSS_RECORD_SOURCE:
    564 	if (cp->type == AUDIO_MIXER_ENUM) {
    565 	    cp->un.ord = ad1848_get_rec_port(ac);
    566 	    error = 0;
    567 	}
    568 	break;
    569 
    570     case WSS_MON_LVL:		/* monitor level */
    571 	if (cp->type == AUDIO_MIXER_VALUE && cp->un.value.num_channels == 1) {
    572 	    error = ad1848_get_mon_gain(ac, &vol);
    573 	    if (!error)
    574 		cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = vol.left;
    575 	}
    576 	break;
    577 
    578     default:
    579 	error = ENXIO;
    580 	break;
    581     }
    582 
    583     return(error);
    584 }
    585 
    586 int
    587 wss_query_devinfo(addr, dip)
    588     void *addr;
    589     register mixer_devinfo_t *dip;
    590 {
    591     DPRINTF(("wss_query_devinfo: index=%d\n", dip->index));
    592 
    593     switch(dip->index) {
    594     case WSS_MIC_IN_LVL:	/* Microphone */
    595 	dip->type = AUDIO_MIXER_VALUE;
    596 	dip->mixer_class = WSS_INPUT_CLASS;
    597 	dip->prev = AUDIO_MIXER_LAST;
    598 	dip->next = WSS_MIC_IN_MUTE;
    599 	strcpy(dip->label.name, AudioNmicrophone);
    600 	dip->un.v.num_channels = 2;
    601 	strcpy(dip->un.v.units.name, AudioNvolume);
    602 	break;
    603 
    604     case WSS_LINE_IN_LVL:	/* line/CD */
    605 	dip->type = AUDIO_MIXER_VALUE;
    606 	dip->mixer_class = WSS_INPUT_CLASS;
    607 	dip->prev = AUDIO_MIXER_LAST;
    608 	dip->next = WSS_LINE_IN_MUTE;
    609 	strcpy(dip->label.name, AudioNcd);
    610 	dip->un.v.num_channels = 2;
    611 	strcpy(dip->un.v.units.name, AudioNvolume);
    612 	break;
    613 
    614     case WSS_DAC_LVL:		/*  dacout */
    615 	dip->type = AUDIO_MIXER_VALUE;
    616 	dip->mixer_class = WSS_INPUT_CLASS;
    617 	dip->prev = AUDIO_MIXER_LAST;
    618 	dip->next = WSS_DAC_MUTE;
    619 	strcpy(dip->label.name, AudioNdac);
    620 	dip->un.v.num_channels = 2;
    621 	strcpy(dip->un.v.units.name, AudioNvolume);
    622 	break;
    623 
    624     case WSS_REC_LVL:	/* record level */
    625 	dip->type = AUDIO_MIXER_VALUE;
    626 	dip->mixer_class = WSS_RECORD_CLASS;
    627 	dip->prev = AUDIO_MIXER_LAST;
    628 	dip->next = WSS_RECORD_SOURCE;
    629 	strcpy(dip->label.name, AudioNrecord);
    630 	dip->un.v.num_channels = 2;
    631 	strcpy(dip->un.v.units.name, AudioNvolume);
    632 	break;
    633 
    634     case WSS_MON_LVL:	/* monitor level */
    635 	dip->type = AUDIO_MIXER_VALUE;
    636 	dip->mixer_class = WSS_MONITOR_CLASS;
    637 	dip->next = dip->prev = AUDIO_MIXER_LAST;
    638 	strcpy(dip->label.name, AudioNmonitor);
    639 	dip->un.v.num_channels = 1;
    640 	strcpy(dip->un.v.units.name, AudioNvolume);
    641 	break;
    642 
    643     case WSS_INPUT_CLASS:			/* input class descriptor */
    644 	dip->type = AUDIO_MIXER_CLASS;
    645 	dip->mixer_class = WSS_INPUT_CLASS;
    646 	dip->next = dip->prev = AUDIO_MIXER_LAST;
    647 	strcpy(dip->label.name, AudioCInputs);
    648 	break;
    649 
    650     case WSS_MONITOR_CLASS:			/* monitor class descriptor */
    651 	dip->type = AUDIO_MIXER_CLASS;
    652 	dip->mixer_class = WSS_MONITOR_CLASS;
    653 	dip->next = dip->prev = AUDIO_MIXER_LAST;
    654 	strcpy(dip->label.name, AudioNmonitor);
    655 	break;
    656 
    657     case WSS_RECORD_CLASS:			/* record source class */
    658 	dip->type = AUDIO_MIXER_CLASS;
    659 	dip->mixer_class = WSS_RECORD_CLASS;
    660 	dip->next = dip->prev = AUDIO_MIXER_LAST;
    661 	strcpy(dip->label.name, AudioNrecord);
    662 	break;
    663 
    664     case WSS_MIC_IN_MUTE:
    665 	dip->mixer_class = WSS_INPUT_CLASS;
    666 	dip->type = AUDIO_MIXER_ENUM;
    667 	dip->prev = WSS_MIC_IN_LVL;
    668 	dip->next = AUDIO_MIXER_LAST;
    669 	goto mute;
    670 
    671     case WSS_LINE_IN_MUTE:
    672 	dip->mixer_class = WSS_INPUT_CLASS;
    673 	dip->type = AUDIO_MIXER_ENUM;
    674 	dip->prev = WSS_LINE_IN_LVL;
    675 	dip->next = AUDIO_MIXER_LAST;
    676 	goto mute;
    677 
    678     case WSS_DAC_MUTE:
    679 	dip->mixer_class = WSS_INPUT_CLASS;
    680 	dip->type = AUDIO_MIXER_ENUM;
    681 	dip->prev = WSS_DAC_LVL;
    682 	dip->next = AUDIO_MIXER_LAST;
    683     mute:
    684 	strcpy(dip->label.name, AudioNmute);
    685 	dip->un.e.num_mem = 2;
    686 	strcpy(dip->un.e.member[0].label.name, AudioNoff);
    687 	dip->un.e.member[0].ord = 0;
    688 	strcpy(dip->un.e.member[1].label.name, AudioNon);
    689 	dip->un.e.member[1].ord = 1;
    690 	break;
    691 
    692     case WSS_RECORD_SOURCE:
    693 	dip->mixer_class = WSS_RECORD_CLASS;
    694 	dip->type = AUDIO_MIXER_ENUM;
    695 	dip->prev = WSS_REC_LVL;
    696 	dip->next = AUDIO_MIXER_LAST;
    697 	strcpy(dip->label.name, AudioNsource);
    698 	dip->un.e.num_mem = 3;
    699 	strcpy(dip->un.e.member[0].label.name, AudioNmicrophone);
    700 	dip->un.e.member[0].ord = WSS_MIC_IN_LVL;
    701 	strcpy(dip->un.e.member[1].label.name, AudioNcd);
    702 	dip->un.e.member[1].ord = WSS_LINE_IN_LVL;
    703 	strcpy(dip->un.e.member[2].label.name, AudioNdac);
    704 	dip->un.e.member[2].ord = WSS_DAC_LVL;
    705 	break;
    706 
    707     default:
    708 	return ENXIO;
    709 	/*NOTREACHED*/
    710     }
    711     DPRINTF(("AUDIO_MIXER_DEVINFO: name=%s\n", dip->label.name));
    712 
    713     return 0;
    714 }
    715