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