8543baeec0ea2c7d42c101073fc174f2b0e90272
[firefly-linux-kernel-4.4.55.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
19 #include <sound/core.h>
20
21 #include "driver.h"
22 #include "dumprequest.h"
23
24 /*
25         PODxt Live interfaces
26 */
27 #define PODXTLIVE_INTERFACE_POD    0
28 #define PODXTLIVE_INTERFACE_VARIAX 1
29
30 /*
31         Locate name in binary program dump
32 */
33 #define POD_NAME_OFFSET 0
34 #define POD_NAME_LENGTH 16
35
36 /*
37         Other constants
38 */
39 #define POD_CONTROL_SIZE 0x80
40 #define POD_BUFSIZE_DUMPREQ 7
41 #define POD_STARTUP_DELAY 1000
42
43 /*
44         Stages of POD startup procedure
45 */
46 enum {
47         POD_STARTUP_INIT = 1,
48         POD_STARTUP_DUMPREQ,
49         POD_STARTUP_VERSIONREQ,
50         POD_STARTUP_WORKQUEUE,
51         POD_STARTUP_SETUP,
52         POD_STARTUP_LAST = POD_STARTUP_SETUP - 1
53 };
54
55 /**
56         Binary PODxt Pro program dump
57 */
58 struct pod_program {
59         /**
60                 Header information (including program name).
61         */
62         unsigned char header[0x20];
63
64         /**
65                 Program parameters.
66         */
67         unsigned char control[POD_CONTROL_SIZE];
68 };
69
70 struct usb_line6_pod {
71         /**
72                 Generic Line6 USB data.
73         */
74         struct usb_line6 line6;
75
76         /**
77                 Dump request structure.
78         */
79         struct line6_dump_request dumpreq;
80
81         /**
82                 Current program settings.
83         */
84         struct pod_program prog_data;
85
86         /**
87                 Buffer for data retrieved from or to be stored on PODxt Pro.
88         */
89         struct pod_program prog_data_buf;
90
91         /**
92                 Instrument monitor level.
93         */
94         int monitor_level;
95
96         /**
97                 Timer for device initializaton.
98         */
99         struct timer_list startup_timer;
100
101         /**
102                 Work handler for device initializaton.
103         */
104         struct work_struct startup_work;
105
106         /**
107                 Current progress in startup procedure.
108         */
109         int startup_progress;
110
111         /**
112                 Some atomic flags.
113         */
114         unsigned long atomic_flags;
115
116         /**
117                 Serial number of device.
118         */
119         int serial_number;
120
121         /**
122                 Firmware version (x 100).
123         */
124         int firmware_version;
125
126         /**
127                 Device ID.
128         */
129         int device_id;
130 };
131
132 extern void line6_pod_disconnect(struct usb_interface *interface);
133 extern int line6_pod_init(struct usb_interface *interface,
134                           struct usb_line6_pod *pod);
135 extern void line6_pod_process_message(struct usb_line6_pod *pod);
136 extern void line6_pod_transmit_parameter(struct usb_line6_pod *pod, int param,
137                                          u8 value);
138
139 #endif