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