void vidc_mixer_init(struct address_info *hw_config) { int vidc_mixer = sound_alloc_mixerdev(); vidc_volume = 100 | (100 << 8); if (num_mixers < MAX_MIXER_DEV) mixer_devs[vidc_mixer] = &vidc_mixer_operations; }
/* Installs the AC97 mixer into CARD. */ static int __init nm256_install_mixer (struct nm256_info *card) { int mixer; card->mdev.reset_device = nm256_resetAC97; card->mdev.read_reg = nm256_readAC97Reg; card->mdev.write_reg = nm256_writeAC97Reg; card->mdev.driver_private = (void *)card; if (ac97_init (&(card->mdev))) return -1; mixer = sound_alloc_mixerdev(); if (num_mixers >= MAX_MIXER_DEV) { printk ("NM256 mixer: Unable to alloc mixerdev\n"); return -1; } mixer_devs[mixer] = &nm256_mixer_operations; card->mixer_oss_dev = mixer; /* Some reasonable default values. */ ac97_set_values (&(card->mdev), mixer_defaults); printk(KERN_INFO "Initialized AC97 mixer\n"); return 0; }
int sound_install_mixer(int vers, char *name, struct mixer_operations *driver, int driver_size, void *devc) { struct mixer_operations *op; int n = sound_alloc_mixerdev(); if (n == -1) { printk(KERN_ERR "Sound: Too many mixer drivers\n"); return -EBUSY; } if (vers != MIXER_DRIVER_VERSION || driver_size > sizeof(struct mixer_operations)) { printk(KERN_ERR "Sound: Incompatible mixer driver for %s\n", name); return -EINVAL; } /* FIXME: This leaks a mixer_operations struct every time its called until you unload sound! */ op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vmalloc(sizeof(struct mixer_operations))); if (sound_nblocks < 1024) sound_nblocks++; if (op == NULL) { printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); return -ENOMEM; } memset((char *) op, 0, sizeof(struct mixer_operations)); memcpy((char *) op, (char *) driver, driver_size); strlcpy(op->name, name, sizeof(op->name)); op->devc = devc; mixer_devs[n] = op; return n; }
int sound_install_mixer(int vers, char *name, struct mixer_operations *driver, int driver_size, void *devc) { struct mixer_operations *op; int n = sound_alloc_mixerdev(); if (n == -1) { printk(KERN_ERR "Sound: Too many mixer drivers\n"); return -EBUSY; } if (vers != MIXER_DRIVER_VERSION || driver_size > sizeof(struct mixer_operations)) { printk(KERN_ERR "Sound: Incompatible mixer driver for %s\n", name); return -EINVAL; } /* */ op = (struct mixer_operations *) (sound_mem_blocks[sound_nblocks] = vzalloc(sizeof(struct mixer_operations))); sound_nblocks++; if (sound_nblocks >= MAX_MEM_BLOCKS) sound_nblocks = MAX_MEM_BLOCKS - 1; if (op == NULL) { printk(KERN_ERR "Sound: Can't allocate mixer driver for (%s)\n", name); return -ENOMEM; } memcpy((char *) op, (char *) driver, driver_size); strlcpy(op->name, name, sizeof(op->name)); op->devc = devc; mixer_devs[n] = op; return n; }