Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
[pandora-kernel.git] / drivers / staging / line6 / variax.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 #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 #include "dumprequest.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 */
30 enum {
31         VARIAX_STARTUP_INIT = 1,
32         VARIAX_STARTUP_VERSIONREQ,
33         VARIAX_STARTUP_WAIT,
34         VARIAX_STARTUP_ACTIVATE,
35         VARIAX_STARTUP_DUMPREQ,
36         VARIAX_STARTUP_WORKQUEUE,
37         VARIAX_STARTUP_SETUP,
38         VARIAX_STARTUP_LAST = VARIAX_STARTUP_SETUP - 1
39 };
40
41 enum {
42         VARIAX_DUMP_PASS1 = LINE6_DUMP_CURRENT,
43         VARIAX_DUMP_PASS2,
44         VARIAX_DUMP_PASS3
45 };
46
47 /**
48         Binary Variax model dump
49 */
50 struct variax_model {
51         /**
52                 Header information (including program name).
53         */
54         unsigned char name[18];
55
56         /**
57                 Model parameters.
58         */
59         unsigned char control[78 * 2];
60 };
61
62 struct usb_line6_variax {
63         /**
64                 Generic Line6 USB data.
65         */
66         struct usb_line6 line6;
67
68         /**
69                 Dump request structure.
70                 Append two extra buffers for 3-pass data query.
71         */
72         struct line6_dump_request dumpreq;
73         struct line6_dump_reqbuf extrabuf[2];
74
75         /**
76                 Buffer for activation code.
77         */
78         unsigned char *buffer_activate;
79
80         /**
81                 Model number.
82         */
83         int model;
84
85         /**
86                 Current model settings.
87         */
88         struct variax_model model_data;
89
90         /**
91                 Name of connected guitar.
92         */
93         unsigned char guitar[18];
94
95         /**
96                 Name of current model bank.
97         */
98         unsigned char bank[18];
99
100         /**
101                 Position of volume dial.
102         */
103         int volume;
104
105         /**
106                 Position of tone control dial.
107         */
108         int tone;
109
110         /**
111                 Handler for device initializaton.
112         */
113         struct work_struct startup_work;
114
115         /**
116                 Timers for device initializaton.
117         */
118         struct timer_list startup_timer1;
119         struct timer_list startup_timer2;
120
121         /**
122                 Current progress in startup procedure.
123         */
124         int startup_progress;
125 };
126
127 extern void line6_variax_disconnect(struct usb_interface *interface);
128 extern int line6_variax_init(struct usb_interface *interface,
129                              struct usb_line6_variax *variax);
130 extern void line6_variax_process_message(struct usb_line6_variax *variax);
131
132 #endif