variax.c (7bfb8575b82cd1facde3dc5be2b125f408171646) | variax.c (ccddbe4a99536154e61d16c0f1c2df8a6d63f52a) |
---|---|
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#include <linux/slab.h> | 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#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 14#include "audio.h" 15#include "driver.h" | 18 19#include "audio.h" 20#include "driver.h" |
16#include "variax.h" | 21#include "usbdefs.h" |
17 | 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}; 72 |
|
18#define VARIAX_OFFSET_ACTIVATE 7 19 20/* 21 This message is sent by the device during initialization and identifies 22 the connected guitar version. 23*/ 24static const char variax_init_version[] = { 25 0xf0, 0x7e, 0x7f, 0x06, 0x02, 0x00, 0x01, 0x0c, --- 197 unchanged lines hidden (view full) --- 223 /* initiate startup procedure: */ 224 variax_startup1(variax); 225 return 0; 226} 227 228/* 229 Init workbench device (and clean up in case of failure). 230*/ | 73#define VARIAX_OFFSET_ACTIVATE 7 74 75/* 76 This message is sent by the device during initialization and identifies 77 the connected guitar version. 78*/ 79static const char variax_init_version[] = { 80 0xf0, 0x7e, 0x7f, 0x06, 0x02, 0x00, 0x01, 0x0c, --- 197 unchanged lines hidden (view full) --- 278 /* initiate startup procedure: */ 279 variax_startup1(variax); 280 return 0; 281} 282 283/* 284 Init workbench device (and clean up in case of failure). 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{ 233 int err = variax_try_init(interface, line6); 234 235 if (err < 0) 236 variax_destruct(interface); 237 238 return err; 239} | 288{ 289 int err = variax_try_init(interface, line6); 290 291 if (err < 0) 292 variax_destruct(interface); 293 294 return err; 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"); |
|