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