Loading drivers/staging/line6/pcm.c +60 −40 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) err = snd_line6_playback_trigger(s, cmd); if (err < 0) { spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); return err; } Loading @@ -49,14 +50,16 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) err = snd_line6_capture_trigger(s, cmd); if (err < 0) { spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); return err; } break; default: dev_err(s2m(substream), "Unknown stream direction %d\n", s->stream); dev_err(s2m(substream), "Unknown stream direction %d\n", s->stream); } } Loading @@ -65,7 +68,9 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) } /* control info callback */ static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; Loading @@ -74,7 +79,9 @@ static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ } /* control get callback */ static int snd_line6_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int snd_line6_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int i; struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); Loading @@ -85,7 +92,9 @@ static int snd_line6_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e } /* control put callback */ static int snd_line6_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int snd_line6_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int i, changed = 0; struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); Loading Loading @@ -135,7 +144,10 @@ static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm) struct snd_pcm *pcm; int err; if((err = snd_pcm_new(line6pcm->line6->card, (char *)line6pcm->line6->properties->name, 0, 1, 1, &pcm)) < 0) err = snd_pcm_new(line6pcm->line6->card, (char *)line6pcm->line6->properties->name, 0, 1, 1, &pcm); if (err < 0) return err; pcm->private_data = line6pcm; Loading @@ -148,8 +160,7 @@ static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops); /* pre-allocation of buffers */ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 64 * 1024, 128 * 1024); Loading @@ -166,7 +177,8 @@ static int snd_line6_pcm_free(struct snd_device *device) Create and register the PCM device and mixer entries. Create URBs for playback and capture. */ int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *properties) int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *properties) { static struct snd_device_ops pcm_ops = { .dev_free = snd_line6_pcm_free, Loading Loading @@ -231,31 +243,39 @@ int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *propert line6pcm->line6 = line6; line6pcm->ep_audio_read = ep_read; line6pcm->ep_audio_write = ep_write; line6pcm->max_packet_size = usb_maxpacket(line6->usbdev, usb_rcvintpipe(line6->usbdev, ep_read), 0); line6pcm->max_packet_size = usb_maxpacket(line6->usbdev, usb_rcvintpipe(line6->usbdev, ep_read), 0); line6pcm->properties = properties; line6->line6pcm = line6pcm; /* PCM device: */ if((err = snd_device_new(line6->card, SNDRV_DEV_PCM, line6, &pcm_ops)) < 0) err = snd_device_new(line6->card, SNDRV_DEV_PCM, line6, &pcm_ops); if (err < 0) return err; snd_card_set_dev(line6->card, line6->ifcdev); if((err = snd_line6_new_pcm(line6pcm)) < 0) err = snd_line6_new_pcm(line6pcm); if (err < 0) return err; spin_lock_init(&line6pcm->lock_audio_out); spin_lock_init(&line6pcm->lock_audio_in); spin_lock_init(&line6pcm->lock_trigger); if((err = create_audio_out_urbs(line6pcm)) < 0) err = create_audio_out_urbs(line6pcm); if (err < 0) return err; if((err = create_audio_in_urbs(line6pcm)) < 0) err = create_audio_in_urbs(line6pcm); if (err < 0) return err; /* mixer: */ if((err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control, line6pcm))) < 0) err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control, line6pcm)); if (err < 0) return err; return 0; Loading Loading
drivers/staging/line6/pcm.c +60 −40 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) err = snd_line6_playback_trigger(s, cmd); if (err < 0) { spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); return err; } Loading @@ -49,14 +50,16 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) err = snd_line6_capture_trigger(s, cmd); if (err < 0) { spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); spin_unlock_irqrestore(&line6pcm->lock_trigger, flags); return err; } break; default: dev_err(s2m(substream), "Unknown stream direction %d\n", s->stream); dev_err(s2m(substream), "Unknown stream direction %d\n", s->stream); } } Loading @@ -65,7 +68,9 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) } /* control info callback */ static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 2; uinfo->value.integer.min = 0; Loading @@ -74,7 +79,9 @@ static int snd_line6_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_ } /* control get callback */ static int snd_line6_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int snd_line6_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int i; struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); Loading @@ -85,7 +92,9 @@ static int snd_line6_control_get(struct snd_kcontrol *kcontrol, struct snd_ctl_e } /* control put callback */ static int snd_line6_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { static int snd_line6_control_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { int i, changed = 0; struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); Loading Loading @@ -135,7 +144,10 @@ static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm) struct snd_pcm *pcm; int err; if((err = snd_pcm_new(line6pcm->line6->card, (char *)line6pcm->line6->properties->name, 0, 1, 1, &pcm)) < 0) err = snd_pcm_new(line6pcm->line6->card, (char *)line6pcm->line6->properties->name, 0, 1, 1, &pcm); if (err < 0) return err; pcm->private_data = line6pcm; Loading @@ -148,8 +160,7 @@ static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_line6_capture_ops); /* pre-allocation of buffers */ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 64 * 1024, 128 * 1024); Loading @@ -166,7 +177,8 @@ static int snd_line6_pcm_free(struct snd_device *device) Create and register the PCM device and mixer entries. Create URBs for playback and capture. */ int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *properties) int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *properties) { static struct snd_device_ops pcm_ops = { .dev_free = snd_line6_pcm_free, Loading Loading @@ -231,31 +243,39 @@ int line6_init_pcm(struct usb_line6 *line6, struct line6_pcm_properties *propert line6pcm->line6 = line6; line6pcm->ep_audio_read = ep_read; line6pcm->ep_audio_write = ep_write; line6pcm->max_packet_size = usb_maxpacket(line6->usbdev, usb_rcvintpipe(line6->usbdev, ep_read), 0); line6pcm->max_packet_size = usb_maxpacket(line6->usbdev, usb_rcvintpipe(line6->usbdev, ep_read), 0); line6pcm->properties = properties; line6->line6pcm = line6pcm; /* PCM device: */ if((err = snd_device_new(line6->card, SNDRV_DEV_PCM, line6, &pcm_ops)) < 0) err = snd_device_new(line6->card, SNDRV_DEV_PCM, line6, &pcm_ops); if (err < 0) return err; snd_card_set_dev(line6->card, line6->ifcdev); if((err = snd_line6_new_pcm(line6pcm)) < 0) err = snd_line6_new_pcm(line6pcm); if (err < 0) return err; spin_lock_init(&line6pcm->lock_audio_out); spin_lock_init(&line6pcm->lock_audio_in); spin_lock_init(&line6pcm->lock_trigger); if((err = create_audio_out_urbs(line6pcm)) < 0) err = create_audio_out_urbs(line6pcm); if (err < 0) return err; if((err = create_audio_in_urbs(line6pcm)) < 0) err = create_audio_in_urbs(line6pcm); if (err < 0) return err; /* mixer: */ if((err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control, line6pcm))) < 0) err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control, line6pcm)); if (err < 0) return err; return 0; Loading