1 /* $OpenBSD: am7930.c,v 1.6 2015/05/11 06:46:21 ratchov Exp $ */ 2 /* $NetBSD: am7930.c,v 1.44 2001/11/13 13:14:34 lukem Exp $ */ 3 4 /* 5 * Copyright (c) 1995 Rolf Grossmann 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 Rolf Grossmann. 19 * 4. The name of the author may not be used to endorse or promote products 20 * derived from this software without specific prior written permission 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 /* 35 * Front-end attachment independent layer for AMD 79c30 36 * audio driver. No ISDN support. 37 */ 38 39 #include <sys/param.h> 40 #include <sys/systm.h> 41 #include <sys/errno.h> 42 #include <sys/ioctl.h> 43 #include <sys/device.h> 44 #include <sys/proc.h> 45 46 #include <sys/audioio.h> 47 #include <dev/audio_if.h> 48 49 #include <dev/ic/am7930reg.h> 50 #include <dev/ic/am7930var.h> 51 52 #ifdef AUDIO_DEBUG 53 int am7930debug = 0; 54 #define DPRINTF(x) if (am7930debug) printf x 55 #else 56 #define DPRINTF(x) 57 #endif 58 59 60 /* The following tables stolen from former (4.4Lite's) sys/sparc/bsd_audio.c */ 61 62 /* 63 * gx, gr & stg gains. this table must contain 256 elements with 64 * the 0th being "infinity" (the magic value 9008). The remaining 65 * elements match sun's gain curve (but with higher resolution): 66 * -18 to 0dB in .16dB steps then 0 to 12dB in .08dB steps. 67 */ 68 static const uint16_t gx_coeff[256] = { 69 0x9008, 0x8e7c, 0x8e51, 0x8e45, 0x8d42, 0x8d3b, 0x8c36, 0x8c33, 70 0x8b32, 0x8b2a, 0x8b2b, 0x8b2c, 0x8b25, 0x8b23, 0x8b22, 0x8b22, 71 0x9122, 0x8b1a, 0x8aa3, 0x8aa3, 0x8b1c, 0x8aa6, 0x912d, 0x912b, 72 0x8aab, 0x8b12, 0x8aaa, 0x8ab2, 0x9132, 0x8ab4, 0x913c, 0x8abb, 73 0x9142, 0x9144, 0x9151, 0x8ad5, 0x8aeb, 0x8a79, 0x8a5a, 0x8a4a, 74 0x8b03, 0x91c2, 0x91bb, 0x8a3f, 0x8a33, 0x91b2, 0x9212, 0x9213, 75 0x8a2c, 0x921d, 0x8a23, 0x921a, 0x9222, 0x9223, 0x922d, 0x9231, 76 0x9234, 0x9242, 0x925b, 0x92dd, 0x92c1, 0x92b3, 0x92ab, 0x92a4, 77 0x92a2, 0x932b, 0x9341, 0x93d3, 0x93b2, 0x93a2, 0x943c, 0x94b2, 78 0x953a, 0x9653, 0x9782, 0x9e21, 0x9d23, 0x9cd2, 0x9c23, 0x9baa, 79 0x9bde, 0x9b33, 0x9b22, 0x9b1d, 0x9ab2, 0xa142, 0xa1e5, 0x9a3b, 80 0xa213, 0xa1a2, 0xa231, 0xa2eb, 0xa313, 0xa334, 0xa421, 0xa54b, 81 0xada4, 0xac23, 0xab3b, 0xaaab, 0xaa5c, 0xb1a3, 0xb2ca, 0xb3bd, 82 0xbe24, 0xbb2b, 0xba33, 0xc32b, 0xcb5a, 0xd2a2, 0xe31d, 0x0808, 83 0x72ba, 0x62c2, 0x5c32, 0x52db, 0x513e, 0x4cce, 0x43b2, 0x4243, 84 0x41b4, 0x3b12, 0x3bc3, 0x3df2, 0x34bd, 0x3334, 0x32c2, 0x3224, 85 0x31aa, 0x2a7b, 0x2aaa, 0x2b23, 0x2bba, 0x2c42, 0x2e23, 0x25bb, 86 0x242b, 0x240f, 0x231a, 0x22bb, 0x2241, 0x2223, 0x221f, 0x1a33, 87 0x1a4a, 0x1acd, 0x2132, 0x1b1b, 0x1b2c, 0x1b62, 0x1c12, 0x1c32, 88 0x1d1b, 0x1e71, 0x16b1, 0x1522, 0x1434, 0x1412, 0x1352, 0x1323, 89 0x1315, 0x12bc, 0x127a, 0x1235, 0x1226, 0x11a2, 0x1216, 0x0a2a, 90 0x11bc, 0x11d1, 0x1163, 0x0ac2, 0x0ab2, 0x0aab, 0x0b1b, 0x0b23, 91 0x0b33, 0x0c0f, 0x0bb3, 0x0c1b, 0x0c3e, 0x0cb1, 0x0d4c, 0x0ec1, 92 0x079a, 0x0614, 0x0521, 0x047c, 0x0422, 0x03b1, 0x03e3, 0x0333, 93 0x0322, 0x031c, 0x02aa, 0x02ba, 0x02f2, 0x0242, 0x0232, 0x0227, 94 0x0222, 0x021b, 0x01ad, 0x0212, 0x01b2, 0x01bb, 0x01cb, 0x01f6, 95 0x0152, 0x013a, 0x0133, 0x0131, 0x012c, 0x0123, 0x0122, 0x00a2, 96 0x011b, 0x011e, 0x0114, 0x00b1, 0x00aa, 0x00b3, 0x00bd, 0x00ba, 97 0x00c5, 0x00d3, 0x00f3, 0x0062, 0x0051, 0x0042, 0x003b, 0x0033, 98 0x0032, 0x002a, 0x002c, 0x0025, 0x0023, 0x0022, 0x001a, 0x0021, 99 0x001b, 0x001b, 0x001d, 0x0015, 0x0013, 0x0013, 0x0012, 0x0012, 100 0x000a, 0x000a, 0x0011, 0x0011, 0x000b, 0x000b, 0x000c, 0x000e, 101 }; 102 103 /* 104 * second stage play gain. 105 */ 106 static const uint16_t ger_coeff[] = { 107 0x431f, /* 5. dB */ 108 0x331f, /* 5.5 dB */ 109 0x40dd, /* 6. dB */ 110 0x11dd, /* 6.5 dB */ 111 0x440f, /* 7. dB */ 112 0x411f, /* 7.5 dB */ 113 0x311f, /* 8. dB */ 114 0x5520, /* 8.5 dB */ 115 0x10dd, /* 9. dB */ 116 0x4211, /* 9.5 dB */ 117 0x410f, /* 10. dB */ 118 0x111f, /* 10.5 dB */ 119 0x600b, /* 11. dB */ 120 0x00dd, /* 11.5 dB */ 121 0x4210, /* 12. dB */ 122 0x110f, /* 13. dB */ 123 0x7200, /* 14. dB */ 124 0x2110, /* 15. dB */ 125 0x2200, /* 15.9 dB */ 126 0x000b, /* 16.9 dB */ 127 0x000f /* 18. dB */ 128 #define NGER (sizeof(ger_coeff) / sizeof(ger_coeff[0])) 129 }; 130 131 132 /* 133 * Reset chip and set boot-time softc defaults. 134 */ 135 void 136 am7930_init(struct am7930_softc *sc, int flag) 137 { 138 DPRINTF(("am7930_init()\n")); 139 140 /* set boot defaults */ 141 sc->sc_rlevel = 128; 142 sc->sc_plevel = 128; 143 sc->sc_mlevel = 0; 144 sc->sc_out_port = AUDIOAMD_SPEAKER_VOL; 145 sc->sc_mic_mute = 0; 146 147 /* disable sample interrupts */ 148 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR4, 0); 149 150 /* initialise voice and data, and disable interrupts */ 151 AM7930_IWRITE(sc, AM7930_IREG_INIT, 152 AM7930_INIT_PMS_ACTIVE | AM7930_INIT_INT_DISABLE); 153 154 if (flag == AUDIOAMD_DMA_MODE) { 155 /* configure PP for serial (SBP) mode */ 156 AM7930_IWRITE(sc, AM7930_IREG_PP_PPCR1, AM7930_PPCR1_SBP); 157 158 /* 159 * Initialise the MUX unit - route the MAP to the PP 160 */ 161 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR1, 162 (AM7930_MCRCHAN_BA << 4) | AM7930_MCRCHAN_BD); 163 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR2, AM7930_MCRCHAN_NC); 164 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR3, AM7930_MCRCHAN_NC); 165 } else { 166 /* 167 * Initialize the MUX unit. We use MCR3 to route the MAP 168 * through channel Bb. MCR1 and MCR2 are unused. 169 * Setting the INT enable bit in MCR4 will generate an 170 * interrupt on each converted audio sample. 171 */ 172 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR1, 0); 173 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR2, 0); 174 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR3, 175 (AM7930_MCRCHAN_BB << 4) | AM7930_MCRCHAN_BA); 176 AM7930_IWRITE(sc, AM7930_IREG_MUX_MCR4, 177 AM7930_MCR4_INT_ENABLE); 178 } 179 } 180 181 int 182 am7930_open(void *addr, int flags) 183 { 184 struct am7930_softc *sc = addr; 185 186 DPRINTF(("sa_open: unit %p\n", sc)); 187 if (sc->sc_open) 188 return EBUSY; 189 sc->sc_open = 1; 190 sc->sc_locked = 0; 191 192 sc->sc_glue->onopen(sc); 193 DPRINTF(("saopen: ok -> sc=%p\n",sc)); 194 return 0; 195 } 196 197 void 198 am7930_close(void *addr) 199 { 200 struct am7930_softc *sc = addr; 201 202 DPRINTF(("sa_close: sc=%p\n", sc)); 203 sc->sc_glue->onclose(sc); 204 sc->sc_open = 0; 205 DPRINTF(("sa_close: closed.\n")); 206 } 207 208 int 209 am7930_set_params(void *addr, int setmode, int usemode, 210 struct audio_params *play, struct audio_params *rec) 211 { 212 struct am7930_softc *sc = addr; 213 struct audio_params *p; 214 int mode; 215 216 for (mode = AUMODE_RECORD; mode != -1; 217 mode = mode == AUMODE_RECORD ? AUMODE_PLAY : -1) { 218 if ((setmode & mode) == 0) 219 continue; 220 221 p = mode == AUMODE_PLAY ? play : rec; 222 if (p == NULL) 223 continue; 224 225 p->encoding = AUDIO_ENCODING_ULAW; 226 p->precision = sc->sc_glue->precision; 227 p->bps = AUDIO_BPS(p->precision); 228 p->msb = 0; 229 p->channels = 1; 230 /* no other rates supported by amd chip */ 231 p->sample_rate = 8000; 232 } 233 234 return 0; 235 } 236 237 int 238 am7930_query_encoding(void *addr, struct audio_encoding *fp) 239 { 240 struct am7930_softc *sc = addr; 241 242 switch (fp->index) { 243 case 0: 244 strlcpy(fp->name, AudioEmulaw, sizeof fp->name); 245 fp->encoding = AUDIO_ENCODING_ULAW; 246 fp->precision = sc->sc_glue->precision; 247 fp->bps = AUDIO_BPS(fp->precision); 248 fp->msb = 0; 249 fp->flags = 0; 250 break; 251 default: 252 return EINVAL; 253 /*NOTREACHED*/ 254 } 255 return 0; 256 } 257 258 int 259 am7930_round_blocksize(void *addr, int blk) 260 { 261 return blk; 262 } 263 264 int 265 am7930_commit_settings(void *addr) 266 { 267 struct am7930_softc *sc = addr; 268 uint16_t ger, gr, gx, stgr; 269 uint8_t mmr2, mmr3; 270 int level; 271 272 DPRINTF(("sa_commit.\n")); 273 gx = gx_coeff[sc->sc_rlevel]; 274 stgr = gx_coeff[sc->sc_mlevel]; 275 276 level = (sc->sc_plevel * (256 + NGER)) >> 8; 277 if (level >= 256) { 278 ger = ger_coeff[level - 256]; 279 gr = gx_coeff[255]; 280 } else { 281 ger = ger_coeff[0]; 282 gr = gx_coeff[level]; 283 } 284 285 /* XXX: this is called before DMA is setup, useful ? */ 286 mtx_enter(&audio_lock); 287 288 mmr2 = AM7930_IREAD(sc, AM7930_IREG_MAP_MMR2); 289 if (sc->sc_out_port == AUDIOAMD_SPEAKER_VOL) 290 mmr2 |= AM7930_MMR2_LS; 291 else 292 mmr2 &= ~AM7930_MMR2_LS; 293 AM7930_IWRITE(sc, AM7930_IREG_MAP_MMR2, mmr2); 294 295 mmr3 = AM7930_IREAD(sc, AM7930_IREG_MAP_MMR3); 296 if (sc->sc_mic_mute) 297 mmr3 |= AM7930_MMR3_MUTE; 298 else 299 mmr3 &= ~AM7930_MMR3_MUTE; 300 AM7930_IWRITE(sc, AM7930_IREG_MAP_MMR3, mmr3); 301 302 AM7930_IWRITE(sc, AM7930_IREG_MAP_MMR1, 303 AM7930_MMR1_GX | AM7930_MMR1_GER | 304 AM7930_MMR1_GR | AM7930_MMR1_STG); 305 306 AM7930_IWRITE16(sc, AM7930_IREG_MAP_GX, gx); 307 AM7930_IWRITE16(sc, AM7930_IREG_MAP_STG, stgr); 308 AM7930_IWRITE16(sc, AM7930_IREG_MAP_GR, gr); 309 AM7930_IWRITE16(sc, AM7930_IREG_MAP_GER, ger); 310 311 mtx_leave(&audio_lock); 312 313 return 0; 314 } 315 316 int 317 am7930_halt_output(void *addr) 318 { 319 struct am7930_softc *sc = addr; 320 321 /* XXX only halt, if input is also halted ?? */ 322 AM7930_IWRITE(sc, AM7930_IREG_INIT, 323 AM7930_INIT_PMS_ACTIVE | AM7930_INIT_INT_DISABLE); 324 sc->sc_locked = 0; 325 return 0; 326 } 327 328 int 329 am7930_halt_input(void *addr) 330 { 331 struct am7930_softc *sc = addr; 332 333 /* XXX only halt, if output is also halted ?? */ 334 AM7930_IWRITE(sc, AM7930_IREG_INIT, 335 AM7930_INIT_PMS_ACTIVE | AM7930_INIT_INT_DISABLE); 336 sc->sc_locked = 0; 337 return 0; 338 } 339 340 /* 341 * XXX chip is full-duplex, but really attach-dependent. 342 * For now we know of no half-duplex attachments. 343 */ 344 int 345 am7930_get_props(void *addr) 346 { 347 return AUDIO_PROP_FULLDUPLEX; 348 } 349 350 /* 351 * Attach-dependent channel set/query 352 */ 353 int 354 am7930_set_port(void *addr, mixer_ctrl_t *cp) 355 { 356 struct am7930_softc *sc = addr; 357 358 DPRINTF(("am7930_set_port: port=%d", cp->dev)); 359 if (cp->dev == AUDIOAMD_RECORD_SOURCE || 360 cp->dev == AUDIOAMD_MONITOR_OUTPUT || 361 cp->dev == AUDIOAMD_MIC_MUTE) { 362 if (cp->type != AUDIO_MIXER_ENUM) 363 return EINVAL; 364 } else if (cp->type != AUDIO_MIXER_VALUE || 365 cp->un.value.num_channels != 1) { 366 return EINVAL; 367 } 368 369 switch(cp->dev) { 370 case AUDIOAMD_MIC_VOL: 371 sc->sc_rlevel = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO]; 372 break; 373 case AUDIOAMD_SPEAKER_VOL: 374 case AUDIOAMD_HEADPHONES_VOL: 375 sc->sc_plevel = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO]; 376 break; 377 case AUDIOAMD_MONITOR_VOL: 378 sc->sc_mlevel = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO]; 379 break; 380 case AUDIOAMD_RECORD_SOURCE: 381 if (cp->un.ord != AUDIOAMD_MIC_VOL) 382 return EINVAL; 383 break; 384 case AUDIOAMD_MIC_MUTE: 385 sc->sc_mic_mute = cp->un.ord; 386 break; 387 case AUDIOAMD_MONITOR_OUTPUT: 388 if (cp->un.ord != AUDIOAMD_SPEAKER_VOL && 389 cp->un.ord != AUDIOAMD_HEADPHONES_VOL) 390 return EINVAL; 391 sc->sc_out_port = cp->un.ord; 392 break; 393 default: 394 return EINVAL; 395 /* NOTREACHED */ 396 } 397 return 0; 398 } 399 400 int 401 am7930_get_port(void *addr, mixer_ctrl_t *cp) 402 { 403 struct am7930_softc *sc = addr; 404 405 DPRINTF(("am7930_get_port: port=%d\n", cp->dev)); 406 if (cp->dev == AUDIOAMD_RECORD_SOURCE || 407 cp->dev == AUDIOAMD_MONITOR_OUTPUT || 408 cp->dev == AUDIOAMD_MIC_MUTE) { 409 if (cp->type != AUDIO_MIXER_ENUM) 410 return EINVAL; 411 } else if (cp->type != AUDIO_MIXER_VALUE || 412 cp->un.value.num_channels != 1) { 413 return EINVAL; 414 } 415 416 switch(cp->dev) { 417 case AUDIOAMD_MIC_VOL: 418 cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = sc->sc_rlevel; 419 break; 420 case AUDIOAMD_SPEAKER_VOL: 421 case AUDIOAMD_HEADPHONES_VOL: 422 cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = sc->sc_plevel; 423 break; 424 case AUDIOAMD_MONITOR_VOL: 425 cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = sc->sc_mlevel; 426 break; 427 case AUDIOAMD_RECORD_SOURCE: 428 cp->un.ord = AUDIOAMD_MIC_VOL; 429 break; 430 case AUDIOAMD_MIC_MUTE: 431 cp->un.ord = sc->sc_mic_mute; 432 break; 433 case AUDIOAMD_MONITOR_OUTPUT: 434 cp->un.ord = sc->sc_out_port; 435 break; 436 default: 437 return EINVAL; 438 /* NOTREACHED */ 439 } 440 return 0; 441 } 442 443 444 /* 445 * Define mixer control facilities. 446 */ 447 int 448 am7930_query_devinfo(void *addr, mixer_devinfo_t *dip) 449 { 450 DPRINTF(("am7930_query_devinfo()\n")); 451 452 switch(dip->index) { 453 case AUDIOAMD_MIC_VOL: 454 dip->type = AUDIO_MIXER_VALUE; 455 dip->mixer_class = AUDIOAMD_INPUT_CLASS; 456 dip->prev = AUDIO_MIXER_LAST; 457 dip->next = AUDIOAMD_MIC_MUTE; 458 strlcpy(dip->label.name, AudioNmicrophone, 459 sizeof dip->label.name); 460 dip->un.v.num_channels = 1; 461 strlcpy(dip->un.v.units.name, AudioNvolume, 462 sizeof dip->un.v.units.name); 463 break; 464 case AUDIOAMD_SPEAKER_VOL: 465 dip->type = AUDIO_MIXER_VALUE; 466 dip->mixer_class = AUDIOAMD_OUTPUT_CLASS; 467 dip->prev = dip->next = AUDIO_MIXER_LAST; 468 strlcpy(dip->label.name, AudioNspeaker, 469 sizeof dip->label.name); 470 dip->un.v.num_channels = 1; 471 strlcpy(dip->un.v.units.name, AudioNvolume, 472 sizeof dip->un.v.units.name); 473 break; 474 case AUDIOAMD_HEADPHONES_VOL: 475 dip->type = AUDIO_MIXER_VALUE; 476 dip->mixer_class = AUDIOAMD_OUTPUT_CLASS; 477 dip->prev = dip->next = AUDIO_MIXER_LAST; 478 strlcpy(dip->label.name, AudioNheadphone, 479 sizeof dip->label.name); 480 dip->un.v.num_channels = 1; 481 strlcpy(dip->un.v.units.name, AudioNvolume, 482 sizeof dip->un.v.units.name); 483 break; 484 case AUDIOAMD_MONITOR_VOL: 485 dip->type = AUDIO_MIXER_VALUE; 486 dip->mixer_class = AUDIOAMD_MONITOR_CLASS; 487 dip->prev = dip->next = AUDIO_MIXER_LAST; 488 strlcpy(dip->label.name, AudioNmonitor, 489 sizeof dip->label.name); 490 dip->un.v.num_channels = 1; 491 strlcpy(dip->un.v.units.name, AudioNvolume, 492 sizeof dip->un.v.units.name); 493 break; 494 case AUDIOAMD_RECORD_SOURCE: 495 dip->type = AUDIO_MIXER_ENUM; 496 dip->mixer_class = AUDIOAMD_RECORD_CLASS; 497 dip->prev = dip->next = AUDIO_MIXER_LAST; 498 strlcpy(dip->label.name, AudioNsource, 499 sizeof dip->label.name); 500 dip->un.e.num_mem = 1; 501 strlcpy(dip->un.e.member[0].label.name, AudioNmicrophone, 502 sizeof dip->un.e.member[0].label.name); 503 dip->un.e.member[0].ord = AUDIOAMD_MIC_VOL; 504 break; 505 case AUDIOAMD_MONITOR_OUTPUT: 506 dip->type = AUDIO_MIXER_ENUM; 507 dip->mixer_class = AUDIOAMD_MONITOR_CLASS; 508 dip->prev = dip->next = AUDIO_MIXER_LAST; 509 strlcpy(dip->label.name, AudioNoutput, 510 sizeof dip->label.name); 511 dip->un.e.num_mem = 2; 512 strlcpy(dip->un.e.member[0].label.name, AudioNspeaker, 513 sizeof dip->un.e.member[0].label.name); 514 dip->un.e.member[0].ord = AUDIOAMD_SPEAKER_VOL; 515 strlcpy(dip->un.e.member[1].label.name, AudioNheadphone, 516 sizeof dip->un.e.member[1].label.name); 517 dip->un.e.member[1].ord = AUDIOAMD_HEADPHONES_VOL; 518 break; 519 case AUDIOAMD_MIC_MUTE: 520 dip->type = AUDIO_MIXER_ENUM; 521 dip->mixer_class = AUDIOAMD_INPUT_CLASS; 522 dip->prev = AUDIOAMD_MIC_VOL; 523 dip->next = AUDIO_MIXER_LAST; 524 strlcpy(dip->label.name, AudioNmute, 525 sizeof dip->label.name); 526 dip->un.e.num_mem = 2; 527 strlcpy(dip->un.e.member[0].label.name, AudioNoff, 528 sizeof dip->un.e.member[0].label.name); 529 dip->un.e.member[0].ord = 0; 530 strlcpy(dip->un.e.member[1].label.name, AudioNon, 531 sizeof dip->un.e.member[1].label.name); 532 dip->un.e.member[1].ord = 1; 533 break; 534 case AUDIOAMD_INPUT_CLASS: 535 dip->type = AUDIO_MIXER_CLASS; 536 dip->mixer_class = AUDIOAMD_INPUT_CLASS; 537 dip->prev = dip->next = AUDIO_MIXER_LAST; 538 strlcpy(dip->label.name, AudioCinputs, 539 sizeof dip->label.name); 540 break; 541 case AUDIOAMD_OUTPUT_CLASS: 542 dip->type = AUDIO_MIXER_CLASS; 543 dip->mixer_class = AUDIOAMD_OUTPUT_CLASS; 544 dip->prev = dip->next = AUDIO_MIXER_LAST; 545 strlcpy(dip->label.name, AudioCoutputs, 546 sizeof dip->label.name); 547 break; 548 case AUDIOAMD_RECORD_CLASS: 549 dip->type = AUDIO_MIXER_CLASS; 550 dip->mixer_class = AUDIOAMD_RECORD_CLASS; 551 dip->prev = dip->next = AUDIO_MIXER_LAST; 552 strlcpy(dip->label.name, AudioCrecord, 553 sizeof dip->label.name); 554 break; 555 case AUDIOAMD_MONITOR_CLASS: 556 dip->type = AUDIO_MIXER_CLASS; 557 dip->mixer_class = AUDIOAMD_MONITOR_CLASS; 558 dip->prev = dip->next = AUDIO_MIXER_LAST; 559 strlcpy(dip->label.name, AudioCmonitor, 560 sizeof dip->label.name); 561 break; 562 default: 563 return ENXIO; 564 /*NOTREACHED*/ 565 } 566 567 DPRINTF(("AUDIO_MIXER_DEVINFO: name=%s\n", dip->label.name)); 568 569 return 0; 570 } 571