1 /* $OpenBSD: am7930.c,v 1.7 2016/09/14 06:12:19 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_round_blocksize(void *addr, int blk) 239 { 240 return blk; 241 } 242 243 int 244 am7930_commit_settings(void *addr) 245 { 246 struct am7930_softc *sc = addr; 247 uint16_t ger, gr, gx, stgr; 248 uint8_t mmr2, mmr3; 249 int level; 250 251 DPRINTF(("sa_commit.\n")); 252 gx = gx_coeff[sc->sc_rlevel]; 253 stgr = gx_coeff[sc->sc_mlevel]; 254 255 level = (sc->sc_plevel * (256 + NGER)) >> 8; 256 if (level >= 256) { 257 ger = ger_coeff[level - 256]; 258 gr = gx_coeff[255]; 259 } else { 260 ger = ger_coeff[0]; 261 gr = gx_coeff[level]; 262 } 263 264 /* XXX: this is called before DMA is setup, useful ? */ 265 mtx_enter(&audio_lock); 266 267 mmr2 = AM7930_IREAD(sc, AM7930_IREG_MAP_MMR2); 268 if (sc->sc_out_port == AUDIOAMD_SPEAKER_VOL) 269 mmr2 |= AM7930_MMR2_LS; 270 else 271 mmr2 &= ~AM7930_MMR2_LS; 272 AM7930_IWRITE(sc, AM7930_IREG_MAP_MMR2, mmr2); 273 274 mmr3 = AM7930_IREAD(sc, AM7930_IREG_MAP_MMR3); 275 if (sc->sc_mic_mute) 276 mmr3 |= AM7930_MMR3_MUTE; 277 else 278 mmr3 &= ~AM7930_MMR3_MUTE; 279 AM7930_IWRITE(sc, AM7930_IREG_MAP_MMR3, mmr3); 280 281 AM7930_IWRITE(sc, AM7930_IREG_MAP_MMR1, 282 AM7930_MMR1_GX | AM7930_MMR1_GER | 283 AM7930_MMR1_GR | AM7930_MMR1_STG); 284 285 AM7930_IWRITE16(sc, AM7930_IREG_MAP_GX, gx); 286 AM7930_IWRITE16(sc, AM7930_IREG_MAP_STG, stgr); 287 AM7930_IWRITE16(sc, AM7930_IREG_MAP_GR, gr); 288 AM7930_IWRITE16(sc, AM7930_IREG_MAP_GER, ger); 289 290 mtx_leave(&audio_lock); 291 292 return 0; 293 } 294 295 int 296 am7930_halt_output(void *addr) 297 { 298 struct am7930_softc *sc = addr; 299 300 /* XXX only halt, if input is also halted ?? */ 301 AM7930_IWRITE(sc, AM7930_IREG_INIT, 302 AM7930_INIT_PMS_ACTIVE | AM7930_INIT_INT_DISABLE); 303 sc->sc_locked = 0; 304 return 0; 305 } 306 307 int 308 am7930_halt_input(void *addr) 309 { 310 struct am7930_softc *sc = addr; 311 312 /* XXX only halt, if output is also halted ?? */ 313 AM7930_IWRITE(sc, AM7930_IREG_INIT, 314 AM7930_INIT_PMS_ACTIVE | AM7930_INIT_INT_DISABLE); 315 sc->sc_locked = 0; 316 return 0; 317 } 318 319 /* 320 * XXX chip is full-duplex, but really attach-dependent. 321 * For now we know of no half-duplex attachments. 322 */ 323 int 324 am7930_get_props(void *addr) 325 { 326 return AUDIO_PROP_FULLDUPLEX; 327 } 328 329 /* 330 * Attach-dependent channel set/query 331 */ 332 int 333 am7930_set_port(void *addr, mixer_ctrl_t *cp) 334 { 335 struct am7930_softc *sc = addr; 336 337 DPRINTF(("am7930_set_port: port=%d", cp->dev)); 338 if (cp->dev == AUDIOAMD_RECORD_SOURCE || 339 cp->dev == AUDIOAMD_MONITOR_OUTPUT || 340 cp->dev == AUDIOAMD_MIC_MUTE) { 341 if (cp->type != AUDIO_MIXER_ENUM) 342 return EINVAL; 343 } else if (cp->type != AUDIO_MIXER_VALUE || 344 cp->un.value.num_channels != 1) { 345 return EINVAL; 346 } 347 348 switch(cp->dev) { 349 case AUDIOAMD_MIC_VOL: 350 sc->sc_rlevel = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO]; 351 break; 352 case AUDIOAMD_SPEAKER_VOL: 353 case AUDIOAMD_HEADPHONES_VOL: 354 sc->sc_plevel = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO]; 355 break; 356 case AUDIOAMD_MONITOR_VOL: 357 sc->sc_mlevel = cp->un.value.level[AUDIO_MIXER_LEVEL_MONO]; 358 break; 359 case AUDIOAMD_RECORD_SOURCE: 360 if (cp->un.ord != AUDIOAMD_MIC_VOL) 361 return EINVAL; 362 break; 363 case AUDIOAMD_MIC_MUTE: 364 sc->sc_mic_mute = cp->un.ord; 365 break; 366 case AUDIOAMD_MONITOR_OUTPUT: 367 if (cp->un.ord != AUDIOAMD_SPEAKER_VOL && 368 cp->un.ord != AUDIOAMD_HEADPHONES_VOL) 369 return EINVAL; 370 sc->sc_out_port = cp->un.ord; 371 break; 372 default: 373 return EINVAL; 374 /* NOTREACHED */ 375 } 376 return 0; 377 } 378 379 int 380 am7930_get_port(void *addr, mixer_ctrl_t *cp) 381 { 382 struct am7930_softc *sc = addr; 383 384 DPRINTF(("am7930_get_port: port=%d\n", cp->dev)); 385 if (cp->dev == AUDIOAMD_RECORD_SOURCE || 386 cp->dev == AUDIOAMD_MONITOR_OUTPUT || 387 cp->dev == AUDIOAMD_MIC_MUTE) { 388 if (cp->type != AUDIO_MIXER_ENUM) 389 return EINVAL; 390 } else if (cp->type != AUDIO_MIXER_VALUE || 391 cp->un.value.num_channels != 1) { 392 return EINVAL; 393 } 394 395 switch(cp->dev) { 396 case AUDIOAMD_MIC_VOL: 397 cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = sc->sc_rlevel; 398 break; 399 case AUDIOAMD_SPEAKER_VOL: 400 case AUDIOAMD_HEADPHONES_VOL: 401 cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = sc->sc_plevel; 402 break; 403 case AUDIOAMD_MONITOR_VOL: 404 cp->un.value.level[AUDIO_MIXER_LEVEL_MONO] = sc->sc_mlevel; 405 break; 406 case AUDIOAMD_RECORD_SOURCE: 407 cp->un.ord = AUDIOAMD_MIC_VOL; 408 break; 409 case AUDIOAMD_MIC_MUTE: 410 cp->un.ord = sc->sc_mic_mute; 411 break; 412 case AUDIOAMD_MONITOR_OUTPUT: 413 cp->un.ord = sc->sc_out_port; 414 break; 415 default: 416 return EINVAL; 417 /* NOTREACHED */ 418 } 419 return 0; 420 } 421 422 423 /* 424 * Define mixer control facilities. 425 */ 426 int 427 am7930_query_devinfo(void *addr, mixer_devinfo_t *dip) 428 { 429 DPRINTF(("am7930_query_devinfo()\n")); 430 431 switch(dip->index) { 432 case AUDIOAMD_MIC_VOL: 433 dip->type = AUDIO_MIXER_VALUE; 434 dip->mixer_class = AUDIOAMD_INPUT_CLASS; 435 dip->prev = AUDIO_MIXER_LAST; 436 dip->next = AUDIOAMD_MIC_MUTE; 437 strlcpy(dip->label.name, AudioNmicrophone, 438 sizeof dip->label.name); 439 dip->un.v.num_channels = 1; 440 strlcpy(dip->un.v.units.name, AudioNvolume, 441 sizeof dip->un.v.units.name); 442 break; 443 case AUDIOAMD_SPEAKER_VOL: 444 dip->type = AUDIO_MIXER_VALUE; 445 dip->mixer_class = AUDIOAMD_OUTPUT_CLASS; 446 dip->prev = dip->next = AUDIO_MIXER_LAST; 447 strlcpy(dip->label.name, AudioNspeaker, 448 sizeof dip->label.name); 449 dip->un.v.num_channels = 1; 450 strlcpy(dip->un.v.units.name, AudioNvolume, 451 sizeof dip->un.v.units.name); 452 break; 453 case AUDIOAMD_HEADPHONES_VOL: 454 dip->type = AUDIO_MIXER_VALUE; 455 dip->mixer_class = AUDIOAMD_OUTPUT_CLASS; 456 dip->prev = dip->next = AUDIO_MIXER_LAST; 457 strlcpy(dip->label.name, AudioNheadphone, 458 sizeof dip->label.name); 459 dip->un.v.num_channels = 1; 460 strlcpy(dip->un.v.units.name, AudioNvolume, 461 sizeof dip->un.v.units.name); 462 break; 463 case AUDIOAMD_MONITOR_VOL: 464 dip->type = AUDIO_MIXER_VALUE; 465 dip->mixer_class = AUDIOAMD_MONITOR_CLASS; 466 dip->prev = dip->next = AUDIO_MIXER_LAST; 467 strlcpy(dip->label.name, AudioNmonitor, 468 sizeof dip->label.name); 469 dip->un.v.num_channels = 1; 470 strlcpy(dip->un.v.units.name, AudioNvolume, 471 sizeof dip->un.v.units.name); 472 break; 473 case AUDIOAMD_RECORD_SOURCE: 474 dip->type = AUDIO_MIXER_ENUM; 475 dip->mixer_class = AUDIOAMD_RECORD_CLASS; 476 dip->prev = dip->next = AUDIO_MIXER_LAST; 477 strlcpy(dip->label.name, AudioNsource, 478 sizeof dip->label.name); 479 dip->un.e.num_mem = 1; 480 strlcpy(dip->un.e.member[0].label.name, AudioNmicrophone, 481 sizeof dip->un.e.member[0].label.name); 482 dip->un.e.member[0].ord = AUDIOAMD_MIC_VOL; 483 break; 484 case AUDIOAMD_MONITOR_OUTPUT: 485 dip->type = AUDIO_MIXER_ENUM; 486 dip->mixer_class = AUDIOAMD_MONITOR_CLASS; 487 dip->prev = dip->next = AUDIO_MIXER_LAST; 488 strlcpy(dip->label.name, AudioNoutput, 489 sizeof dip->label.name); 490 dip->un.e.num_mem = 2; 491 strlcpy(dip->un.e.member[0].label.name, AudioNspeaker, 492 sizeof dip->un.e.member[0].label.name); 493 dip->un.e.member[0].ord = AUDIOAMD_SPEAKER_VOL; 494 strlcpy(dip->un.e.member[1].label.name, AudioNheadphone, 495 sizeof dip->un.e.member[1].label.name); 496 dip->un.e.member[1].ord = AUDIOAMD_HEADPHONES_VOL; 497 break; 498 case AUDIOAMD_MIC_MUTE: 499 dip->type = AUDIO_MIXER_ENUM; 500 dip->mixer_class = AUDIOAMD_INPUT_CLASS; 501 dip->prev = AUDIOAMD_MIC_VOL; 502 dip->next = AUDIO_MIXER_LAST; 503 strlcpy(dip->label.name, AudioNmute, 504 sizeof dip->label.name); 505 dip->un.e.num_mem = 2; 506 strlcpy(dip->un.e.member[0].label.name, AudioNoff, 507 sizeof dip->un.e.member[0].label.name); 508 dip->un.e.member[0].ord = 0; 509 strlcpy(dip->un.e.member[1].label.name, AudioNon, 510 sizeof dip->un.e.member[1].label.name); 511 dip->un.e.member[1].ord = 1; 512 break; 513 case AUDIOAMD_INPUT_CLASS: 514 dip->type = AUDIO_MIXER_CLASS; 515 dip->mixer_class = AUDIOAMD_INPUT_CLASS; 516 dip->prev = dip->next = AUDIO_MIXER_LAST; 517 strlcpy(dip->label.name, AudioCinputs, 518 sizeof dip->label.name); 519 break; 520 case AUDIOAMD_OUTPUT_CLASS: 521 dip->type = AUDIO_MIXER_CLASS; 522 dip->mixer_class = AUDIOAMD_OUTPUT_CLASS; 523 dip->prev = dip->next = AUDIO_MIXER_LAST; 524 strlcpy(dip->label.name, AudioCoutputs, 525 sizeof dip->label.name); 526 break; 527 case AUDIOAMD_RECORD_CLASS: 528 dip->type = AUDIO_MIXER_CLASS; 529 dip->mixer_class = AUDIOAMD_RECORD_CLASS; 530 dip->prev = dip->next = AUDIO_MIXER_LAST; 531 strlcpy(dip->label.name, AudioCrecord, 532 sizeof dip->label.name); 533 break; 534 case AUDIOAMD_MONITOR_CLASS: 535 dip->type = AUDIO_MIXER_CLASS; 536 dip->mixer_class = AUDIOAMD_MONITOR_CLASS; 537 dip->prev = dip->next = AUDIO_MIXER_LAST; 538 strlcpy(dip->label.name, AudioCmonitor, 539 sizeof dip->label.name); 540 break; 541 default: 542 return ENXIO; 543 /*NOTREACHED*/ 544 } 545 546 DPRINTF(("AUDIO_MIXER_DEVINFO: name=%s\n", dip->label.name)); 547 548 return 0; 549 } 550