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