/* Toneport device disconnected. */ void line6_toneport_disconnect(struct usb_interface *interface) { struct usb_line6_toneport *toneport; if (interface == NULL) return; toneport = usb_get_intfdata(interface); del_timer_sync(&toneport->timer); if (toneport_has_led(toneport->line6.usbdev->descriptor.idProduct)) { device_remove_file(&interface->dev, &dev_attr_led_red); device_remove_file(&interface->dev, &dev_attr_led_green); } if (toneport != NULL) { struct snd_line6_pcm *line6pcm = toneport->line6.line6pcm; if (line6pcm != NULL) { line6_pcm_stop(line6pcm, MASK_PCM_MONITOR); line6_pcm_disconnect(line6pcm); } } toneport_destruct(interface); }
/* trigger callback */ int snd_line6_capture_trigger(struct snd_line6_pcm *line6pcm, int cmd) { int err; switch (cmd) { case SNDRV_PCM_TRIGGER_START: #ifdef CONFIG_PM case SNDRV_PCM_TRIGGER_RESUME: #endif err = line6_pcm_start(line6pcm, MASK_PCM_ALSA_CAPTURE); if (err < 0) return err; break; case SNDRV_PCM_TRIGGER_STOP: #ifdef CONFIG_PM case SNDRV_PCM_TRIGGER_SUSPEND: #endif err = line6_pcm_stop(line6pcm, MASK_PCM_ALSA_CAPTURE); if (err < 0) return err; break; default: return -EINVAL; } return 0; }
/* "write" request on "impulse_volume" special file. */ static ssize_t pcm_set_impulse_volume(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct snd_line6_pcm *line6pcm = dev2pcm(dev); int value = simple_strtoul(buf, NULL, 10); line6pcm->impulse_volume = value; if (value > 0) line6_pcm_start(line6pcm, MASK_PCM_IMPULSE); else line6_pcm_stop(line6pcm, MASK_PCM_IMPULSE); return count; }
/* monitor put callback */ static int snd_toneport_monitor_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor) return 0; line6pcm->volume_monitor = ucontrol->value.integer.value[0]; if (line6pcm->volume_monitor > 0) line6_pcm_start(line6pcm, MASK_PCM_MONITOR); else line6_pcm_stop(line6pcm, MASK_PCM_MONITOR); return 1; }
/* Module cleanup. */ static void __exit line6_exit(void) { int i; struct usb_line6 *line6; struct snd_line6_pcm *line6pcm; /* stop all PCM channels */ for (i = LINE6_MAX_DEVICES; i--;) { line6 = line6_devices[i]; if (line6 == NULL) continue; line6pcm = line6->line6pcm; if (line6pcm == NULL) continue; line6_pcm_stop(line6pcm, ~0); } usb_deregister(&line6_driver); kfree(line6_request_version); }