12 #include <linux/slab.h>
24 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
40 return sprintf(buf,
"%d\n", dev2pcm(dev)->impulse_volume);
48 const char *buf,
size_t count)
58 line6pcm->impulse_volume =
value;
74 return sprintf(buf,
"%d\n", dev2pcm(dev)->impulse_period);
82 const char *buf,
size_t count)
89 pcm_set_impulse_volume);
91 pcm_set_impulse_period);
95 static bool test_flags(
unsigned long flags0,
unsigned long flags1,
98 return ((flags0 & mask) == 0) && ((flags1 &
mask) != 0);
103 unsigned long flags_old =
104 __sync_fetch_and_or(&line6pcm->
flags, channels);
105 unsigned long flags_new = flags_old |
channels;
106 unsigned long flags_final = flags_old;
120 "cannot malloc capture buffer\n");
122 goto pcm_acquire_error;
136 dev_err(line6pcm->
line6->ifcdev,
"Device not yet ready\n");
145 goto pcm_acquire_error;
159 "cannot malloc playback buffer\n");
161 goto pcm_acquire_error;
173 dev_err(line6pcm->
line6->ifcdev,
"Device not yet ready\n");
181 goto pcm_acquire_error;
199 unsigned long flags_old =
200 __sync_fetch_and_and(&line6pcm->
flags, ~channels);
201 unsigned long flags_new = flags_old & ~channels;
259 "Unknown stream direction %d\n", s->
stream);
268 static int snd_line6_control_playback_info(
struct snd_kcontrol *kcontrol,
279 static int snd_line6_control_playback_get(
struct snd_kcontrol *kcontrol,
292 static int snd_line6_control_playback_put(
struct snd_kcontrol *kcontrol,
300 ucontrol->
value.integer.value[i]) {
302 ucontrol->
value.integer.value[
i];
312 .name =
"PCM Playback Volume",
315 .info = snd_line6_control_playback_info,
316 .get = snd_line6_control_playback_get,
317 .put = snd_line6_control_playback_put
323 static void line6_cleanup_pcm(
struct snd_pcm *pcm)
328 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
352 (
char *)line6pcm->
line6->properties->name,
387 if (substream->
runtime && snd_pcm_running(substream))
416 int ep_read = 0, ep_write = 0;
472 if (line6pcm ==
NULL)
483 usb_maxpacket(line6->
usbdev,
484 usb_rcvisocpipe(line6->
usbdev, ep_read), 0),
485 usb_maxpacket(line6->
usbdev,
486 usb_sndisocpipe(line6->
usbdev, ep_write), 1));
498 err = snd_line6_new_pcm(line6pcm);
521 #ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
531 line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;
542 switch (substream->
stream) {