Lines Matching refs:devc

222 static void     sb_mixer_reset(sb_devc * devc);
224 void sb_mixer_set_stereo(sb_devc * devc, int mode) in sb_mixer_set_stereo() argument
226 sb_chgmixer(devc, OUT_FILTER, STEREO_DAC, (mode ? STEREO_DAC : MONO_DAC)); in sb_mixer_set_stereo()
229 static int detect_mixer(sb_devc * devc) in detect_mixer() argument
235 static void oss_change_bits(sb_devc *devc, unsigned char *regval, int dev, int chn, int newval) in oss_change_bits() argument
240 mask = (1 << (*devc->iomap)[dev][chn].nbits) - 1; in oss_change_bits()
243 shift = (*devc->iomap)[dev][chn].bitoffs - (*devc->iomap)[dev][LEFT_CHN].nbits + 1; in oss_change_bits()
249 static int sb_mixer_get(sb_devc * devc, int dev) in sb_mixer_get() argument
251 if (!((1 << dev) & devc->supported_devices)) in sb_mixer_get()
253 return devc->levels[dev]; in sb_mixer_get()
256 void smw_mixer_init(sb_devc * devc) in smw_mixer_init() argument
260 sb_setmixer(devc, 0x00, 0x18); /* Mute unused (Telephone) line */ in smw_mixer_init()
261 sb_setmixer(devc, 0x10, 0x38); /* Config register 2 */ in smw_mixer_init()
263 devc->supported_devices = 0; in smw_mixer_init()
266 devc->supported_devices |= (1 << i); in smw_mixer_init()
268 devc->supported_rec_devices = devc->supported_devices & in smw_mixer_init()
270 sb_mixer_reset(devc); in smw_mixer_init()
273 int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right) in sb_common_mixer_set() argument
278 if ((dev < 0) || (dev >= devc->iomap_sz)) in sb_common_mixer_set()
281 regoffs = (*devc->iomap)[dev][LEFT_CHN].regno; in sb_common_mixer_set()
286 val = sb_getmixer(devc, regoffs); in sb_common_mixer_set()
287 oss_change_bits(devc, &val, dev, LEFT_CHN, left); in sb_common_mixer_set()
289 if ((*devc->iomap)[dev][RIGHT_CHN].regno != regoffs) /* in sb_common_mixer_set()
293 sb_setmixer(devc, regoffs, val); /* in sb_common_mixer_set()
296 regoffs = (*devc->iomap)[dev][RIGHT_CHN].regno; in sb_common_mixer_set()
303 val = sb_getmixer(devc, regoffs); /* in sb_common_mixer_set()
307 oss_change_bits(devc, &val, dev, RIGHT_CHN, right); in sb_common_mixer_set()
309 sb_setmixer(devc, regoffs, val); in sb_common_mixer_set()
314 static int smw_mixer_set(sb_devc * devc, int dev, int left, int right) in smw_mixer_set() argument
321 sb_setmixer(devc, 0x0b, 96 - (96 * left / 100)); /* 96=mute, 0=max */ in smw_mixer_set()
322 sb_setmixer(devc, 0x0c, 96 - (96 * right / 100)); in smw_mixer_set()
327 devc->levels[dev] = left | (right << 8); in smw_mixer_set()
329 val = ((devc->levels[SOUND_MIXER_TREBLE] & 0xff) * 16 / (unsigned) 100) << 4; in smw_mixer_set()
330 val |= ((devc->levels[SOUND_MIXER_BASS] & 0xff) * 16 / (unsigned) 100) & 0x0f; in smw_mixer_set()
331 sb_setmixer(devc, 0x0d, val); in smw_mixer_set()
334 val = (((devc->levels[SOUND_MIXER_TREBLE] >> 8) & 0xff) * 16 / (unsigned) 100) << 4; in smw_mixer_set()
335 val |= (((devc->levels[SOUND_MIXER_BASS] >> 8) & 0xff) * 16 / (unsigned) 100) & 0x0f; in smw_mixer_set()
336 sb_setmixer(devc, 0x0e, val); in smw_mixer_set()
347 sb_setmixer(devc, reg, (24 - (24 * left / 100)) | 0x20); /* 24=mute, 0=max */ in smw_mixer_set()
348 sb_setmixer(devc, reg + 1, (24 - (24 * right / 100)) | 0x40); in smw_mixer_set()
351 devc->levels[dev] = left | (right << 8); in smw_mixer_set()
355 static int sb_mixer_set(sb_devc * devc, int dev, int value) in sb_mixer_set() argument
369 if (!(devc->supported_devices & (1 << dev))) /* in sb_mixer_set()
375 switch (devc->model) { in sb_mixer_set()
377 retval = smw_mixer_set(devc, dev, left, right); in sb_mixer_set()
380 retval = ess_mixer_set(devc, dev, left, right); in sb_mixer_set()
383 retval = sb_common_mixer_set(devc, dev, left, right); in sb_mixer_set()
385 if (retval >= 0) devc->levels[dev] = retval; in sb_mixer_set()
393 static void set_recsrc(sb_devc * devc, int src) in set_recsrc() argument
395 sb_setmixer(devc, RECORD_SRC, (sb_getmixer(devc, RECORD_SRC) & ~7) | (src & 0x7)); in set_recsrc()
398 static int set_recmask(sb_devc * devc, int mask) in set_recmask() argument
403 devmask = mask & devc->supported_rec_devices; in set_recmask()
405 switch (devc->model) in set_recmask()
411 if (devc->model == MDL_ESS && ess_set_recmask (devc, &devmask)) { in set_recmask()
422 devmask &= ~devc->recmask; in set_recmask()
434 if (devmask ^ devc->recmask) /* in set_recmask()
441 set_recsrc(devc, SRC__MIC); in set_recmask()
445 set_recsrc(devc, SRC__LINE); in set_recmask()
449 set_recsrc(devc, SRC__CD); in set_recmask()
453 set_recsrc(devc, SRC__MIC); in set_recmask()
462 if (devc->submodel == SUBMDL_ALS007) in set_recmask()
467 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_LINE); in set_recmask()
470 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_CD); in set_recmask()
473 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_SYNTH); in set_recmask()
476 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_MIC); in set_recmask()
490 sb_setmixer (devc, SB16_IMASK_L, regimageL); in set_recmask()
491 sb_setmixer (devc, SB16_IMASK_R, regimageR); in set_recmask()
496 devc->recmask = devmask; in set_recmask()
497 return devc->recmask; in set_recmask()
500 static int set_outmask(sb_devc * devc, int mask) in set_outmask() argument
505 devmask = mask & devc->supported_out_devices; in set_outmask()
507 switch (devc->model) in set_outmask()
510 if (devc->submodel == SUBMDL_ALS007) in set_outmask()
521 sb_setmixer (devc, SB16_OMASK, regimage); in set_outmask()
529 devc->outmask = devmask; in set_outmask()
530 return devc->outmask; in set_outmask()
535 sb_devc *devc = mixer_devs[dev]->devc; in sb_mixer_ioctl() local
544 if (devc->model == MDL_SB16) { in sb_mixer_ioctl()
549 sb_setmixer(devc, 0x43, (~val) & 0x01); in sb_mixer_ioctl()
556 if (devc->minor < 15) in sb_mixer_ioctl()
561 sb_chgmixer(devc, AWE_3DSE, 0x01, val); in sb_mixer_ioctl()
564 ret = sb_getmixer(devc, AWE_3DSE)&0x01; in sb_mixer_ioctl()
581 ret = set_recmask(devc, val); in sb_mixer_ioctl()
585 ret = set_outmask(devc, val); in sb_mixer_ioctl()
589 ret = sb_mixer_set(devc, cmd & 0xff, val); in sb_mixer_ioctl()
595 ret = devc->recmask; in sb_mixer_ioctl()
599 ret = devc->outmask; in sb_mixer_ioctl()
603 ret = devc->supported_devices; in sb_mixer_ioctl()
607 ret = devc->supported_devices; in sb_mixer_ioctl()
609 if (devc->model == MDL_ESS) in sb_mixer_ioctl()
611 else if (devc->model != MDL_JAZZ && devc->model != MDL_SMW) in sb_mixer_ioctl()
616 ret = devc->supported_rec_devices; in sb_mixer_ioctl()
620 ret = devc->supported_out_devices; in sb_mixer_ioctl()
624 ret = devc->mixer_caps; in sb_mixer_ioctl()
628 ret = sb_mixer_get(devc, cmd & 0xff); in sb_mixer_ioctl()
652 static void sb_mixer_reset(sb_devc * devc) in sb_mixer_reset() argument
657 sprintf(name, "SB_%d", devc->sbmixnum); in sb_mixer_reset()
659 if (devc->sbmo.sm_games) in sb_mixer_reset()
660 devc->levels = load_mixer_volumes(name, smg_default_levels, 1); in sb_mixer_reset()
662 devc->levels = load_mixer_volumes(name, sb_default_levels, 1); in sb_mixer_reset()
665 sb_mixer_set(devc, i, devc->levels[i]); in sb_mixer_reset()
667 if (devc->model != MDL_ESS || !ess_mixer_reset (devc)) { in sb_mixer_reset()
668 set_recmask(devc, SOUND_MASK_MIC); in sb_mixer_reset()
672 int sb_mixer_init(sb_devc * devc, struct module *owner) in sb_mixer_init() argument
677 devc->sbmixnum = sbmixnum++; in sb_mixer_init()
678 devc->levels = NULL; in sb_mixer_init()
680 sb_setmixer(devc, 0x00, 0); /* Reset mixer */ in sb_mixer_init()
682 if (!(mixer_type = detect_mixer(devc))) in sb_mixer_init()
685 switch (devc->model) in sb_mixer_init()
692 devc->mixer_caps = SOUND_CAP_EXCL_INPUT; in sb_mixer_init()
693 devc->supported_devices = SBPRO_MIXER_DEVICES; in sb_mixer_init()
694 devc->supported_rec_devices = SBPRO_RECORDING_DEVICES; in sb_mixer_init()
695 devc->iomap = &sbpro_mix; in sb_mixer_init()
696 devc->iomap_sz = ARRAY_SIZE(sbpro_mix); in sb_mixer_init()
700 ess_mixer_init (devc); in sb_mixer_init()
704 devc->mixer_caps = SOUND_CAP_EXCL_INPUT; in sb_mixer_init()
705 devc->supported_devices = 0; in sb_mixer_init()
706 devc->supported_rec_devices = 0; in sb_mixer_init()
707 devc->iomap = &sbpro_mix; in sb_mixer_init()
708 devc->iomap_sz = ARRAY_SIZE(sbpro_mix); in sb_mixer_init()
709 smw_mixer_init(devc); in sb_mixer_init()
713 devc->mixer_caps = 0; in sb_mixer_init()
714 devc->supported_rec_devices = SB16_RECORDING_DEVICES; in sb_mixer_init()
715 devc->supported_out_devices = SB16_OUTFILTER_DEVICES; in sb_mixer_init()
716 if (devc->submodel != SUBMDL_ALS007) in sb_mixer_init()
718 devc->supported_devices = SB16_MIXER_DEVICES; in sb_mixer_init()
719 devc->iomap = &sb16_mix; in sb_mixer_init()
720 devc->iomap_sz = ARRAY_SIZE(sb16_mix); in sb_mixer_init()
724 devc->supported_devices = ALS007_MIXER_DEVICES; in sb_mixer_init()
725 devc->iomap = &als007_mix; in sb_mixer_init()
726 devc->iomap_sz = ARRAY_SIZE(als007_mix); in sb_mixer_init()
731 printk(KERN_WARNING "sb_mixer: Unsupported mixer type %d\n", devc->model); in sb_mixer_init()
747 if (devc->submodel != SUBMDL_ALS007) in sb_mixer_init()
752 mixer_devs[m]->devc = devc; in sb_mixer_init()
757 devc->my_mixerdev = m; in sb_mixer_init()
758 sb_mixer_reset(devc); in sb_mixer_init()
762 void sb_mixer_unload(sb_devc *devc) in sb_mixer_unload() argument
764 if (devc->my_mixerdev == -1) in sb_mixer_unload()
767 kfree(mixer_devs[devc->my_mixerdev]); in sb_mixer_unload()
768 sound_unload_mixerdev(devc->my_mixerdev); in sb_mixer_unload()