Merge branch 'linus' into x86/mm
[linux-2.6-block.git] / drivers / staging / line6 / control.c
CommitLineData
705ececd
MG
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
9a92fadc
GKH
21#define DEVICE_ATTR2(_name1, _name2, _mode, _show, _store) \
22struct device_attribute dev_attr_##_name1 = __ATTR(_name2, _mode, _show, _store)
705ececd
MG
23
24#define LINE6_PARAM_R(PREFIX, prefix, type, param) \
2a20bf6f 25static ssize_t prefix##_get_##param(struct device *dev, \
77491e52 26 struct device_attribute *attr, char *buf) \
705ececd 27{ \
2a20bf6f 28 return prefix##_get_param_##type(dev, buf, PREFIX##_##param); \
705ececd
MG
29}
30
31#define LINE6_PARAM_RW(PREFIX, prefix, type, param) \
32LINE6_PARAM_R(PREFIX, prefix, type, param); \
2a20bf6f 33static ssize_t prefix##_set_##param(struct device *dev, \
77491e52 34 struct device_attribute *attr, const char *buf, size_t count) \
705ececd 35{ \
2a20bf6f 36 return prefix##_set_param_##type(dev, buf, count, PREFIX##_##param); \
705ececd
MG
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
705ececd
MG
44static 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);
9a92fadc
GKH
49 if (retval < 0)
50 return retval;
705ececd
MG
51 return sprintf(buf, "%d\n", pod->prog_data.control[param]);
52}
53
acdc1021
SB
54static ssize_t pod_set_param_int(struct device *dev, const char *buf,
55 size_t count, int param)
705ececd
MG
56{
57 struct usb_interface *interface = to_usb_interface(dev);
58 struct usb_line6_pod *pod = usb_get_intfdata(interface);
49da3dd9
SB
59 unsigned long value;
60 int retval;
61
62 retval = strict_strtoul(buf, 10, &value);
63 if (retval)
64 return retval;
65
705ececd
MG
66 pod_transmit_parameter(pod, param, value);
67 return count;
68}
69
70static 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);
9a92fadc
GKH
75 if (retval < 0)
76 return retval;
705ececd
MG
77 return sprintf(buf, "%d\n", variax->model_data.control[param]);
78}
79
80static ssize_t variax_get_param_float(struct device *dev, char *buf, int param)
81{
82 /*
acdc1021
SB
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 */
705ececd
MG
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);
9a92fadc
GKH
101 if (retval < 0)
102 return retval;
705ececd 103
9a92fadc 104 if ((p[0] == 0) && (p[1] == 0) && (p[2] == 0))
705ececd
MG
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
9a92fadc 111 if (exponent >= 0) {
705ececd
MG
112 part_int = mantissa << exponent;
113 part_frac = 0;
9a92fadc 114 } else {
705ececd
MG
115 part_int = mantissa >> -exponent;
116 part_frac = (mantissa << (32 + exponent)) & 0xffffffff;
117 }
118
acdc1021
SB
119 part_frac =
120 (part_frac / ((1UL << 31) / (PRECISION / 2 * 10)) + 5) / 10;
705ececd
MG
121 }
122
acdc1021
SB
123 len +=
124 sprintf(buf + len, "%s%d.%03d\n", ((p[0] & 0x80) ? "-" : ""),
125 part_int, part_frac);
705ececd
MG
126 return len;
127}
128
129POD_PARAM_RW(int, tweak);
130POD_PARAM_RW(int, wah_position);
131POD_PARAM_RW(int, compression_gain);
132POD_PARAM_RW(int, vol_pedal_position);
133POD_PARAM_RW(int, compression_threshold);
134POD_PARAM_RW(int, pan);
135POD_PARAM_RW(int, amp_model_setup);
136POD_PARAM_RW(int, amp_model);
137POD_PARAM_RW(int, drive);
138POD_PARAM_RW(int, bass);
139POD_PARAM_RW(int, mid);
140POD_PARAM_RW(int, lowmid);
141POD_PARAM_RW(int, treble);
142POD_PARAM_RW(int, highmid);
143POD_PARAM_RW(int, chan_vol);
144POD_PARAM_RW(int, reverb_mix);
145POD_PARAM_RW(int, effect_setup);
146POD_PARAM_RW(int, band_1_frequency);
147POD_PARAM_RW(int, presence);
148POD_PARAM_RW(int, treble__bass);
149POD_PARAM_RW(int, noise_gate_enable);
150POD_PARAM_RW(int, gate_threshold);
151POD_PARAM_RW(int, gate_decay_time);
152POD_PARAM_RW(int, stomp_enable);
153POD_PARAM_RW(int, comp_enable);
154POD_PARAM_RW(int, stomp_time);
155POD_PARAM_RW(int, delay_enable);
156POD_PARAM_RW(int, mod_param_1);
157POD_PARAM_RW(int, delay_param_1);
158POD_PARAM_RW(int, delay_param_1_note_value);
159POD_PARAM_RW(int, band_2_frequency__bass);
160POD_PARAM_RW(int, delay_param_2);
161POD_PARAM_RW(int, delay_volume_mix);
162POD_PARAM_RW(int, delay_param_3);
163POD_PARAM_RW(int, reverb_enable);
164POD_PARAM_RW(int, reverb_type);
165POD_PARAM_RW(int, reverb_decay);
166POD_PARAM_RW(int, reverb_tone);
167POD_PARAM_RW(int, reverb_pre_delay);
168POD_PARAM_RW(int, reverb_pre_post);
169POD_PARAM_RW(int, band_2_frequency);
170POD_PARAM_RW(int, band_3_frequency__bass);
171POD_PARAM_RW(int, wah_enable);
172POD_PARAM_RW(int, modulation_lo_cut);
173POD_PARAM_RW(int, delay_reverb_lo_cut);
174POD_PARAM_RW(int, volume_pedal_minimum);
175POD_PARAM_RW(int, eq_pre_post);
176POD_PARAM_RW(int, volume_pre_post);
177POD_PARAM_RW(int, di_model);
178POD_PARAM_RW(int, di_delay);
179POD_PARAM_RW(int, mod_enable);
180POD_PARAM_RW(int, mod_param_1_note_value);
181POD_PARAM_RW(int, mod_param_2);
182POD_PARAM_RW(int, mod_param_3);
183POD_PARAM_RW(int, mod_param_4);
184POD_PARAM_RW(int, mod_param_5);
185POD_PARAM_RW(int, mod_volume_mix);
186POD_PARAM_RW(int, mod_pre_post);
187POD_PARAM_RW(int, modulation_model);
188POD_PARAM_RW(int, band_3_frequency);
189POD_PARAM_RW(int, band_4_frequency__bass);
190POD_PARAM_RW(int, mod_param_1_double_precision);
191POD_PARAM_RW(int, delay_param_1_double_precision);
192POD_PARAM_RW(int, eq_enable);
193POD_PARAM_RW(int, tap);
194POD_PARAM_RW(int, volume_tweak_pedal_assign);
195POD_PARAM_RW(int, band_5_frequency);
196POD_PARAM_RW(int, tuner);
197POD_PARAM_RW(int, mic_selection);
198POD_PARAM_RW(int, cabinet_model);
199POD_PARAM_RW(int, stomp_model);
200POD_PARAM_RW(int, roomlevel);
201POD_PARAM_RW(int, band_4_frequency);
202POD_PARAM_RW(int, band_6_frequency);
203POD_PARAM_RW(int, stomp_param_1_note_value);
204POD_PARAM_RW(int, stomp_param_2);
205POD_PARAM_RW(int, stomp_param_3);
206POD_PARAM_RW(int, stomp_param_4);
207POD_PARAM_RW(int, stomp_param_5);
208POD_PARAM_RW(int, stomp_param_6);
209POD_PARAM_RW(int, amp_switch_select);
210POD_PARAM_RW(int, delay_param_4);
211POD_PARAM_RW(int, delay_param_5);
212POD_PARAM_RW(int, delay_pre_post);
213POD_PARAM_RW(int, delay_model);
214POD_PARAM_RW(int, delay_verb_model);
215POD_PARAM_RW(int, tempo_msb);
216POD_PARAM_RW(int, tempo_lsb);
217POD_PARAM_RW(int, wah_model);
218POD_PARAM_RW(int, bypass_volume);
219POD_PARAM_RW(int, fx_loop_on_off);
220POD_PARAM_RW(int, tweak_param_select);
221POD_PARAM_RW(int, amp1_engage);
222POD_PARAM_RW(int, band_1_gain);
223POD_PARAM_RW(int, band_2_gain__bass);
224POD_PARAM_RW(int, band_2_gain);
225POD_PARAM_RW(int, band_3_gain__bass);
226POD_PARAM_RW(int, band_3_gain);
227POD_PARAM_RW(int, band_4_gain__bass);
228POD_PARAM_RW(int, band_5_gain__bass);
229POD_PARAM_RW(int, band_4_gain);
230POD_PARAM_RW(int, band_6_gain__bass);
231VARIAX_PARAM_R(int, body);
232VARIAX_PARAM_R(int, pickup1_enable);
233VARIAX_PARAM_R(int, pickup1_type);
234VARIAX_PARAM_R(float, pickup1_position);
235VARIAX_PARAM_R(float, pickup1_angle);
236VARIAX_PARAM_R(float, pickup1_level);
237VARIAX_PARAM_R(int, pickup2_enable);
238VARIAX_PARAM_R(int, pickup2_type);
239VARIAX_PARAM_R(float, pickup2_position);
240VARIAX_PARAM_R(float, pickup2_angle);
241VARIAX_PARAM_R(float, pickup2_level);
242VARIAX_PARAM_R(int, pickup_phase);
243VARIAX_PARAM_R(float, capacitance);
244VARIAX_PARAM_R(float, tone_resistance);
245VARIAX_PARAM_R(float, volume_resistance);
246VARIAX_PARAM_R(int, taper);
247VARIAX_PARAM_R(float, tone_dump);
248VARIAX_PARAM_R(int, save_tone);
249VARIAX_PARAM_R(float, volume_dump);
250VARIAX_PARAM_R(int, tuning_enable);
251VARIAX_PARAM_R(int, tuning6);
252VARIAX_PARAM_R(int, tuning5);
253VARIAX_PARAM_R(int, tuning4);
254VARIAX_PARAM_R(int, tuning3);
255VARIAX_PARAM_R(int, tuning2);
256VARIAX_PARAM_R(int, tuning1);
257VARIAX_PARAM_R(float, detune6);
258VARIAX_PARAM_R(float, detune5);
259VARIAX_PARAM_R(float, detune4);
260VARIAX_PARAM_R(float, detune3);
261VARIAX_PARAM_R(float, detune2);
262VARIAX_PARAM_R(float, detune1);
263VARIAX_PARAM_R(float, mix6);
264VARIAX_PARAM_R(float, mix5);
265VARIAX_PARAM_R(float, mix4);
266VARIAX_PARAM_R(float, mix3);
267VARIAX_PARAM_R(float, mix2);
268VARIAX_PARAM_R(float, mix1);
269VARIAX_PARAM_R(int, pickup_wiring);
270
271static DEVICE_ATTR(tweak, S_IWUGO | S_IRUGO, pod_get_tweak, pod_set_tweak);
acdc1021
SB
272static DEVICE_ATTR(wah_position, S_IWUGO | S_IRUGO, pod_get_wah_position,
273 pod_set_wah_position);
274static DEVICE_ATTR(compression_gain, S_IWUGO | S_IRUGO,
275 pod_get_compression_gain, pod_set_compression_gain);
276static DEVICE_ATTR(vol_pedal_position, S_IWUGO | S_IRUGO,
277 pod_get_vol_pedal_position, pod_set_vol_pedal_position);
278static DEVICE_ATTR(compression_threshold, S_IWUGO | S_IRUGO,
279 pod_get_compression_threshold,
280 pod_set_compression_threshold);
705ececd 281static DEVICE_ATTR(pan, S_IWUGO | S_IRUGO, pod_get_pan, pod_set_pan);
acdc1021
SB
282static DEVICE_ATTR(amp_model_setup, S_IWUGO | S_IRUGO, pod_get_amp_model_setup,
283 pod_set_amp_model_setup);
284static DEVICE_ATTR(amp_model, S_IWUGO | S_IRUGO, pod_get_amp_model,
285 pod_set_amp_model);
705ececd
MG
286static DEVICE_ATTR(drive, S_IWUGO | S_IRUGO, pod_get_drive, pod_set_drive);
287static DEVICE_ATTR(bass, S_IWUGO | S_IRUGO, pod_get_bass, pod_set_bass);
288static DEVICE_ATTR(mid, S_IWUGO | S_IRUGO, pod_get_mid, pod_set_mid);
289static DEVICE_ATTR(lowmid, S_IWUGO | S_IRUGO, pod_get_lowmid, pod_set_lowmid);
290static DEVICE_ATTR(treble, S_IWUGO | S_IRUGO, pod_get_treble, pod_set_treble);
acdc1021
SB
291static DEVICE_ATTR(highmid, S_IWUGO | S_IRUGO, pod_get_highmid,
292 pod_set_highmid);
293static DEVICE_ATTR(chan_vol, S_IWUGO | S_IRUGO, pod_get_chan_vol,
294 pod_set_chan_vol);
295static DEVICE_ATTR(reverb_mix, S_IWUGO | S_IRUGO, pod_get_reverb_mix,
296 pod_set_reverb_mix);
297static DEVICE_ATTR(effect_setup, S_IWUGO | S_IRUGO, pod_get_effect_setup,
298 pod_set_effect_setup);
299static DEVICE_ATTR(band_1_frequency, S_IWUGO | S_IRUGO,
300 pod_get_band_1_frequency, pod_set_band_1_frequency);
301static DEVICE_ATTR(presence, S_IWUGO | S_IRUGO, pod_get_presence,
302 pod_set_presence);
303static DEVICE_ATTR2(treble__bass, treble, S_IWUGO | S_IRUGO,
304 pod_get_treble__bass, pod_set_treble__bass);
305static DEVICE_ATTR(noise_gate_enable, S_IWUGO | S_IRUGO,
306 pod_get_noise_gate_enable, pod_set_noise_gate_enable);
307static DEVICE_ATTR(gate_threshold, S_IWUGO | S_IRUGO, pod_get_gate_threshold,
308 pod_set_gate_threshold);
309static DEVICE_ATTR(gate_decay_time, S_IWUGO | S_IRUGO, pod_get_gate_decay_time,
310 pod_set_gate_decay_time);
311static DEVICE_ATTR(stomp_enable, S_IWUGO | S_IRUGO, pod_get_stomp_enable,
312 pod_set_stomp_enable);
313static DEVICE_ATTR(comp_enable, S_IWUGO | S_IRUGO, pod_get_comp_enable,
314 pod_set_comp_enable);
315static DEVICE_ATTR(stomp_time, S_IWUGO | S_IRUGO, pod_get_stomp_time,
316 pod_set_stomp_time);
317static DEVICE_ATTR(delay_enable, S_IWUGO | S_IRUGO, pod_get_delay_enable,
318 pod_set_delay_enable);
319static DEVICE_ATTR(mod_param_1, S_IWUGO | S_IRUGO, pod_get_mod_param_1,
320 pod_set_mod_param_1);
321static DEVICE_ATTR(delay_param_1, S_IWUGO | S_IRUGO, pod_get_delay_param_1,
322 pod_set_delay_param_1);
323static 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);
326static 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);
329static DEVICE_ATTR(delay_param_2, S_IWUGO | S_IRUGO, pod_get_delay_param_2,
330 pod_set_delay_param_2);
331static DEVICE_ATTR(delay_volume_mix, S_IWUGO | S_IRUGO,
332 pod_get_delay_volume_mix, pod_set_delay_volume_mix);
333static DEVICE_ATTR(delay_param_3, S_IWUGO | S_IRUGO, pod_get_delay_param_3,
334 pod_set_delay_param_3);
335static DEVICE_ATTR(reverb_enable, S_IWUGO | S_IRUGO, pod_get_reverb_enable,
336 pod_set_reverb_enable);
337static DEVICE_ATTR(reverb_type, S_IWUGO | S_IRUGO, pod_get_reverb_type,
338 pod_set_reverb_type);
339static DEVICE_ATTR(reverb_decay, S_IWUGO | S_IRUGO, pod_get_reverb_decay,
340 pod_set_reverb_decay);
341static DEVICE_ATTR(reverb_tone, S_IWUGO | S_IRUGO, pod_get_reverb_tone,
342 pod_set_reverb_tone);
343static DEVICE_ATTR(reverb_pre_delay, S_IWUGO | S_IRUGO,
344 pod_get_reverb_pre_delay, pod_set_reverb_pre_delay);
345static DEVICE_ATTR(reverb_pre_post, S_IWUGO | S_IRUGO, pod_get_reverb_pre_post,
346 pod_set_reverb_pre_post);
347static DEVICE_ATTR(band_2_frequency, S_IWUGO | S_IRUGO,
348 pod_get_band_2_frequency, pod_set_band_2_frequency);
349static 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);
352static DEVICE_ATTR(wah_enable, S_IWUGO | S_IRUGO, pod_get_wah_enable,
353 pod_set_wah_enable);
354static DEVICE_ATTR(modulation_lo_cut, S_IWUGO | S_IRUGO,
355 pod_get_modulation_lo_cut, pod_set_modulation_lo_cut);
356static DEVICE_ATTR(delay_reverb_lo_cut, S_IWUGO | S_IRUGO,
357 pod_get_delay_reverb_lo_cut, pod_set_delay_reverb_lo_cut);
358static DEVICE_ATTR(volume_pedal_minimum, S_IWUGO | S_IRUGO,
359 pod_get_volume_pedal_minimum, pod_set_volume_pedal_minimum);
360static DEVICE_ATTR(eq_pre_post, S_IWUGO | S_IRUGO, pod_get_eq_pre_post,
361 pod_set_eq_pre_post);
362static DEVICE_ATTR(volume_pre_post, S_IWUGO | S_IRUGO, pod_get_volume_pre_post,
363 pod_set_volume_pre_post);
364static DEVICE_ATTR(di_model, S_IWUGO | S_IRUGO, pod_get_di_model,
365 pod_set_di_model);
366static DEVICE_ATTR(di_delay, S_IWUGO | S_IRUGO, pod_get_di_delay,
367 pod_set_di_delay);
368static DEVICE_ATTR(mod_enable, S_IWUGO | S_IRUGO, pod_get_mod_enable,
369 pod_set_mod_enable);
370static 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);
373static DEVICE_ATTR(mod_param_2, S_IWUGO | S_IRUGO, pod_get_mod_param_2,
374 pod_set_mod_param_2);
375static DEVICE_ATTR(mod_param_3, S_IWUGO | S_IRUGO, pod_get_mod_param_3,
376 pod_set_mod_param_3);
377static DEVICE_ATTR(mod_param_4, S_IWUGO | S_IRUGO, pod_get_mod_param_4,
378 pod_set_mod_param_4);
379static DEVICE_ATTR(mod_param_5, S_IWUGO | S_IRUGO, pod_get_mod_param_5,
380 pod_set_mod_param_5);
381static DEVICE_ATTR(mod_volume_mix, S_IWUGO | S_IRUGO, pod_get_mod_volume_mix,
382 pod_set_mod_volume_mix);
383static DEVICE_ATTR(mod_pre_post, S_IWUGO | S_IRUGO, pod_get_mod_pre_post,
384 pod_set_mod_pre_post);
385static DEVICE_ATTR(modulation_model, S_IWUGO | S_IRUGO,
386 pod_get_modulation_model, pod_set_modulation_model);
387static DEVICE_ATTR(band_3_frequency, S_IWUGO | S_IRUGO,
388 pod_get_band_3_frequency, pod_set_band_3_frequency);
389static 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);
392static 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);
395static 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);
398static DEVICE_ATTR(eq_enable, S_IWUGO | S_IRUGO, pod_get_eq_enable,
399 pod_set_eq_enable);
705ececd 400static DEVICE_ATTR(tap, S_IWUGO | S_IRUGO, pod_get_tap, pod_set_tap);
acdc1021
SB
401static DEVICE_ATTR(volume_tweak_pedal_assign, S_IWUGO | S_IRUGO,
402 pod_get_volume_tweak_pedal_assign,
403 pod_set_volume_tweak_pedal_assign);
404static DEVICE_ATTR(band_5_frequency, S_IWUGO | S_IRUGO,
405 pod_get_band_5_frequency, pod_set_band_5_frequency);
705ececd 406static DEVICE_ATTR(tuner, S_IWUGO | S_IRUGO, pod_get_tuner, pod_set_tuner);
acdc1021
SB
407static DEVICE_ATTR(mic_selection, S_IWUGO | S_IRUGO, pod_get_mic_selection,
408 pod_set_mic_selection);
409static DEVICE_ATTR(cabinet_model, S_IWUGO | S_IRUGO, pod_get_cabinet_model,
410 pod_set_cabinet_model);
411static DEVICE_ATTR(stomp_model, S_IWUGO | S_IRUGO, pod_get_stomp_model,
412 pod_set_stomp_model);
413static DEVICE_ATTR(roomlevel, S_IWUGO | S_IRUGO, pod_get_roomlevel,
414 pod_set_roomlevel);
415static DEVICE_ATTR(band_4_frequency, S_IWUGO | S_IRUGO,
416 pod_get_band_4_frequency, pod_set_band_4_frequency);
417static DEVICE_ATTR(band_6_frequency, S_IWUGO | S_IRUGO,
418 pod_get_band_6_frequency, pod_set_band_6_frequency);
419static 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);
422static DEVICE_ATTR(stomp_param_2, S_IWUGO | S_IRUGO, pod_get_stomp_param_2,
423 pod_set_stomp_param_2);
424static DEVICE_ATTR(stomp_param_3, S_IWUGO | S_IRUGO, pod_get_stomp_param_3,
425 pod_set_stomp_param_3);
426static DEVICE_ATTR(stomp_param_4, S_IWUGO | S_IRUGO, pod_get_stomp_param_4,
427 pod_set_stomp_param_4);
428static DEVICE_ATTR(stomp_param_5, S_IWUGO | S_IRUGO, pod_get_stomp_param_5,
429 pod_set_stomp_param_5);
430static DEVICE_ATTR(stomp_param_6, S_IWUGO | S_IRUGO, pod_get_stomp_param_6,
431 pod_set_stomp_param_6);
432static DEVICE_ATTR(amp_switch_select, S_IWUGO | S_IRUGO,
433 pod_get_amp_switch_select, pod_set_amp_switch_select);
434static DEVICE_ATTR(delay_param_4, S_IWUGO | S_IRUGO, pod_get_delay_param_4,
435 pod_set_delay_param_4);
436static DEVICE_ATTR(delay_param_5, S_IWUGO | S_IRUGO, pod_get_delay_param_5,
437 pod_set_delay_param_5);
438static DEVICE_ATTR(delay_pre_post, S_IWUGO | S_IRUGO, pod_get_delay_pre_post,
439 pod_set_delay_pre_post);
440static DEVICE_ATTR(delay_model, S_IWUGO | S_IRUGO, pod_get_delay_model,
441 pod_set_delay_model);
442static DEVICE_ATTR(delay_verb_model, S_IWUGO | S_IRUGO,
443 pod_get_delay_verb_model, pod_set_delay_verb_model);
444static DEVICE_ATTR(tempo_msb, S_IWUGO | S_IRUGO, pod_get_tempo_msb,
445 pod_set_tempo_msb);
446static DEVICE_ATTR(tempo_lsb, S_IWUGO | S_IRUGO, pod_get_tempo_lsb,
447 pod_set_tempo_lsb);
448static DEVICE_ATTR(wah_model, S_IWUGO | S_IRUGO, pod_get_wah_model,
449 pod_set_wah_model);
450static DEVICE_ATTR(bypass_volume, S_IWUGO | S_IRUGO, pod_get_bypass_volume,
451 pod_set_bypass_volume);
452static DEVICE_ATTR(fx_loop_on_off, S_IWUGO | S_IRUGO, pod_get_fx_loop_on_off,
453 pod_set_fx_loop_on_off);
454static DEVICE_ATTR(tweak_param_select, S_IWUGO | S_IRUGO,
455 pod_get_tweak_param_select, pod_set_tweak_param_select);
456static DEVICE_ATTR(amp1_engage, S_IWUGO | S_IRUGO, pod_get_amp1_engage,
457 pod_set_amp1_engage);
458static DEVICE_ATTR(band_1_gain, S_IWUGO | S_IRUGO, pod_get_band_1_gain,
459 pod_set_band_1_gain);
460static 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);
462static DEVICE_ATTR(band_2_gain, S_IWUGO | S_IRUGO, pod_get_band_2_gain,
463 pod_set_band_2_gain);
464static 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);
466static DEVICE_ATTR(band_3_gain, S_IWUGO | S_IRUGO, pod_get_band_3_gain,
467 pod_set_band_3_gain);
468static 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);
470static 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);
472static DEVICE_ATTR(band_4_gain, S_IWUGO | S_IRUGO, pod_get_band_4_gain,
473 pod_set_band_4_gain);
474static 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);
705ececd 476static DEVICE_ATTR(body, S_IRUGO, variax_get_body, line6_nop_write);
acdc1021
SB
477static DEVICE_ATTR(pickup1_enable, S_IRUGO, variax_get_pickup1_enable,
478 line6_nop_write);
479static DEVICE_ATTR(pickup1_type, S_IRUGO, variax_get_pickup1_type,
480 line6_nop_write);
481static DEVICE_ATTR(pickup1_position, S_IRUGO, variax_get_pickup1_position,
482 line6_nop_write);
483static DEVICE_ATTR(pickup1_angle, S_IRUGO, variax_get_pickup1_angle,
484 line6_nop_write);
485static DEVICE_ATTR(pickup1_level, S_IRUGO, variax_get_pickup1_level,
486 line6_nop_write);
487static DEVICE_ATTR(pickup2_enable, S_IRUGO, variax_get_pickup2_enable,
488 line6_nop_write);
489static DEVICE_ATTR(pickup2_type, S_IRUGO, variax_get_pickup2_type,
490 line6_nop_write);
491static DEVICE_ATTR(pickup2_position, S_IRUGO, variax_get_pickup2_position,
492 line6_nop_write);
493static DEVICE_ATTR(pickup2_angle, S_IRUGO, variax_get_pickup2_angle,
494 line6_nop_write);
495static DEVICE_ATTR(pickup2_level, S_IRUGO, variax_get_pickup2_level,
496 line6_nop_write);
497static DEVICE_ATTR(pickup_phase, S_IRUGO, variax_get_pickup_phase,
498 line6_nop_write);
499static DEVICE_ATTR(capacitance, S_IRUGO, variax_get_capacitance,
500 line6_nop_write);
501static DEVICE_ATTR(tone_resistance, S_IRUGO, variax_get_tone_resistance,
502 line6_nop_write);
503static DEVICE_ATTR(volume_resistance, S_IRUGO, variax_get_volume_resistance,
504 line6_nop_write);
705ececd
MG
505static DEVICE_ATTR(taper, S_IRUGO, variax_get_taper, line6_nop_write);
506static DEVICE_ATTR(tone_dump, S_IRUGO, variax_get_tone_dump, line6_nop_write);
507static DEVICE_ATTR(save_tone, S_IRUGO, variax_get_save_tone, line6_nop_write);
acdc1021
SB
508static DEVICE_ATTR(volume_dump, S_IRUGO, variax_get_volume_dump,
509 line6_nop_write);
510static DEVICE_ATTR(tuning_enable, S_IRUGO, variax_get_tuning_enable,
511 line6_nop_write);
705ececd
MG
512static DEVICE_ATTR(tuning6, S_IRUGO, variax_get_tuning6, line6_nop_write);
513static DEVICE_ATTR(tuning5, S_IRUGO, variax_get_tuning5, line6_nop_write);
514static DEVICE_ATTR(tuning4, S_IRUGO, variax_get_tuning4, line6_nop_write);
515static DEVICE_ATTR(tuning3, S_IRUGO, variax_get_tuning3, line6_nop_write);
516static DEVICE_ATTR(tuning2, S_IRUGO, variax_get_tuning2, line6_nop_write);
517static DEVICE_ATTR(tuning1, S_IRUGO, variax_get_tuning1, line6_nop_write);
518static DEVICE_ATTR(detune6, S_IRUGO, variax_get_detune6, line6_nop_write);
519static DEVICE_ATTR(detune5, S_IRUGO, variax_get_detune5, line6_nop_write);
520static DEVICE_ATTR(detune4, S_IRUGO, variax_get_detune4, line6_nop_write);
521static DEVICE_ATTR(detune3, S_IRUGO, variax_get_detune3, line6_nop_write);
522static DEVICE_ATTR(detune2, S_IRUGO, variax_get_detune2, line6_nop_write);
523static DEVICE_ATTR(detune1, S_IRUGO, variax_get_detune1, line6_nop_write);
524static DEVICE_ATTR(mix6, S_IRUGO, variax_get_mix6, line6_nop_write);
525static DEVICE_ATTR(mix5, S_IRUGO, variax_get_mix5, line6_nop_write);
526static DEVICE_ATTR(mix4, S_IRUGO, variax_get_mix4, line6_nop_write);
527static DEVICE_ATTR(mix3, S_IRUGO, variax_get_mix3, line6_nop_write);
528static DEVICE_ATTR(mix2, S_IRUGO, variax_get_mix2, line6_nop_write);
529static DEVICE_ATTR(mix1, S_IRUGO, variax_get_mix1, line6_nop_write);
acdc1021
SB
530static DEVICE_ATTR(pickup_wiring, S_IRUGO, variax_get_pickup_wiring,
531 line6_nop_write);
705ececd 532
9a92fadc
GKH
533int pod_create_files(int firmware, int type, struct device *dev)
534{
705ececd
MG
535 int err;
536 CHECK_RETURN(device_create_file(dev, &dev_attr_tweak));
537 CHECK_RETURN(device_create_file(dev, &dev_attr_wah_position));
9a92fadc 538 if ((type & (LINE6_BITS_PODXTALL)) != 0)
acdc1021
SB
539 CHECK_RETURN(device_create_file
540 (dev, &dev_attr_compression_gain));
705ececd
MG
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));
9a92fadc
GKH
545 if (firmware >= 200)
546 CHECK_RETURN(device_create_file(dev, &dev_attr_amp_model));
705ececd
MG
547 CHECK_RETURN(device_create_file(dev, &dev_attr_drive));
548 CHECK_RETURN(device_create_file(dev, &dev_attr_bass));
9a92fadc
GKH
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));
705ececd 557 CHECK_RETURN(device_create_file(dev, &dev_attr_chan_vol));
9a92fadc
GKH
558 if ((type & (LINE6_BITS_PODXTALL)) != 0)
559 CHECK_RETURN(device_create_file(dev, &dev_attr_reverb_mix));
705ececd 560 CHECK_RETURN(device_create_file(dev, &dev_attr_effect_setup));
9a92fadc 561 if (firmware >= 200)
acdc1021
SB
562 CHECK_RETURN(device_create_file
563 (dev, &dev_attr_band_1_frequency));
9a92fadc
GKH
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));
705ececd
MG
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));
acdc1021
SB
577 CHECK_RETURN(device_create_file
578 (dev, &dev_attr_delay_param_1_note_value));
9a92fadc
GKH
579 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
580 if (firmware >= 200)
acdc1021
SB
581 CHECK_RETURN(device_create_file
582 (dev, &dev_attr_band_2_frequency__bass));
705ececd
MG
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));
9a92fadc
GKH
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)
acdc1021
SB
595 CHECK_RETURN(device_create_file
596 (dev, &dev_attr_reverb_pre_delay));
9a92fadc 597 if ((type & (LINE6_BITS_PODXTALL)) != 0)
acdc1021
SB
598 CHECK_RETURN(device_create_file
599 (dev, &dev_attr_reverb_pre_post));
9a92fadc
GKH
600 if ((type & (LINE6_BITS_PODXTALL)) != 0)
601 if (firmware >= 200)
acdc1021
SB
602 CHECK_RETURN(device_create_file
603 (dev, &dev_attr_band_2_frequency));
9a92fadc
GKH
604 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
605 if (firmware >= 200)
acdc1021
SB
606 CHECK_RETURN(device_create_file
607 (dev, &dev_attr_band_3_frequency__bass));
705ececd 608 CHECK_RETURN(device_create_file(dev, &dev_attr_wah_enable));
9a92fadc 609 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
acdc1021
SB
610 CHECK_RETURN(device_create_file
611 (dev, &dev_attr_modulation_lo_cut));
9a92fadc 612 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
acdc1021
SB
613 CHECK_RETURN(device_create_file
614 (dev, &dev_attr_delay_reverb_lo_cut));
9a92fadc
GKH
615 if ((type & (LINE6_BITS_PODXTALL)) != 0)
616 if (firmware >= 200)
acdc1021
SB
617 CHECK_RETURN(device_create_file
618 (dev, &dev_attr_volume_pedal_minimum));
9a92fadc
GKH
619 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
620 if (firmware >= 200)
acdc1021
SB
621 CHECK_RETURN(device_create_file
622 (dev, &dev_attr_eq_pre_post));
705ececd 623 CHECK_RETURN(device_create_file(dev, &dev_attr_volume_pre_post));
9a92fadc
GKH
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));
705ececd
MG
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));
9a92fadc
GKH
633 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
634 CHECK_RETURN(device_create_file(dev, &dev_attr_mod_param_5));
705ececd
MG
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));
9a92fadc
GKH
638 if ((type & (LINE6_BITS_PODXTALL)) != 0)
639 if (firmware >= 200)
acdc1021
SB
640 CHECK_RETURN(device_create_file
641 (dev, &dev_attr_band_3_frequency));
9a92fadc
GKH
642 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
643 if (firmware >= 200)
acdc1021
SB
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));
9a92fadc
GKH
650 if (firmware >= 200)
651 CHECK_RETURN(device_create_file(dev, &dev_attr_eq_enable));
705ececd 652 CHECK_RETURN(device_create_file(dev, &dev_attr_tap));
acdc1021
SB
653 CHECK_RETURN(device_create_file
654 (dev, &dev_attr_volume_tweak_pedal_assign));
9a92fadc
GKH
655 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
656 if (firmware >= 200)
acdc1021
SB
657 CHECK_RETURN(device_create_file
658 (dev, &dev_attr_band_5_frequency));
705ececd
MG
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));
9a92fadc
GKH
664 if ((type & (LINE6_BITS_PODXTALL)) != 0)
665 if (firmware >= 200)
acdc1021
SB
666 CHECK_RETURN(device_create_file
667 (dev, &dev_attr_band_4_frequency));
9a92fadc
GKH
668 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
669 if (firmware >= 200)
acdc1021
SB
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));
705ececd
MG
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));
9a92fadc 679 if ((type & (LINE6_BITS_LIVE)) != 0)
acdc1021
SB
680 CHECK_RETURN(device_create_file
681 (dev, &dev_attr_amp_switch_select));
705ececd
MG
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));
9a92fadc
GKH
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)
acdc1021
SB
688 CHECK_RETURN(device_create_file
689 (dev, &dev_attr_delay_verb_model));
705ececd
MG
690 CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_msb));
691 CHECK_RETURN(device_create_file(dev, &dev_attr_tempo_lsb));
9a92fadc
GKH
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));
705ececd
MG
698 CHECK_RETURN(device_create_file(dev, &dev_attr_tweak_param_select));
699 CHECK_RETURN(device_create_file(dev, &dev_attr_amp1_engage));
9a92fadc
GKH
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)
acdc1021
SB
704 CHECK_RETURN(device_create_file
705 (dev, &dev_attr_band_2_gain__bass));
9a92fadc
GKH
706 if ((type & (LINE6_BITS_PODXTALL)) != 0)
707 if (firmware >= 200)
acdc1021
SB
708 CHECK_RETURN(device_create_file
709 (dev, &dev_attr_band_2_gain));
9a92fadc
GKH
710 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
711 if (firmware >= 200)
acdc1021
SB
712 CHECK_RETURN(device_create_file
713 (dev, &dev_attr_band_3_gain__bass));
9a92fadc
GKH
714 if ((type & (LINE6_BITS_PODXTALL)) != 0)
715 if (firmware >= 200)
acdc1021
SB
716 CHECK_RETURN(device_create_file
717 (dev, &dev_attr_band_3_gain));
9a92fadc
GKH
718 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
719 if (firmware >= 200)
acdc1021
SB
720 CHECK_RETURN(device_create_file
721 (dev, &dev_attr_band_4_gain__bass));
9a92fadc
GKH
722 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
723 if (firmware >= 200)
acdc1021
SB
724 CHECK_RETURN(device_create_file
725 (dev, &dev_attr_band_5_gain__bass));
9a92fadc
GKH
726 if ((type & (LINE6_BITS_PODXTALL)) != 0)
727 if (firmware >= 200)
acdc1021
SB
728 CHECK_RETURN(device_create_file
729 (dev, &dev_attr_band_4_gain));
9a92fadc
GKH
730 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
731 if (firmware >= 200)
acdc1021
SB
732 CHECK_RETURN(device_create_file
733 (dev, &dev_attr_band_6_gain__bass));
734 return 0;
705ececd 735}
2a20bf6f 736EXPORT_SYMBOL(pod_create_files);
705ececd 737
9a92fadc
GKH
738void pod_remove_files(int firmware, int type, struct device *dev)
739{
705ececd
MG
740 device_remove_file(dev, &dev_attr_tweak);
741 device_remove_file(dev, &dev_attr_wah_position);
9a92fadc
GKH
742 if ((type & (LINE6_BITS_PODXTALL)) != 0)
743 device_remove_file(dev, &dev_attr_compression_gain);
705ececd
MG
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);
9a92fadc
GKH
748 if (firmware >= 200)
749 device_remove_file(dev, &dev_attr_amp_model);
705ececd
MG
750 device_remove_file(dev, &dev_attr_drive);
751 device_remove_file(dev, &dev_attr_bass);
9a92fadc
GKH
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);
705ececd 760 device_remove_file(dev, &dev_attr_chan_vol);
9a92fadc
GKH
761 if ((type & (LINE6_BITS_PODXTALL)) != 0)
762 device_remove_file(dev, &dev_attr_reverb_mix);
705ececd 763 device_remove_file(dev, &dev_attr_effect_setup);
9a92fadc
GKH
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);
705ececd
MG
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);
9a92fadc
GKH
780 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
781 if (firmware >= 200)
acdc1021
SB
782 device_remove_file(dev,
783 &dev_attr_band_2_frequency__bass);
705ececd
MG
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);
9a92fadc
GKH
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)
acdc1021
SB
804 device_remove_file(dev,
805 &dev_attr_band_3_frequency__bass);
705ececd 806 device_remove_file(dev, &dev_attr_wah_enable);
9a92fadc
GKH
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);
705ececd 817 device_remove_file(dev, &dev_attr_volume_pre_post);
9a92fadc
GKH
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);
705ececd
MG
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);
9a92fadc
GKH
827 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
828 device_remove_file(dev, &dev_attr_mod_param_5);
705ececd
MG
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);
9a92fadc
GKH
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)
acdc1021
SB
837 device_remove_file(dev,
838 &dev_attr_band_4_frequency__bass);
705ececd
MG
839 device_remove_file(dev, &dev_attr_mod_param_1_double_precision);
840 device_remove_file(dev, &dev_attr_delay_param_1_double_precision);
9a92fadc
GKH
841 if (firmware >= 200)
842 device_remove_file(dev, &dev_attr_eq_enable);
705ececd
MG
843 device_remove_file(dev, &dev_attr_tap);
844 device_remove_file(dev, &dev_attr_volume_tweak_pedal_assign);
9a92fadc
GKH
845 if ((type & (LINE6_BITS_BASSPODXTALL)) != 0)
846 if (firmware >= 200)
847 device_remove_file(dev, &dev_attr_band_5_frequency);
705ececd
MG
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);
9a92fadc
GKH
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);
705ececd
MG
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);
9a92fadc
GKH
865 if ((type & (LINE6_BITS_LIVE)) != 0)
866 device_remove_file(dev, &dev_attr_amp_switch_select);
705ececd
MG
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);
9a92fadc
GKH
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);
705ececd
MG
874 device_remove_file(dev, &dev_attr_tempo_msb);
875 device_remove_file(dev, &dev_attr_tempo_lsb);
9a92fadc
GKH
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);
705ececd
MG
882 device_remove_file(dev, &dev_attr_tweak_param_select);
883 device_remove_file(dev, &dev_attr_amp1_engage);
9a92fadc
GKH
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);
705ececd 910}
705ececd
MG
911EXPORT_SYMBOL(pod_remove_files);
912
9a92fadc
GKH
913int variax_create_files(int firmware, int type, struct device *dev)
914{
705ececd
MG
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));
acdc1021 955 return 0;
705ececd 956}
2a20bf6f 957EXPORT_SYMBOL(variax_create_files);
705ececd 958
9a92fadc
GKH
959void variax_remove_files(int firmware, int type, struct device *dev)
960{
705ececd
MG
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}
705ececd 1001EXPORT_SYMBOL(variax_remove_files);