2d98935f7b0be87ac2ed3e1dd46d8ba69c35a8f9
[pandora-kernel.git] / 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 static ssize_t pod_get_param_int(struct device *dev, char *buf, int param)
45 {
46         struct usb_interface *interface = to_usb_interface(dev);
47         struct usb_line6_pod *pod = usb_get_intfdata(interface);
48         int retval = line6_wait_dump(&pod->dumpreq, 0);
49         if (retval < 0)
50                 return retval;
51         return sprintf(buf, "%d\n", pod->prog_data.control[param]);
52 }
53
54 static ssize_t pod_set_param_int(struct device *dev, const char *buf,
55                                  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 =
114                     (part_frac / ((1UL << 31) / (PRECISION / 2 * 10)) + 5) / 10;
115         }
116
117         len +=
118             sprintf(buf + len, "%s%d.%03d\n", ((p[0] & 0x80) ? "-" : ""),
119                     part_int, part_frac);
120         return len;
121 }
122
123 POD_PARAM_RW(int, tweak);
124 POD_PARAM_RW(int, wah_position);
125 POD_PARAM_RW(int, compression_gain);
126 POD_PARAM_RW(int, vol_pedal_position);
127 POD_PARAM_RW(int, compression_threshold);
128 POD_PARAM_RW(int, pan);
129 POD_PARAM_RW(int, amp_model_setup);
130 POD_PARAM_RW(int, amp_model);
131 POD_PARAM_RW(int, drive);
132 POD_PARAM_RW(int, bass);
133 POD_PARAM_RW(int, mid);
134 POD_PARAM_RW(int, lowmid);
135 POD_PARAM_RW(int, treble);
136 POD_PARAM_RW(int, highmid);
137 POD_PARAM_RW(int, chan_vol);
138 POD_PARAM_RW(int, reverb_mix);
139 POD_PARAM_RW(int, effect_setup);
140 POD_PARAM_RW(int, band_1_frequency);
141 POD_PARAM_RW(int, presence);
142 POD_PARAM_RW(int, treble__bass);
143 POD_PARAM_RW(int, noise_gate_enable);
144 POD_PARAM_RW(int, gate_threshold);
145 POD_PARAM_RW(int, gate_decay_time);
146 POD_PARAM_RW(int, stomp_enable);
147 POD_PARAM_RW(int, comp_enable);
148 POD_PARAM_RW(int, stomp_time);
149 POD_PARAM_RW(int, delay_enable);
150 POD_PARAM_RW(int, mod_param_1);
151 POD_PARAM_RW(int, delay_param_1);
152 POD_PARAM_RW(int, delay_param_1_note_value);
153 POD_PARAM_RW(int, band_2_frequency__bass);
154 POD_PARAM_RW(int, delay_param_2);
155 POD_PARAM_RW(int, delay_volume_mix);
156 POD_PARAM_RW(int, delay_param_3);
157 POD_PARAM_RW(int, reverb_enable);
158 POD_PARAM_RW(int, reverb_type);
159 POD_PARAM_RW(int, reverb_decay);
160 POD_PARAM_RW(int, reverb_tone);
161 POD_PARAM_RW(int, reverb_pre_delay);
162 POD_PARAM_RW(int, reverb_pre_post);
163 POD_PARAM_RW(int, band_2_frequency);
164 POD_PARAM_RW(int, band_3_frequency__bass);
165 POD_PARAM_RW(int, wah_enable);
166 POD_PARAM_RW(int, modulation_lo_cut);
167 POD_PARAM_RW(int, delay_reverb_lo_cut);
168 POD_PARAM_RW(int, volume_pedal_minimum);
169 POD_PARAM_RW(int, eq_pre_post);
170 POD_PARAM_RW(int, volume_pre_post);
171 POD_PARAM_RW(int, di_model);
172 POD_PARAM_RW(int, di_delay);
173 POD_PARAM_RW(int, mod_enable);
174 POD_PARAM_RW(int, mod_param_1_note_value);
175 POD_PARAM_RW(int, mod_param_2);
176 POD_PARAM_RW(int, mod_param_3);
177 POD_PARAM_RW(int, mod_param_4);
178 POD_PARAM_RW(int, mod_param_5);
179 POD_PARAM_RW(int, mod_volume_mix);
180 POD_PARAM_RW(int, mod_pre_post);
181 POD_PARAM_RW(int, modulation_model);
182 POD_PARAM_RW(int, band_3_frequency);
183 POD_PARAM_RW(int, band_4_frequency__bass);
184 POD_PARAM_RW(int, mod_param_1_double_precision);
185 POD_PARAM_RW(int, delay_param_1_double_precision);
186 POD_PARAM_RW(int, eq_enable);
187 POD_PARAM_RW(int, tap);
188 POD_PARAM_RW(int, volume_tweak_pedal_assign);
189 POD_PARAM_RW(int, band_5_frequency);
190 POD_PARAM_RW(int, tuner);
191 POD_PARAM_RW(int, mic_selection);
192 POD_PARAM_RW(int, cabinet_model);
193 POD_PARAM_RW(int, stomp_model);
194 POD_PARAM_RW(int, roomlevel);
195 POD_PARAM_RW(int, band_4_frequency);
196 POD_PARAM_RW(int, band_6_frequency);
197 POD_PARAM_RW(int, stomp_param_1_note_value);
198 POD_PARAM_RW(int, stomp_param_2);
199 POD_PARAM_RW(int, stomp_param_3);
200 POD_PARAM_RW(int, stomp_param_4);
201 POD_PARAM_RW(int, stomp_param_5);
202 POD_PARAM_RW(int, stomp_param_6);
203 POD_PARAM_RW(int, amp_switch_select);
204 POD_PARAM_RW(int, delay_param_4);
205 POD_PARAM_RW(int, delay_param_5);
206 POD_PARAM_RW(int, delay_pre_post);
207 POD_PARAM_RW(int, delay_model);
208 POD_PARAM_RW(int, delay_verb_model);
209 POD_PARAM_RW(int, tempo_msb);
210 POD_PARAM_RW(int, tempo_lsb);
211 POD_PARAM_RW(int, wah_model);
212 POD_PARAM_RW(int, bypass_volume);
213 POD_PARAM_RW(int, fx_loop_on_off);
214 POD_PARAM_RW(int, tweak_param_select);
215 POD_PARAM_RW(int, amp1_engage);
216 POD_PARAM_RW(int, band_1_gain);
217 POD_PARAM_RW(int, band_2_gain__bass);
218 POD_PARAM_RW(int, band_2_gain);
219 POD_PARAM_RW(int, band_3_gain__bass);
220 POD_PARAM_RW(int, band_3_gain);
221 POD_PARAM_RW(int, band_4_gain__bass);
222 POD_PARAM_RW(int, band_5_gain__bass);
223 POD_PARAM_RW(int, band_4_gain);
224 POD_PARAM_RW(int, band_6_gain__bass);
225 VARIAX_PARAM_R(int, body);
226 VARIAX_PARAM_R(int, pickup1_enable);
227 VARIAX_PARAM_R(int, pickup1_type);
228 VARIAX_PARAM_R(float, pickup1_position);
229 VARIAX_PARAM_R(float, pickup1_angle);
230 VARIAX_PARAM_R(float, pickup1_level);
231 VARIAX_PARAM_R(int, pickup2_enable);
232 VARIAX_PARAM_R(int, pickup2_type);
233 VARIAX_PARAM_R(float, pickup2_position);
234 VARIAX_PARAM_R(float, pickup2_angle);
235 VARIAX_PARAM_R(float, pickup2_level);
236 VARIAX_PARAM_R(int, pickup_phase);
237 VARIAX_PARAM_R(float, capacitance);
238 VARIAX_PARAM_R(float, tone_resistance);
239 VARIAX_PARAM_R(float, volume_resistance);
240 VARIAX_PARAM_R(int, taper);
241 VARIAX_PARAM_R(float, tone_dump);
242 VARIAX_PARAM_R(int, save_tone);
243 VARIAX_PARAM_R(float, volume_dump);
244 VARIAX_PARAM_R(int, tuning_enable);
245 VARIAX_PARAM_R(int, tuning6);
246 VARIAX_PARAM_R(int, tuning5);
247 VARIAX_PARAM_R(int, tuning4);
248 VARIAX_PARAM_R(int, tuning3);
249 VARIAX_PARAM_R(int, tuning2);
250 VARIAX_PARAM_R(int, tuning1);
251 VARIAX_PARAM_R(float, detune6);
252 VARIAX_PARAM_R(float, detune5);
253 VARIAX_PARAM_R(float, detune4);
254 VARIAX_PARAM_R(float, detune3);
255 VARIAX_PARAM_R(float, detune2);
256 VARIAX_PARAM_R(float, detune1);
257 VARIAX_PARAM_R(float, mix6);
258 VARIAX_PARAM_R(float, mix5);
259 VARIAX_PARAM_R(float, mix4);
260 VARIAX_PARAM_R(float, mix3);
261 VARIAX_PARAM_R(float, mix2);
262 VARIAX_PARAM_R(float, mix1);
263 VARIAX_PARAM_R(int, pickup_wiring);
264
265 static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak);
266 static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position,
267                    pod_set_wah_position);
268 static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO,
269                    pod_get_compression_gain, pod_set_compression_gain);
270 static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO,
271                    pod_get_vol_pedal_position, pod_set_vol_pedal_position);
272 static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO,
273                    pod_get_compression_threshold,
274                    pod_set_compression_threshold);
275 static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan);
276 static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup,
277                    pod_set_amp_model_setup);
278 static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model,
279                    pod_set_amp_model);
280 static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive);
281 static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass);
282 static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid);
283 static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid);
284 static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble);
285 static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid,
286                    pod_set_highmid);
287 static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol,
288                    pod_set_chan_vol);
289 static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix,
290                    pod_set_reverb_mix);
291 static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup,
292                    pod_set_effect_setup);
293 static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO,
294                    pod_get_band_1_frequency, pod_set_band_1_frequency);
295 static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence,
296                    pod_set_presence);
297 static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO,
298                     pod_get_treble__bass, pod_set_treble__bass);
299 static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO,
300                    pod_get_noise_gate_enable, pod_set_noise_gate_enable);
301 static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold,
302                    pod_set_gate_threshold);
303 static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time,
304                    pod_set_gate_decay_time);
305 static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable,
306                    pod_set_stomp_enable);
307 static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable,
308                    pod_set_comp_enable);
309 static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time,
310                    pod_set_stomp_time);
311 static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable,
312                    pod_set_delay_enable);
313 static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1,
314                    pod_set_mod_param_1);
315 static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1,
316                    pod_set_delay_param_1);
317 static DEVICE_ATTR(delay_param_1_note_value, S_IWUGO | S_IRUGO,
318                    pod_get_delay_param_1_note_value,
319                    pod_set_delay_param_1_note_value);
320 static DEVICE_ATTR2(band_2_frequency__bass, band_2_frequency, S_IWUGO | S_IRUGO,
321                     pod_get_band_2_frequency__bass,
322                     pod_set_band_2_frequency__bass);
323 static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2,
324                    pod_set_delay_param_2);
325 static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO,
326                    pod_get_delay_volume_mix, pod_set_delay_volume_mix);
327 static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3,
328                    pod_set_delay_param_3);
329 static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable,
330                    pod_set_reverb_enable);
331 static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type,
332                    pod_set_reverb_type);
333 static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay,
334                    pod_set_reverb_decay);
335 static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone,
336                    pod_set_reverb_tone);
337 static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO,
338                    pod_get_reverb_pre_delay, pod_set_reverb_pre_delay);
339 static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post,
340                    pod_set_reverb_pre_post);
341 static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO,
342                    pod_get_band_2_frequency, pod_set_band_2_frequency);
343 static DEVICE_ATTR2(band_3_frequency__bass, band_3_frequency, S_IWUGO | S_IRUGO,
344                     pod_get_band_3_frequency__bass,
345                     pod_set_band_3_frequency__bass);
346 static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable,
347                    pod_set_wah_enable);
348 static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO,
349                    pod_get_modulation_lo_cut, pod_set_modulation_lo_cut);
350 static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO,
351                    pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut);
352 static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO,
353                    pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum);
354 static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post,
355                    pod_set_eq_pre_post);
356 static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post,
357                    pod_set_volume_pre_post);
358 static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model,
359                    pod_set_di_model);
360 static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay,
361                    pod_set_di_delay);
362 static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable,
363                    pod_set_mod_enable);
364 static DEVICE_ATTR(mod_param_1_note_value, S_IWUGO | S_IRUGO,
365                    pod_get_mod_param_1_note_value,
366                    pod_set_mod_param_1_note_value);
367 static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2,
368                    pod_set_mod_param_2);
369 static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3,
370                    pod_set_mod_param_3);
371 static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4,
372                    pod_set_mod_param_4);
373 static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5,
374                    pod_set_mod_param_5);
375 static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix,
376                    pod_set_mod_volume_mix);
377 static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post,
378                    pod_set_mod_pre_post);
379 static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO,
380                    pod_get_modulation_model, pod_set_modulation_model);
381 static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO,
382                    pod_get_band_3_frequency, pod_set_band_3_frequency);
383 static DEVICE_ATTR2(band_4_frequency__bass, band_4_frequency, S_IWUGO | S_IRUGO,
384                     pod_get_band_4_frequency__bass,
385                     pod_set_band_4_frequency__bass);
386 static DEVICE_ATTR(mod_param_1_double_precision, S_IWUGO | S_IRUGO,
387                    pod_get_mod_param_1_double_precision,
388                    pod_set_mod_param_1_double_precision);
389 static DEVICE_ATTR(delay_param_1_double_precision, S_IWUGO | S_IRUGO,
390                    pod_get_delay_param_1_double_precision,
391                    pod_set_delay_param_1_double_precision);
392 static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable,
393                    pod_set_eq_enable);
394 static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap);
395 static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO,
396                    pod_get_volume_tweak_pedal_assign,
397                    pod_set_volume_tweak_pedal_assign);
398 static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO,
399                    pod_get_band_5_frequency, pod_set_band_5_frequency);
400 static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner);
401 static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection,
402                    pod_set_mic_selection);
403 static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model,
404                    pod_set_cabinet_model);
405 static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model,
406                    pod_set_stomp_model);
407 static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel,
408                    pod_set_roomlevel);
409 static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO,
410                    pod_get_band_4_frequency, pod_set_band_4_frequency);
411 static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO,
412                    pod_get_band_6_frequency, pod_set_band_6_frequency);
413 static DEVICE_ATTR(stomp_param_1_note_value, S_IWUGO | S_IRUGO,
414                    pod_get_stomp_param_1_note_value,
415                    pod_set_stomp_param_1_note_value);
416 static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2,
417                    pod_set_stomp_param_2);
418 static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3,
419                    pod_set_stomp_param_3);
420 static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4,
421                    pod_set_stomp_param_4);
422 static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5,
423                    pod_set_stomp_param_5);
424 static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6,
425                    pod_set_stomp_param_6);
426 static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO,
427                    pod_get_amp_switch_select, pod_set_amp_switch_select);
428 static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4,
429                    pod_set_delay_param_4);
430 static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5,
431                    pod_set_delay_param_5);
432 static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post,
433                    pod_set_delay_pre_post);
434 static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model,
435                    pod_set_delay_model);
436 static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO,
437                    pod_get_delay_verb_model, pod_set_delay_verb_model);
438 static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb,
439                    pod_set_tempo_msb);
440 static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb,
441                    pod_set_tempo_lsb);
442 static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model,
443                    pod_set_wah_model);
444 static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume,
445                    pod_set_bypass_volume);
446 static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off,
447                    pod_set_fx_loop_on_off);
448 static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO,
449                    pod_get_tweak_param_select, pod_set_tweak_param_select);
450 static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage,
451                    pod_set_amp1_engage);
452 static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain,
453                    pod_set_band_1_gain);
454 static DEVICE_ATTR2(band_2_gain__bass, band_2_gain, S_IWUGO | S_IRUGO,
455                     pod_get_band_2_gain__bass, pod_set_band_2_gain__bass);
456 static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain,
457                    pod_set_band_2_gain);
458 static DEVICE_ATTR2(band_3_gain__bass, band_3_gain, S_IWUGO | S_IRUGO,
459                     pod_get_band_3_gain__bass, pod_set_band_3_gain__bass);
460 static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain,
461                    pod_set_band_3_gain);
462 static DEVICE_ATTR2(band_4_gain__bass, band_4_gain, S_IWUGO | S_IRUGO,
463                     pod_get_band_4_gain__bass, pod_set_band_4_gain__bass);
464 static DEVICE_ATTR2(band_5_gain__bass, band_5_gain, S_IWUGO | S_IRUGO,
465                     pod_get_band_5_gain__bass, pod_set_band_5_gain__bass);
466 static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain,
467                    pod_set_band_4_gain);
468 static DEVICE_ATTR2(band_6_gain__bass, band_6_gain, S_IWUGO | S_IRUGO,
469                     pod_get_band_6_gain__bass, pod_set_band_6_gain__bass);
470 static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write);
471 static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable,
472                    line6_nop_write);
473 static DEVICE_ATTR(pickup1_type, S_IRUGO, variax_get_pickup1_type,
474                    line6_nop_write);
475 static DEVICE_ATTR(pickup1_position, S_IRUGO, variax_get_pickup1_position,
476                    line6_nop_write);
477 static DEVICE_ATTR(pickup1_angle, S_IRUGO, variax_get_pickup1_angle,
478                    line6_nop_write);
479 static DEVICE_ATTR(pickup1_level, S_IRUGO, variax_get_pickup1_level,
480                    line6_nop_write);
481 static DEVICE_ATTR(pickup2_enable, S_IRUGO, variax_get_pickup2_enable,
482                    line6_nop_write);
483 static DEVICE_ATTR(pickup2_type, S_IRUGO, variax_get_pickup2_type,
484                    line6_nop_write);
485 static DEVICE_ATTR(pickup2_position, S_IRUGO, variax_get_pickup2_position,
486                    line6_nop_write);
487 static DEVICE_ATTR(pickup2_angle, S_IRUGO, variax_get_pickup2_angle,
488                    line6_nop_write);
489 static DEVICE_ATTR(pickup2_level, S_IRUGO, variax_get_pickup2_level,
490                    line6_nop_write);
491 static DEVICE_ATTR(pickup_phase, S_IRUGO, variax_get_pickup_phase,
492                    line6_nop_write);
493 static DEVICE_ATTR(capacitance, S_IRUGO, variax_get_capacitance,
494                    line6_nop_write);
495 static DEVICE_ATTR(tone_resistance, S_IRUGO, variax_get_tone_resistance,
496                    line6_nop_write);
497 static DEVICE_ATTR(volume_resistance, S_IRUGO, variax_get_volume_resistance,
498                    line6_nop_write);
499 static DEVICE_ATTR(taper, S_IRUGO, variax_get_taper, line6_nop_write);
500 static DEVICE_ATTR(tone_dump, S_IRUGO, variax_get_tone_dump, line6_nop_write);
501 static DEVICE_ATTR(save_tone, S_IRUGO, variax_get_save_tone, line6_nop_write);
502 static DEVICE_ATTR(volume_dump, S_IRUGO, variax_get_volume_dump,
503                    line6_nop_write);
504 static DEVICE_ATTR(tuning_enable, S_IRUGO, variax_get_tuning_enable,
505                    line6_nop_write);
506 static DEVICE_ATTR(tuning6, S_IRUGO, variax_get_tuning6, line6_nop_write);
507 static DEVICE_ATTR(tuning5, S_IRUGO, variax_get_tuning5, line6_nop_write);
508 static DEVICE_ATTR(tuning4, S_IRUGO, variax_get_tuning4, line6_nop_write);
509 static DEVICE_ATTR(tuning3, S_IRUGO, variax_get_tuning3, line6_nop_write);
510 static DEVICE_ATTR(tuning2, S_IRUGO, variax_get_tuning2, line6_nop_write);
511 static DEVICE_ATTR(tuning1, S_IRUGO, variax_get_tuning1, line6_nop_write);
512 static DEVICE_ATTR(detune6, S_IRUGO, variax_get_detune6, line6_nop_write);
513 static DEVICE_ATTR(detune5, S_IRUGO, variax_get_detune5, line6_nop_write);
514 static DEVICE_ATTR(detune4, S_IRUGO, variax_get_detune4, line6_nop_write);
515 static DEVICE_ATTR(detune3, S_IRUGO, variax_get_detune3, line6_nop_write);
516 static DEVICE_ATTR(detune2, S_IRUGO, variax_get_detune2, line6_nop_write);
517 static DEVICE_ATTR(detune1, S_IRUGO, variax_get_detune1, line6_nop_write);
518 static DEVICE_ATTR(mix6, S_IRUGO, variax_get_mix6, line6_nop_write);
519 static DEVICE_ATTR(mix5, S_IRUGO, variax_get_mix5, line6_nop_write);
520 static DEVICE_ATTR(mix4, S_IRUGO, variax_get_mix4, line6_nop_write);
521 static DEVICE_ATTR(mix3, S_IRUGO, variax_get_mix3, line6_nop_write);
522 static DEVICE_ATTR(mix2, S_IRUGO, variax_get_mix2, line6_nop_write);
523 static DEVICE_ATTR(mix1, S_IRUGO, variax_get_mix1, line6_nop_write);
524 static DEVICE_ATTR(pickup_wiring, S_IRUGO, variax_get_pickup_wiring,
525                    line6_nop_write);
526
527 int pod_create_files(int firmware, int type, struct device *dev)
528 {
529         int err;
530         CHECK_RETURN(device_create_file(dev, &dev_attr_tweak));
531         CHECK_RETURN(device_create_file(dev, &dev_attr_wah_position));
532         if ((type & (LINE6_BITS_PODXTALL)) != 0)
533                 CHECK_RETURN(device_create_file
534                              (dev, &dev_attr_compression_gain));
535         CHECK_RETURN(device_create_file(dev, &dev_attr_vol_pedal_position));
536         CHECK_RETURN(device_create_file(dev, &dev_attr_compression_threshold));
537         CHECK_RETURN(device_create_file(dev, &dev_attr_pan));
538         CHECK_RETURN(device_create_file(dev, &dev_attr_amp_model_setup));
539         if (firmware >= 200)
540                 CHECK_RETURN(device_create_file(dev, &dev_attr_amp_model));
541         CHECK_RETURN(device_create_file(dev, &dev_attr_drive));
542         CHECK_RETURN(device_create_file(dev, &dev_attr_bass));
543         if ((type & (LINE6_BITS_PODXTALL)) != 0)
544                 CHECK_RETURN(device_create_file(dev, &dev_attr_mid));
545         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
546                 CHECK_RETURN(device_create_file(dev, &dev_attr_lowmid));
547         if ((type & (LINE6_BITS_PODXTALL)) != 0)
548                 CHECK_RETURN(device_create_file(dev, &dev_attr_treble));
549         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
550                 CHECK_RETURN(device_create_file(dev, &dev_attr_highmid));
551         CHECK_RETURN(device_create_file(dev, &dev_attr_chan_vol));
552         if ((type & (LINE6_BITS_PODXTALL)) != 0)
553                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_mix));
554         CHECK_RETURN(device_create_file(dev, &dev_attr_effect_setup));
555         if (firmware >= 200)
556                 CHECK_RETURN(device_create_file
557                              (dev, &dev_attr_band_1_frequency));
558         if ((type & (LINE6_BITS_PODXTALL)) != 0)
559                 CHECK_RETURN(device_create_file(dev, &dev_attr_presence));
560         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
561                 CHECK_RETURN(device_create_file(dev, &dev_attr_treble__bass));
562         CHECK_RETURN(device_create_file(dev, &dev_attr_noise_gate_enable));
563         CHECK_RETURN(device_create_file(dev, &dev_attr_gate_threshold));
564         CHECK_RETURN(device_create_file(dev, &dev_attr_gate_decay_time));
565         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_enable));
566         CHECK_RETURN(device_create_file(dev, &dev_attr_comp_enable));
567         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_time));
568         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_enable));
569         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_1));
570         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_1));
571         CHECK_RETURN(device_create_file
572                      (dev, &dev_attr_delay_param_1_note_value));
573         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
574                 if (firmware >= 200)
575                         CHECK_RETURN(device_create_file
576                                      (dev, &dev_attr_band_2_frequency__bass));
577         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_2));
578         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_volume_mix));
579         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_3));
580         if ((type & (LINE6_BITS_PODXTALL)) != 0)
581                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_enable));
582         if ((type & (LINE6_BITS_PODXTALL)) != 0)
583                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_type));
584         if ((type & (LINE6_BITS_PODXTALL)) != 0)
585                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_decay));
586         if ((type & (LINE6_BITS_PODXTALL)) != 0)
587                 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_tone));
588         if ((type & (LINE6_BITS_PODXTALL)) != 0)
589                 CHECK_RETURN(device_create_file
590                              (dev, &dev_attr_reverb_pre_delay));
591         if ((type & (LINE6_BITS_PODXTALL)) != 0)
592                 CHECK_RETURN(device_create_file
593                              (dev, &dev_attr_reverb_pre_post));
594         if ((type & (LINE6_BITS_PODXTALL)) != 0)
595                 if (firmware >= 200)
596                         CHECK_RETURN(device_create_file
597                                      (dev, &dev_attr_band_2_frequency));
598         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
599                 if (firmware >= 200)
600                         CHECK_RETURN(device_create_file
601                                      (dev, &dev_attr_band_3_frequency__bass));
602         CHECK_RETURN(device_create_file(dev, &dev_attr_wah_enable));
603         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
604                 CHECK_RETURN(device_create_file
605                              (dev, &dev_attr_modulation_lo_cut));
606         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
607                 CHECK_RETURN(device_create_file
608                              (dev, &dev_attr_delay_reverb_lo_cut));
609         if ((type & (LINE6_BITS_PODXTALL)) != 0)
610                 if (firmware >= 200)
611                         CHECK_RETURN(device_create_file
612                                      (dev, &dev_attr_volume_pedal_minimum));
613         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
614                 if (firmware >= 200)
615                         CHECK_RETURN(device_create_file
616                                      (dev, &dev_attr_eq_pre_post));
617         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_pre_post));
618         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
619                 CHECK_RETURN(device_create_file(dev, &dev_attr_di_model));
620         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
621                 CHECK_RETURN(device_create_file(dev, &dev_attr_di_delay));
622         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_enable));
623         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_1_note_value));
624         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_2));
625         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_3));
626         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_4));
627         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
628                 CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_5));
629         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_volume_mix));
630         CHECK_RETURN(device_create_file(dev, &dev_attr_mod_pre_post));
631         CHECK_RETURN(device_create_file(dev, &dev_attr_modulation_model));
632         if ((type & (LINE6_BITS_PODXTALL)) != 0)
633                 if (firmware >= 200)
634                         CHECK_RETURN(device_create_file
635                                      (dev, &dev_attr_band_3_frequency));
636         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
637                 if (firmware >= 200)
638                         CHECK_RETURN(device_create_file
639                                      (dev, &dev_attr_band_4_frequency__bass));
640         CHECK_RETURN(device_create_file
641                      (dev, &dev_attr_mod_param_1_double_precision));
642         CHECK_RETURN(device_create_file
643                      (dev, &dev_attr_delay_param_1_double_precision));
644         if (firmware >= 200)
645                 CHECK_RETURN(device_create_file(dev, &dev_attr_eq_enable));
646         CHECK_RETURN(device_create_file(dev, &dev_attr_tap));
647         CHECK_RETURN(device_create_file
648                      (dev, &dev_attr_volume_tweak_pedal_assign));
649         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
650                 if (firmware >= 200)
651                         CHECK_RETURN(device_create_file
652                                      (dev, &dev_attr_band_5_frequency));
653         CHECK_RETURN(device_create_file(dev, &dev_attr_tuner));
654         CHECK_RETURN(device_create_file(dev, &dev_attr_mic_selection));
655         CHECK_RETURN(device_create_file(dev, &dev_attr_cabinet_model));
656         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_model));
657         CHECK_RETURN(device_create_file(dev, &dev_attr_roomlevel));
658         if ((type & (LINE6_BITS_PODXTALL)) != 0)
659                 if (firmware >= 200)
660                         CHECK_RETURN(device_create_file
661                                      (dev, &dev_attr_band_4_frequency));
662         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
663                 if (firmware >= 200)
664                         CHECK_RETURN(device_create_file
665                                      (dev, &dev_attr_band_6_frequency));
666         CHECK_RETURN(device_create_file
667                      (dev, &dev_attr_stomp_param_1_note_value));
668         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_2));
669         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_3));
670         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_4));
671         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_5));
672         CHECK_RETURN(device_create_file(dev, &dev_attr_stomp_param_6));
673         if ((type & (LINE6_BITS_LIVE)) != 0)
674                 CHECK_RETURN(device_create_file
675                              (dev, &dev_attr_amp_switch_select));
676         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_4));
677         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_param_5));
678         CHECK_RETURN(device_create_file(dev, &dev_attr_delay_pre_post));
679         if ((type & (LINE6_BITS_PODXTALL)) != 0)
680                 CHECK_RETURN(device_create_file(dev, &dev_attr_delay_model));
681         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
682                 CHECK_RETURN(device_create_file
683                              (dev, &dev_attr_delay_verb_model));
684         CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_msb));
685         CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_lsb));
686         if (firmware >= 300)
687                 CHECK_RETURN(device_create_file(dev, &dev_attr_wah_model));
688         if (firmware >= 214)
689                 CHECK_RETURN(device_create_file(dev, &dev_attr_bypass_volume));
690         if ((type & (LINE6_BITS_PRO)) != 0)
691                 CHECK_RETURN(device_create_file(dev, &dev_attr_fx_loop_on_off));
692         CHECK_RETURN(device_create_file(dev, &dev_attr_tweak_param_select));
693         CHECK_RETURN(device_create_file(dev, &dev_attr_amp1_engage));
694         if (firmware >= 200)
695                 CHECK_RETURN(device_create_file(dev, &dev_attr_band_1_gain));
696         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
697                 if (firmware >= 200)
698                         CHECK_RETURN(device_create_file
699                                      (dev, &dev_attr_band_2_gain__bass));
700         if ((type & (LINE6_BITS_PODXTALL)) != 0)
701                 if (firmware >= 200)
702                         CHECK_RETURN(device_create_file
703                                      (dev, &dev_attr_band_2_gain));
704         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
705                 if (firmware >= 200)
706                         CHECK_RETURN(device_create_file
707                                      (dev, &dev_attr_band_3_gain__bass));
708         if ((type & (LINE6_BITS_PODXTALL)) != 0)
709                 if (firmware >= 200)
710                         CHECK_RETURN(device_create_file
711                                      (dev, &dev_attr_band_3_gain));
712         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
713                 if (firmware >= 200)
714                         CHECK_RETURN(device_create_file
715                                      (dev, &dev_attr_band_4_gain__bass));
716         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
717                 if (firmware >= 200)
718                         CHECK_RETURN(device_create_file
719                                      (dev, &dev_attr_band_5_gain__bass));
720         if ((type & (LINE6_BITS_PODXTALL)) != 0)
721                 if (firmware >= 200)
722                         CHECK_RETURN(device_create_file
723                                      (dev, &dev_attr_band_4_gain));
724         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
725                 if (firmware >= 200)
726                         CHECK_RETURN(device_create_file
727                                      (dev, &dev_attr_band_6_gain__bass));
728         return 0;
729 }
730 EXPORT_SYMBOL(pod_create_files);
731
732 void pod_remove_files(int firmware, int type, struct device *dev)
733 {
734         device_remove_file(dev, &dev_attr_tweak);
735         device_remove_file(dev, &dev_attr_wah_position);
736         if ((type & (LINE6_BITS_PODXTALL)) != 0)
737                 device_remove_file(dev, &dev_attr_compression_gain);
738         device_remove_file(dev, &dev_attr_vol_pedal_position);
739         device_remove_file(dev, &dev_attr_compression_threshold);
740         device_remove_file(dev, &dev_attr_pan);
741         device_remove_file(dev, &dev_attr_amp_model_setup);
742         if (firmware >= 200)
743                 device_remove_file(dev, &dev_attr_amp_model);
744         device_remove_file(dev, &dev_attr_drive);
745         device_remove_file(dev, &dev_attr_bass);
746         if ((type & (LINE6_BITS_PODXTALL)) != 0)
747                 device_remove_file(dev, &dev_attr_mid);
748         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
749                 device_remove_file(dev, &dev_attr_lowmid);
750         if ((type & (LINE6_BITS_PODXTALL)) != 0)
751                 device_remove_file(dev, &dev_attr_treble);
752         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
753                 device_remove_file(dev, &dev_attr_highmid);
754         device_remove_file(dev, &dev_attr_chan_vol);
755         if ((type & (LINE6_BITS_PODXTALL)) != 0)
756                 device_remove_file(dev, &dev_attr_reverb_mix);
757         device_remove_file(dev, &dev_attr_effect_setup);
758         if (firmware >= 200)
759                 device_remove_file(dev, &dev_attr_band_1_frequency);
760         if ((type & (LINE6_BITS_PODXTALL)) != 0)
761                 device_remove_file(dev, &dev_attr_presence);
762         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
763                 device_remove_file(dev, &dev_attr_treble__bass);
764         device_remove_file(dev, &dev_attr_noise_gate_enable);
765         device_remove_file(dev, &dev_attr_gate_threshold);
766         device_remove_file(dev, &dev_attr_gate_decay_time);
767         device_remove_file(dev, &dev_attr_stomp_enable);
768         device_remove_file(dev, &dev_attr_comp_enable);
769         device_remove_file(dev, &dev_attr_stomp_time);
770         device_remove_file(dev, &dev_attr_delay_enable);
771         device_remove_file(dev, &dev_attr_mod_param_1);
772         device_remove_file(dev, &dev_attr_delay_param_1);
773         device_remove_file(dev, &dev_attr_delay_param_1_note_value);
774         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
775                 if (firmware >= 200)
776                         device_remove_file(dev,
777                                            &dev_attr_band_2_frequency__bass);
778         device_remove_file(dev, &dev_attr_delay_param_2);
779         device_remove_file(dev, &dev_attr_delay_volume_mix);
780         device_remove_file(dev, &dev_attr_delay_param_3);
781         if ((type & (LINE6_BITS_PODXTALL)) != 0)
782                 device_remove_file(dev, &dev_attr_reverb_enable);
783         if ((type & (LINE6_BITS_PODXTALL)) != 0)
784                 device_remove_file(dev, &dev_attr_reverb_type);
785         if ((type & (LINE6_BITS_PODXTALL)) != 0)
786                 device_remove_file(dev, &dev_attr_reverb_decay);
787         if ((type & (LINE6_BITS_PODXTALL)) != 0)
788                 device_remove_file(dev, &dev_attr_reverb_tone);
789         if ((type & (LINE6_BITS_PODXTALL)) != 0)
790                 device_remove_file(dev, &dev_attr_reverb_pre_delay);
791         if ((type & (LINE6_BITS_PODXTALL)) != 0)
792                 device_remove_file(dev, &dev_attr_reverb_pre_post);
793         if ((type & (LINE6_BITS_PODXTALL)) != 0)
794                 if (firmware >= 200)
795                         device_remove_file(dev, &dev_attr_band_2_frequency);
796         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
797                 if (firmware >= 200)
798                         device_remove_file(dev,
799                                            &dev_attr_band_3_frequency__bass);
800         device_remove_file(dev, &dev_attr_wah_enable);
801         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
802                 device_remove_file(dev, &dev_attr_modulation_lo_cut);
803         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
804                 device_remove_file(dev, &dev_attr_delay_reverb_lo_cut);
805         if ((type & (LINE6_BITS_PODXTALL)) != 0)
806                 if (firmware >= 200)
807                         device_remove_file(dev, &dev_attr_volume_pedal_minimum);
808         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
809                 if (firmware >= 200)
810                         device_remove_file(dev, &dev_attr_eq_pre_post);
811         device_remove_file(dev, &dev_attr_volume_pre_post);
812         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
813                 device_remove_file(dev, &dev_attr_di_model);
814         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
815                 device_remove_file(dev, &dev_attr_di_delay);
816         device_remove_file(dev, &dev_attr_mod_enable);
817         device_remove_file(dev, &dev_attr_mod_param_1_note_value);
818         device_remove_file(dev, &dev_attr_mod_param_2);
819         device_remove_file(dev, &dev_attr_mod_param_3);
820         device_remove_file(dev, &dev_attr_mod_param_4);
821         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
822                 device_remove_file(dev, &dev_attr_mod_param_5);
823         device_remove_file(dev, &dev_attr_mod_volume_mix);
824         device_remove_file(dev, &dev_attr_mod_pre_post);
825         device_remove_file(dev, &dev_attr_modulation_model);
826         if ((type & (LINE6_BITS_PODXTALL)) != 0)
827                 if (firmware >= 200)
828                         device_remove_file(dev, &dev_attr_band_3_frequency);
829         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
830                 if (firmware >= 200)
831                         device_remove_file(dev,
832                                            &dev_attr_band_4_frequency__bass);
833         device_remove_file(dev, &dev_attr_mod_param_1_double_precision);
834         device_remove_file(dev, &dev_attr_delay_param_1_double_precision);
835         if (firmware >= 200)
836                 device_remove_file(dev, &dev_attr_eq_enable);
837         device_remove_file(dev, &dev_attr_tap);
838         device_remove_file(dev, &dev_attr_volume_tweak_pedal_assign);
839         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
840                 if (firmware >= 200)
841                         device_remove_file(dev, &dev_attr_band_5_frequency);
842         device_remove_file(dev, &dev_attr_tuner);
843         device_remove_file(dev, &dev_attr_mic_selection);
844         device_remove_file(dev, &dev_attr_cabinet_model);
845         device_remove_file(dev, &dev_attr_stomp_model);
846         device_remove_file(dev, &dev_attr_roomlevel);
847         if ((type & (LINE6_BITS_PODXTALL)) != 0)
848                 if (firmware >= 200)
849                         device_remove_file(dev, &dev_attr_band_4_frequency);
850         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
851                 if (firmware >= 200)
852                         device_remove_file(dev, &dev_attr_band_6_frequency);
853         device_remove_file(dev, &dev_attr_stomp_param_1_note_value);
854         device_remove_file(dev, &dev_attr_stomp_param_2);
855         device_remove_file(dev, &dev_attr_stomp_param_3);
856         device_remove_file(dev, &dev_attr_stomp_param_4);
857         device_remove_file(dev, &dev_attr_stomp_param_5);
858         device_remove_file(dev, &dev_attr_stomp_param_6);
859         if ((type & (LINE6_BITS_LIVE)) != 0)
860                 device_remove_file(dev, &dev_attr_amp_switch_select);
861         device_remove_file(dev, &dev_attr_delay_param_4);
862         device_remove_file(dev, &dev_attr_delay_param_5);
863         device_remove_file(dev, &dev_attr_delay_pre_post);
864         if ((type & (LINE6_BITS_PODXTALL)) != 0)
865                 device_remove_file(dev, &dev_attr_delay_model);
866         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
867                 device_remove_file(dev, &dev_attr_delay_verb_model);
868         device_remove_file(dev, &dev_attr_tempo_msb);
869         device_remove_file(dev, &dev_attr_tempo_lsb);
870         if (firmware >= 300)
871                 device_remove_file(dev, &dev_attr_wah_model);
872         if (firmware >= 214)
873                 device_remove_file(dev, &dev_attr_bypass_volume);
874         if ((type & (LINE6_BITS_PRO)) != 0)
875                 device_remove_file(dev, &dev_attr_fx_loop_on_off);
876         device_remove_file(dev, &dev_attr_tweak_param_select);
877         device_remove_file(dev, &dev_attr_amp1_engage);
878         if (firmware >= 200)
879                 device_remove_file(dev, &dev_attr_band_1_gain);
880         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
881                 if (firmware >= 200)
882                         device_remove_file(dev, &dev_attr_band_2_gain__bass);
883         if ((type & (LINE6_BITS_PODXTALL)) != 0)
884                 if (firmware >= 200)
885                         device_remove_file(dev, &dev_attr_band_2_gain);
886         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
887                 if (firmware >= 200)
888                         device_remove_file(dev, &dev_attr_band_3_gain__bass);
889         if ((type & (LINE6_BITS_PODXTALL)) != 0)
890                 if (firmware >= 200)
891                         device_remove_file(dev, &dev_attr_band_3_gain);
892         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
893                 if (firmware >= 200)
894                         device_remove_file(dev, &dev_attr_band_4_gain__bass);
895         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
896                 if (firmware >= 200)
897                         device_remove_file(dev, &dev_attr_band_5_gain__bass);
898         if ((type & (LINE6_BITS_PODXTALL)) != 0)
899                 if (firmware >= 200)
900                         device_remove_file(dev, &dev_attr_band_4_gain);
901         if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
902                 if (firmware >= 200)
903                         device_remove_file(dev, &dev_attr_band_6_gain__bass);
904 }
905 EXPORT_SYMBOL(pod_remove_files);
906
907 int variax_create_files(int firmware, int type, struct device *dev)
908 {
909         int err;
910         CHECK_RETURN(device_create_file(dev, &dev_attr_body));
911         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_enable));
912         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_type));
913         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_position));
914         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_angle));
915         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup1_level));
916         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_enable));
917         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_type));
918         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_position));
919         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_angle));
920         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup2_level));
921         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup_phase));
922         CHECK_RETURN(device_create_file(dev, &dev_attr_capacitance));
923         CHECK_RETURN(device_create_file(dev, &dev_attr_tone_resistance));
924         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_resistance));
925         CHECK_RETURN(device_create_file(dev, &dev_attr_taper));
926         CHECK_RETURN(device_create_file(dev, &dev_attr_tone_dump));
927         CHECK_RETURN(device_create_file(dev, &dev_attr_save_tone));
928         CHECK_RETURN(device_create_file(dev, &dev_attr_volume_dump));
929         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning_enable));
930         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning6));
931         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning5));
932         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning4));
933         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning3));
934         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning2));
935         CHECK_RETURN(device_create_file(dev, &dev_attr_tuning1));
936         CHECK_RETURN(device_create_file(dev, &dev_attr_detune6));
937         CHECK_RETURN(device_create_file(dev, &dev_attr_detune5));
938         CHECK_RETURN(device_create_file(dev, &dev_attr_detune4));
939         CHECK_RETURN(device_create_file(dev, &dev_attr_detune3));
940         CHECK_RETURN(device_create_file(dev, &dev_attr_detune2));
941         CHECK_RETURN(device_create_file(dev, &dev_attr_detune1));
942         CHECK_RETURN(device_create_file(dev, &dev_attr_mix6));
943         CHECK_RETURN(device_create_file(dev, &dev_attr_mix5));
944         CHECK_RETURN(device_create_file(dev, &dev_attr_mix4));
945         CHECK_RETURN(device_create_file(dev, &dev_attr_mix3));
946         CHECK_RETURN(device_create_file(dev, &dev_attr_mix2));
947         CHECK_RETURN(device_create_file(dev, &dev_attr_mix1));
948         CHECK_RETURN(device_create_file(dev, &dev_attr_pickup_wiring));
949         return 0;
950 }
951 EXPORT_SYMBOL(variax_create_files);
952
953 void variax_remove_files(int firmware, int type, struct device *dev)
954 {
955         device_remove_file(dev, &dev_attr_body);
956         device_remove_file(dev, &dev_attr_pickup1_enable);
957         device_remove_file(dev, &dev_attr_pickup1_type);
958         device_remove_file(dev, &dev_attr_pickup1_position);
959         device_remove_file(dev, &dev_attr_pickup1_angle);
960         device_remove_file(dev, &dev_attr_pickup1_level);
961         device_remove_file(dev, &dev_attr_pickup2_enable);
962         device_remove_file(dev, &dev_attr_pickup2_type);
963         device_remove_file(dev, &dev_attr_pickup2_position);
964         device_remove_file(dev, &dev_attr_pickup2_angle);
965         device_remove_file(dev, &dev_attr_pickup2_level);
966         device_remove_file(dev, &dev_attr_pickup_phase);
967         device_remove_file(dev, &dev_attr_capacitance);
968         device_remove_file(dev, &dev_attr_tone_resistance);
969         device_remove_file(dev, &dev_attr_volume_resistance);
970         device_remove_file(dev, &dev_attr_taper);
971         device_remove_file(dev, &dev_attr_tone_dump);
972         device_remove_file(dev, &dev_attr_save_tone);
973         device_remove_file(dev, &dev_attr_volume_dump);
974         device_remove_file(dev, &dev_attr_tuning_enable);
975         device_remove_file(dev, &dev_attr_tuning6);
976         device_remove_file(dev, &dev_attr_tuning5);
977         device_remove_file(dev, &dev_attr_tuning4);
978         device_remove_file(dev, &dev_attr_tuning3);
979         device_remove_file(dev, &dev_attr_tuning2);
980         device_remove_file(dev, &dev_attr_tuning1);
981         device_remove_file(dev, &dev_attr_detune6);
982         device_remove_file(dev, &dev_attr_detune5);
983         device_remove_file(dev, &dev_attr_detune4);
984         device_remove_file(dev, &dev_attr_detune3);
985         device_remove_file(dev, &dev_attr_detune2);
986         device_remove_file(dev, &dev_attr_detune1);
987         device_remove_file(dev, &dev_attr_mix6);
988         device_remove_file(dev, &dev_attr_mix5);
989         device_remove_file(dev, &dev_attr_mix4);
990         device_remove_file(dev, &dev_attr_mix3);
991         device_remove_file(dev, &dev_attr_mix2);
992         device_remove_file(dev, &dev_attr_mix1);
993         device_remove_file(dev, &dev_attr_pickup_wiring);
994 }
995 EXPORT_SYMBOL(variax_remove_files);