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