OSDN Git Service

0f9e83debc6f6f991c9f12af06d47d6005ba77e9
[android-x86/kernel.git] / drivers / staging / line6 / pod.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 POD_H
13 #define POD_H
14
15 #include <linux/interrupt.h>
16 #include <linux/spinlock.h>
17 #include <linux/usb.h>
18 #include <linux/wait.h>
19
20 #include <sound/core.h>
21
22 #include "driver.h"
23 #include "dumprequest.h"
24
25 /*
26         PODxt Live interfaces
27 */
28 #define PODXTLIVE_INTERFACE_POD    0
29 #define PODXTLIVE_INTERFACE_VARIAX 1
30
31 /*
32         Locate name in binary program dump
33 */
34 #define POD_NAME_OFFSET 0
35 #define POD_NAME_LENGTH 16
36
37 /*
38         Other constants
39 */
40 #define POD_CONTROL_SIZE 0x80
41 #define POD_BUFSIZE_DUMPREQ 7
42 #define POD_STARTUP_DELAY 1000
43
44 /*
45         Stages of POD startup procedure
46 */
47 enum {
48         POD_STARTUP_INIT = 1,
49         POD_STARTUP_DUMPREQ,
50         POD_STARTUP_VERSIONREQ,
51         POD_STARTUP_WORKQUEUE,
52         POD_STARTUP_SETUP,
53         POD_STARTUP_LAST = POD_STARTUP_SETUP - 1
54 };
55
56 /**
57         Data structure for values that need to be requested explicitly.
58         This is the case for system and tuner settings.
59 */
60 struct ValueWait {
61         int value;
62         wait_queue_head_t wait;
63 };
64
65 /**
66         Binary PODxt Pro program dump
67 */
68 struct pod_program {
69         /**
70                 Header information (including program name).
71         */
72         unsigned char header[0x20];
73
74         /**
75                 Program parameters.
76         */
77         unsigned char control[POD_CONTROL_SIZE];
78 };
79
80 struct usb_line6_pod {
81         /**
82                 Generic Line6 USB data.
83         */
84         struct usb_line6 line6;
85
86         /**
87                 Dump request structure.
88         */
89         struct line6_dump_request dumpreq;
90
91         /**
92                 Current program settings.
93         */
94         struct pod_program prog_data;
95
96         /**
97                 Buffer for data retrieved from or to be stored on PODxt Pro.
98         */
99         struct pod_program prog_data_buf;
100
101         /**
102                 Tuner mute mode.
103         */
104         struct ValueWait tuner_mute;
105
106         /**
107                 Tuner base frequency (typically 440Hz).
108         */
109         struct ValueWait tuner_freq;
110
111         /**
112                 Note received from tuner.
113         */
114         struct ValueWait tuner_note;
115
116         /**
117                 Pitch value received from tuner.
118         */
119         struct ValueWait tuner_pitch;
120
121         /**
122                 Instrument monitor level.
123         */
124         struct ValueWait monitor_level;
125
126         /**
127                 Audio routing mode.
128                 0: send processed guitar
129                 1: send clean guitar
130                 2: send clean guitar re-amp playback
131                 3: send re-amp playback
132         */
133         struct ValueWait routing;
134
135         /**
136                 Wait for audio clipping event.
137         */
138         struct ValueWait clipping;
139
140         /**
141                 Timer for device initializaton.
142         */
143         struct timer_list startup_timer;
144
145         /**
146                 Work handler for device initializaton.
147         */
148         struct work_struct startup_work;
149
150         /**
151                 Current progress in startup procedure.
152         */
153         int startup_progress;
154
155         /**
156                 Dirty flags for access to parameter data.
157         */
158         unsigned long param_dirty[POD_CONTROL_SIZE / sizeof(unsigned long)];
159
160         /**
161                 Some atomic flags.
162         */
163         unsigned long atomic_flags;
164
165         /**
166                 Serial number of device.
167         */
168         int serial_number;
169
170         /**
171                 Firmware version (x 100).
172         */
173         int firmware_version;
174
175         /**
176                 Device ID.
177         */
178         int device_id;
179
180         /**
181                 Flag to indicate modification of current program settings.
182         */
183         char dirty;
184
185         /**
186                 Flag to enable MIDI postprocessing.
187         */
188         char midi_postprocess;
189 };
190
191 extern void line6_pod_disconnect(struct usb_interface *interface);
192 extern int line6_pod_init(struct usb_interface *interface,
193                           struct usb_line6_pod *pod);
194 extern void line6_pod_midi_postprocess(struct usb_line6_pod *pod,
195                                        unsigned char *data, int length);
196 extern void line6_pod_process_message(struct usb_line6_pod *pod);
197 extern void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param,
198                                          u8 value);
199
200 #endif