aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/line6
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-01-15 02:22:31 -0500
committerTakashi Iwai <tiwai@suse.de>2015-01-20 02:14:17 -0500
commitccddbe4a99536154e61d16c0f1c2df8a6d63f52a (patch)
tree440dbf9f275211e88b7594834041330f1ba2fb2b /sound/usb/line6
parent0f2524b347b1ce16ce6a34cb194445e25bc6ae42 (diff)
ALSA: line6: Split to each driver
Split to each individual driver for POD, PODHD, TonePort and Variax with a core LINE6 helper module. The new modules follow the standard ALSA naming rule with snd prefix: snd-usb-pod, snd-usb-podhd, snd-usb-toneport and snd-usb-variax, together with the corresponding CONFIG_SND_USB_* Kconfig items. Tested-by: Chris Rorvick <chris@rorvick.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/line6')
-rw-r--r--sound/usb/line6/Kconfig36
-rw-r--r--sound/usb/line6/Makefile21
-rw-r--r--sound/usb/line6/audio.c3
-rw-r--r--sound/usb/line6/capture.c1
-rw-r--r--sound/usb/line6/driver.c452
-rw-r--r--sound/usb/line6/driver.h39
-rw-r--r--sound/usb/line6/midi.c3
-rw-r--r--sound/usb/line6/pcm.c6
-rw-r--r--sound/usb/line6/playback.c1
-rw-r--r--sound/usb/line6/pod.c224
-rw-r--r--sound/usb/line6/pod.h92
-rw-r--r--sound/usb/line6/podhd.c124
-rw-r--r--sound/usb/line6/podhd.h29
-rw-r--r--sound/usb/line6/toneport.c188
-rw-r--r--sound/usb/line6/toneport.h51
-rw-r--r--sound/usb/line6/variax.c133
-rw-r--r--sound/usb/line6/variax.h70
17 files changed, 747 insertions, 726 deletions
diff --git a/sound/usb/line6/Kconfig b/sound/usb/line6/Kconfig
index 4f1219b4c692..33deb419dde8 100644
--- a/sound/usb/line6/Kconfig
+++ b/sound/usb/line6/Kconfig
@@ -1,12 +1,14 @@
1menuconfig LINE6_USB 1config SND_USB_LINE6
2 tristate "Line6 USB support" 2 tristate
3 depends on USB && SND
4 select SND_RAWMIDI 3 select SND_RAWMIDI
5 select SND_PCM 4 select SND_PCM
5
6config SND_USB_POD
7 tristate "Line6 POD USB support"
8 select SND_USB_LINE6
6 help 9 help
7 This is a driver for the guitar amp, cab, and effects modeller 10 This is a driver for PODxt and other similar devices,
8 PODxt Pro by Line6 (and similar devices), supporting the 11 supporting the following features:
9 following features:
10 * Reading/writing individual parameters 12 * Reading/writing individual parameters
11 * Reading/writing complete channel, effects setup, and amp 13 * Reading/writing complete channel, effects setup, and amp
12 setup data 14 setup data
@@ -18,14 +20,27 @@ menuconfig LINE6_USB
18 * Signal routing (record clean/processed guitar signal, 20 * Signal routing (record clean/processed guitar signal,
19 re-amping) 21 re-amping)
20 22
21 Preliminary support for the Variax Workbench and TonePort 23config SND_USB_PODHD
22 devices is included. 24 tristate "Line6 POD HD300/400/500 USB support"
25 select SND_USB_LINE6
26 help
27 This is a driver for POD HD300, 400 and 500 devices.
23 28
24if LINE6_USB 29config SND_USB_TONEPORT
30 tristate "TonePort GX, UX1 and UX2 USB support"
31 select SND_USB_LINE6
32 help
33 This is a driver for TonePort GX, UX1 and UX2 devices.
34
35config SND_USB_VARIAX
36 tristate "Variax Workbench USB support"
37 select SND_USB_LINE6
38 help
39 This is a driver for Variax Workbench device.
25 40
26config LINE6_USB_IMPULSE_RESPONSE 41config LINE6_USB_IMPULSE_RESPONSE
27 bool "measure impulse response" 42 bool "measure impulse response"
28 default n 43 depends on SND_USB_LINE6
29 help 44 help
30 Say Y here to add code to measure the impulse response of a Line6 45 Say Y here to add code to measure the impulse response of a Line6
31 device. This is more accurate than user-space methods since it 46 device. This is more accurate than user-space methods since it
@@ -35,4 +50,3 @@ config LINE6_USB_IMPULSE_RESPONSE
35 50
36 If unsure, say N. 51 If unsure, say N.
37 52
38endif # LINE6_USB
diff --git a/sound/usb/line6/Makefile b/sound/usb/line6/Makefile
index ae5c374b0f87..fa3a78dac097 100644
--- a/sound/usb/line6/Makefile
+++ b/sound/usb/line6/Makefile
@@ -1,14 +1,19 @@
1obj-$(CONFIG_LINE6_USB) += line6usb.o 1snd-usb-line6-y := \
2
3line6usb-y := \
4 audio.o \ 2 audio.o \
5 capture.o \ 3 capture.o \
6 driver.o \ 4 driver.o \
7 midi.o \ 5 midi.o \
8 midibuf.o \ 6 midibuf.o \
9 pcm.o \ 7 pcm.o \
10 playback.o \ 8 playback.o
11 pod.o \ 9
12 toneport.o \ 10snd-usb-pod-y := pod.o
13 variax.o \ 11snd-usb-podhd-y := podhd.o
14 podhd.o 12snd-usb-toneport-y := toneport.o
13snd-usb-variax-y := variax.o
14
15obj-$(CONFIG_SND_USB_LINE6) += snd-usb-line6.o
16obj-$(CONFIG_SND_USB_POD) += snd-usb-pod.o
17obj-$(CONFIG_SND_USB_PODHD) += snd-usb-podhd.o
18obj-$(CONFIG_SND_USB_TONEPORT) += snd-usb-toneport.o
19obj-$(CONFIG_SND_USB_VARIAX) += snd-usb-variax.o
diff --git a/sound/usb/line6/audio.c b/sound/usb/line6/audio.c
index 171d80c1b020..95686e5af4bd 100644
--- a/sound/usb/line6/audio.c
+++ b/sound/usb/line6/audio.c
@@ -40,6 +40,7 @@ int line6_init_audio(struct usb_line6 *line6)
40 dev_name(line6->ifcdev)); 40 dev_name(line6->ifcdev));
41 return 0; 41 return 0;
42} 42}
43EXPORT_SYMBOL_GPL(line6_init_audio);
43 44
44/* 45/*
45 Register the Line6 USB audio system. 46 Register the Line6 USB audio system.
@@ -54,6 +55,7 @@ int line6_register_audio(struct usb_line6 *line6)
54 55
55 return 0; 56 return 0;
56} 57}
58EXPORT_SYMBOL_GPL(line6_register_audio);
57 59
58/* 60/*
59 Cleanup the Line6 USB audio system. 61 Cleanup the Line6 USB audio system.
@@ -69,3 +71,4 @@ void line6_cleanup_audio(struct usb_line6 *line6)
69 snd_card_free(card); 71 snd_card_free(card);
70 line6->card = NULL; 72 line6->card = NULL;
71} 73}
74EXPORT_SYMBOL_GPL(line6_cleanup_audio);
diff --git a/sound/usb/line6/capture.c b/sound/usb/line6/capture.c
index f24c7c5e0a3e..da4ab013ea8e 100644
--- a/sound/usb/line6/capture.c
+++ b/sound/usb/line6/capture.c
@@ -18,7 +18,6 @@
18#include "capture.h" 18#include "capture.h"
19#include "driver.h" 19#include "driver.h"
20#include "pcm.h" 20#include "pcm.h"
21#include "pod.h"
22 21
23/* 22/*
24 Find a free URB and submit it. 23 Find a free URB and submit it.
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c
index 19904d677114..149c393c7302 100644
--- a/sound/usb/line6/driver.c
+++ b/sound/usb/line6/driver.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/export.h>
14#include <linux/slab.h> 15#include <linux/slab.h>
15#include <linux/usb.h> 16#include <linux/usb.h>
16 17
@@ -19,269 +20,20 @@
19#include "driver.h" 20#include "driver.h"
20#include "midi.h" 21#include "midi.h"
21#include "playback.h" 22#include "playback.h"
22#include "pod.h"
23#include "podhd.h"
24#include "revision.h" 23#include "revision.h"
25#include "toneport.h"
26#include "usbdefs.h" 24#include "usbdefs.h"
27#include "variax.h"
28 25
29#define DRIVER_AUTHOR "Markus Grabner <grabner@icg.tugraz.at>" 26#define DRIVER_AUTHOR "Markus Grabner <grabner@icg.tugraz.at>"
30#define DRIVER_DESC "Line6 USB Driver" 27#define DRIVER_DESC "Line6 USB Driver"
31#define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION 28#define DRIVER_VERSION "0.9.1beta" DRIVER_REVISION
32 29
33#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
34#define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
35
36/* table of devices that work with this driver */
37static const struct usb_device_id line6_id_table[] = {
38 { LINE6_DEVICE(0x4250), .driver_info = LINE6_BASSPODXT },
39 { LINE6_DEVICE(0x4642), .driver_info = LINE6_BASSPODXTLIVE },
40 { LINE6_DEVICE(0x4252), .driver_info = LINE6_BASSPODXTPRO },
41 { LINE6_DEVICE(0x4750), .driver_info = LINE6_GUITARPORT },
42 { LINE6_IF_NUM(0x5051, 1), .driver_info = LINE6_POCKETPOD },
43 { LINE6_DEVICE(0x5057), .driver_info = LINE6_PODHD300 },
44 { LINE6_DEVICE(0x5058), .driver_info = LINE6_PODHD400 },
45 { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500_0 },
46 { LINE6_IF_NUM(0x414D, 1), .driver_info = LINE6_PODHD500_1 },
47 { LINE6_DEVICE(0x4153), .driver_info = LINE6_PODSTUDIO_GX },
48 { LINE6_DEVICE(0x4150), .driver_info = LINE6_PODSTUDIO_UX1 },
49 { LINE6_IF_NUM(0x4151, 0), .driver_info = LINE6_PODSTUDIO_UX2 },
50 { LINE6_DEVICE(0x5044), .driver_info = LINE6_PODXT },
51 { LINE6_IF_NUM(0x4650, 0), .driver_info = LINE6_PODXTLIVE_POD },
52 { LINE6_IF_NUM(0x4650, 1), .driver_info = LINE6_PODXTLIVE_VARIAX },
53 { LINE6_DEVICE(0x5050), .driver_info = LINE6_PODXTPRO },
54 { LINE6_DEVICE(0x4147), .driver_info = LINE6_TONEPORT_GX },
55 { LINE6_DEVICE(0x4141), .driver_info = LINE6_TONEPORT_UX1 },
56 { LINE6_IF_NUM(0x4142, 0), .driver_info = LINE6_TONEPORT_UX2 },
57 { LINE6_DEVICE(0x534d), .driver_info = LINE6_VARIAX },
58 {}
59};
60
61MODULE_DEVICE_TABLE(usb, line6_id_table);
62
63static const struct line6_properties line6_properties_table[] = {
64 [LINE6_BASSPODXT] = {
65 .id = "BassPODxt",
66 .name = "BassPODxt",
67 .capabilities = LINE6_CAP_CONTROL
68 | LINE6_CAP_PCM
69 | LINE6_CAP_HWMON,
70 .altsetting = 5,
71 .ep_ctrl_r = 0x84,
72 .ep_ctrl_w = 0x03,
73 .ep_audio_r = 0x82,
74 .ep_audio_w = 0x01,
75 },
76 [LINE6_BASSPODXTLIVE] = {
77 .id = "BassPODxtLive",
78 .name = "BassPODxt Live",
79 .capabilities = LINE6_CAP_CONTROL
80 | LINE6_CAP_PCM
81 | LINE6_CAP_HWMON,
82 .altsetting = 1,
83 .ep_ctrl_r = 0x84,
84 .ep_ctrl_w = 0x03,
85 .ep_audio_r = 0x82,
86 .ep_audio_w = 0x01,
87 },
88 [LINE6_BASSPODXTPRO] = {
89 .id = "BassPODxtPro",
90 .name = "BassPODxt Pro",
91 .capabilities = LINE6_CAP_CONTROL
92 | LINE6_CAP_PCM
93 | LINE6_CAP_HWMON,
94 .altsetting = 5,
95 .ep_ctrl_r = 0x84,
96 .ep_ctrl_w = 0x03,
97 .ep_audio_r = 0x82,
98 .ep_audio_w = 0x01,
99 },
100 [LINE6_GUITARPORT] = {
101 .id = "GuitarPort",
102 .name = "GuitarPort",
103 .capabilities = LINE6_CAP_PCM,
104 .altsetting = 2, /* 1..4 seem to be ok */
105 /* no control channel */
106 .ep_audio_r = 0x82,
107 .ep_audio_w = 0x01,
108 },
109 [LINE6_POCKETPOD] = {
110 .id = "PocketPOD",
111 .name = "Pocket POD",
112 .capabilities = LINE6_CAP_CONTROL,
113 .altsetting = 0,
114 .ep_ctrl_r = 0x82,
115 .ep_ctrl_w = 0x02,
116 /* no audio channel */
117 },
118 [LINE6_PODHD300] = {
119 .id = "PODHD300",
120 .name = "POD HD300",
121 .capabilities = LINE6_CAP_CONTROL
122 | LINE6_CAP_PCM
123 | LINE6_CAP_HWMON,
124 .altsetting = 5,
125 .ep_ctrl_r = 0x84,
126 .ep_ctrl_w = 0x03,
127 .ep_audio_r = 0x82,
128 .ep_audio_w = 0x01,
129 },
130 [LINE6_PODHD400] = {
131 .id = "PODHD400",
132 .name = "POD HD400",
133 .capabilities = LINE6_CAP_CONTROL
134 | LINE6_CAP_PCM
135 | LINE6_CAP_HWMON,
136 .altsetting = 5,
137 .ep_ctrl_r = 0x84,
138 .ep_ctrl_w = 0x03,
139 .ep_audio_r = 0x82,
140 .ep_audio_w = 0x01,
141 },
142 [LINE6_PODHD500_0] = {
143 .id = "PODHD500",
144 .name = "POD HD500",
145 .capabilities = LINE6_CAP_CONTROL
146 | LINE6_CAP_PCM
147 | LINE6_CAP_HWMON,
148 .altsetting = 1,
149 .ep_ctrl_r = 0x81,
150 .ep_ctrl_w = 0x01,
151 .ep_audio_r = 0x86,
152 .ep_audio_w = 0x02,
153 },
154 [LINE6_PODHD500_1] = {
155 .id = "PODHD500",
156 .name = "POD HD500",
157 .capabilities = LINE6_CAP_CONTROL
158 | LINE6_CAP_PCM
159 | LINE6_CAP_HWMON,
160 .altsetting = 1,
161 .ep_ctrl_r = 0x81,
162 .ep_ctrl_w = 0x01,
163 .ep_audio_r = 0x86,
164 .ep_audio_w = 0x02,
165 },
166 [LINE6_PODSTUDIO_GX] = {
167 .id = "PODStudioGX",
168 .name = "POD Studio GX",
169 .capabilities = LINE6_CAP_PCM,
170 .altsetting = 2, /* 1..4 seem to be ok */
171 /* no control channel */
172 .ep_audio_r = 0x82,
173 .ep_audio_w = 0x01,
174 },
175 [LINE6_PODSTUDIO_UX1] = {
176 .id = "PODStudioUX1",
177 .name = "POD Studio UX1",
178 .capabilities = LINE6_CAP_PCM,
179 .altsetting = 2, /* 1..4 seem to be ok */
180 /* no control channel */
181 .ep_audio_r = 0x82,
182 .ep_audio_w = 0x01,
183 },
184 [LINE6_PODSTUDIO_UX2] = {
185 .id = "PODStudioUX2",
186 .name = "POD Studio UX2",
187 .capabilities = LINE6_CAP_PCM,
188 .altsetting = 2, /* defaults to 44.1kHz, 16-bit */
189 /* no control channel */
190 .ep_audio_r = 0x82,
191 .ep_audio_w = 0x01,
192 },
193 [LINE6_PODXT] = {
194 .id = "PODxt",
195 .name = "PODxt",
196 .capabilities = LINE6_CAP_CONTROL
197 | LINE6_CAP_PCM
198 | LINE6_CAP_HWMON,
199 .altsetting = 5,
200 .ep_ctrl_r = 0x84,
201 .ep_ctrl_w = 0x03,
202 .ep_audio_r = 0x82,
203 .ep_audio_w = 0x01,
204 },
205 [LINE6_PODXTLIVE_POD] = {
206 .id = "PODxtLive",
207 .name = "PODxt Live",
208 .capabilities = LINE6_CAP_CONTROL
209 | LINE6_CAP_PCM
210 | LINE6_CAP_HWMON,
211 .altsetting = 1,
212 .ep_ctrl_r = 0x84,
213 .ep_ctrl_w = 0x03,
214 .ep_audio_r = 0x82,
215 .ep_audio_w = 0x01,
216 },
217 [LINE6_PODXTLIVE_VARIAX] = {
218 .id = "PODxtLive",
219 .name = "PODxt Live",
220 .capabilities = LINE6_CAP_CONTROL
221 | LINE6_CAP_PCM
222 | LINE6_CAP_HWMON,
223 .altsetting = 1,
224 .ep_ctrl_r = 0x86,
225 .ep_ctrl_w = 0x05,
226 .ep_audio_r = 0x82,
227 .ep_audio_w = 0x01,
228 },
229 [LINE6_PODXTPRO] = {
230 .id = "PODxtPro",
231 .name = "PODxt Pro",
232 .capabilities = LINE6_CAP_CONTROL
233 | LINE6_CAP_PCM
234 | LINE6_CAP_HWMON,
235 .altsetting = 5,
236 .ep_ctrl_r = 0x84,
237 .ep_ctrl_w = 0x03,
238 .ep_audio_r = 0x82,
239 .ep_audio_w = 0x01,
240 },
241 [LINE6_TONEPORT_GX] = {
242 .id = "TonePortGX",
243 .name = "TonePort GX",
244 .capabilities = LINE6_CAP_PCM,
245 .altsetting = 2, /* 1..4 seem to be ok */
246 /* no control channel */
247 .ep_audio_r = 0x82,
248 .ep_audio_w = 0x01,
249 },
250 [LINE6_TONEPORT_UX1] = {
251 .id = "TonePortUX1",
252 .name = "TonePort UX1",
253 .capabilities = LINE6_CAP_PCM,
254 .altsetting = 2, /* 1..4 seem to be ok */
255 /* no control channel */
256 .ep_audio_r = 0x82,
257 .ep_audio_w = 0x01,
258 },
259 [LINE6_TONEPORT_UX2] = {
260 .id = "TonePortUX2",
261 .name = "TonePort UX2",
262 .capabilities = LINE6_CAP_PCM,
263 .altsetting = 2, /* defaults to 44.1kHz, 16-bit */
264 /* no control channel */
265 .ep_audio_r = 0x82,
266 .ep_audio_w = 0x01,
267 },
268 [LINE6_VARIAX] = {
269 .id = "Variax",
270 .name = "Variax Workbench",
271 .capabilities = LINE6_CAP_CONTROL,
272 .altsetting = 1,
273 .ep_ctrl_r = 0x82,
274 .ep_ctrl_w = 0x01,
275 /* no audio channel */
276 }
277};
278
279/* 30/*
280 This is Line6's MIDI manufacturer ID. 31 This is Line6's MIDI manufacturer ID.
281*/ 32*/
282const unsigned char line6_midi_id[] = { 33const unsigned char line6_midi_id[] = {
283 0x00, 0x01, 0x0c 34 0x00, 0x01, 0x0c
284}; 35};
36EXPORT_SYMBOL_GPL(line6_midi_id);
285 37
286/* 38/*
287 Code to request version of POD, Variax interface 39 Code to request version of POD, Variax interface
@@ -417,6 +169,7 @@ void line6_start_timer(struct timer_list *timer, unsigned int msecs,
417 setup_timer(timer, function, data); 169 setup_timer(timer, function, data);
418 mod_timer(timer, jiffies + msecs * HZ / 1000); 170 mod_timer(timer, jiffies + msecs * HZ / 1000);
419} 171}
172EXPORT_SYMBOL_GPL(line6_start_timer);
420 173
421/* 174/*
422 Asynchronously send raw message. 175 Asynchronously send raw message.
@@ -450,6 +203,7 @@ int line6_send_raw_message_async(struct usb_line6 *line6, const char *buffer,
450 /* start sending: */ 203 /* start sending: */
451 return line6_send_raw_message_async_part(msg, urb); 204 return line6_send_raw_message_async_part(msg, urb);
452} 205}
206EXPORT_SYMBOL_GPL(line6_send_raw_message_async);
453 207
454/* 208/*
455 Send asynchronous device version request. 209 Send asynchronous device version request.
@@ -471,6 +225,7 @@ int line6_version_request_async(struct usb_line6 *line6)
471 kfree(buffer); 225 kfree(buffer);
472 return retval; 226 return retval;
473} 227}
228EXPORT_SYMBOL_GPL(line6_version_request_async);
474 229
475/* 230/*
476 Send sysex message in pieces of wMaxPacketSize bytes. 231 Send sysex message in pieces of wMaxPacketSize bytes.
@@ -482,6 +237,7 @@ int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer,
482 size + SYSEX_EXTRA_SIZE) - 237 size + SYSEX_EXTRA_SIZE) -
483 SYSEX_EXTRA_SIZE; 238 SYSEX_EXTRA_SIZE;
484} 239}
240EXPORT_SYMBOL_GPL(line6_send_sysex_message);
485 241
486/* 242/*
487 Allocate buffer for sysex message and prepare header. 243 Allocate buffer for sysex message and prepare header.
@@ -503,6 +259,7 @@ char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2,
503 buffer[sizeof(line6_midi_id) + 3 + size] = LINE6_SYSEX_END; 259 buffer[sizeof(line6_midi_id) + 3 + size] = LINE6_SYSEX_END;
504 return buffer; 260 return buffer;
505} 261}
262EXPORT_SYMBOL_GPL(line6_alloc_sysex_buffer);
506 263
507/* 264/*
508 Notification of data received from the Line6 device. 265 Notification of data received from the Line6 device.
@@ -658,6 +415,7 @@ int line6_read_data(struct usb_line6 *line6, int address, void *data,
658 415
659 return 0; 416 return 0;
660} 417}
418EXPORT_SYMBOL_GPL(line6_read_data);
661 419
662/* 420/*
663 Write data to device. 421 Write data to device.
@@ -702,6 +460,7 @@ int line6_write_data(struct usb_line6 *line6, int address, void *data,
702 460
703 return 0; 461 return 0;
704} 462}
463EXPORT_SYMBOL_GPL(line6_write_data);
705 464
706/* 465/*
707 Read Line6 device serial number. 466 Read Line6 device serial number.
@@ -712,6 +471,7 @@ int line6_read_serial_number(struct usb_line6 *line6, int *serial_number)
712 return line6_read_data(line6, 0x80d0, serial_number, 471 return line6_read_data(line6, 0x80d0, serial_number,
713 sizeof(*serial_number)); 472 sizeof(*serial_number));
714} 473}
474EXPORT_SYMBOL_GPL(line6_read_serial_number);
715 475
716/* 476/*
717 No operation (i.e., unsupported). 477 No operation (i.e., unsupported).
@@ -721,6 +481,7 @@ ssize_t line6_nop_read(struct device *dev, struct device_attribute *attr,
721{ 481{
722 return 0; 482 return 0;
723} 483}
484EXPORT_SYMBOL_GPL(line6_nop_read);
724 485
725/* 486/*
726 Generic destructor. 487 Generic destructor.
@@ -744,30 +505,29 @@ static void line6_destruct(struct usb_interface *interface)
744 505
745 /* make sure the device isn't destructed twice: */ 506 /* make sure the device isn't destructed twice: */
746 usb_set_intfdata(interface, NULL); 507 usb_set_intfdata(interface, NULL);
747
748 /* free interface data: */
749 kfree(line6);
750} 508}
751 509
752/* 510/*
753 Probe USB device. 511 Probe USB device.
754*/ 512*/
755static int line6_probe(struct usb_interface *interface, 513int line6_probe(struct usb_interface *interface,
756 const struct usb_device_id *id) 514 struct usb_line6 *line6,
515 const struct line6_properties *properties,
516 int (*private_init)(struct usb_interface *, struct usb_line6 *))
757{ 517{
758 enum line6_device_type devtype;
759 struct usb_device *usbdev; 518 struct usb_device *usbdev;
760 struct usb_line6 *line6;
761 const struct line6_properties *properties;
762 int interface_number; 519 int interface_number;
763 int size = 0;
764 int ret; 520 int ret;
765 521
766 if (interface == NULL) 522 if (!interface) {
767 return -ENODEV; 523 ret = -ENODEV;
524 goto err_put;
525 }
768 usbdev = interface_to_usbdev(interface); 526 usbdev = interface_to_usbdev(interface);
769 if (usbdev == NULL) 527 if (!usbdev) {
770 return -ENODEV; 528 ret = -ENODEV;
529 goto err_put;
530 }
771 531
772 /* we don't handle multiple configurations */ 532 /* we don't handle multiple configurations */
773 if (usbdev->descriptor.bNumConfigurations != 1) { 533 if (usbdev->descriptor.bNumConfigurations != 1) {
@@ -775,10 +535,7 @@ static int line6_probe(struct usb_interface *interface,
775 goto err_put; 535 goto err_put;
776 } 536 }
777 537
778 devtype = id->driver_info;
779
780 /* initialize device info: */ 538 /* initialize device info: */
781 properties = &line6_properties_table[devtype];
782 dev_info(&interface->dev, "Line6 %s found\n", properties->name); 539 dev_info(&interface->dev, "Line6 %s found\n", properties->name);
783 540
784 /* query interface number */ 541 /* query interface number */
@@ -791,76 +548,10 @@ static int line6_probe(struct usb_interface *interface,
791 goto err_put; 548 goto err_put;
792 } 549 }
793 550
794 /* initialize device data based on device: */
795 switch (devtype) {
796 case LINE6_BASSPODXT:
797 case LINE6_BASSPODXTLIVE:
798 case LINE6_BASSPODXTPRO:
799 case LINE6_PODXT:
800 case LINE6_PODXTPRO:
801 size = sizeof(struct usb_line6_pod);
802 break;
803
804 case LINE6_PODHD300:
805 case LINE6_PODHD400:
806 size = sizeof(struct usb_line6_podhd);
807 break;
808
809 case LINE6_PODHD500_0:
810 case LINE6_PODHD500_1:
811 size = sizeof(struct usb_line6_podhd);
812 break;
813
814 case LINE6_POCKETPOD:
815 size = sizeof(struct usb_line6_pod);
816 break;
817
818 case LINE6_PODSTUDIO_GX:
819 case LINE6_PODSTUDIO_UX1:
820 case LINE6_PODSTUDIO_UX2:
821 case LINE6_TONEPORT_GX:
822 case LINE6_TONEPORT_UX1:
823 case LINE6_TONEPORT_UX2:
824 case LINE6_GUITARPORT:
825 size = sizeof(struct usb_line6_toneport);
826 break;
827
828 case LINE6_PODXTLIVE_POD:
829 size = sizeof(struct usb_line6_pod);
830 break;
831
832 case LINE6_PODXTLIVE_VARIAX:
833 size = sizeof(struct usb_line6_variax);
834 break;
835
836 case LINE6_VARIAX:
837 size = sizeof(struct usb_line6_variax);
838 break;
839
840 default:
841 MISSING_CASE;
842 ret = -ENODEV;
843 goto err_put;
844 }
845
846 if (size == 0) {
847 dev_err(&interface->dev,
848 "driver bug: interface data size not set\n");
849 ret = -ENODEV;
850 goto err_put;
851 }
852
853 line6 = kzalloc(size, GFP_KERNEL);
854 if (line6 == NULL) {
855 ret = -ENODEV;
856 goto err_put;
857 }
858
859 /* store basic data: */ 551 /* store basic data: */
860 line6->properties = properties; 552 line6->properties = properties;
861 line6->usbdev = usbdev; 553 line6->usbdev = usbdev;
862 line6->ifcdev = &interface->dev; 554 line6->ifcdev = &interface->dev;
863 line6->type = devtype;
864 555
865 /* get data from endpoint descriptor (see usb_maxpacket): */ 556 /* get data from endpoint descriptor (see usb_maxpacket): */
866 { 557 {
@@ -903,7 +594,6 @@ static int line6_probe(struct usb_interface *interface,
903 594
904 if (line6->urb_listen == NULL) { 595 if (line6->urb_listen == NULL) {
905 dev_err(&interface->dev, "Out of memory\n"); 596 dev_err(&interface->dev, "Out of memory\n");
906 line6_destruct(interface);
907 ret = -ENOMEM; 597 ret = -ENOMEM;
908 goto err_destruct; 598 goto err_destruct;
909 } 599 }
@@ -917,50 +607,7 @@ static int line6_probe(struct usb_interface *interface,
917 } 607 }
918 608
919 /* initialize device data based on device: */ 609 /* initialize device data based on device: */
920 switch (devtype) { 610 ret = private_init(interface, line6);
921 case LINE6_BASSPODXT:
922 case LINE6_BASSPODXTLIVE:
923 case LINE6_BASSPODXTPRO:
924 case LINE6_POCKETPOD:
925 case LINE6_PODXT:
926 case LINE6_PODXTPRO:
927 ret = line6_pod_init(interface, line6);
928 break;
929
930 case LINE6_PODHD300:
931 case LINE6_PODHD400:
932 case LINE6_PODHD500_0:
933 case LINE6_PODHD500_1:
934 ret = line6_podhd_init(interface, line6);
935 break;
936
937 case LINE6_PODXTLIVE_POD:
938 ret = line6_pod_init(interface, line6);
939 break;
940
941 case LINE6_PODXTLIVE_VARIAX:
942 ret = line6_variax_init(interface, line6);
943 break;
944
945 case LINE6_VARIAX:
946 ret = line6_variax_init(interface, line6);
947 break;
948
949 case LINE6_PODSTUDIO_GX:
950 case LINE6_PODSTUDIO_UX1:
951 case LINE6_PODSTUDIO_UX2:
952 case LINE6_TONEPORT_GX:
953 case LINE6_TONEPORT_UX1:
954 case LINE6_TONEPORT_UX2:
955 case LINE6_GUITARPORT:
956 ret = line6_toneport_init(interface, line6);
957 break;
958
959 default:
960 MISSING_CASE;
961 ret = -ENODEV;
962 }
963
964 if (ret < 0) 611 if (ret < 0)
965 goto err_destruct; 612 goto err_destruct;
966 613
@@ -985,11 +632,12 @@ err_destruct:
985err_put: 632err_put:
986 return ret; 633 return ret;
987} 634}
635EXPORT_SYMBOL_GPL(line6_probe);
988 636
989/* 637/*
990 Line6 device disconnected. 638 Line6 device disconnected.
991*/ 639*/
992static void line6_disconnect(struct usb_interface *interface) 640void line6_disconnect(struct usb_interface *interface)
993{ 641{
994 struct usb_line6 *line6; 642 struct usb_line6 *line6;
995 struct usb_device *usbdev; 643 struct usb_device *usbdev;
@@ -1024,17 +672,21 @@ static void line6_disconnect(struct usb_interface *interface)
1024 672
1025 line6_destruct(interface); 673 line6_destruct(interface);
1026 674
675 /* free interface data: */
676 kfree(line6);
677
1027 /* decrement reference counters: */ 678 /* decrement reference counters: */
1028 usb_put_intf(interface); 679 usb_put_intf(interface);
1029 usb_put_dev(usbdev); 680 usb_put_dev(usbdev);
1030} 681}
682EXPORT_SYMBOL_GPL(line6_disconnect);
1031 683
1032#ifdef CONFIG_PM 684#ifdef CONFIG_PM
1033 685
1034/* 686/*
1035 Suspend Line6 device. 687 Suspend Line6 device.
1036*/ 688*/
1037static int line6_suspend(struct usb_interface *interface, pm_message_t message) 689int line6_suspend(struct usb_interface *interface, pm_message_t message)
1038{ 690{
1039 struct usb_line6 *line6 = usb_get_intfdata(interface); 691 struct usb_line6 *line6 = usb_get_intfdata(interface);
1040 struct snd_line6_pcm *line6pcm = line6->line6pcm; 692 struct snd_line6_pcm *line6pcm = line6->line6pcm;
@@ -1052,11 +704,12 @@ static int line6_suspend(struct usb_interface *interface, pm_message_t message)
1052 704
1053 return 0; 705 return 0;
1054} 706}
707EXPORT_SYMBOL_GPL(line6_suspend);
1055 708
1056/* 709/*
1057 Resume Line6 device. 710 Resume Line6 device.
1058*/ 711*/
1059static int line6_resume(struct usb_interface *interface) 712int line6_resume(struct usb_interface *interface)
1060{ 713{
1061 struct usb_line6 *line6 = usb_get_intfdata(interface); 714 struct usb_line6 *line6 = usb_get_intfdata(interface);
1062 715
@@ -1066,47 +719,10 @@ static int line6_resume(struct usb_interface *interface)
1066 snd_power_change_state(line6->card, SNDRV_CTL_POWER_D0); 719 snd_power_change_state(line6->card, SNDRV_CTL_POWER_D0);
1067 return 0; 720 return 0;
1068} 721}
1069 722EXPORT_SYMBOL_GPL(line6_resume);
1070/*
1071 Resume Line6 device after reset.
1072*/
1073static int line6_reset_resume(struct usb_interface *interface)
1074{
1075 struct usb_line6 *line6 = usb_get_intfdata(interface);
1076
1077 switch (line6->type) {
1078 case LINE6_PODSTUDIO_GX:
1079 case LINE6_PODSTUDIO_UX1:
1080 case LINE6_PODSTUDIO_UX2:
1081 case LINE6_TONEPORT_GX:
1082 case LINE6_TONEPORT_UX1:
1083 case LINE6_TONEPORT_UX2:
1084 case LINE6_GUITARPORT:
1085 line6_toneport_reset_resume((struct usb_line6_toneport *)line6);
1086
1087 default:
1088 break;
1089 }
1090
1091 return line6_resume(interface);
1092}
1093 723
1094#endif /* CONFIG_PM */ 724#endif /* CONFIG_PM */
1095 725
1096static struct usb_driver line6_driver = {
1097 .name = DRIVER_NAME,
1098 .probe = line6_probe,
1099 .disconnect = line6_disconnect,
1100#ifdef CONFIG_PM
1101 .suspend = line6_suspend,
1102 .resume = line6_resume,
1103 .reset_resume = line6_reset_resume,
1104#endif
1105 .id_table = line6_id_table,
1106};
1107
1108module_usb_driver(line6_driver);
1109
1110MODULE_AUTHOR(DRIVER_AUTHOR); 726MODULE_AUTHOR(DRIVER_AUTHOR);
1111MODULE_DESCRIPTION(DRIVER_DESC); 727MODULE_DESCRIPTION(DRIVER_DESC);
1112MODULE_LICENSE("GPL"); 728MODULE_LICENSE("GPL");
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h
index ad203f197e80..31cd318369e9 100644
--- a/sound/usb/line6/driver.h
+++ b/sound/usb/line6/driver.h
@@ -20,29 +20,6 @@
20 20
21#define DRIVER_NAME "line6usb" 21#define DRIVER_NAME "line6usb"
22 22
23enum line6_device_type {
24 LINE6_BASSPODXT,
25 LINE6_BASSPODXTLIVE,
26 LINE6_BASSPODXTPRO,
27 LINE6_GUITARPORT,
28 LINE6_POCKETPOD,
29 LINE6_PODHD300,
30 LINE6_PODHD400,
31 LINE6_PODHD500_0,
32 LINE6_PODHD500_1,
33 LINE6_PODSTUDIO_GX,
34 LINE6_PODSTUDIO_UX1,
35 LINE6_PODSTUDIO_UX2,
36 LINE6_PODXT,
37 LINE6_PODXTLIVE_POD,
38 LINE6_PODXTLIVE_VARIAX,
39 LINE6_PODXTPRO,
40 LINE6_TONEPORT_GX,
41 LINE6_TONEPORT_UX1,
42 LINE6_TONEPORT_UX2,
43 LINE6_VARIAX
44};
45
46#define LINE6_TIMEOUT 1 23#define LINE6_TIMEOUT 1
47#define LINE6_BUFSIZE_LISTEN 32 24#define LINE6_BUFSIZE_LISTEN 32
48#define LINE6_MESSAGE_MAXLEN 256 25#define LINE6_MESSAGE_MAXLEN 256
@@ -135,11 +112,6 @@ struct usb_line6 {
135 struct usb_device *usbdev; 112 struct usb_device *usbdev;
136 113
137 /** 114 /**
138 Device type.
139 */
140 enum line6_device_type type;
141
142 /**
143 Properties. 115 Properties.
144 */ 116 */
145 const struct line6_properties *properties; 117 const struct line6_properties *properties;
@@ -225,4 +197,15 @@ extern int line6_version_request_async(struct usb_line6 *line6);
225extern int line6_write_data(struct usb_line6 *line6, int address, void *data, 197extern int line6_write_data(struct usb_line6 *line6, int address, void *data,
226 size_t datalen); 198 size_t datalen);
227 199
200int line6_probe(struct usb_interface *interface,
201 struct usb_line6 *line6,
202 const struct line6_properties *properties,
203 int (*private_init)(struct usb_interface *, struct usb_line6 *));
204void line6_disconnect(struct usb_interface *interface);
205
206#ifdef CONFIG_PM
207int line6_suspend(struct usb_interface *interface, pm_message_t message);
208int line6_resume(struct usb_interface *interface);
209#endif
210
228#endif 211#endif
diff --git a/sound/usb/line6/midi.c b/sound/usb/line6/midi.c
index c9d725ae85a0..2a42d533f49c 100644
--- a/sound/usb/line6/midi.c
+++ b/sound/usb/line6/midi.c
@@ -11,13 +11,13 @@
11 11
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/usb.h> 13#include <linux/usb.h>
14#include <linux/export.h>
14#include <sound/core.h> 15#include <sound/core.h>
15#include <sound/rawmidi.h> 16#include <sound/rawmidi.h>
16 17
17#include "audio.h" 18#include "audio.h"
18#include "driver.h" 19#include "driver.h"
19#include "midi.h" 20#include "midi.h"
20#include "pod.h"
21#include "usbdefs.h" 21#include "usbdefs.h"
22 22
23#define line6_rawmidi_substream_midi(substream) \ 23#define line6_rawmidi_substream_midi(substream) \
@@ -319,3 +319,4 @@ int line6_init_midi(struct usb_line6 *line6)
319 spin_lock_init(&line6midi->midi_transmit_lock); 319 spin_lock_init(&line6midi->midi_transmit_lock);
320 return 0; 320 return 0;
321} 321}
322EXPORT_SYMBOL_GPL(line6_init_midi);
diff --git a/sound/usb/line6/pcm.c b/sound/usb/line6/pcm.c
index 6d4e5cd0482c..b7348b031bf7 100644
--- a/sound/usb/line6/pcm.c
+++ b/sound/usb/line6/pcm.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/export.h>
13#include <sound/core.h> 14#include <sound/core.h>
14#include <sound/control.h> 15#include <sound/control.h>
15#include <sound/pcm.h> 16#include <sound/pcm.h>
@@ -19,7 +20,6 @@
19#include "capture.h" 20#include "capture.h"
20#include "driver.h" 21#include "driver.h"
21#include "playback.h" 22#include "playback.h"
22#include "pod.h"
23 23
24#ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE 24#ifdef CONFIG_LINE6_USB_IMPULSE_RESPONSE
25 25
@@ -195,6 +195,7 @@ pcm_acquire_error:
195 line6_pcm_release(line6pcm, flags_final & channels); 195 line6_pcm_release(line6pcm, flags_final & channels);
196 return err; 196 return err;
197} 197}
198EXPORT_SYMBOL_GPL(line6_pcm_acquire);
198 199
199int line6_pcm_release(struct snd_line6_pcm *line6pcm, int channels) 200int line6_pcm_release(struct snd_line6_pcm *line6pcm, int channels)
200{ 201{
@@ -223,6 +224,7 @@ int line6_pcm_release(struct snd_line6_pcm *line6pcm, int channels)
223 224
224 return 0; 225 return 0;
225} 226}
227EXPORT_SYMBOL_GPL(line6_pcm_release);
226 228
227/* trigger callback */ 229/* trigger callback */
228int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd) 230int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
@@ -408,6 +410,7 @@ void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm)
408 line6_unlink_wait_clear_audio_out_urbs(line6pcm); 410 line6_unlink_wait_clear_audio_out_urbs(line6pcm);
409 line6_unlink_wait_clear_audio_in_urbs(line6pcm); 411 line6_unlink_wait_clear_audio_in_urbs(line6pcm);
410} 412}
413EXPORT_SYMBOL_GPL(line6_pcm_disconnect);
411 414
412/* 415/*
413 Create and register the PCM device and mixer entries. 416 Create and register the PCM device and mixer entries.
@@ -490,6 +493,7 @@ int line6_init_pcm(struct usb_line6 *line6,
490 493
491 return 0; 494 return 0;
492} 495}
496EXPORT_SYMBOL_GPL(line6_init_pcm);
493 497
494/* prepare pcm callback */ 498/* prepare pcm callback */
495int snd_line6_prepare(struct snd_pcm_substream *substream) 499int snd_line6_prepare(struct snd_pcm_substream *substream)
diff --git a/sound/usb/line6/playback.c b/sound/usb/line6/playback.c
index da2e3b8876b8..0a874105ccef 100644
--- a/sound/usb/line6/playback.c
+++ b/sound/usb/line6/playback.c
@@ -18,7 +18,6 @@
18#include "capture.h" 18#include "capture.h"
19#include "driver.h" 19#include "driver.h"
20#include "pcm.h" 20#include "pcm.h"
21#include "pod.h"
22#include "playback.h" 21#include "playback.h"
23 22
24/* 23/*
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c
index 85a43631996e..dde9c2b8ad0f 100644
--- a/sound/usb/line6/pod.c
+++ b/sound/usb/line6/pod.c
@@ -11,13 +11,94 @@
11 11
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/wait.h> 13#include <linux/wait.h>
14#include <linux/interrupt.h>
15#include <linux/module.h>
16#include <linux/usb.h>
17
18#include <sound/core.h>
14#include <sound/control.h> 19#include <sound/control.h>
15 20
16#include "audio.h" 21#include "audio.h"
17#include "capture.h" 22#include "capture.h"
18#include "driver.h" 23#include "driver.h"
19#include "playback.h" 24#include "playback.h"
20#include "pod.h" 25#include "usbdefs.h"
26
27/*
28 Locate name in binary program dump
29*/
30#define POD_NAME_OFFSET 0
31#define POD_NAME_LENGTH 16
32
33/*
34 Other constants
35*/
36#define POD_CONTROL_SIZE 0x80
37#define POD_BUFSIZE_DUMPREQ 7
38#define POD_STARTUP_DELAY 1000
39
40/*
41 Stages of POD startup procedure
42*/
43enum {
44 POD_STARTUP_INIT = 1,
45 POD_STARTUP_VERSIONREQ,
46 POD_STARTUP_WORKQUEUE,
47 POD_STARTUP_SETUP,
48 POD_STARTUP_LAST = POD_STARTUP_SETUP - 1
49};
50
51enum {
52 LINE6_BASSPODXT,
53 LINE6_BASSPODXTLIVE,
54 LINE6_BASSPODXTPRO,
55 LINE6_POCKETPOD,
56 LINE6_PODXT,
57 LINE6_PODXTLIVE_POD,
58 LINE6_PODXTPRO,
59};
60
61struct usb_line6_pod {
62 /**
63 Generic Line6 USB data.
64 */
65 struct usb_line6 line6;
66
67 /**
68 Instrument monitor level.
69 */
70 int monitor_level;
71
72 /**
73 Timer for device initializaton.
74 */
75 struct timer_list startup_timer;
76
77 /**
78 Work handler for device initializaton.
79 */
80 struct work_struct startup_work;
81
82 /**
83 Current progress in startup procedure.
84 */
85 int startup_progress;
86
87 /**
88 Serial number of device.
89 */
90 int serial_number;
91
92 /**
93 Firmware version (x 100).
94 */
95 int firmware_version;
96
97 /**
98 Device ID.
99 */
100 int device_id;
101};
21 102
22#define POD_SYSEX_CODE 3 103#define POD_SYSEX_CODE 3
23#define POD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */ 104#define POD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */
@@ -442,7 +523,8 @@ static int pod_try_init(struct usb_interface *interface,
442/* 523/*
443 Init POD device (and clean up in case of failure). 524 Init POD device (and clean up in case of failure).
444*/ 525*/
445int line6_pod_init(struct usb_interface *interface, struct usb_line6 *line6) 526static int pod_init(struct usb_interface *interface,
527 struct usb_line6 *line6)
446{ 528{
447 int err = pod_try_init(interface, line6); 529 int err = pod_try_init(interface, line6);
448 530
@@ -451,3 +533,141 @@ int line6_pod_init(struct usb_interface *interface, struct usb_line6 *line6)
451 533
452 return err; 534 return err;
453} 535}
536
537#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
538#define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
539
540/* table of devices that work with this driver */
541static const struct usb_device_id pod_id_table[] = {
542 { LINE6_DEVICE(0x4250), .driver_info = LINE6_BASSPODXT },
543 { LINE6_DEVICE(0x4642), .driver_info = LINE6_BASSPODXTLIVE },
544 { LINE6_DEVICE(0x4252), .driver_info = LINE6_BASSPODXTPRO },
545 { LINE6_IF_NUM(0x5051, 1), .driver_info = LINE6_POCKETPOD },
546 { LINE6_DEVICE(0x5044), .driver_info = LINE6_PODXT },
547 { LINE6_IF_NUM(0x4650, 0), .driver_info = LINE6_PODXTLIVE_POD },
548 { LINE6_DEVICE(0x5050), .driver_info = LINE6_PODXTPRO },
549 {}
550};
551
552MODULE_DEVICE_TABLE(usb, pod_id_table);
553
554static const struct line6_properties pod_properties_table[] = {
555 [LINE6_BASSPODXT] = {
556 .id = "BassPODxt",
557 .name = "BassPODxt",
558 .capabilities = LINE6_CAP_CONTROL
559 | LINE6_CAP_PCM
560 | LINE6_CAP_HWMON,
561 .altsetting = 5,
562 .ep_ctrl_r = 0x84,
563 .ep_ctrl_w = 0x03,
564 .ep_audio_r = 0x82,
565 .ep_audio_w = 0x01,
566 },
567 [LINE6_BASSPODXTLIVE] = {
568 .id = "BassPODxtLive",
569 .name = "BassPODxt Live",
570 .capabilities = LINE6_CAP_CONTROL
571 | LINE6_CAP_PCM
572 | LINE6_CAP_HWMON,
573 .altsetting = 1,
574 .ep_ctrl_r = 0x84,
575 .ep_ctrl_w = 0x03,
576 .ep_audio_r = 0x82,
577 .ep_audio_w = 0x01,
578 },
579 [LINE6_BASSPODXTPRO] = {
580 .id = "BassPODxtPro",
581 .name = "BassPODxt Pro",
582 .capabilities = LINE6_CAP_CONTROL
583 | LINE6_CAP_PCM
584 | LINE6_CAP_HWMON,
585 .altsetting = 5,
586 .ep_ctrl_r = 0x84,
587 .ep_ctrl_w = 0x03,
588 .ep_audio_r = 0x82,
589 .ep_audio_w = 0x01,
590 },
591 [LINE6_POCKETPOD] = {
592 .id = "PocketPOD",
593 .name = "Pocket POD",
594 .capabilities = LINE6_CAP_CONTROL,
595 .altsetting = 0,
596 .ep_ctrl_r = 0x82,
597 .ep_ctrl_w = 0x02,
598 /* no audio channel */
599 },
600 [LINE6_PODXT] = {
601 .id = "PODxt",
602 .name = "PODxt",
603 .capabilities = LINE6_CAP_CONTROL
604 | LINE6_CAP_PCM
605 | LINE6_CAP_HWMON,
606 .altsetting = 5,
607 .ep_ctrl_r = 0x84,
608 .ep_ctrl_w = 0x03,
609 .ep_audio_r = 0x82,
610 .ep_audio_w = 0x01,
611 },
612 [LINE6_PODXTLIVE_POD] = {
613 .id = "PODxtLive",
614 .name = "PODxt Live",
615 .capabilities = LINE6_CAP_CONTROL
616 | LINE6_CAP_PCM
617 | LINE6_CAP_HWMON,
618 .altsetting = 1,
619 .ep_ctrl_r = 0x84,
620 .ep_ctrl_w = 0x03,
621 .ep_audio_r = 0x82,
622 .ep_audio_w = 0x01,
623 },
624 [LINE6_PODXTPRO] = {
625 .id = "PODxtPro",
626 .name = "PODxt Pro",
627 .capabilities = LINE6_CAP_CONTROL
628 | LINE6_CAP_PCM
629 | LINE6_CAP_HWMON,
630 .altsetting = 5,
631 .ep_ctrl_r = 0x84,
632 .ep_ctrl_w = 0x03,
633 .ep_audio_r = 0x82,
634 .ep_audio_w = 0x01,
635 },
636};
637
638/*
639 Probe USB device.
640*/
641static int pod_probe(struct usb_interface *interface,
642 const struct usb_device_id *id)
643{
644 struct usb_line6_pod *pod;
645 int err;
646
647 pod = kzalloc(sizeof(*pod), GFP_KERNEL);
648 if (!pod)
649 return -ENODEV;
650 err = line6_probe(interface, &pod->line6,
651 &pod_properties_table[id->driver_info],
652 pod_init);
653 if (err < 0)
654 kfree(pod);
655 return err;
656}
657
658static struct usb_driver pod_driver = {
659 .name = KBUILD_MODNAME,
660 .probe = pod_probe,
661 .disconnect = line6_disconnect,
662#ifdef CONFIG_PM
663 .suspend = line6_suspend,
664 .resume = line6_resume,
665 .reset_resume = line6_resume,
666#endif
667 .id_table = pod_id_table,
668};
669
670module_usb_driver(pod_driver);
671
672MODULE_DESCRIPTION("Line6 POD USB driver");
673MODULE_LICENSE("GPL");
diff --git a/sound/usb/line6/pod.h b/sound/usb/line6/pod.h
deleted file mode 100644
index 87a8f0fa9cba..000000000000
--- a/sound/usb/line6/pod.h
+++ /dev/null
@@ -1,92 +0,0 @@
1/*
2 * Line6 Linux USB driver - 0.9.1beta
3 *
4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
5 *
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
12#ifndef POD_H
13#define POD_H
14
15#include <linux/interrupt.h>
16#include <linux/spinlock.h>
17#include <linux/usb.h>
18
19#include <sound/core.h>
20
21#include "driver.h"
22
23/*
24 Locate name in binary program dump
25*/
26#define POD_NAME_OFFSET 0
27#define POD_NAME_LENGTH 16
28
29/*
30 Other constants
31*/
32#define POD_CONTROL_SIZE 0x80
33#define POD_BUFSIZE_DUMPREQ 7
34#define POD_STARTUP_DELAY 1000
35
36/*
37 Stages of POD startup procedure
38*/
39enum {
40 POD_STARTUP_INIT = 1,
41 POD_STARTUP_VERSIONREQ,
42 POD_STARTUP_WORKQUEUE,
43 POD_STARTUP_SETUP,
44 POD_STARTUP_LAST = POD_STARTUP_SETUP - 1
45};
46
47struct usb_line6_pod {
48 /**
49 Generic Line6 USB data.
50 */
51 struct usb_line6 line6;
52
53 /**
54 Instrument monitor level.
55 */
56 int monitor_level;
57
58 /**
59 Timer for device initializaton.
60 */
61 struct timer_list startup_timer;
62
63 /**
64 Work handler for device initializaton.
65 */
66 struct work_struct startup_work;
67
68 /**
69 Current progress in startup procedure.
70 */
71 int startup_progress;
72
73 /**
74 Serial number of device.
75 */
76 int serial_number;
77
78 /**
79 Firmware version (x 100).
80 */
81 int firmware_version;
82
83 /**
84 Device ID.
85 */
86 int device_id;
87};
88
89extern int line6_pod_init(struct usb_interface *interface,
90 struct usb_line6 *line6);
91
92#endif
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c
index 27c5402cece8..84096326694c 100644
--- a/sound/usb/line6/podhd.c
+++ b/sound/usb/line6/podhd.c
@@ -9,13 +9,30 @@
9 * 9 *
10 */ 10 */
11 11
12#include <linux/usb.h>
13#include <linux/slab.h>
14#include <linux/module.h>
12#include <sound/core.h> 15#include <sound/core.h>
13#include <sound/pcm.h> 16#include <sound/pcm.h>
14 17
15#include "audio.h" 18#include "audio.h"
16#include "driver.h" 19#include "driver.h"
17#include "pcm.h" 20#include "pcm.h"
18#include "podhd.h" 21#include "usbdefs.h"
22
23enum {
24 LINE6_PODHD300,
25 LINE6_PODHD400,
26 LINE6_PODHD500_0,
27 LINE6_PODHD500_1,
28};
29
30struct usb_line6_podhd {
31 /**
32 Generic Line6 USB data.
33 */
34 struct usb_line6 line6;
35};
19 36
20#define PODHD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */ 37#define PODHD_BYTES_PER_FRAME 6 /* 24bit audio (stereo) */
21 38
@@ -141,10 +158,76 @@ static int podhd_try_init(struct usb_interface *interface,
141 return err; 158 return err;
142} 159}
143 160
161#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
162#define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
163
164/* table of devices that work with this driver */
165static const struct usb_device_id podhd_id_table[] = {
166 { LINE6_DEVICE(0x5057), .driver_info = LINE6_PODHD300 },
167 { LINE6_DEVICE(0x5058), .driver_info = LINE6_PODHD400 },
168 { LINE6_IF_NUM(0x414D, 0), .driver_info = LINE6_PODHD500_0 },
169 { LINE6_IF_NUM(0x414D, 1), .driver_info = LINE6_PODHD500_1 },
170 {}
171};
172
173MODULE_DEVICE_TABLE(usb, podhd_id_table);
174
175static const struct line6_properties podhd_properties_table[] = {
176 [LINE6_PODHD300] = {
177 .id = "PODHD300",
178 .name = "POD HD300",
179 .capabilities = LINE6_CAP_CONTROL
180 | LINE6_CAP_PCM
181 | LINE6_CAP_HWMON,
182 .altsetting = 5,
183 .ep_ctrl_r = 0x84,
184 .ep_ctrl_w = 0x03,
185 .ep_audio_r = 0x82,
186 .ep_audio_w = 0x01,
187 },
188 [LINE6_PODHD400] = {
189 .id = "PODHD400",
190 .name = "POD HD400",
191 .capabilities = LINE6_CAP_CONTROL
192 | LINE6_CAP_PCM
193 | LINE6_CAP_HWMON,
194 .altsetting = 5,
195 .ep_ctrl_r = 0x84,
196 .ep_ctrl_w = 0x03,
197 .ep_audio_r = 0x82,
198 .ep_audio_w = 0x01,
199 },
200 [LINE6_PODHD500_0] = {
201 .id = "PODHD500",
202 .name = "POD HD500",
203 .capabilities = LINE6_CAP_CONTROL
204 | LINE6_CAP_PCM
205 | LINE6_CAP_HWMON,
206 .altsetting = 1,
207 .ep_ctrl_r = 0x81,
208 .ep_ctrl_w = 0x01,
209 .ep_audio_r = 0x86,
210 .ep_audio_w = 0x02,
211 },
212 [LINE6_PODHD500_1] = {
213 .id = "PODHD500",
214 .name = "POD HD500",
215 .capabilities = LINE6_CAP_CONTROL
216 | LINE6_CAP_PCM
217 | LINE6_CAP_HWMON,
218 .altsetting = 1,
219 .ep_ctrl_r = 0x81,
220 .ep_ctrl_w = 0x01,
221 .ep_audio_r = 0x86,
222 .ep_audio_w = 0x02,
223 },
224};
225
144/* 226/*
145 Init POD HD device (and clean up in case of failure). 227 Init POD HD device (and clean up in case of failure).
146*/ 228*/
147int line6_podhd_init(struct usb_interface *interface, struct usb_line6 *line6) 229static int podhd_init(struct usb_interface *interface,
230 struct usb_line6 *line6)
148{ 231{
149 struct usb_line6_podhd *podhd = (struct usb_line6_podhd *) line6; 232 struct usb_line6_podhd *podhd = (struct usb_line6_podhd *) line6;
150 int err = podhd_try_init(interface, podhd); 233 int err = podhd_try_init(interface, podhd);
@@ -154,3 +237,40 @@ int line6_podhd_init(struct usb_interface *interface, struct usb_line6 *line6)
154 237
155 return err; 238 return err;
156} 239}
240
241/*
242 Probe USB device.
243*/
244static int podhd_probe(struct usb_interface *interface,
245 const struct usb_device_id *id)
246{
247 struct usb_line6_podhd *podhd;
248 int err;
249
250 podhd = kzalloc(sizeof(*podhd), GFP_KERNEL);
251 if (!podhd)
252 return -ENODEV;
253 err = line6_probe(interface, &podhd->line6,
254 &podhd_properties_table[id->driver_info],
255 podhd_init);
256 if (err < 0)
257 kfree(podhd);
258 return err;
259}
260
261static struct usb_driver podhd_driver = {
262 .name = KBUILD_MODNAME,
263 .probe = podhd_probe,
264 .disconnect = line6_disconnect,
265#ifdef CONFIG_PM
266 .suspend = line6_suspend,
267 .resume = line6_resume,
268 .reset_resume = line6_resume,
269#endif
270 .id_table = podhd_id_table,
271};
272
273module_usb_driver(podhd_driver);
274
275MODULE_DESCRIPTION("Line6 PODHD USB driver");
276MODULE_LICENSE("GPL");
diff --git a/sound/usb/line6/podhd.h b/sound/usb/line6/podhd.h
deleted file mode 100644
index a14f711f9725..000000000000
--- a/sound/usb/line6/podhd.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Line6 Pod HD
3 *
4 * Copyright (C) 2011 Stefan Hajnoczi <stefanha@gmail.com>
5 *
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
12#ifndef PODHD_H
13#define PODHD_H
14
15#include <linux/usb.h>
16
17#include "driver.h"
18
19struct usb_line6_podhd {
20 /**
21 Generic Line6 USB data.
22 */
23 struct usb_line6 line6;
24};
25
26extern int line6_podhd_init(struct usb_interface *interface,
27 struct usb_line6 *line6);
28
29#endif /* PODHD_H */
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c
index 7f97f4a812a7..4f07643e47f2 100644
--- a/sound/usb/line6/toneport.c
+++ b/sound/usb/line6/toneport.c
@@ -11,13 +11,59 @@
11 */ 11 */
12 12
13#include <linux/wait.h> 13#include <linux/wait.h>
14#include <linux/usb.h>
15#include <linux/slab.h>
16#include <linux/module.h>
17#include <sound/core.h>
14#include <sound/control.h> 18#include <sound/control.h>
15 19
16#include "audio.h" 20#include "audio.h"
17#include "capture.h" 21#include "capture.h"
18#include "driver.h" 22#include "driver.h"
19#include "playback.h" 23#include "playback.h"
20#include "toneport.h" 24#include "usbdefs.h"
25
26enum line6_device_type {
27 LINE6_GUITARPORT,
28 LINE6_PODSTUDIO_GX,
29 LINE6_PODSTUDIO_UX1,
30 LINE6_PODSTUDIO_UX2,
31 LINE6_TONEPORT_GX,
32 LINE6_TONEPORT_UX1,
33 LINE6_TONEPORT_UX2,
34};
35
36struct usb_line6_toneport {
37 /**
38 Generic Line6 USB data.
39 */
40 struct usb_line6 line6;
41
42 /**
43 Source selector.
44 */
45 int source;
46
47 /**
48 Serial number of device.
49 */
50 int serial_number;
51
52 /**
53 Firmware version (x 100).
54 */
55 int firmware_version;
56
57 /**
58 Timer for delayed PCM startup.
59 */
60 struct timer_list timer;
61
62 /**
63 Device type.
64 */
65 enum line6_device_type type;
66};
21 67
22static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2); 68static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2);
23 69
@@ -319,7 +365,7 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
319 toneport_send_cmd(usbdev, 0x0301, 0x0000); 365 toneport_send_cmd(usbdev, 0x0301, 0x0000);
320 366
321 /* initialize source select: */ 367 /* initialize source select: */
322 switch (line6->type) { 368 switch (toneport->type) {
323 case LINE6_TONEPORT_UX1: 369 case LINE6_TONEPORT_UX1:
324 case LINE6_TONEPORT_UX2: 370 case LINE6_TONEPORT_UX2:
325 case LINE6_PODSTUDIO_UX1: 371 case LINE6_PODSTUDIO_UX1:
@@ -331,7 +377,7 @@ static void toneport_setup(struct usb_line6_toneport *toneport)
331 break; 377 break;
332 } 378 }
333 379
334 if (toneport_has_led(line6->type)) 380 if (toneport_has_led(toneport->type))
335 toneport_update_led(&usbdev->dev); 381 toneport_update_led(&usbdev->dev);
336} 382}
337 383
@@ -400,7 +446,7 @@ static int toneport_try_init(struct usb_interface *interface,
400 return err; 446 return err;
401 447
402 /* register source select control: */ 448 /* register source select control: */
403 switch (line6->type) { 449 switch (toneport->type) {
404 case LINE6_TONEPORT_UX1: 450 case LINE6_TONEPORT_UX1:
405 case LINE6_TONEPORT_UX2: 451 case LINE6_TONEPORT_UX2:
406 case LINE6_PODSTUDIO_UX1: 452 case LINE6_PODSTUDIO_UX1:
@@ -424,7 +470,7 @@ static int toneport_try_init(struct usb_interface *interface,
424 line6_read_serial_number(line6, &toneport->serial_number); 470 line6_read_serial_number(line6, &toneport->serial_number);
425 line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1); 471 line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);
426 472
427 if (toneport_has_led(line6->type)) { 473 if (toneport_has_led(toneport->type)) {
428 CHECK_RETURN(device_create_file 474 CHECK_RETURN(device_create_file
429 (&interface->dev, &dev_attr_led_red)); 475 (&interface->dev, &dev_attr_led_red));
430 CHECK_RETURN(device_create_file 476 CHECK_RETURN(device_create_file
@@ -443,8 +489,8 @@ static int toneport_try_init(struct usb_interface *interface,
443/* 489/*
444 Init Toneport device (and clean up in case of failure). 490 Init Toneport device (and clean up in case of failure).
445*/ 491*/
446int line6_toneport_init(struct usb_interface *interface, 492static int toneport_init(struct usb_interface *interface,
447 struct usb_line6 *line6) 493 struct usb_line6 *line6)
448{ 494{
449 int err = toneport_try_init(interface, line6); 495 int err = toneport_try_init(interface, line6);
450 496
@@ -454,10 +500,134 @@ int line6_toneport_init(struct usb_interface *interface,
454 return err; 500 return err;
455} 501}
456 502
503#ifdef CONFIG_PM
457/* 504/*
458 Resume Toneport device after reset. 505 Resume Toneport device after reset.
459*/ 506*/
460void line6_toneport_reset_resume(struct usb_line6_toneport *toneport) 507static int toneport_reset_resume(struct usb_interface *interface)
461{ 508{
462 toneport_setup(toneport); 509 toneport_setup(usb_get_intfdata(interface));
510 return line6_resume(interface);
463} 511}
512#endif
513
514#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
515#define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
516
517/* table of devices that work with this driver */
518static const struct usb_device_id toneport_id_table[] = {
519 { LINE6_DEVICE(0x4750), .driver_info = LINE6_GUITARPORT },
520 { LINE6_DEVICE(0x4153), .driver_info = LINE6_PODSTUDIO_GX },
521 { LINE6_DEVICE(0x4150), .driver_info = LINE6_PODSTUDIO_UX1 },
522 { LINE6_IF_NUM(0x4151, 0), .driver_info = LINE6_PODSTUDIO_UX2 },
523 { LINE6_DEVICE(0x4147), .driver_info = LINE6_TONEPORT_GX },
524 { LINE6_DEVICE(0x4141), .driver_info = LINE6_TONEPORT_UX1 },
525 { LINE6_IF_NUM(0x4142, 0), .driver_info = LINE6_TONEPORT_UX2 },
526 {}
527};
528
529MODULE_DEVICE_TABLE(usb, toneport_id_table);
530
531static const struct line6_properties toneport_properties_table[] = {
532 [LINE6_GUITARPORT] = {
533 .id = "GuitarPort",
534 .name = "GuitarPort",
535 .capabilities = LINE6_CAP_PCM,
536 .altsetting = 2, /* 1..4 seem to be ok */
537 /* no control channel */
538 .ep_audio_r = 0x82,
539 .ep_audio_w = 0x01,
540 },
541 [LINE6_PODSTUDIO_GX] = {
542 .id = "PODStudioGX",
543 .name = "POD Studio GX",
544 .capabilities = LINE6_CAP_PCM,
545 .altsetting = 2, /* 1..4 seem to be ok */
546 /* no control channel */
547 .ep_audio_r = 0x82,
548 .ep_audio_w = 0x01,
549 },
550 [LINE6_PODSTUDIO_UX1] = {
551 .id = "PODStudioUX1",
552 .name = "POD Studio UX1",
553 .capabilities = LINE6_CAP_PCM,
554 .altsetting = 2, /* 1..4 seem to be ok */
555 /* no control channel */
556 .ep_audio_r = 0x82,
557 .ep_audio_w = 0x01,
558 },
559 [LINE6_PODSTUDIO_UX2] = {
560 .id = "PODStudioUX2",
561 .name = "POD Studio UX2",
562 .capabilities = LINE6_CAP_PCM,
563 .altsetting = 2, /* defaults to 44.1kHz, 16-bit */
564 /* no control channel */
565 .ep_audio_r = 0x82,
566 .ep_audio_w = 0x01,
567 },
568 [LINE6_TONEPORT_GX] = {
569 .id = "TonePortGX",
570 .name = "TonePort GX",
571 .capabilities = LINE6_CAP_PCM,
572 .altsetting = 2, /* 1..4 seem to be ok */
573 /* no control channel */
574 .ep_audio_r = 0x82,
575 .ep_audio_w = 0x01,
576 },
577 [LINE6_TONEPORT_UX1] = {
578 .id = "TonePortUX1",
579 .name = "TonePort UX1",
580 .capabilities = LINE6_CAP_PCM,
581 .altsetting = 2, /* 1..4 seem to be ok */
582 /* no control channel */
583 .ep_audio_r = 0x82,
584 .ep_audio_w = 0x01,
585 },
586 [LINE6_TONEPORT_UX2] = {
587 .id = "TonePortUX2",
588 .name = "TonePort UX2",
589 .capabilities = LINE6_CAP_PCM,
590 .altsetting = 2, /* defaults to 44.1kHz, 16-bit */
591 /* no control channel */
592 .ep_audio_r = 0x82,
593 .ep_audio_w = 0x01,
594 },
595};
596
597/*
598 Probe USB device.
599*/
600static int toneport_probe(struct usb_interface *interface,
601 const struct usb_device_id *id)
602{
603 struct usb_line6_toneport *toneport;
604 int err;
605
606 toneport = kzalloc(sizeof(*toneport), GFP_KERNEL);
607 if (!toneport)
608 return -ENODEV;
609 toneport->type = id->driver_info;
610 err = line6_probe(interface, &toneport->line6,
611 &toneport_properties_table[id->driver_info],
612 toneport_init);
613 if (err < 0)
614 kfree(toneport);
615 return err;
616}
617
618static struct usb_driver toneport_driver = {
619 .name = KBUILD_MODNAME,
620 .probe = toneport_probe,
621 .disconnect = line6_disconnect,
622#ifdef CONFIG_PM
623 .suspend = line6_suspend,
624 .resume = line6_resume,
625 .reset_resume = toneport_reset_resume,
626#endif
627 .id_table = toneport_id_table,
628};
629
630module_usb_driver(toneport_driver);
631
632MODULE_DESCRIPTION("TonePort USB driver");
633MODULE_LICENSE("GPL");
diff --git a/sound/usb/line6/toneport.h b/sound/usb/line6/toneport.h
deleted file mode 100644
index 8cb14426f6ae..000000000000
--- a/sound/usb/line6/toneport.h
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 * Line6 Linux USB driver - 0.9.1beta
3 *
4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
5 *
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
12#ifndef TONEPORT_H
13#define TONEPORT_H
14
15#include <linux/usb.h>
16#include <sound/core.h>
17
18#include "driver.h"
19
20struct usb_line6_toneport {
21 /**
22 Generic Line6 USB data.
23 */
24 struct usb_line6 line6;
25
26 /**
27 Source selector.
28 */
29 int source;
30
31 /**
32 Serial number of device.
33 */
34 int serial_number;
35
36 /**
37 Firmware version (x 100).
38 */
39 int firmware_version;
40
41 /**
42 Timer for delayed PCM startup.
43 */
44 struct timer_list timer;
45};
46
47extern int line6_toneport_init(struct usb_interface *interface,
48 struct usb_line6 *line6);
49extern void line6_toneport_reset_resume(struct usb_line6_toneport *toneport);
50
51#endif
diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c
index b4a41b0ad0ea..0c852bb1e76c 100644
--- a/sound/usb/line6/variax.c
+++ b/sound/usb/line6/variax.c
@@ -10,10 +10,65 @@
10 */ 10 */
11 11
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/spinlock.h>
14#include <linux/usb.h>
15#include <linux/wait.h>
16#include <linux/module.h>
17#include <sound/core.h>
13 18
14#include "audio.h" 19#include "audio.h"
15#include "driver.h" 20#include "driver.h"
16#include "variax.h" 21#include "usbdefs.h"
22
23#define VARIAX_STARTUP_DELAY1 1000
24#define VARIAX_STARTUP_DELAY3 100
25#define VARIAX_STARTUP_DELAY4 100
26
27/*
28 Stages of Variax startup procedure
29*/
30enum {
31 VARIAX_STARTUP_INIT = 1,
32 VARIAX_STARTUP_VERSIONREQ,
33 VARIAX_STARTUP_WAIT,
34 VARIAX_STARTUP_ACTIVATE,
35 VARIAX_STARTUP_WORKQUEUE,
36 VARIAX_STARTUP_SETUP,
37 VARIAX_STARTUP_LAST = VARIAX_STARTUP_SETUP - 1
38};
39
40enum {
41 LINE6_PODXTLIVE_VARIAX,
42 LINE6_VARIAX
43};
44
45struct usb_line6_variax {
46 /**
47 Generic Line6 USB data.
48 */
49 struct usb_line6 line6;
50
51 /**
52 Buffer for activation code.
53 */
54 unsigned char *buffer_activate;
55
56 /**
57 Handler for device initializaton.
58 */
59 struct work_struct startup_work;
60
61 /**
62 Timers for device initializaton.
63 */
64 struct timer_list startup_timer1;
65 struct timer_list startup_timer2;
66
67 /**
68 Current progress in startup procedure.
69 */
70 int startup_progress;
71};
17 72
18#define VARIAX_OFFSET_ACTIVATE 7 73#define VARIAX_OFFSET_ACTIVATE 7
19 74
@@ -228,7 +283,8 @@ static int variax_try_init(struct usb_interface *interface,
228/* 283/*
229 Init workbench device (and clean up in case of failure). 284 Init workbench device (and clean up in case of failure).
230*/ 285*/
231int line6_variax_init(struct usb_interface *interface, struct usb_line6 *line6) 286static int variax_init(struct usb_interface *interface,
287 struct usb_line6 *line6)
232{ 288{
233 int err = variax_try_init(interface, line6); 289 int err = variax_try_init(interface, line6);
234 290
@@ -237,3 +293,76 @@ int line6_variax_init(struct usb_interface *interface, struct usb_line6 *line6)
237 293
238 return err; 294 return err;
239} 295}
296
297#define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod)
298#define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n)
299
300/* table of devices that work with this driver */
301static const struct usb_device_id variax_id_table[] = {
302 { LINE6_IF_NUM(0x4650, 1), .driver_info = LINE6_PODXTLIVE_VARIAX },
303 { LINE6_DEVICE(0x534d), .driver_info = LINE6_VARIAX },
304 {}
305};
306
307MODULE_DEVICE_TABLE(usb, variax_id_table);
308
309static const struct line6_properties variax_properties_table[] = {
310 [LINE6_PODXTLIVE_VARIAX] = {
311 .id = "PODxtLive",
312 .name = "PODxt Live",
313 .capabilities = LINE6_CAP_CONTROL
314 | LINE6_CAP_PCM
315 | LINE6_CAP_HWMON,
316 .altsetting = 1,
317 .ep_ctrl_r = 0x86,
318 .ep_ctrl_w = 0x05,
319 .ep_audio_r = 0x82,
320 .ep_audio_w = 0x01,
321 },
322 [LINE6_VARIAX] = {
323 .id = "Variax",
324 .name = "Variax Workbench",
325 .capabilities = LINE6_CAP_CONTROL,
326 .altsetting = 1,
327 .ep_ctrl_r = 0x82,
328 .ep_ctrl_w = 0x01,
329 /* no audio channel */
330 }
331};
332
333/*
334 Probe USB device.
335*/
336static int variax_probe(struct usb_interface *interface,
337 const struct usb_device_id *id)
338{
339 struct usb_line6_variax *variax;
340 int err;
341
342 variax = kzalloc(sizeof(*variax), GFP_KERNEL);
343 if (!variax)
344 return -ENODEV;
345 err = line6_probe(interface, &variax->line6,
346 &variax_properties_table[id->driver_info],
347 variax_init);
348 if (err < 0)
349 kfree(variax);
350 return err;
351}
352
353static struct usb_driver variax_driver = {
354 .name = KBUILD_MODNAME,
355 .probe = variax_probe,
356 .disconnect = line6_disconnect,
357#ifdef CONFIG_PM
358 .suspend = line6_suspend,
359 .resume = line6_resume,
360 .reset_resume = line6_resume,
361#endif
362 .id_table = variax_id_table,
363};
364
365module_usb_driver(variax_driver);
366
367MODULE_DESCRIPTION("Vairax Workbench USB driver");
368MODULE_LICENSE("GPL");
diff --git a/sound/usb/line6/variax.h b/sound/usb/line6/variax.h
deleted file mode 100644
index dfb94e574cc4..000000000000
--- a/sound/usb/line6/variax.h
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Line6 Linux USB driver - 0.9.1beta
3 *
4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
5 *
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
12#ifndef VARIAX_H
13#define VARIAX_H
14
15#include <linux/spinlock.h>
16#include <linux/usb.h>
17#include <linux/wait.h>
18#include <sound/core.h>
19
20#include "driver.h"
21
22#define VARIAX_STARTUP_DELAY1 1000
23#define VARIAX_STARTUP_DELAY3 100
24#define VARIAX_STARTUP_DELAY4 100
25
26/*
27 Stages of Variax startup procedure
28*/
29enum {
30 VARIAX_STARTUP_INIT = 1,
31 VARIAX_STARTUP_VERSIONREQ,
32 VARIAX_STARTUP_WAIT,
33 VARIAX_STARTUP_ACTIVATE,
34 VARIAX_STARTUP_WORKQUEUE,
35 VARIAX_STARTUP_SETUP,
36 VARIAX_STARTUP_LAST = VARIAX_STARTUP_SETUP - 1
37};
38
39struct usb_line6_variax {
40 /**
41 Generic Line6 USB data.
42 */
43 struct usb_line6 line6;
44
45 /**
46 Buffer for activation code.
47 */
48 unsigned char *buffer_activate;
49
50 /**
51 Handler for device initializaton.
52 */
53 struct work_struct startup_work;
54
55 /**
56 Timers for device initializaton.
57 */
58 struct timer_list startup_timer1;
59 struct timer_list startup_timer2;
60
61 /**
62 Current progress in startup procedure.
63 */
64 int startup_progress;
65};
66
67extern int line6_variax_init(struct usb_interface *interface,
68 struct usb_line6 *line6);
69
70#endif