blob: 0eac29123f777d1679d5ed0baa640ff72ffd18c2 [file] [log] [blame]
Markus Grabner705ecec2009-02-27 19:43:04 -08001/*
Markus Grabner1027f4762010-08-12 01:35:30 +02002 * Line6 Linux USB driver - 0.9.0
Markus Grabner705ecec2009-02-27 19:43:04 -08003 *
Markus Grabner1027f4762010-08-12 01:35:30 +02004 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
Markus Grabner705ecec2009-02-27 19:43:04 -08005 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation, version 2.
9 *
10 */
11
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090012#include <linux/slab.h>
Markus Grabner705ecec2009-02-27 19:43:04 -080013#include <sound/core.h>
14#include <sound/control.h>
15#include <sound/pcm.h>
16#include <sound/pcm_params.h>
17
18#include "audio.h"
19#include "capture.h"
Markus Grabner1027f4762010-08-12 01:35:30 +020020#include "driver.h"
Markus Grabner705ecec2009-02-27 19:43:04 -080021#include "playback.h"
22#include "pod.h"
23
24
Markus Grabner1027f4762010-08-12 01:35:30 +020025#ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
26
27static struct snd_line6_pcm* dev2pcm(struct device *dev)
28{
29 struct usb_interface *interface = to_usb_interface(dev);
30 struct usb_line6 *line6 = usb_get_intfdata(interface);
31 struct snd_line6_pcm *line6pcm = line6->line6pcm;
32 return line6pcm;
33}
34
35/*
36 "read" request on "impulse_volume" special file.
37*/
38static ssize_t pcm_get_impulse_volume(struct device *dev,
39 struct device_attribute *attr,
40 char *buf)
41{
42 return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_volume);
43}
44
45/*
46 "write" request on "impulse_volume" special file.
47*/
48static ssize_t pcm_set_impulse_volume(struct device *dev,
49 struct device_attribute *attr,
50 const char *buf, size_t count)
51{
52 struct snd_line6_pcm *line6pcm = dev2pcm(dev);
53 int value = simple_strtoul(buf, NULL, 10);
54 line6pcm->impulse_volume = value;
55
56 if(value > 0)
57 line6_pcm_start(line6pcm, MASK_PCM_IMPULSE);
58 else
59 line6_pcm_stop(line6pcm, MASK_PCM_IMPULSE);
60
61 return count;
62}
63
64/*
65 "read" request on "impulse_period" special file.
66*/
67static ssize_t pcm_get_impulse_period(struct device *dev,
68 struct device_attribute *attr,
69 char *buf)
70{
71 return sprintf(buf, "%d\n", dev2pcm(dev)->impulse_period);
72}
73
74/*
75 "write" request on "impulse_period" special file.
76*/
77static ssize_t pcm_set_impulse_period(struct device *dev,
78 struct device_attribute *attr,
79 const char *buf, size_t count)
80{
81 dev2pcm(dev)->impulse_period = simple_strtoul(buf, NULL, 10);
82 return count;
83}
84
85static DEVICE_ATTR(impulse_volume, S_IWUGO | S_IRUGO, pcm_get_impulse_volume, pcm_set_impulse_volume);
86static DEVICE_ATTR(impulse_period, S_IWUGO | S_IRUGO, pcm_get_impulse_period, pcm_set_impulse_period);
87
88#endif
89
90int line6_pcm_start(struct snd_line6_pcm *line6pcm, int channels)
91{
92 unsigned long flags_old = __sync_fetch_and_or(&line6pcm->flags, channels);
93 unsigned long flags_new = flags_old | channels;
94 int err = 0;
95
96#if LINE6_BACKUP_MONITOR_SIGNAL
97 if (!(line6pcm->line6->properties->capabilities & LINE6_BIT_HWMON)) {
98 line6pcm->prev_fbuf = kmalloc(LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL);
99
100 if (!line6pcm->prev_fbuf) {
101 dev_err(line6pcm->line6->ifcdev, "cannot malloc monitor buffer\n");
102 return -ENOMEM;
103 }
104 }
105#else
106 line6pcm->prev_fbuf = NULL;
107#endif
108
109 if (((flags_old & MASK_CAPTURE) == 0) &&
110 ((flags_new & MASK_CAPTURE) != 0)) {
111 /*
112 Waiting for completion of active URBs in the stop handler is
113 a bug, we therefore report an error if capturing is restarted
114 too soon.
115 */
116 if(line6pcm->active_urb_in | line6pcm->unlink_urb_in)
117 return -EBUSY;
118
119 line6pcm->buffer_in = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL);
120
121 if (!line6pcm->buffer_in) {
122 dev_err(line6pcm->line6->ifcdev, "cannot malloc capture buffer\n");
123 return -ENOMEM;
124 }
125
126 line6pcm->count_in = 0;
127 line6pcm->prev_fsize = 0;
128 err = line6_submit_audio_in_all_urbs(line6pcm);
129
130 if (err < 0) {
131 __sync_fetch_and_and(&line6pcm->flags, ~channels);
132 return err;
133 }
134 }
135
136 if (((flags_old & MASK_PLAYBACK) == 0) &&
137 ((flags_new & MASK_PLAYBACK) != 0)) {
138 /*
139 See comment above regarding PCM restart.
140 */
141 if(line6pcm->active_urb_out | line6pcm->unlink_urb_out)
142 return -EBUSY;
143
144 line6pcm->buffer_out = kmalloc(LINE6_ISO_BUFFERS * LINE6_ISO_PACKETS * line6pcm->max_packet_size, GFP_KERNEL);
145
146 if (!line6pcm->buffer_out) {
147 dev_err(line6pcm->line6->ifcdev, "cannot malloc playback buffer\n");
148 return -ENOMEM;
149 }
150
151 line6pcm->count_out = 0;
152 err = line6_submit_audio_out_all_urbs(line6pcm);
153
154 if (err < 0) {
155 __sync_fetch_and_and(&line6pcm->flags, ~channels);
156 return err;
157 }
158 }
159
160 return 0;
161}
162
163int line6_pcm_stop(struct snd_line6_pcm *line6pcm, int channels)
164{
165 unsigned long flags_old = __sync_fetch_and_and(&line6pcm->flags, ~channels);
166 unsigned long flags_new = flags_old & ~channels;
167
168 if (((flags_old & MASK_CAPTURE) != 0) &&
169 ((flags_new & MASK_CAPTURE) == 0)) {
170 line6_unlink_audio_in_urbs(line6pcm);
171 kfree(line6pcm->buffer_in);
172 line6pcm->buffer_in = NULL;
173 }
174
175 if (((flags_old & MASK_PLAYBACK) != 0) &&
176 ((flags_new & MASK_PLAYBACK) == 0)) {
177 line6_unlink_audio_out_urbs(line6pcm);
178 kfree(line6pcm->buffer_out);
179 line6pcm->buffer_out = NULL;
180 }
181
182#if LINE6_BACKUP_MONITOR_SIGNAL
183 if (line6pcm->prev_fbuf != NULL)
184 kfree(line6pcm->prev_fbuf);
185#endif
186
187 return 0;
188}
189
Markus Grabner705ecec2009-02-27 19:43:04 -0800190/* trigger callback */
191int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
192{
193 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
Markus Grabner705ecec2009-02-27 19:43:04 -0800194 struct snd_pcm_substream *s;
195 int err;
196 unsigned long flags;
197
198 spin_lock_irqsave(&line6pcm->lock_trigger, flags);
199 clear_bit(BIT_PREPARED, &line6pcm->flags);
200
Markus Grabner705ecec2009-02-27 19:43:04 -0800201 snd_pcm_group_for_each_entry(s, substream) {
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800202 switch (s->stream) {
Markus Grabner705ecec2009-02-27 19:43:04 -0800203 case SNDRV_PCM_STREAM_PLAYBACK:
Markus Grabner1027f4762010-08-12 01:35:30 +0200204 err = snd_line6_playback_trigger(line6pcm, cmd);
Markus Grabner705ecec2009-02-27 19:43:04 -0800205
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800206 if (err < 0) {
207 spin_unlock_irqrestore(&line6pcm->lock_trigger,
208 flags);
Markus Grabner705ecec2009-02-27 19:43:04 -0800209 return err;
210 }
211
212 break;
213
214 case SNDRV_PCM_STREAM_CAPTURE:
Markus Grabner1027f4762010-08-12 01:35:30 +0200215 err = snd_line6_capture_trigger(line6pcm, cmd);
Markus Grabner705ecec2009-02-27 19:43:04 -0800216
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800217 if (err < 0) {
218 spin_unlock_irqrestore(&line6pcm->lock_trigger,
219 flags);
Markus Grabner705ecec2009-02-27 19:43:04 -0800220 return err;
221 }
222
223 break;
224
225 default:
Markus Grabner1027f4762010-08-12 01:35:30 +0200226 dev_err(line6pcm->line6->ifcdev, "Unknown stream direction %d\n",
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800227 s->stream);
Markus Grabner705ecec2009-02-27 19:43:04 -0800228 }
229 }
230
231 spin_unlock_irqrestore(&line6pcm->lock_trigger, flags);
232 return 0;
233}
234
235/* control info callback */
Markus Grabner1027f4762010-08-12 01:35:30 +0200236static int snd_line6_control_playback_info(struct snd_kcontrol *kcontrol,
237 struct snd_ctl_elem_info *uinfo)
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800238{
Markus Grabner705ecec2009-02-27 19:43:04 -0800239 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
240 uinfo->count = 2;
241 uinfo->value.integer.min = 0;
242 uinfo->value.integer.max = 256;
243 return 0;
244}
245
246/* control get callback */
Markus Grabner1027f4762010-08-12 01:35:30 +0200247static int snd_line6_control_playback_get(struct snd_kcontrol *kcontrol,
248 struct snd_ctl_elem_value *ucontrol)
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800249{
Markus Grabner705ecec2009-02-27 19:43:04 -0800250 int i;
251 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
252
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800253 for (i = 2; i--;)
Markus Grabner1027f4762010-08-12 01:35:30 +0200254 ucontrol->value.integer.value[i] = line6pcm->volume_playback[i];
Markus Grabner705ecec2009-02-27 19:43:04 -0800255
256 return 0;
257}
258
259/* control put callback */
Markus Grabner1027f4762010-08-12 01:35:30 +0200260static int snd_line6_control_playback_put(struct snd_kcontrol *kcontrol,
261 struct snd_ctl_elem_value *ucontrol)
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800262{
Markus Grabner705ecec2009-02-27 19:43:04 -0800263 int i, changed = 0;
264 struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol);
265
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800266 for (i = 2; i--;)
Markus Grabner1027f4762010-08-12 01:35:30 +0200267 if (line6pcm->volume_playback[i] != ucontrol->value.integer.value[i]) {
268 line6pcm->volume_playback[i] = ucontrol->value.integer.value[i];
Markus Grabner705ecec2009-02-27 19:43:04 -0800269 changed = 1;
270 }
271
272 return changed;
273}
274
275/* control definition */
Markus Grabner1027f4762010-08-12 01:35:30 +0200276static struct snd_kcontrol_new line6_control_playback = {
Markus Grabner705ecec2009-02-27 19:43:04 -0800277 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
278 .name = "PCM Playback Volume",
279 .index = 0,
280 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
Markus Grabner1027f4762010-08-12 01:35:30 +0200281 .info = snd_line6_control_playback_info,
282 .get = snd_line6_control_playback_get,
283 .put = snd_line6_control_playback_put
Markus Grabner705ecec2009-02-27 19:43:04 -0800284};
285
286/*
287 Cleanup the PCM device.
288*/
289static void line6_cleanup_pcm(struct snd_pcm *pcm)
290{
291 int i;
292 struct snd_line6_pcm *line6pcm = snd_pcm_chip(pcm);
293
Markus Grabner1027f4762010-08-12 01:35:30 +0200294#ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
295 device_remove_file(line6pcm->line6->ifcdev, &dev_attr_impulse_volume);
296 device_remove_file(line6pcm->line6->ifcdev, &dev_attr_impulse_period);
297#endif
298
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800299 for (i = LINE6_ISO_BUFFERS; i--;) {
300 if (line6pcm->urb_audio_out[i]) {
Markus Grabner705ecec2009-02-27 19:43:04 -0800301 usb_kill_urb(line6pcm->urb_audio_out[i]);
302 usb_free_urb(line6pcm->urb_audio_out[i]);
303 }
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800304 if (line6pcm->urb_audio_in[i]) {
Markus Grabner705ecec2009-02-27 19:43:04 -0800305 usb_kill_urb(line6pcm->urb_audio_in[i]);
306 usb_free_urb(line6pcm->urb_audio_in[i]);
307 }
308 }
309}
310
311/* create a PCM device */
312static int snd_line6_new_pcm(struct snd_line6_pcm *line6pcm)
313{
314 struct snd_pcm *pcm;
315 int err;
316
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800317 err = snd_pcm_new(line6pcm->line6->card,
318 (char *)line6pcm->line6->properties->name,
319 0, 1, 1, &pcm);
320 if (err < 0)
Markus Grabner705ecec2009-02-27 19:43:04 -0800321 return err;
322
323 pcm->private_data = line6pcm;
324 pcm->private_free = line6_cleanup_pcm;
325 line6pcm->pcm = pcm;
326 strcpy(pcm->name, line6pcm->line6->properties->name);
327
328 /* set operators */
Shawn Bohrerafb90912009-11-15 22:17:57 -0600329 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
330 &snd_line6_playback_ops);
Markus Grabner1027f4762010-08-12 01:35:30 +0200331 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
332 &snd_line6_capture_ops);
Markus Grabner705ecec2009-02-27 19:43:04 -0800333
334 /* pre-allocation of buffers */
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800335 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
336 snd_dma_continuous_data(GFP_KERNEL),
337 64 * 1024, 128 * 1024);
Markus Grabner705ecec2009-02-27 19:43:04 -0800338
339 return 0;
340}
341
342/* PCM device destructor */
343static int snd_line6_pcm_free(struct snd_device *device)
344{
345 return 0;
346}
347
348/*
Markus Grabner1027f4762010-08-12 01:35:30 +0200349 Stop substream if still running.
350*/
351static void pcm_disconnect_substream(struct snd_pcm_substream *substream)
352{
353 if(substream->runtime && snd_pcm_running(substream)) {
354 snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
355 }
356}
357
358/*
359 Stop PCM stream.
360*/
361void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm)
362{
363 pcm_disconnect_substream(get_substream(line6pcm, SNDRV_PCM_STREAM_CAPTURE));
364 pcm_disconnect_substream(get_substream(line6pcm, SNDRV_PCM_STREAM_PLAYBACK));
365 line6_unlink_wait_clear_audio_out_urbs(line6pcm);
366 line6_unlink_wait_clear_audio_in_urbs(line6pcm);
367}
368
369/*
Markus Grabner705ecec2009-02-27 19:43:04 -0800370 Create and register the PCM device and mixer entries.
371 Create URBs for playback and capture.
372*/
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800373int line6_init_pcm(struct usb_line6 *line6,
374 struct line6_pcm_properties *properties)
Markus Grabner705ecec2009-02-27 19:43:04 -0800375{
376 static struct snd_device_ops pcm_ops = {
377 .dev_free = snd_line6_pcm_free,
378 };
379
380 int err;
381 int ep_read = 0, ep_write = 0;
382 struct snd_line6_pcm *line6pcm;
383
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800384 if (!(line6->properties->capabilities & LINE6_BIT_PCM))
Markus Grabner705ecec2009-02-27 19:43:04 -0800385 return 0; /* skip PCM initialization and report success */
386
387 /* initialize PCM subsystem based on product id: */
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800388 switch (line6->product) {
Markus Grabner705ecec2009-02-27 19:43:04 -0800389 case LINE6_DEVID_BASSPODXT:
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800390 case LINE6_DEVID_BASSPODXTLIVE:
391 case LINE6_DEVID_BASSPODXTPRO:
392 case LINE6_DEVID_PODXT:
393 case LINE6_DEVID_PODXTLIVE:
394 case LINE6_DEVID_PODXTPRO:
Markus Grabner705ecec2009-02-27 19:43:04 -0800395 ep_read = 0x82;
396 ep_write = 0x01;
397 break;
398
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800399 case LINE6_DEVID_PODX3:
400 case LINE6_DEVID_PODX3LIVE:
Markus Grabner705ecec2009-02-27 19:43:04 -0800401 ep_read = 0x86;
402 ep_write = 0x02;
403 break;
404
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800405 case LINE6_DEVID_POCKETPOD:
Markus Grabner705ecec2009-02-27 19:43:04 -0800406 ep_read = 0x82;
407 ep_write = 0x02;
408 break;
409
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800410 case LINE6_DEVID_GUITARPORT:
Markus Grabner1027f4762010-08-12 01:35:30 +0200411 case LINE6_DEVID_PODSTUDIO_GX:
412 case LINE6_DEVID_PODSTUDIO_UX1:
413 case LINE6_DEVID_PODSTUDIO_UX2:
Markus Grabner705ecec2009-02-27 19:43:04 -0800414 case LINE6_DEVID_TONEPORT_GX:
Markus Grabner1027f4762010-08-12 01:35:30 +0200415 case LINE6_DEVID_TONEPORT_UX1:
416 case LINE6_DEVID_TONEPORT_UX2:
Markus Grabner705ecec2009-02-27 19:43:04 -0800417 ep_read = 0x82;
418 ep_write = 0x01;
419 break;
420
Markus Grabner1027f4762010-08-12 01:35:30 +0200421 /* this is for interface_number == 1:
Markus Grabner705ecec2009-02-27 19:43:04 -0800422 case LINE6_DEVID_TONEPORT_UX2:
Markus Grabner1027f4762010-08-12 01:35:30 +0200423 case LINE6_DEVID_PODSTUDIO_UX2:
Markus Grabner705ecec2009-02-27 19:43:04 -0800424 ep_read = 0x87;
425 ep_write = 0x00;
426 break;
Markus Grabner1027f4762010-08-12 01:35:30 +0200427 */
Markus Grabner705ecec2009-02-27 19:43:04 -0800428
429 default:
430 MISSING_CASE;
431 }
432
433 line6pcm = kzalloc(sizeof(struct snd_line6_pcm), GFP_KERNEL);
434
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800435 if (line6pcm == NULL)
Markus Grabner705ecec2009-02-27 19:43:04 -0800436 return -ENOMEM;
437
Markus Grabner1027f4762010-08-12 01:35:30 +0200438 line6pcm->volume_playback[0] = line6pcm->volume_playback[1] = 255;
439 line6pcm->volume_monitor = 255;
Markus Grabner705ecec2009-02-27 19:43:04 -0800440 line6pcm->line6 = line6;
441 line6pcm->ep_audio_read = ep_read;
442 line6pcm->ep_audio_write = ep_write;
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800443 line6pcm->max_packet_size = usb_maxpacket(line6->usbdev,
Markus Grabner1027f4762010-08-12 01:35:30 +0200444 usb_rcvintpipe(line6->usbdev,
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800445 ep_read),
446 0);
Markus Grabner705ecec2009-02-27 19:43:04 -0800447 line6pcm->properties = properties;
448 line6->line6pcm = line6pcm;
449
450 /* PCM device: */
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800451 err = snd_device_new(line6->card, SNDRV_DEV_PCM, line6, &pcm_ops);
452 if (err < 0)
Markus Grabner705ecec2009-02-27 19:43:04 -0800453 return err;
454
455 snd_card_set_dev(line6->card, line6->ifcdev);
456
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800457 err = snd_line6_new_pcm(line6pcm);
458 if (err < 0)
Markus Grabner705ecec2009-02-27 19:43:04 -0800459 return err;
460
461 spin_lock_init(&line6pcm->lock_audio_out);
462 spin_lock_init(&line6pcm->lock_audio_in);
463 spin_lock_init(&line6pcm->lock_trigger);
464
Markus Grabner1027f4762010-08-12 01:35:30 +0200465 err = line6_create_audio_out_urbs(line6pcm);
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800466 if (err < 0)
Markus Grabner705ecec2009-02-27 19:43:04 -0800467 return err;
468
Markus Grabner1027f4762010-08-12 01:35:30 +0200469 err = line6_create_audio_in_urbs(line6pcm);
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800470 if (err < 0)
Markus Grabner705ecec2009-02-27 19:43:04 -0800471 return err;
472
473 /* mixer: */
Markus Grabner1027f4762010-08-12 01:35:30 +0200474 err = snd_ctl_add(line6->card, snd_ctl_new1(&line6_control_playback, line6pcm));
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800475 if (err < 0)
Markus Grabner705ecec2009-02-27 19:43:04 -0800476 return err;
477
Markus Grabner1027f4762010-08-12 01:35:30 +0200478#ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
479 /* impulse response test: */
480 err = device_create_file(line6->ifcdev, &dev_attr_impulse_volume);
481 if (err < 0)
482 return err;
483
484 err = device_create_file(line6->ifcdev, &dev_attr_impulse_period);
485 if (err < 0)
486 return err;
487
488 line6pcm->impulse_period = LINE6_IMPULSE_DEFAULT_PERIOD;
489#endif
490
Markus Grabner705ecec2009-02-27 19:43:04 -0800491 return 0;
492}
493
494/* prepare pcm callback */
495int snd_line6_prepare(struct snd_pcm_substream *substream)
496{
497 struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
498
Greg Kroah-Hartman68dc3dd2009-02-27 22:43:30 -0800499 if (!test_and_set_bit(BIT_PREPARED, &line6pcm->flags)) {
Markus Grabner1027f4762010-08-12 01:35:30 +0200500 line6pcm->count_out = 0;
Markus Grabner705ecec2009-02-27 19:43:04 -0800501 line6pcm->pos_out = 0;
502 line6pcm->pos_out_done = 0;
Markus Grabner705ecec2009-02-27 19:43:04 -0800503 line6pcm->bytes_out = 0;
Markus Grabner1027f4762010-08-12 01:35:30 +0200504 line6pcm->count_in = 0;
Markus Grabner705ecec2009-02-27 19:43:04 -0800505 line6pcm->pos_in_done = 0;
506 line6pcm->bytes_in = 0;
507 }
508
509 return 0;
510}