Home | History | Annotate | Line # | Download | only in isa
wss.c revision 1.9
      1 /*	$NetBSD: wss.c,v 1.9 1996/02/16 08:18:36 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/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 /*
    117  * Define our interface to the higher level audio driver.
    118  */
    119 
    120 struct audio_hw_if wss_hw_if = {
    121 	wssopen,
    122 	ad1848_close,
    123 	NULL,
    124 	ad1848_set_in_sr,
    125 	ad1848_get_in_sr,
    126 	ad1848_set_out_sr,
    127 	ad1848_get_out_sr,
    128 	ad1848_query_encoding,
    129 	ad1848_set_encoding,
    130 	ad1848_get_encoding,
    131 	ad1848_set_precision,
    132 	ad1848_get_precision,
    133 	ad1848_set_channels,
    134 	ad1848_get_channels,
    135 	ad1848_round_blocksize,
    136 	wss_set_out_port,
    137 	wss_get_out_port,
    138 	wss_set_in_port,
    139 	wss_get_in_port,
    140 	ad1848_commit_settings,
    141 	ad1848_get_silence,
    142 	NULL,
    143 	NULL,
    144 	ad1848_dma_output,
    145 	ad1848_dma_input,
    146 	ad1848_halt_out_dma,
    147 	ad1848_halt_in_dma,
    148 	ad1848_cont_out_dma,
    149 	ad1848_cont_in_dma,
    150 	NULL,
    151 	wss_getdev,
    152 	wss_setfd,
    153 	wss_mixer_set_port,
    154 	wss_mixer_get_port,
    155 	wss_query_devinfo,
    156 	0,	/* not full-duplex */
    157 	0
    158 };
    159 
    160 #ifndef NEWCONFIG
    161 #define at_dma(flags, ptr, cc, chan)	isa_dmastart(flags, ptr, cc, chan)
    162 #endif
    163 
    164 int	wssprobe __P((struct device *, void *, void *));
    165 void	wssattach __P((struct device *, struct device *, void *));
    166 
    167 struct cfdriver wsscd = {
    168 	NULL, "wss", wssprobe, wssattach, DV_DULL, sizeof(struct wss_softc)
    169 };
    170 
    171 /*
    172  * Probe for the Microsoft Sound System hardware.
    173  */
    174 int
    175 wssprobe(parent, match, aux)
    176     struct device *parent;
    177     void *match, *aux;
    178 {
    179     register struct wss_softc *sc = match;
    180     register struct isa_attach_args *ia = aux;
    181     register int iobase = ia->ia_iobase;
    182     static u_char interrupt_bits[12] = {
    183 	-1, -1, -1, -1, -1, -1, -1, 0x08, -1, 0x10, 0x18, 0x20
    184     };
    185     static u_char dma_bits[4] = {1, 2, 0, 3};
    186 
    187     if (!WSS_BASE_VALID(ia->ia_iobase)) {
    188 	printf("wss: configured iobase %x invalid\n", ia->ia_iobase);
    189 	return 0;
    190     }
    191 
    192     sc->sc_ad1848.sc_iobase = iobase;
    193 
    194     /* Is there an ad1848 chip at the WSS iobase ? */
    195     if (ad1848_probe(&sc->sc_ad1848) == 0)
    196 	return 0;
    197 
    198     ia->ia_iosize = WSS_NPORT;
    199 
    200     /* Setup WSS interrupt and DMA */
    201     if (!WSS_DRQ_VALID(ia->ia_drq)) {
    202 	printf("wss: configured dma chan %d invalid\n", ia->ia_drq);
    203 	return 0;
    204     }
    205     sc->wss_drq = ia->ia_drq;
    206 
    207 #ifdef NEWCONFIG
    208     /*
    209      * If the IRQ wasn't compiled in, auto-detect it.
    210      */
    211     if (ia->ia_irq == IRQUNK) {
    212 	ia->ia_irq = isa_discoverintr(ad1848_forceintr, &sc->sc_ad1848);
    213 	if (!WSS_IRQ_VALID(ia->ia_irq)) {
    214 	    printf("wss: couldn't auto-detect interrupt\n");
    215 	    return 0;
    216 	}
    217     }
    218     else
    219 #endif
    220     if (!WSS_IRQ_VALID(ia->ia_irq)) {
    221 	printf("wss: configured interrupt %d invalid\n", ia->ia_irq);
    222 	return 0;
    223     }
    224 
    225     sc->wss_irq = ia->ia_irq;
    226 
    227     outb(iobase+WSS_CONFIG,
    228 	 (interrupt_bits[ia->ia_irq] | dma_bits[ia->ia_drq]));
    229 
    230     return 1;
    231 }
    232 
    233 /*
    234  * Attach hardware to driver, attach hardware driver to audio
    235  * pseudo-device driver .
    236  */
    237 void
    238 wssattach(parent, self, aux)
    239     struct device *parent, *self;
    240     void *aux;
    241 {
    242     register struct wss_softc *sc = (struct wss_softc *)self;
    243     struct isa_attach_args *ia = (struct isa_attach_args *)aux;
    244     register int iobase = ia->ia_iobase;
    245     int err;
    246 
    247     sc->sc_ad1848.sc_recdrq = ia->ia_drq;
    248 
    249 #ifdef NEWCONFIG
    250     isa_establish(&sc->sc_id, &sc->sc_dev);
    251 #endif
    252     sc->sc_ih = isa_intr_establish(ia->ia_irq, IST_EDGE, IPL_AUDIO, ad1848_intr,	&sc->sc_ad1848);
    253 
    254     ad1848_attach(&sc->sc_ad1848);
    255 
    256     printf(" (vers %d)", inb(iobase+WSS_STATUS) & WSS_VERSMASK);
    257     printf("\n");
    258 
    259     sc->sc_ad1848.parent = sc;
    260 
    261     if ((err = audio_hardware_attach(&wss_hw_if, &sc->sc_ad1848)) != 0)
    262 	printf("wss: could not attach to audio pseudo-device driver (%d)\n", err);
    263 }
    264 
    265 static int
    266 wss_to_vol(cp, vol)
    267     mixer_ctrl_t *cp;
    268     struct ad1848_volume *vol;
    269 {
    270     if (cp->un.value.num_channels == 1) {
    271 	vol->left = vol->right = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO];
    272 	return(1);
    273     }
    274     else if (cp->un.value.num_channels == 2) {
    275 	vol->left  = cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT];
    276 	vol->right = cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT];
    277 	return(1);
    278     }
    279     return(0);
    280 }
    281 
    282 static int
    283 wss_from_vol(cp, vol)
    284     mixer_ctrl_t *cp;
    285     struct ad1848_volume *vol;
    286 {
    287     if (cp->un.value.num_channels == 1) {
    288 	cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = vol->left;
    289 	return(1);
    290     }
    291     else if (cp->un.value.num_channels == 2) {
    292 	cp->un.value.level[AUDIO_MIXER_LEVEL_LEFT] = vol->left;
    293 	cp->un.value.level[AUDIO_MIXER_LEVEL_RIGHT] = vol->right;
    294 	return(1);
    295     }
    296     return(0);
    297 }
    298 
    299 int
    300 wssopen(dev, flags)
    301     dev_t dev;
    302     int flags;
    303 {
    304     struct wss_softc *sc;
    305     int unit = AUDIOUNIT(dev);
    306 
    307     if (unit >= wsscd.cd_ndevs)
    308 	return ENODEV;
    309 
    310     sc = wsscd.cd_devs[unit];
    311     if (!sc)
    312 	return ENXIO;
    313 
    314     return ad1848_open(&sc->sc_ad1848, dev, flags);
    315 }
    316 
    317 int
    318 wss_getdev(addr, retp)
    319     void *addr;
    320     struct audio_device *retp;
    321 {
    322     *retp = wss_device;
    323     return 0;
    324 }
    325 
    326 int
    327 wss_setfd(addr, flag)
    328     void *addr;
    329     int flag;
    330 {
    331     /* Can't do full-duplex */
    332     return(ENOTTY);
    333 }
    334 
    335 
    336 int
    337 wss_set_out_port(addr, port)
    338     void *addr;
    339     int port;
    340 {
    341     DPRINTF(("wss_set_out_port:\n"));
    342     return(EINVAL);
    343 }
    344 
    345 int
    346 wss_get_out_port(addr)
    347     void *addr;
    348 {
    349     DPRINTF(("wss_get_out_port:\n"));
    350     return(EINVAL);
    351 }
    352 
    353 int
    354 wss_set_in_port(addr, port)
    355     void *addr;
    356     int port;
    357 {
    358     register struct ad1848_softc *ac = addr;
    359     register struct wss_softc *sc = ac->parent;
    360 
    361     DPRINTF(("wss_set_in_port: %d\n", port));
    362 
    363     switch(port) {
    364     case WSS_MIC_IN_LVL:
    365 	port = MIC_IN_PORT;
    366 	break;
    367     case WSS_LINE_IN_LVL:
    368 	port = LINE_IN_PORT;
    369 	break;
    370     case WSS_DAC_LVL:
    371 	port = DAC_IN_PORT;
    372 	break;
    373     default:
    374 	return(EINVAL);
    375 	/*NOTREACHED*/
    376     }
    377 
    378     return(ad1848_set_rec_port(ac, port));
    379 }
    380 
    381 int
    382 wss_get_in_port(addr)
    383     void *addr;
    384 {
    385     register struct ad1848_softc *ac = addr;
    386     register struct wss_softc *sc = ac->parent;
    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     u_char eq;
    415     int error = EINVAL;
    416 
    417     DPRINTF(("wss_mixer_set_port: dev=%d type=%d\n", cp->dev, cp->type));
    418 
    419     switch (cp->dev) {
    420     case WSS_MIC_IN_LVL:	/* Microphone */
    421 	if (cp->type == AUDIO_MIXER_VALUE) {
    422 	    if (wss_to_vol(cp, &vol))
    423 		error = ad1848_set_aux2_gain(ac, &vol);
    424 	}
    425 	break;
    426 
    427     case WSS_MIC_IN_MUTE:	/* Microphone */
    428 	if (cp->type == AUDIO_MIXER_ENUM) {
    429 	    sc->mic_mute = cp->un.ord;
    430 	    DPRINTF(("mic mute %d\n", cp->un.ord));
    431 	    error = 0;
    432 	}
    433 	break;
    434 
    435     case WSS_LINE_IN_LVL:	/* linein/CD */
    436 	if (cp->type == AUDIO_MIXER_VALUE) {
    437 	    if (wss_to_vol(cp, &vol))
    438 		error = ad1848_set_aux1_gain(ac, &vol);
    439 	}
    440 	break;
    441 
    442     case WSS_LINE_IN_MUTE:	/* linein/CD */
    443 	if (cp->type == AUDIO_MIXER_ENUM) {
    444 	    sc->cd_mute = cp->un.ord;
    445 	    DPRINTF(("CD mute %d\n", cp->un.ord));
    446 	    error = 0;
    447 	}
    448 	break;
    449 
    450     case WSS_DAC_LVL:		/* dac out */
    451 	if (cp->type == AUDIO_MIXER_VALUE) {
    452 	    if (wss_to_vol(cp, &vol))
    453 		error = ad1848_set_out_gain(ac, &vol);
    454 	}
    455 	break;
    456 
    457     case WSS_DAC_MUTE:		/* dac out */
    458 	if (cp->type == AUDIO_MIXER_ENUM) {
    459 	    sc->dac_mute = cp->un.ord;
    460 	    DPRINTF(("DAC mute %d\n", cp->un.ord));
    461 	    error = 0;
    462 	}
    463 	break;
    464 
    465     case WSS_REC_LVL:		/* record level */
    466 	if (cp->type == AUDIO_MIXER_VALUE) {
    467 	    if (wss_to_vol(cp, &vol))
    468 		error = ad1848_set_rec_gain(ac, &vol);
    469 	}
    470 	break;
    471 
    472     case WSS_RECORD_SOURCE:
    473 	if (cp->type == AUDIO_MIXER_ENUM) {
    474 	    error = ad1848_set_rec_port(ac, cp->un.ord);
    475 	}
    476 	break;
    477 
    478     case WSS_MON_LVL:
    479 	if (cp->type == AUDIO_MIXER_VALUE && cp->un.value.num_channels == 1) {
    480 	    vol.left  = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO];
    481 	    error = ad1848_set_mon_gain(ac, &vol);
    482 	}
    483 	break;
    484 
    485     default:
    486 	    return ENXIO;
    487 	    /*NOTREACHED*/
    488     }
    489 
    490     return 0;
    491 }
    492 
    493 int
    494 wss_mixer_get_port(addr, cp)
    495     void *addr;
    496     mixer_ctrl_t *cp;
    497 {
    498     register struct ad1848_softc *ac = addr;
    499     register struct wss_softc *sc = ac->parent;
    500     struct ad1848_volume vol;
    501     u_char eq;
    502     int error = EINVAL;
    503 
    504     DPRINTF(("wss_mixer_get_port: port=%d\n", cp->dev));
    505 
    506     switch (cp->dev) {
    507     case WSS_MIC_IN_LVL:	/* Microphone */
    508 	if (cp->type == AUDIO_MIXER_VALUE) {
    509 	    error = ad1848_get_aux2_gain(ac, &vol);
    510 	    if (!error)
    511 		wss_from_vol(cp, &vol);
    512 	}
    513 	break;
    514 
    515     case WSS_MIC_IN_MUTE:
    516 	if (cp->type == AUDIO_MIXER_ENUM) {
    517 	    cp->un.ord = sc->mic_mute;
    518 	    error = 0;
    519 	}
    520 	break;
    521 
    522     case WSS_LINE_IN_LVL:	/* linein/CD */
    523 	if (cp->type == AUDIO_MIXER_VALUE) {
    524 	    error = ad1848_get_aux1_gain(ac, &vol);
    525 	    if (!error)
    526 		wss_from_vol(cp, &vol);
    527 	}
    528 	break;
    529 
    530     case WSS_LINE_IN_MUTE:
    531 	if (cp->type == AUDIO_MIXER_ENUM) {
    532 	    cp->un.ord = sc->cd_mute;
    533 	    error = 0;
    534 	}
    535 	break;
    536 
    537     case WSS_DAC_LVL:		/* dac out */
    538 	if (cp->type == AUDIO_MIXER_VALUE) {
    539 	    error = ad1848_get_out_gain(ac, &vol);
    540 	    if (!error)
    541 		wss_from_vol(cp, &vol);
    542 	}
    543 	break;
    544 
    545     case WSS_DAC_MUTE:
    546 	if (cp->type == AUDIO_MIXER_ENUM) {
    547 	    cp->un.ord = sc->dac_mute;
    548 	    error = 0;
    549 	}
    550 	break;
    551 
    552     case WSS_REC_LVL:		/* record level */
    553 	if (cp->type == AUDIO_MIXER_VALUE) {
    554 	    error = ad1848_get_rec_gain(ac, &vol);
    555 	    if (!error)
    556 		wss_from_vol(cp, &vol);
    557 	}
    558 	break;
    559 
    560     case WSS_RECORD_SOURCE:
    561 	if (cp->type == AUDIO_MIXER_ENUM) {
    562 	    cp->un.ord = ad1848_get_rec_port(ac);
    563 	    error = 0;
    564 	}
    565 	break;
    566 
    567     case WSS_MON_LVL:		/* monitor level */
    568 	if (cp->type == AUDIO_MIXER_VALUE && cp->un.value.num_channels == 1) {
    569 	    error = ad1848_get_mon_gain(ac, &vol);
    570 	    if (!error)
    571 		cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = vol.left;
    572 	}
    573 	break;
    574 
    575     default:
    576 	error = ENXIO;
    577 	break;
    578     }
    579 
    580     return(error);
    581 }
    582 
    583 int
    584 wss_query_devinfo(addr, dip)
    585     void *addr;
    586     register mixer_devinfo_t *dip;
    587 {
    588     register struct ad1848_softc *ac = addr;
    589     register struct wss_softc *sc = ac->parent;
    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