Commit | Line | Data |
---|---|---|
705ececd | 1 | /* |
c078a4aa | 2 | * Line 6 Linux USB driver |
705ececd | 3 | * |
1027f476 | 4 | * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at) |
705ececd MG |
5 | * Emil Myhrman (emil.myhrman@gmail.com) |
6 | * | |
7 | * This program is free software; you can redistribute it and/or | |
8 | * modify it under the terms of the GNU General Public License as | |
9 | * published by the Free Software Foundation, version 2. | |
10 | * | |
11 | */ | |
12 | ||
1027f476 | 13 | #include <linux/wait.h> |
ccddbe4a TI |
14 | #include <linux/usb.h> |
15 | #include <linux/slab.h> | |
16 | #include <linux/module.h> | |
f44edd7b | 17 | #include <linux/leds.h> |
ccddbe4a | 18 | #include <sound/core.h> |
1027f476 | 19 | #include <sound/control.h> |
705ececd | 20 | |
705ececd | 21 | #include "capture.h" |
1027f476 | 22 | #include "driver.h" |
705ececd | 23 | #include "playback.h" |
ccddbe4a TI |
24 | |
25 | enum line6_device_type { | |
26 | LINE6_GUITARPORT, | |
27 | LINE6_PODSTUDIO_GX, | |
28 | LINE6_PODSTUDIO_UX1, | |
29 | LINE6_PODSTUDIO_UX2, | |
30 | LINE6_TONEPORT_GX, | |
31 | LINE6_TONEPORT_UX1, | |
32 | LINE6_TONEPORT_UX2, | |
33 | }; | |
34 | ||
f44edd7b TI |
35 | struct usb_line6_toneport; |
36 | ||
37 | struct toneport_led { | |
38 | struct led_classdev dev; | |
39 | char name[64]; | |
40 | struct usb_line6_toneport *toneport; | |
41 | bool registered; | |
42 | }; | |
43 | ||
ccddbe4a | 44 | struct usb_line6_toneport { |
cddbd4f1 | 45 | /* Generic Line 6 USB data */ |
ccddbe4a TI |
46 | struct usb_line6 line6; |
47 | ||
cddbd4f1 | 48 | /* Source selector */ |
ccddbe4a TI |
49 | int source; |
50 | ||
cddbd4f1 | 51 | /* Serial number of device */ |
ccddbe4a TI |
52 | int serial_number; |
53 | ||
cddbd4f1 | 54 | /* Firmware version (x 100) */ |
ccddbe4a TI |
55 | int firmware_version; |
56 | ||
cddbd4f1 | 57 | /* Timer for delayed PCM startup */ |
ccddbe4a TI |
58 | struct timer_list timer; |
59 | ||
cddbd4f1 | 60 | /* Device type */ |
ccddbe4a | 61 | enum line6_device_type type; |
f44edd7b TI |
62 | |
63 | /* LED instances */ | |
64 | struct toneport_led leds[2]; | |
ccddbe4a | 65 | }; |
705ececd | 66 | |
705ececd MG |
67 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2); |
68 | ||
1027f476 MG |
69 | #define TONEPORT_PCM_DELAY 1 |
70 | ||
705ececd MG |
71 | static struct snd_ratden toneport_ratden = { |
72 | .num_min = 44100, | |
73 | .num_max = 44100, | |
74 | .num_step = 1, | |
75 | .den = 1 | |
76 | }; | |
77 | ||
78 | static struct line6_pcm_properties toneport_pcm_properties = { | |
1263f611 | 79 | .playback_hw = { |
e1a164d7 MG |
80 | .info = (SNDRV_PCM_INFO_MMAP | |
81 | SNDRV_PCM_INFO_INTERLEAVED | | |
82 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | |
83 | SNDRV_PCM_INFO_MMAP_VALID | | |
84 | SNDRV_PCM_INFO_PAUSE | | |
e1a164d7 MG |
85 | SNDRV_PCM_INFO_SYNC_START), |
86 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | |
87 | .rates = SNDRV_PCM_RATE_KNOT, | |
88 | .rate_min = 44100, | |
89 | .rate_max = 44100, | |
90 | .channels_min = 2, | |
91 | .channels_max = 2, | |
92 | .buffer_bytes_max = 60000, | |
93 | .period_bytes_min = 64, | |
94 | .period_bytes_max = 8192, | |
95 | .periods_min = 1, | |
96 | .periods_max = 1024}, | |
1263f611 | 97 | .capture_hw = { |
e1a164d7 MG |
98 | .info = (SNDRV_PCM_INFO_MMAP | |
99 | SNDRV_PCM_INFO_INTERLEAVED | | |
100 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | |
101 | SNDRV_PCM_INFO_MMAP_VALID | | |
e1a164d7 MG |
102 | SNDRV_PCM_INFO_SYNC_START), |
103 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | |
104 | .rates = SNDRV_PCM_RATE_KNOT, | |
105 | .rate_min = 44100, | |
106 | .rate_max = 44100, | |
107 | .channels_min = 2, | |
108 | .channels_max = 2, | |
109 | .buffer_bytes_max = 60000, | |
110 | .period_bytes_min = 64, | |
111 | .period_bytes_max = 8192, | |
112 | .periods_min = 1, | |
113 | .periods_max = 1024}, | |
1263f611 | 114 | .rates = { |
e1a164d7 MG |
115 | .nrats = 1, |
116 | .rats = &toneport_ratden}, | |
705ececd MG |
117 | .bytes_per_frame = 4 |
118 | }; | |
119 | ||
709b2fae | 120 | static const struct { |
1027f476 MG |
121 | const char *name; |
122 | int code; | |
709b2fae | 123 | } toneport_source_info[] = { |
e1a164d7 MG |
124 | {"Microphone", 0x0a01}, |
125 | {"Line", 0x0801}, | |
126 | {"Instrument", 0x0b01}, | |
127 | {"Inst & Mic", 0x0901} | |
1027f476 MG |
128 | }; |
129 | ||
705ececd MG |
130 | static int toneport_send_cmd(struct usb_device *usbdev, int cmd1, int cmd2) |
131 | { | |
132 | int ret; | |
705ececd | 133 | |
6353773b GKH |
134 | ret = usb_control_msg(usbdev, usb_sndctrlpipe(usbdev, 0), 0x67, |
135 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, | |
136 | cmd1, cmd2, NULL, 0, LINE6_TIMEOUT * HZ); | |
137 | ||
138 | if (ret < 0) { | |
d86938fb | 139 | dev_err(&usbdev->dev, "send failed (error %d)\n", ret); |
705ececd MG |
140 | return ret; |
141 | } | |
142 | ||
143 | return 0; | |
144 | } | |
145 | ||
1027f476 MG |
146 | /* monitor info callback */ |
147 | static int snd_toneport_monitor_info(struct snd_kcontrol *kcontrol, | |
148 | struct snd_ctl_elem_info *uinfo) | |
149 | { | |
150 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | |
151 | uinfo->count = 1; | |
152 | uinfo->value.integer.min = 0; | |
153 | uinfo->value.integer.max = 256; | |
154 | return 0; | |
155 | } | |
156 | ||
157 | /* monitor get callback */ | |
158 | static int snd_toneport_monitor_get(struct snd_kcontrol *kcontrol, | |
159 | struct snd_ctl_elem_value *ucontrol) | |
160 | { | |
161 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | |
f3c5261e | 162 | |
1027f476 MG |
163 | ucontrol->value.integer.value[0] = line6pcm->volume_monitor; |
164 | return 0; | |
165 | } | |
166 | ||
167 | /* monitor put callback */ | |
168 | static int snd_toneport_monitor_put(struct snd_kcontrol *kcontrol, | |
169 | struct snd_ctl_elem_value *ucontrol) | |
170 | { | |
171 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | |
247d95ee | 172 | int err; |
1027f476 | 173 | |
e1a164d7 | 174 | if (ucontrol->value.integer.value[0] == line6pcm->volume_monitor) |
1027f476 MG |
175 | return 0; |
176 | ||
177 | line6pcm->volume_monitor = ucontrol->value.integer.value[0]; | |
e1a164d7 | 178 | |
247d95ee TI |
179 | if (line6pcm->volume_monitor > 0) { |
180 | err = line6_pcm_acquire(line6pcm, LINE6_STREAM_MONITOR); | |
181 | if (err < 0) { | |
182 | line6pcm->volume_monitor = 0; | |
183 | line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR); | |
184 | return err; | |
185 | } | |
186 | } else { | |
63e20df1 | 187 | line6_pcm_release(line6pcm, LINE6_STREAM_MONITOR); |
247d95ee | 188 | } |
e1a164d7 | 189 | |
1027f476 MG |
190 | return 1; |
191 | } | |
192 | ||
193 | /* source info callback */ | |
194 | static int snd_toneport_source_info(struct snd_kcontrol *kcontrol, | |
195 | struct snd_ctl_elem_info *uinfo) | |
196 | { | |
197 | const int size = ARRAY_SIZE(toneport_source_info); | |
a6b4699d | 198 | |
1027f476 MG |
199 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
200 | uinfo->count = 1; | |
201 | uinfo->value.enumerated.items = size; | |
202 | ||
e1a164d7 | 203 | if (uinfo->value.enumerated.item >= size) |
1027f476 MG |
204 | uinfo->value.enumerated.item = size - 1; |
205 | ||
206 | strcpy(uinfo->value.enumerated.name, | |
207 | toneport_source_info[uinfo->value.enumerated.item].name); | |
208 | ||
209 | return 0; | |
210 | } | |
211 | ||
212 | /* source get callback */ | |
213 | static int snd_toneport_source_get(struct snd_kcontrol *kcontrol, | |
214 | struct snd_ctl_elem_value *ucontrol) | |
215 | { | |
216 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | |
e1a164d7 MG |
217 | struct usb_line6_toneport *toneport = |
218 | (struct usb_line6_toneport *)line6pcm->line6; | |
1027f476 MG |
219 | ucontrol->value.enumerated.item[0] = toneport->source; |
220 | return 0; | |
221 | } | |
222 | ||
223 | /* source put callback */ | |
224 | static int snd_toneport_source_put(struct snd_kcontrol *kcontrol, | |
225 | struct snd_ctl_elem_value *ucontrol) | |
226 | { | |
227 | struct snd_line6_pcm *line6pcm = snd_kcontrol_chip(kcontrol); | |
e1a164d7 MG |
228 | struct usb_line6_toneport *toneport = |
229 | (struct usb_line6_toneport *)line6pcm->line6; | |
c3cb718a | 230 | unsigned int source; |
1027f476 | 231 | |
c3cb718a DC |
232 | source = ucontrol->value.enumerated.item[0]; |
233 | if (source >= ARRAY_SIZE(toneport_source_info)) | |
234 | return -EINVAL; | |
235 | if (source == toneport->source) | |
1027f476 MG |
236 | return 0; |
237 | ||
c3cb718a | 238 | toneport->source = source; |
e1a164d7 | 239 | toneport_send_cmd(toneport->line6.usbdev, |
c3cb718a | 240 | toneport_source_info[source].code, 0x0000); |
1027f476 MG |
241 | return 1; |
242 | } | |
243 | ||
244 | static void toneport_start_pcm(unsigned long arg) | |
245 | { | |
246 | struct usb_line6_toneport *toneport = (struct usb_line6_toneport *)arg; | |
247 | struct usb_line6 *line6 = &toneport->line6; | |
f3c5261e | 248 | |
63e20df1 | 249 | line6_pcm_acquire(line6->line6pcm, LINE6_STREAM_MONITOR); |
1027f476 MG |
250 | } |
251 | ||
252 | /* control definition */ | |
253 | static struct snd_kcontrol_new toneport_control_monitor = { | |
254 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
255 | .name = "Monitor Playback Volume", | |
256 | .index = 0, | |
257 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, | |
258 | .info = snd_toneport_monitor_info, | |
259 | .get = snd_toneport_monitor_get, | |
260 | .put = snd_toneport_monitor_put | |
261 | }; | |
262 | ||
263 | /* source selector definition */ | |
264 | static struct snd_kcontrol_new toneport_control_source = { | |
265 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
266 | .name = "PCM Capture Source", | |
267 | .index = 0, | |
268 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, | |
269 | .info = snd_toneport_source_info, | |
270 | .get = snd_toneport_source_get, | |
271 | .put = snd_toneport_source_put | |
272 | }; | |
273 | ||
f44edd7b TI |
274 | /* |
275 | For the led on Guitarport. | |
276 | Brightness goes from 0x00 to 0x26. Set a value above this to have led | |
277 | blink. | |
278 | (void cmd_0x02(byte red, byte green) | |
279 | */ | |
280 | ||
281 | static bool toneport_has_led(enum line6_device_type type) | |
282 | { | |
283 | return | |
284 | (type == LINE6_GUITARPORT) || | |
285 | (type == LINE6_TONEPORT_GX); | |
286 | /* add your device here if you are missing support for the LEDs */ | |
287 | } | |
288 | ||
289 | static const char * const led_colors[2] = { "red", "green" }; | |
290 | static const int led_init_vals[2] = { 0x00, 0x26 }; | |
291 | ||
292 | static void toneport_update_led(struct usb_line6_toneport *toneport) | |
293 | { | |
294 | toneport_send_cmd(toneport->line6.usbdev, | |
295 | (toneport->leds[0].dev.brightness << 8) | 0x0002, | |
296 | toneport->leds[1].dev.brightness); | |
297 | } | |
298 | ||
299 | static void toneport_led_brightness_set(struct led_classdev *led_cdev, | |
300 | enum led_brightness brightness) | |
301 | { | |
302 | struct toneport_led *leds = | |
303 | container_of(led_cdev, struct toneport_led, dev); | |
304 | toneport_update_led(leds->toneport); | |
305 | } | |
306 | ||
307 | static int toneport_init_leds(struct usb_line6_toneport *toneport) | |
308 | { | |
309 | struct device *dev = &toneport->line6.usbdev->dev; | |
310 | int i, err; | |
311 | ||
312 | for (i = 0; i < 2; i++) { | |
313 | struct toneport_led *led = &toneport->leds[i]; | |
314 | struct led_classdev *leddev = &led->dev; | |
315 | ||
316 | led->toneport = toneport; | |
317 | snprintf(led->name, sizeof(led->name), "%s::%s", | |
318 | dev_name(dev), led_colors[i]); | |
319 | leddev->name = led->name; | |
320 | leddev->brightness = led_init_vals[i]; | |
321 | leddev->max_brightness = 0x26; | |
322 | leddev->brightness_set = toneport_led_brightness_set; | |
323 | err = led_classdev_register(dev, leddev); | |
324 | if (err) | |
325 | return err; | |
326 | led->registered = true; | |
327 | } | |
328 | ||
329 | return 0; | |
330 | } | |
331 | ||
332 | static void toneport_remove_leds(struct usb_line6_toneport *toneport) | |
333 | { | |
334 | struct toneport_led *led; | |
335 | int i; | |
336 | ||
337 | for (i = 0; i < 2; i++) { | |
338 | led = &toneport->leds[i]; | |
339 | if (!led->registered) | |
340 | break; | |
341 | led_classdev_unregister(&led->dev); | |
342 | led->registered = false; | |
343 | } | |
344 | } | |
345 | ||
705ececd | 346 | /* |
1027f476 | 347 | Setup Toneport device. |
705ececd | 348 | */ |
1027f476 | 349 | static void toneport_setup(struct usb_line6_toneport *toneport) |
705ececd | 350 | { |
1027f476 | 351 | int ticks; |
705ececd | 352 | struct usb_line6 *line6 = &toneport->line6; |
1027f476 MG |
353 | struct usb_device *usbdev = line6->usbdev; |
354 | ||
355 | /* sync time on device with host: */ | |
356 | ticks = (int)get_seconds(); | |
357 | line6_write_data(line6, 0x80c6, &ticks, 4); | |
358 | ||
359 | /* enable device: */ | |
360 | toneport_send_cmd(usbdev, 0x0301, 0x0000); | |
361 | ||
362 | /* initialize source select: */ | |
ccddbe4a | 363 | switch (toneport->type) { |
a23a8bff CR |
364 | case LINE6_TONEPORT_UX1: |
365 | case LINE6_TONEPORT_UX2: | |
366 | case LINE6_PODSTUDIO_UX1: | |
367 | case LINE6_PODSTUDIO_UX2: | |
e1a164d7 MG |
368 | toneport_send_cmd(usbdev, |
369 | toneport_source_info[toneport->source].code, | |
370 | 0x0000); | |
a23a8bff CR |
371 | default: |
372 | break; | |
1027f476 MG |
373 | } |
374 | ||
ccddbe4a | 375 | if (toneport_has_led(toneport->type)) |
f44edd7b | 376 | toneport_update_led(toneport); |
6dd1c05c TI |
377 | |
378 | mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ); | |
1027f476 MG |
379 | } |
380 | ||
d29b854f CR |
381 | /* |
382 | Toneport device disconnected. | |
383 | */ | |
f66fd990 | 384 | static void line6_toneport_disconnect(struct usb_line6 *line6) |
d29b854f | 385 | { |
f66fd990 TI |
386 | struct usb_line6_toneport *toneport = |
387 | (struct usb_line6_toneport *)line6; | |
d29b854f | 388 | |
d29b854f | 389 | del_timer_sync(&toneport->timer); |
d29b854f | 390 | |
f44edd7b TI |
391 | if (toneport_has_led(toneport->type)) |
392 | toneport_remove_leds(toneport); | |
d29b854f CR |
393 | } |
394 | ||
395 | ||
1027f476 MG |
396 | /* |
397 | Try to init Toneport device. | |
398 | */ | |
f66fd990 TI |
399 | static int toneport_init(struct usb_line6 *line6, |
400 | const struct usb_device_id *id) | |
1027f476 MG |
401 | { |
402 | int err; | |
a221dd45 | 403 | struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6; |
705ececd | 404 | |
f66fd990 | 405 | toneport->type = id->driver_info; |
6dd1c05c TI |
406 | setup_timer(&toneport->timer, toneport_start_pcm, |
407 | (unsigned long)toneport); | |
408 | ||
a46c4672 CR |
409 | line6->disconnect = line6_toneport_disconnect; |
410 | ||
705ececd | 411 | /* initialize PCM subsystem: */ |
6353773b | 412 | err = line6_init_pcm(line6, &toneport_pcm_properties); |
027360c5 | 413 | if (err < 0) |
705ececd | 414 | return err; |
705ececd | 415 | |
1027f476 | 416 | /* register monitor control: */ |
027360c5 GKH |
417 | err = snd_ctl_add(line6->card, |
418 | snd_ctl_new1(&toneport_control_monitor, | |
419 | line6->line6pcm)); | |
420 | if (err < 0) | |
1027f476 | 421 | return err; |
1027f476 MG |
422 | |
423 | /* register source select control: */ | |
ccddbe4a | 424 | switch (toneport->type) { |
a23a8bff CR |
425 | case LINE6_TONEPORT_UX1: |
426 | case LINE6_TONEPORT_UX2: | |
427 | case LINE6_PODSTUDIO_UX1: | |
428 | case LINE6_PODSTUDIO_UX2: | |
e1a164d7 MG |
429 | err = |
430 | snd_ctl_add(line6->card, | |
431 | snd_ctl_new1(&toneport_control_source, | |
432 | line6->line6pcm)); | |
027360c5 | 433 | if (err < 0) |
1027f476 | 434 | return err; |
a23a8bff CR |
435 | |
436 | default: | |
437 | break; | |
1027f476 MG |
438 | } |
439 | ||
705ececd MG |
440 | line6_read_serial_number(line6, &toneport->serial_number); |
441 | line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1); | |
442 | ||
ccddbe4a | 443 | if (toneport_has_led(toneport->type)) { |
f44edd7b | 444 | err = toneport_init_leds(toneport); |
b2a3b023 TI |
445 | if (err < 0) |
446 | return err; | |
1027f476 | 447 | } |
705ececd | 448 | |
1027f476 | 449 | toneport_setup(toneport); |
705ececd | 450 | |
85a9339b TI |
451 | /* register audio system: */ |
452 | return snd_card_register(line6->card); | |
1027f476 MG |
453 | } |
454 | ||
ccddbe4a | 455 | #ifdef CONFIG_PM |
1027f476 MG |
456 | /* |
457 | Resume Toneport device after reset. | |
458 | */ | |
ccddbe4a | 459 | static int toneport_reset_resume(struct usb_interface *interface) |
1027f476 | 460 | { |
ccddbe4a TI |
461 | toneport_setup(usb_get_intfdata(interface)); |
462 | return line6_resume(interface); | |
1027f476 | 463 | } |
ccddbe4a TI |
464 | #endif |
465 | ||
466 | #define LINE6_DEVICE(prod) USB_DEVICE(0x0e41, prod) | |
467 | #define LINE6_IF_NUM(prod, n) USB_DEVICE_INTERFACE_NUMBER(0x0e41, prod, n) | |
468 | ||
469 | /* table of devices that work with this driver */ | |
470 | static const struct usb_device_id toneport_id_table[] = { | |
471 | { LINE6_DEVICE(0x4750), .driver_info = LINE6_GUITARPORT }, | |
472 | { LINE6_DEVICE(0x4153), .driver_info = LINE6_PODSTUDIO_GX }, | |
473 | { LINE6_DEVICE(0x4150), .driver_info = LINE6_PODSTUDIO_UX1 }, | |
474 | { LINE6_IF_NUM(0x4151, 0), .driver_info = LINE6_PODSTUDIO_UX2 }, | |
475 | { LINE6_DEVICE(0x4147), .driver_info = LINE6_TONEPORT_GX }, | |
476 | { LINE6_DEVICE(0x4141), .driver_info = LINE6_TONEPORT_UX1 }, | |
477 | { LINE6_IF_NUM(0x4142, 0), .driver_info = LINE6_TONEPORT_UX2 }, | |
478 | {} | |
479 | }; | |
480 | ||
481 | MODULE_DEVICE_TABLE(usb, toneport_id_table); | |
482 | ||
483 | static const struct line6_properties toneport_properties_table[] = { | |
484 | [LINE6_GUITARPORT] = { | |
485 | .id = "GuitarPort", | |
486 | .name = "GuitarPort", | |
487 | .capabilities = LINE6_CAP_PCM, | |
488 | .altsetting = 2, /* 1..4 seem to be ok */ | |
489 | /* no control channel */ | |
490 | .ep_audio_r = 0x82, | |
491 | .ep_audio_w = 0x01, | |
492 | }, | |
493 | [LINE6_PODSTUDIO_GX] = { | |
494 | .id = "PODStudioGX", | |
495 | .name = "POD Studio GX", | |
496 | .capabilities = LINE6_CAP_PCM, | |
497 | .altsetting = 2, /* 1..4 seem to be ok */ | |
498 | /* no control channel */ | |
499 | .ep_audio_r = 0x82, | |
500 | .ep_audio_w = 0x01, | |
501 | }, | |
502 | [LINE6_PODSTUDIO_UX1] = { | |
503 | .id = "PODStudioUX1", | |
504 | .name = "POD Studio UX1", | |
505 | .capabilities = LINE6_CAP_PCM, | |
506 | .altsetting = 2, /* 1..4 seem to be ok */ | |
507 | /* no control channel */ | |
508 | .ep_audio_r = 0x82, | |
509 | .ep_audio_w = 0x01, | |
510 | }, | |
511 | [LINE6_PODSTUDIO_UX2] = { | |
512 | .id = "PODStudioUX2", | |
513 | .name = "POD Studio UX2", | |
514 | .capabilities = LINE6_CAP_PCM, | |
515 | .altsetting = 2, /* defaults to 44.1kHz, 16-bit */ | |
516 | /* no control channel */ | |
517 | .ep_audio_r = 0x82, | |
518 | .ep_audio_w = 0x01, | |
519 | }, | |
520 | [LINE6_TONEPORT_GX] = { | |
521 | .id = "TonePortGX", | |
522 | .name = "TonePort GX", | |
523 | .capabilities = LINE6_CAP_PCM, | |
524 | .altsetting = 2, /* 1..4 seem to be ok */ | |
525 | /* no control channel */ | |
526 | .ep_audio_r = 0x82, | |
527 | .ep_audio_w = 0x01, | |
528 | }, | |
529 | [LINE6_TONEPORT_UX1] = { | |
530 | .id = "TonePortUX1", | |
531 | .name = "TonePort UX1", | |
532 | .capabilities = LINE6_CAP_PCM, | |
533 | .altsetting = 2, /* 1..4 seem to be ok */ | |
534 | /* no control channel */ | |
535 | .ep_audio_r = 0x82, | |
536 | .ep_audio_w = 0x01, | |
537 | }, | |
538 | [LINE6_TONEPORT_UX2] = { | |
539 | .id = "TonePortUX2", | |
540 | .name = "TonePort UX2", | |
541 | .capabilities = LINE6_CAP_PCM, | |
542 | .altsetting = 2, /* defaults to 44.1kHz, 16-bit */ | |
543 | /* no control channel */ | |
544 | .ep_audio_r = 0x82, | |
545 | .ep_audio_w = 0x01, | |
546 | }, | |
547 | }; | |
548 | ||
549 | /* | |
550 | Probe USB device. | |
551 | */ | |
552 | static int toneport_probe(struct usb_interface *interface, | |
553 | const struct usb_device_id *id) | |
554 | { | |
aca514b8 | 555 | return line6_probe(interface, id, |
85a9339b | 556 | &toneport_properties_table[id->driver_info], |
aca514b8 | 557 | toneport_init, sizeof(struct usb_line6_toneport)); |
ccddbe4a TI |
558 | } |
559 | ||
560 | static struct usb_driver toneport_driver = { | |
561 | .name = KBUILD_MODNAME, | |
562 | .probe = toneport_probe, | |
563 | .disconnect = line6_disconnect, | |
564 | #ifdef CONFIG_PM | |
565 | .suspend = line6_suspend, | |
566 | .resume = line6_resume, | |
567 | .reset_resume = toneport_reset_resume, | |
568 | #endif | |
569 | .id_table = toneport_id_table, | |
570 | }; | |
571 | ||
572 | module_usb_driver(toneport_driver); | |
573 | ||
574 | MODULE_DESCRIPTION("TonePort USB driver"); | |
575 | MODULE_LICENSE("GPL"); |