mlx4_en: Counting all the dropped packets on the TX side
[linux-2.6] / drivers / staging / line6 / control.c
1 /*
2  * Line6 Linux USB driver - 0.8.0
3  *
4  * Copyright (C) 2004-2009 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 "driver.h"
13
14 #include <linux/usb.h>
15
16 #include "control.h"
17 #include "pod.h"
18 #include "usbdefs.h"
19 #include "variax.h"
20
21 #define DEVICE_ATTR2(_name1, _name2, _mode, _show, _store) \
22 struct device_attribute dev_attr_##_name1 = __ATTR(_name2, _mode, _show, _store)
23
24 #define LINE6_PARAM_R(PREFIX, prefix, type, param) \
25 static ssize_t prefix ## _get_ ## param(struct device *dev, \
26                         struct device_attribute *attr, char *buf) \
27 { \
28         return prefix ## _get_param_ ## type(dev, buf, PREFIX ## _ ## param); \
29 }
30
31 #define LINE6_PARAM_RW(PREFIX, prefix, type, param) \
32 LINE6_PARAM_R(PREFIX, prefix, type, param); \
33 static ssize_t prefix ## _set_ ## param(struct device *dev, \
34                 struct device_attribute *attr, const char *buf, size_t count) \
35 { \
36         return prefix ## _set_param_ ## type(dev, buf, count, PREFIX ## _ ## param); \
37 }
38
39 #define POD_PARAM_R(type, param) LINE6_PARAM_R(POD, pod, type, param)
40 #define POD_PARAM_RW(type, param) LINE6_PARAM_RW(POD, pod, type, param)
41 #define VARIAX_PARAM_R(type, param) LINE6_PARAM_R(VARIAX, variax, type, param)
42 #define VARIAX_PARAM_RW(type, param) LINE6_PARAM_RW(VARIAX, variax, type, param)
43
44
45 static ssize_t pod_get_param_int(struct device *dev, char *buf, int param)
46 {
47         struct usb_interface *interface = to_usb_interface(dev);
48         struct usb_line6_pod *pod = usb_get_intfdata(interface);
49         int retval = line6_wait_dump(&pod->dumpreq, 0);
50         if (retval < 0)
51                 return retval;
52         return sprintf(buf, "%d\n", pod->prog_data.control[param]);
53 }
54
55 static ssize_t pod_set_param_int(struct device *dev, const char *buf, size_t count, int param)
56 {
57         struct usb_interface *interface = to_usb_interface(dev);
58         struct usb_line6_pod *pod = usb_get_intfdata(interface);
59         int value = simple_strtoul(buf, NULL, 10);
60         pod_transmit_parameter(pod, param, value);
61         return count;
62 }
63
64 static ssize_t variax_get_param_int(struct device *dev, char *buf, int param)
65 {
66         struct usb_interface *interface = to_usb_interface(dev);
67         struct usb_line6_variax *variax = usb_get_intfdata(interface);
68         int retval = line6_wait_dump(&variax->dumpreq, 0);
69         if (retval < 0)
70                 return retval;
71         return sprintf(buf, "%d\n", variax->model_data.control[param]);
72 }
73
74 static ssize_t variax_get_param_float(struct device *dev, char *buf, int param)
75 {
76         /*
77                 We do our own floating point handling here since floats in the
78                 kernel are problematic for at least two reasons: - many distros
79                 are still shipped with binary kernels optimized for the ancient
80                 80386 without FPU
81                 - there isn't a printf("%f")
82                   (see http://www.kernelthread.com/publications/faq/335.html)
83         */
84
85         static const int BIAS = 0x7f;
86         static const int OFFSET = 0xf;
87         static const int PRECISION = 1000;
88
89         int len = 0;
90         unsigned part_int, part_frac;
91         struct usb_interface *interface = to_usb_interface(dev);
92         struct usb_line6_variax *variax = usb_get_intfdata(interface);
93         const unsigned char *p = variax->model_data.control + param;
94         int retval = line6_wait_dump(&variax->dumpreq, 0);
95         if (retval < 0)
96                 return retval;
97
98         if ((p[0] == 0) && (p[1] == 0) && (p[2] == 0))
99                 part_int = part_frac = 0;
100         else {
101                 int exponent = (((p[0] & 0x7f) << 1) | (p[1] >> 7)) - BIAS;
102                 unsigned mantissa = (p[1] << 8) | p[2] | 0x8000;
103                 exponent -= OFFSET;
104
105                 if (exponent >= 0) {
106                         part_int = mantissa << exponent;
107                         part_frac = 0;
108                 } else {
109                         part_int = mantissa >> -exponent;
110                         part_frac = (mantissa << (32 + exponent)) & 0xffffffff;
111                 }
112
113                 part_frac = (part_frac / ((1UL << 31) / (PRECISION / 2 * 10)) + 5) / 10;
114         }
115
116         len += sprintf(buf + len, "%s%d.%03d\n", ((p[0] & 0x80) ? "-" : ""), part_int, part_frac);
117         return len;
118 }
119
120 POD_PARAM_RW(int, tweak);
121 POD_PARAM_RW(int, wah_position);
122 POD_PARAM_RW(int, compression_gain);
123 POD_PARAM_RW(int, vol_pedal_position);
124 POD_PARAM_RW(int, compression_threshold);
125 POD_PARAM_RW(int, pan);
126 POD_PARAM_RW(int, amp_model_setup);
127 POD_PARAM_RW(int, amp_model);
128 POD_PARAM_RW(int, drive);
129 POD_PARAM_RW(int, bass);
130 POD_PARAM_RW(int, mid);
131 POD_PARAM_RW(int, lowmid);
132 POD_PARAM_RW(int, treble);
133 POD_PARAM_RW(int, highmid);
134 POD_PARAM_RW(int, chan_vol);
135 POD_PARAM_RW(int, reverb_mix);
136 POD_PARAM_RW(int, effect_setup);
137 POD_PARAM_RW(int, band_1_frequency);
138 POD_PARAM_RW(int, presence);
139 POD_PARAM_RW(int, treble__bass);
140 POD_PARAM_RW(int, noise_gate_enable);
141 POD_PARAM_RW(int, gate_threshold);
142 POD_PARAM_RW(int, gate_decay_time);
143 POD_PARAM_RW(int, stomp_enable);
144 POD_PARAM_RW(int, comp_enable);
145 POD_PARAM_RW(int, stomp_time);
146 POD_PARAM_RW(int, delay_enable);
147 POD_PARAM_RW(int, mod_param_1);
148 POD_PARAM_RW(int, delay_param_1);
149 POD_PARAM_RW(int, delay_param_1_note_value);
150 POD_PARAM_RW(int, band_2_frequency__bass);
151 POD_PARAM_RW(int, delay_param_2);
152 POD_PARAM_RW(int, delay_volume_mix);
153 POD_PARAM_RW(int, delay_param_3);
154 POD_PARAM_RW(int, reverb_enable);
155 POD_PARAM_RW(int, reverb_type);
156 POD_PARAM_RW(int, reverb_decay);
157 POD_PARAM_RW(int, reverb_tone);
158 POD_PARAM_RW(int, reverb_pre_delay);
159 POD_PARAM_RW(int, reverb_pre_post);
160 POD_PARAM_RW(int, band_2_frequency);
161 POD_PARAM_RW(int, band_3_frequency__bass);
162 POD_PARAM_RW(int, wah_enable);
163 POD_PARAM_RW(int, modulation_lo_cut);
164 POD_PARAM_RW(int, delay_reverb_lo_cut);
165 POD_PARAM_RW(int, volume_pedal_minimum);
166 POD_PARAM_RW(int, eq_pre_post);
167 POD_PARAM_RW(int, volume_pre_post);
168 POD_PARAM_RW(int, di_model);
169 POD_PARAM_RW(int, di_delay);
170 POD_PARAM_RW(int, mod_enable);
171 POD_PARAM_RW(int, mod_param_1_note_value);
172 POD_PARAM_RW(int, mod_param_2);
173 POD_PARAM_RW(int, mod_param_3);
174 POD_PARAM_RW(int, mod_param_4);
175 POD_PARAM_RW(int, mod_param_5);
176 POD_PARAM_RW(int, mod_volume_mix);
177 POD_PARAM_RW(int, mod_pre_post);
178 POD_PARAM_RW(int, modulation_model);
179 POD_PARAM_RW(int, band_3_frequency);
180 POD_PARAM_RW(int, band_4_frequency__bass);
181 POD_PARAM_RW(int, mod_param_1_double_precision);
182 POD_PARAM_RW(int, delay_param_1_double_precision);
183 POD_PARAM_RW(int, eq_enable);
184 POD_PARAM_RW(int, tap);
185 POD_PARAM_RW(int, volume_tweak_pedal_assign);
186 POD_PARAM_RW(int, band_5_frequency);
187 POD_PARAM_RW(int, tuner);
188 POD_PARAM_RW(int, mic_selection);
189 POD_PARAM_RW(int, cabinet_model);
190 POD_PARAM_RW(int, stomp_model);
191 POD_PARAM_RW(int, roomlevel);
192 POD_PARAM_RW(int, band_4_frequency);
193 POD_PARAM_RW(int, band_6_frequency);
194 POD_PARAM_RW(int, stomp_param_1_note_value);
195 POD_PARAM_RW(int, stomp_param_2);
196 POD_PARAM_RW(int, stomp_param_3);
197 POD_PARAM_RW(int, stomp_param_4);
198 POD_PARAM_RW(int, stomp_param_5);
199 POD_PARAM_RW(int, stomp_param_6);
200 POD_PARAM_RW(int, amp_switch_select);
201 POD_PARAM_RW(int, delay_param_4);
202 POD_PARAM_RW(int, delay_param_5);
203 POD_PARAM_RW(int, delay_pre_post);
204 POD_PARAM_RW(int, delay_model);
205 POD_PARAM_RW(int, delay_verb_model);
206 POD_PARAM_RW(int, tempo_msb);
207 POD_PARAM_RW(int, tempo_lsb);
208 POD_PARAM_RW(int, wah_model);
209 POD_PARAM_RW(int, bypass_volume);
210 POD_PARAM_RW(int, fx_loop_on_off);
211 POD_PARAM_RW(int, tweak_param_select);
212 POD_PARAM_RW(int, amp1_engage);
213 POD_PARAM_RW(int, band_1_gain);
214 POD_PARAM_RW(int, band_2_gain__bass);
215 POD_PARAM_RW(int, band_2_gain);
216 POD_PARAM_RW(int, band_3_gain__bass);
217 POD_PARAM_RW(int, band_3_gain);
218 POD_PARAM_RW(int, band_4_gain__bass);
219 POD_PARAM_RW(int, band_5_gain__bass);
220 POD_PARAM_RW(int, band_4_gain);
221 POD_PARAM_RW(int, band_6_gain__bass);
222 VARIAX_PARAM_R(int, body);
223 VARIAX_PARAM_R(int, pickup1_enable);
224 VARIAX_PARAM_R(int, pickup1_type);
225 VARIAX_PARAM_R(float, pickup1_position);
226 VARIAX_PARAM_R(float, pickup1_angle);
227 VARIAX_PARAM_R(float, pickup1_level);
228 VARIAX_PARAM_R(int, pickup2_enable);
229 VARIAX_PARAM_R(int, pickup2_type);
230 VARIAX_PARAM_R(float, pickup2_position);
231 VARIAX_PARAM_R(float, pickup2_angle);
232 VARIAX_PARAM_R(float, pickup2_level);
233 VARIAX_PARAM_R(int, pickup_phase);
234 VARIAX_PARAM_R(float, capacitance);
235 VARIAX_PARAM_R(float, tone_resistance);
236 VARIAX_PARAM_R(float, volume_resistance);
237 VARIAX_PARAM_R(int, taper);
238 VARIAX_PARAM_R(float, tone_dump);
239 VARIAX_PARAM_R(int, save_tone);
240 VARIAX_PARAM_R(float, volume_dump);
241 VARIAX_PARAM_R(int, tuning_enable);
242 VARIAX_PARAM_R(int, tuning6);
243 VARIAX_PARAM_R(int, tuning5);
244 VARIAX_PARAM_R(int, tuning4);
245 VARIAX_PARAM_R(int, tuning3);
246 VARIAX_PARAM_R(int, tuning2);
247 VARIAX_PARAM_R(int, tuning1);
248 VARIAX_PARAM_R(float, detune6);
249 VARIAX_PARAM_R(float, detune5);
250 VARIAX_PARAM_R(float, detune4);
251 VARIAX_PARAM_R(float, detune3);
252 VARIAX_PARAM_R(float, detune2);
253 VARIAX_PARAM_R(float, detune1);
254 VARIAX_PARAM_R(float, mix6);
255 VARIAX_PARAM_R(float, mix5);
256 VARIAX_PARAM_R(float, mix4);
257 VARIAX_PARAM_R(float, mix3);
258 VARIAX_PARAM_R(float, mix2);
259 VARIAX_PARAM_R(float, mix1);
260 VARIAX_PARAM_R(int, pickup_wiring);
261
262 static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak);
263 static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position, pod_set_wah_position);
264 static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO, pod_get_compression_gain, pod_set_compression_gain);
265 static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO, pod_get_vol_pedal_position, pod_set_vol_pedal_position);
266 static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO, pod_get_compression_threshold, pod_set_compression_threshold);
267 static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan);
268 static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup, pod_set_amp_model_setup);
269 static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model, pod_set_amp_model);
270 static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive);
271 static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass);
272 static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid);
273 static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid);
274 static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble);
275 static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid, pod_set_highmid);
276 static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol, pod_set_chan_vol);
277 static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix, pod_set_reverb_mix);
278 static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup, pod_set_effect_setup);
279 static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO, pod_get_band_1_frequency, pod_set_band_1_frequency);
280 static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence, pod_set_presence);
281 static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO, pod_get_treble__bass, pod_set_treble__bass);
282 static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO, pod_get_noise_gate_enable, pod_set_noise_gate_enable);
283 static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold, pod_set_gate_threshold);
284 static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time, pod_set_gate_decay_time);
285 static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable, pod_set_stomp_enable);
286 static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable, pod_set_comp_enable);
287 static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time, pod_set_stomp_time);
288 static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable, pod_set_delay_enable);
289 static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1, pod_set_mod_param_1);
290 static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1, pod_set_delay_param_1);
291 static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO, pod_get_delay_param_1_note_value, pod_set_delay_param_1_note_value);
292 static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO, pod_get_band_2_frequency__bass, pod_set_band_2_frequency__bass);
293 static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2, pod_set_delay_param_2);
294 static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO, pod_get_delay_volume_mix, pod_set_delay_volume_mix);
295 static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3, pod_set_delay_param_3);
296 static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable, pod_set_reverb_enable);
297 static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type, pod_set_reverb_type);
298 static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay, pod_set_reverb_decay);
299 static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone, pod_set_reverb_tone);
300 static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO, pod_get_reverb_pre_delay, pod_set_reverb_pre_delay);
301 static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post, pod_set_reverb_pre_post);
302 static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO, pod_get_band_2_frequency, pod_set_band_2_frequency);
303 static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO, pod_get_band_3_frequency__bass, pod_set_band_3_frequency__bass);
304 static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable, pod_set_wah_enable);
305 static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO, pod_get_modulation_lo_cut, pod_set_modulation_lo_cut);
306 static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO, pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut);
307 static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO, pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum);
308 static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post, pod_set_eq_pre_post);
309 static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post, pod_set_volume_pre_post);
310 static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model, pod_set_di_model);
311 static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay, pod_set_di_delay);
312 static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable, pod_set_mod_enable);
313 static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO, pod_get_mod_param_1_note_value, pod_set_mod_param_1_note_value);
314 static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2, pod_set_mod_param_2);
315 static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3, pod_set_mod_param_3);
316 static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4, pod_set_mod_param_4);
317 static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5, pod_set_mod_param_5);
318 static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix, pod_set_mod_volume_mix);
319 static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post, pod_set_mod_pre_post);
320 static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO, pod_get_modulation_model, pod_set_modulation_model);
321 static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO, pod_get_band_3_frequency, pod_set_band_3_frequency);
322 static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO, pod_get_band_4_frequency__bass, pod_set_band_4_frequency__bass);
323 static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO, pod_get_mod_param_1_double_precision, pod_set_mod_param_1_double_precision);
324 static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO, pod_get_delay_param_1_double_precision, pod_set_delay_param_1_double_precision);
325 static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable, pod_set_eq_enable);
326 static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap);
327 static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO, pod_get_volume_tweak_pedal_assign, pod_set_volume_tweak_pedal_assign);
328 static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO, pod_get_band_5_frequency, pod_set_band_5_frequency);
329 static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner);
330 static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection, pod_set_mic_selection);
331 static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model, pod_set_cabinet_model);
332 static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model, pod_set_stomp_model);
333 static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel, pod_set_roomlevel);
334 static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO, pod_get_band_4_frequency, pod_set_band_4_frequency);
335 static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO, pod_get_band_6_frequency, pod_set_band_6_frequency);
336 static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO, pod_get_stomp_param_1_note_value, pod_set_stomp_param_1_note_value);
337 static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2, pod_set_stomp_param_2);
338 static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3, pod_set_stomp_param_3);
339 static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4, pod_set_stomp_param_4);
340 static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5, pod_set_stomp_param_5);
341 static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6, pod_set_stomp_param_6);
342 static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO, pod_get_amp_switch_select, pod_set_amp_switch_select);
343 static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4, pod_set_delay_param_4);
344 static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5, pod_set_delay_param_5);
345 static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post, pod_set_delay_pre_post);
346 static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model, pod_set_delay_model);
347 static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO, pod_get_delay_verb_model, pod_set_delay_verb_model);
348 static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb, pod_set_tempo_msb);
349 static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb, pod_set_tempo_lsb);
350 static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model, pod_set_wah_model);
351 static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume, pod_set_bypass_volume);
352 static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off, pod_set_fx_loop_on_off);
353 static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO, pod_get_tweak_param_select, pod_set_tweak_param_select);
354 static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage, pod_set_amp1_engage);
355 static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain, pod_set_band_1_gain);
356 static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain__bass, pod_set_band_2_gain__bass);
357 static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain, pod_set_band_2_gain);
358 static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain__bass, pod_set_band_3_gain__bass);
359 static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain, pod_set_band_3_gain);
360 static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain__bass, pod_set_band_4_gain__bass);
361 static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO, pod_get_band_5_gain__bass, pod_set_band_5_gain__bass);
362 static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain, pod_set_band_4_gain);
363 static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO, pod_get_band_6_gain__bass, pod_set_band_6_gain__bass);
364 static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write);
365 static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable, line6_nop_write);
366 static DEVICE_ATTR(pickup1_type, S_IRUGO, variax_get_pickup1_type, line6_nop_write);
367 static DEVICE_ATTR(pickup1_position, S_IRUGO, variax_get_pickup1_position, line6_nop_write);
368 static DEVICE_ATTR(pickup1_angle, S_IRUGO, variax_get_pickup1_angle, line6_nop_write);
369 static DEVICE_ATTR(pickup1_level, S_IRUGO, variax_get_pickup1_level, line6_nop_write);
370 static DEVICE_ATTR(pickup2_enable, S_IRUGO, variax_get_pickup2_enable, line6_nop_write);
371 static DEVICE_ATTR(pickup2_type, S_IRUGO, variax_get_pickup2_type, line6_nop_write);
372 static DEVICE_ATTR(pickup2_position, S_IRUGO, variax_get_pickup2_position, line6_nop_write);
373 static DEVICE_ATTR(pickup2_angle, S_IRUGO, variax_get_pickup2_angle, line6_nop_write);
374 static DEVICE_ATTR(pickup2_level, S_IRUGO, variax_get_pickup2_level, line6_nop_write);
375 static DEVICE_ATTR(pickup_phase, S_IRUGO, variax_get_pickup_phase, line6_nop_write);
376 static DEVICE_ATTR(capacitance, S_IRUGO, variax_get_capacitance, line6_nop_write);
377 static DEVICE_ATTR(tone_resistance, S_IRUGO, variax_get_tone_resistance, line6_nop_write);
378 static DEVICE_ATTR(volume_resistance, S_IRUGO, variax_get_volume_resistance, line6_nop_write);
379 static DEVICE_ATTR(taper, S_IRUGO, variax_get_taper, line6_nop_write);
380 static DEVICE_ATTR(tone_dump, S_IRUGO, variax_get_tone_dump, line6_nop_write);
381 static DEVICE_ATTR(save_tone, S_IRUGO, variax_get_save_tone, line6_nop_write);
382 static DEVICE_ATTR(volume_dump, S_IRUGO, variax_get_volume_dump, line6_nop_write);
383 static DEVICE_ATTR(tuning_enable, S_IRUGO, variax_get_tuning_enable, line6_nop_write);
384 static DEVICE_ATTR(tuning6, S_IRUGO, variax_get_tuning6, line6_nop_write);
385 static DEVICE_ATTR(tuning5, S_IRUGO, variax_get_tuning5, line6_nop_write);
386 static DEVICE_ATTR(tuning4, S_IRUGO, variax_get_tuning4, line6_nop_write);
387 static DEVICE_ATTR(tuning3, S_IRUGO, variax_get_tuning3, line6_nop_write);
388 static DEVICE_ATTR(tuning2, S_IRUGO, variax_get_tuning2, line6_nop_write);
389 static DEVICE_ATTR(tuning1, S_IRUGO, variax_get_tuning1, line6_nop_write);
390 static DEVICE_ATTR(detune6, S_IRUGO, variax_get_detune6, line6_nop_write);
391 static DEVICE_ATTR(detune5, S_IRUGO, variax_get_detune5, line6_nop_write);
392 static DEVICE_ATTR(detune4, S_IRUGO, variax_get_detune4, line6_nop_write);
393 static DEVICE_ATTR(detune3, S_IRUGO, variax_get_detune3, line6_nop_write);
394 static DEVICE_ATTR(detune2, S_IRUGO, variax_get_detune2, line6_nop_write);
395 static DEVICE_ATTR(detune1, S_IRUGO, variax_get_detune1, line6_nop_write);
396 static DEVICE_ATTR(mix6, S_IRUGO, variax_get_mix6, line6_nop_write);
397 static DEVICE_ATTR(mix5, S_IRUGO, variax_get_mix5, line6_nop_write);
398 static DEVICE_ATTR(mix4, S_IRUGO, variax_get_mix4, line6_nop_write);
399 static DEVICE_ATTR(mix3, S_IRUGO, variax_get_mix3, line6_nop_write);
400 static DEVICE_ATTR(mix2, S_IRUGO, variax_get_mix2, line6_nop_write);
401 static DEVICE_ATTR(mix1, S_IRUGO, variax_get_mix1, line6_nop_write);
402 static DEVICE_ATTR(pickup_wiring, S_IRUGO, variax_get_pickup_wiring, line6_nop_write);
403
404 int pod_create_files(int firmware, int type, struct device *dev)
405 {
406         int err;
407         CHECK_RETURN(device_create_file(dev, &dev_attr_tweak));
408         CHECK_RETURN(device_create_file(dev, &dev_attr_wah_position));
409         if ((type & (LINE6_BITS_PODXTALL)) != 0)
410                 CHECK_RETURN(device_create_file(dev, &dev_attr_compression_gain));
411         CHECK_RETURN(device_create_file(dev, &dev_attr_vol_pedal_position));
412         CHECK_RETURN(device_create_file(dev, &dev_attr_compression_threshold));
413         CHECK_RETURN(device_create_file(dev, &dev_attr_pan));
414         CHECK_RETURN(device_create_file(dev, &dev_attr_amp_model_setup));
415         if (firmware >= 200)
416                 CHECK_RETURN(device_create_file(dev, &dev_attr_amp_model));
417         CHECK_RETURN(device_create_file(dev, &dev_attr_drive));
418         CHECK_RETURN(device_create_file(dev, &dev_attr_bass));
419         if ((type & (LINE6_BITS_PODXTALL)) != 0)
420                 CHECK_RETURN(device_create_file(dev, &dev_attr_mid));
421         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
422                 CHECK_RETURN(device_create_file(dev, &dev_attr_lowmid));
423         if ((type & (LINE6_BITS_PODXTALL)) != 0)
424                 CHECK_RETURN(device_create_file(dev, &dev_attr_treble));
425         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
426                 CHECK_RETURN(device_create_file(dev, &dev_attr_highmid));
427         CHECK_RETURN(device_create_file(dev, &dev_attr_chan_vol));
428         if ((type & (LINE6_BITS_PODXTALL)) != 0)
429                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_mix));
430         CHECK_RETURN(device_create_file(dev, &dev_attr_effect_setup));
431         if (firmware >= 200)
432                 CHECK_RETURN(device_create_file(dev, &dev_attr_band_1_frequency));
433         if ((type & (LINE6_BITS_PODXTALL)) != 0)
434                 CHECK_RETURN(device_create_file(dev, &dev_attr_presence));
435         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
436                 CHECK_RETURN(device_create_file(dev, &dev_attr_treble__bass));
437         CHECK_RETURN(device_create_file(dev, &dev_attr_noise_gate_enable));
438         CHECK_RETURN(device_create_file(dev, &dev_attr_gate_threshold));
439         CHECK_RETURN(device_create_file(dev, &dev_attr_gate_decay_time));
440         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_enable));
441         CHECK_RETURN(device_create_file(dev, &dev_attr_comp_enable));
442         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_time));
443         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_enable));
444         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_1));
445         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_1));
446         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_1_note_value));
447         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
448                 if (firmware >= 200)
449                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_frequency__bass));
450         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_2));
451         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_volume_mix));
452         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_3));
453         if ((type & (LINE6_BITS_PODXTALL)) != 0)
454                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_enable));
455         if ((type & (LINE6_BITS_PODXTALL)) != 0)
456                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_type));
457         if ((type & (LINE6_BITS_PODXTALL)) != 0)
458                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_decay));
459         if ((type & (LINE6_BITS_PODXTALL)) != 0)
460                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_tone));
461         if ((type & (LINE6_BITS_PODXTALL)) != 0)
462                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_pre_delay));
463         if ((type & (LINE6_BITS_PODXTALL)) != 0)
464                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_pre_post));
465         if ((type & (LINE6_BITS_PODXTALL)) != 0)
466                 if (firmware >= 200)
467                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_frequency));
468         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
469                 if (firmware >= 200)
470                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_frequency__bass));
471         CHECK_RETURN(device_create_file(dev, &dev_attr_wah_enable));
472         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
473                 CHECK_RETURN(device_create_file(dev, &dev_attr_modulation_lo_cut));
474         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
475                 CHECK_RETURN(device_create_file(dev, &dev_attr_delay_reverb_lo_cut));
476         if ((type & (LINE6_BITS_PODXTALL)) != 0)
477                 if (firmware >= 200)
478                         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_pedal_minimum));
479         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
480                 if (firmware >= 200)
481                         CHECK_RETURN(device_create_file(dev, &dev_attr_eq_pre_post));
482         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_pre_post));
483         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
484                 CHECK_RETURN(device_create_file(dev, &dev_attr_di_model));
485         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
486                 CHECK_RETURN(device_create_file(dev, &dev_attr_di_delay));
487         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_enable));
488         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_1_note_value));
489         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_2));
490         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_3));
491         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_4));
492         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
493                 CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_5));
494         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_volume_mix));
495         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_pre_post));
496         CHECK_RETURN(device_create_file(dev, &dev_attr_modulation_model));
497         if ((type & (LINE6_BITS_PODXTALL)) != 0)
498                 if (firmware >= 200)
499                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_frequency));
500         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
501                 if (firmware >= 200)
502                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_frequency__bass));
503         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_1_double_precision));
504         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_1_double_precision));
505         if (firmware >= 200)
506                 CHECK_RETURN(device_create_file(dev, &dev_attr_eq_enable));
507         CHECK_RETURN(device_create_file(dev, &dev_attr_tap));
508         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_tweak_pedal_assign));
509         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
510                 if (firmware >= 200)
511                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_5_frequency));
512         CHECK_RETURN(device_create_file(dev, &dev_attr_tuner));
513         CHECK_RETURN(device_create_file(dev, &dev_attr_mic_selection));
514         CHECK_RETURN(device_create_file(dev, &dev_attr_cabinet_model));
515         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_model));
516         CHECK_RETURN(device_create_file(dev, &dev_attr_roomlevel));
517         if ((type & (LINE6_BITS_PODXTALL)) != 0)
518                 if (firmware >= 200)
519                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_frequency));
520         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
521                 if (firmware >= 200)
522                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_6_frequency));
523         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_1_note_value));
524         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_2));
525         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_3));
526         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_4));
527         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_5));
528         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_6));
529         if ((type & (LINE6_BITS_LIVE)) != 0)
530                 CHECK_RETURN(device_create_file(dev, &dev_attr_amp_switch_select));
531         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_4));
532         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_5));
533         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_pre_post));
534         if ((type & (LINE6_BITS_PODXTALL)) != 0)
535                 CHECK_RETURN(device_create_file(dev, &dev_attr_delay_model));
536         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
537                 CHECK_RETURN(device_create_file(dev, &dev_attr_delay_verb_model));
538         CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_msb));
539         CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_lsb));
540         if (firmware >= 300)
541                 CHECK_RETURN(device_create_file(dev, &dev_attr_wah_model));
542         if (firmware >= 214)
543                 CHECK_RETURN(device_create_file(dev, &dev_attr_bypass_volume));
544         if ((type & (LINE6_BITS_PRO)) != 0)
545                 CHECK_RETURN(device_create_file(dev, &dev_attr_fx_loop_on_off));
546         CHECK_RETURN(device_create_file(dev, &dev_attr_tweak_param_select));
547         CHECK_RETURN(device_create_file(dev, &dev_attr_amp1_engage));
548         if (firmware >= 200)
549                 CHECK_RETURN(device_create_file(dev, &dev_attr_band_1_gain));
550         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
551                 if (firmware >= 200)
552                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_gain__bass));
553         if ((type & (LINE6_BITS_PODXTALL)) != 0)
554                 if (firmware >= 200)
555                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_2_gain));
556         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
557                 if (firmware >= 200)
558                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_gain__bass));
559         if ((type & (LINE6_BITS_PODXTALL)) != 0)
560                 if (firmware >= 200)
561                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_3_gain));
562         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
563                 if (firmware >= 200)
564                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_gain__bass));
565         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
566                 if (firmware >= 200)
567                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_5_gain__bass));
568         if ((type & (LINE6_BITS_PODXTALL)) != 0)
569                 if (firmware >= 200)
570                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_4_gain));
571         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
572                 if (firmware >= 200)
573                         CHECK_RETURN(device_create_file(dev, &dev_attr_band_6_gain__bass));
574   return 0;
575 }
576
577 void pod_remove_files(int firmware, int type, struct device *dev)
578 {
579         device_remove_file(dev, &dev_attr_tweak);
580         device_remove_file(dev, &dev_attr_wah_position);
581         if ((type & (LINE6_BITS_PODXTALL)) != 0)
582                 device_remove_file(dev, &dev_attr_compression_gain);
583         device_remove_file(dev, &dev_attr_vol_pedal_position);
584         device_remove_file(dev, &dev_attr_compression_threshold);
585         device_remove_file(dev, &dev_attr_pan);
586         device_remove_file(dev, &dev_attr_amp_model_setup);
587         if (firmware >= 200)
588                 device_remove_file(dev, &dev_attr_amp_model);
589         device_remove_file(dev, &dev_attr_drive);
590         device_remove_file(dev, &dev_attr_bass);
591         if ((type & (LINE6_BITS_PODXTALL)) != 0)
592                 device_remove_file(dev, &dev_attr_mid);
593         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
594                 device_remove_file(dev, &dev_attr_lowmid);
595         if ((type & (LINE6_BITS_PODXTALL)) != 0)
596                 device_remove_file(dev, &dev_attr_treble);
597         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
598                 device_remove_file(dev, &dev_attr_highmid);
599         device_remove_file(dev, &dev_attr_chan_vol);
600         if ((type & (LINE6_BITS_PODXTALL)) != 0)
601                 device_remove_file(dev, &dev_attr_reverb_mix);
602         device_remove_file(dev, &dev_attr_effect_setup);
603         if (firmware >= 200)
604                 device_remove_file(dev, &dev_attr_band_1_frequency);
605         if ((type & (LINE6_BITS_PODXTALL)) != 0)
606                 device_remove_file(dev, &dev_attr_presence);
607         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
608                 device_remove_file(dev, &dev_attr_treble__bass);
609         device_remove_file(dev, &dev_attr_noise_gate_enable);
610         device_remove_file(dev, &dev_attr_gate_threshold);
611         device_remove_file(dev, &dev_attr_gate_decay_time);
612         device_remove_file(dev, &dev_attr_stomp_enable);
613         device_remove_file(dev, &dev_attr_comp_enable);
614         device_remove_file(dev, &dev_attr_stomp_time);
615         device_remove_file(dev, &dev_attr_delay_enable);
616         device_remove_file(dev, &dev_attr_mod_param_1);
617         device_remove_file(dev, &dev_attr_delay_param_1);
618         device_remove_file(dev, &dev_attr_delay_param_1_note_value);
619         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
620                 if (firmware >= 200)
621                         device_remove_file(dev, &dev_attr_band_2_frequency__bass);
622         device_remove_file(dev, &dev_attr_delay_param_2);
623         device_remove_file(dev, &dev_attr_delay_volume_mix);
624         device_remove_file(dev, &dev_attr_delay_param_3);
625         if ((type & (LINE6_BITS_PODXTALL)) != 0)
626                 device_remove_file(dev, &dev_attr_reverb_enable);
627         if ((type & (LINE6_BITS_PODXTALL)) != 0)
628                 device_remove_file(dev, &dev_attr_reverb_type);
629         if ((type & (LINE6_BITS_PODXTALL)) != 0)
630                 device_remove_file(dev, &dev_attr_reverb_decay);
631         if ((type & (LINE6_BITS_PODXTALL)) != 0)
632                 device_remove_file(dev, &dev_attr_reverb_tone);
633         if ((type & (LINE6_BITS_PODXTALL)) != 0)
634                 device_remove_file(dev, &dev_attr_reverb_pre_delay);
635         if ((type & (LINE6_BITS_PODXTALL)) != 0)
636                 device_remove_file(dev, &dev_attr_reverb_pre_post);
637         if ((type & (LINE6_BITS_PODXTALL)) != 0)
638                 if (firmware >= 200)
639                         device_remove_file(dev, &dev_attr_band_2_frequency);
640         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
641                 if (firmware >= 200)
642                         device_remove_file(dev, &dev_attr_band_3_frequency__bass);
643         device_remove_file(dev, &dev_attr_wah_enable);
644         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
645                 device_remove_file(dev, &dev_attr_modulation_lo_cut);
646         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
647                 device_remove_file(dev, &dev_attr_delay_reverb_lo_cut);
648         if ((type & (LINE6_BITS_PODXTALL)) != 0)
649                 if (firmware >= 200)
650                         device_remove_file(dev, &dev_attr_volume_pedal_minimum);
651         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
652                 if (firmware >= 200)
653                         device_remove_file(dev, &dev_attr_eq_pre_post);
654         device_remove_file(dev, &dev_attr_volume_pre_post);
655         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
656                 device_remove_file(dev, &dev_attr_di_model);
657         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
658                 device_remove_file(dev, &dev_attr_di_delay);
659         device_remove_file(dev, &dev_attr_mod_enable);
660         device_remove_file(dev, &dev_attr_mod_param_1_note_value);
661         device_remove_file(dev, &dev_attr_mod_param_2);
662         device_remove_file(dev, &dev_attr_mod_param_3);
663         device_remove_file(dev, &dev_attr_mod_param_4);
664         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
665                 device_remove_file(dev, &dev_attr_mod_param_5);
666         device_remove_file(dev, &dev_attr_mod_volume_mix);
667         device_remove_file(dev, &dev_attr_mod_pre_post);
668         device_remove_file(dev, &dev_attr_modulation_model);
669         if ((type & (LINE6_BITS_PODXTALL)) != 0)
670                 if (firmware >= 200)
671                         device_remove_file(dev, &dev_attr_band_3_frequency);
672         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
673                 if (firmware >= 200)
674                         device_remove_file(dev, &dev_attr_band_4_frequency__bass);
675         device_remove_file(dev, &dev_attr_mod_param_1_double_precision);
676         device_remove_file(dev, &dev_attr_delay_param_1_double_precision);
677         if (firmware >= 200)
678                 device_remove_file(dev, &dev_attr_eq_enable);
679         device_remove_file(dev, &dev_attr_tap);
680         device_remove_file(dev, &dev_attr_volume_tweak_pedal_assign);
681         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
682                 if (firmware >= 200)
683                         device_remove_file(dev, &dev_attr_band_5_frequency);
684         device_remove_file(dev, &dev_attr_tuner);
685         device_remove_file(dev, &dev_attr_mic_selection);
686         device_remove_file(dev, &dev_attr_cabinet_model);
687         device_remove_file(dev, &dev_attr_stomp_model);
688         device_remove_file(dev, &dev_attr_roomlevel);
689         if ((type & (LINE6_BITS_PODXTALL)) != 0)
690                 if (firmware >= 200)
691                         device_remove_file(dev, &dev_attr_band_4_frequency);
692         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
693                 if (firmware >= 200)
694                         device_remove_file(dev, &dev_attr_band_6_frequency);
695         device_remove_file(dev, &dev_attr_stomp_param_1_note_value);
696         device_remove_file(dev, &dev_attr_stomp_param_2);
697         device_remove_file(dev, &dev_attr_stomp_param_3);
698         device_remove_file(dev, &dev_attr_stomp_param_4);
699         device_remove_file(dev, &dev_attr_stomp_param_5);
700         device_remove_file(dev, &dev_attr_stomp_param_6);
701         if ((type & (LINE6_BITS_LIVE)) != 0)
702                 device_remove_file(dev, &dev_attr_amp_switch_select);
703         device_remove_file(dev, &dev_attr_delay_param_4);
704         device_remove_file(dev, &dev_attr_delay_param_5);
705         device_remove_file(dev, &dev_attr_delay_pre_post);
706         if ((type & (LINE6_BITS_PODXTALL)) != 0)
707                 device_remove_file(dev, &dev_attr_delay_model);
708         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
709                 device_remove_file(dev, &dev_attr_delay_verb_model);
710         device_remove_file(dev, &dev_attr_tempo_msb);
711         device_remove_file(dev, &dev_attr_tempo_lsb);
712         if (firmware >= 300)
713                 device_remove_file(dev, &dev_attr_wah_model);
714         if (firmware >= 214)
715                 device_remove_file(dev, &dev_attr_bypass_volume);
716         if ((type & (LINE6_BITS_PRO)) != 0)
717                 device_remove_file(dev, &dev_attr_fx_loop_on_off);
718         device_remove_file(dev, &dev_attr_tweak_param_select);
719         device_remove_file(dev, &dev_attr_amp1_engage);
720         if (firmware >= 200)
721                 device_remove_file(dev, &dev_attr_band_1_gain);
722         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
723                 if (firmware >= 200)
724                         device_remove_file(dev, &dev_attr_band_2_gain__bass);
725         if ((type & (LINE6_BITS_PODXTALL)) != 0)
726                 if (firmware >= 200)
727                         device_remove_file(dev, &dev_attr_band_2_gain);
728         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
729                 if (firmware >= 200)
730                         device_remove_file(dev, &dev_attr_band_3_gain__bass);
731         if ((type & (LINE6_BITS_PODXTALL)) != 0)
732                 if (firmware >= 200)
733                         device_remove_file(dev, &dev_attr_band_3_gain);
734         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
735                 if (firmware >= 200)
736                         device_remove_file(dev, &dev_attr_band_4_gain__bass);
737         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
738                 if (firmware >= 200)
739                         device_remove_file(dev, &dev_attr_band_5_gain__bass);
740         if ((type & (LINE6_BITS_PODXTALL)) != 0)
741                 if (firmware >= 200)
742                         device_remove_file(dev, &dev_attr_band_4_gain);
743         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
744                 if (firmware >= 200)
745                         device_remove_file(dev, &dev_attr_band_6_gain__bass);
746 }
747
748 EXPORT_SYMBOL(pod_create_files);
749 EXPORT_SYMBOL(pod_remove_files);
750
751 int variax_create_files(int firmware, int type, struct device *dev)
752 {
753         int err;
754         CHECK_RETURN(device_create_file(dev, &dev_attr_body));
755         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_enable));
756         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_type));
757         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_position));
758         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_angle));
759         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_level));
760         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_enable));
761         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_type));
762         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_position));
763         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_angle));
764         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_level));
765         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup_phase));
766         CHECK_RETURN(device_create_file(dev, &dev_attr_capacitance));
767         CHECK_RETURN(device_create_file(dev, &dev_attr_tone_resistance));
768         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_resistance));
769         CHECK_RETURN(device_create_file(dev, &dev_attr_taper));
770         CHECK_RETURN(device_create_file(dev, &dev_attr_tone_dump));
771         CHECK_RETURN(device_create_file(dev, &dev_attr_save_tone));
772         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_dump));
773         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning_enable));
774         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning6));
775         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning5));
776         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning4));
777         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning3));
778         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning2));
779         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning1));
780         CHECK_RETURN(device_create_file(dev, &dev_attr_detune6));
781         CHECK_RETURN(device_create_file(dev, &dev_attr_detune5));
782         CHECK_RETURN(device_create_file(dev, &dev_attr_detune4));
783         CHECK_RETURN(device_create_file(dev, &dev_attr_detune3));
784         CHECK_RETURN(device_create_file(dev, &dev_attr_detune2));
785         CHECK_RETURN(device_create_file(dev, &dev_attr_detune1));
786         CHECK_RETURN(device_create_file(dev, &dev_attr_mix6));
787         CHECK_RETURN(device_create_file(dev, &dev_attr_mix5));
788         CHECK_RETURN(device_create_file(dev, &dev_attr_mix4));
789         CHECK_RETURN(device_create_file(dev, &dev_attr_mix3));
790         CHECK_RETURN(device_create_file(dev, &dev_attr_mix2));
791         CHECK_RETURN(device_create_file(dev, &dev_attr_mix1));
792         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup_wiring));
793   return 0;
794 }
795
796 void variax_remove_files(int firmware, int type, struct device *dev)
797 {
798         device_remove_file(dev, &dev_attr_body);
799         device_remove_file(dev, &dev_attr_pickup1_enable);
800         device_remove_file(dev, &dev_attr_pickup1_type);
801         device_remove_file(dev, &dev_attr_pickup1_position);
802         device_remove_file(dev, &dev_attr_pickup1_angle);
803         device_remove_file(dev, &dev_attr_pickup1_level);
804         device_remove_file(dev, &dev_attr_pickup2_enable);
805         device_remove_file(dev, &dev_attr_pickup2_type);
806         device_remove_file(dev, &dev_attr_pickup2_position);
807         device_remove_file(dev, &dev_attr_pickup2_angle);
808         device_remove_file(dev, &dev_attr_pickup2_level);
809         device_remove_file(dev, &dev_attr_pickup_phase);
810         device_remove_file(dev, &dev_attr_capacitance);
811         device_remove_file(dev, &dev_attr_tone_resistance);
812         device_remove_file(dev, &dev_attr_volume_resistance);
813         device_remove_file(dev, &dev_attr_taper);
814         device_remove_file(dev, &dev_attr_tone_dump);
815         device_remove_file(dev, &dev_attr_save_tone);
816         device_remove_file(dev, &dev_attr_volume_dump);
817         device_remove_file(dev, &dev_attr_tuning_enable);
818         device_remove_file(dev, &dev_attr_tuning6);
819         device_remove_file(dev, &dev_attr_tuning5);
820         device_remove_file(dev, &dev_attr_tuning4);
821         device_remove_file(dev, &dev_attr_tuning3);
822         device_remove_file(dev, &dev_attr_tuning2);
823         device_remove_file(dev, &dev_attr_tuning1);
824         device_remove_file(dev, &dev_attr_detune6);
825         device_remove_file(dev, &dev_attr_detune5);
826         device_remove_file(dev, &dev_attr_detune4);
827         device_remove_file(dev, &dev_attr_detune3);
828         device_remove_file(dev, &dev_attr_detune2);
829         device_remove_file(dev, &dev_attr_detune1);
830         device_remove_file(dev, &dev_attr_mix6);
831         device_remove_file(dev, &dev_attr_mix5);
832         device_remove_file(dev, &dev_attr_mix4);
833         device_remove_file(dev, &dev_attr_mix3);
834         device_remove_file(dev, &dev_attr_mix2);
835         device_remove_file(dev, &dev_attr_mix1);
836         device_remove_file(dev, &dev_attr_pickup_wiring);
837 }
838
839 EXPORT_SYMBOL(variax_create_files);
840 EXPORT_SYMBOL(variax_remove_files);