diff options
Diffstat (limited to 'sound/pci/ice1712/hoontech.c')
-rw-r--r-- | sound/pci/ice1712/hoontech.c | 183 |
1 files changed, 101 insertions, 82 deletions
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c index b042e5cfc3cd..cf5c7c0898fd 100644 --- a/sound/pci/ice1712/hoontech.c +++ b/sound/pci/ice1712/hoontech.c | |||
@@ -33,6 +33,12 @@ | |||
33 | #include "ice1712.h" | 33 | #include "ice1712.h" |
34 | #include "hoontech.h" | 34 | #include "hoontech.h" |
35 | 35 | ||
36 | /* Hoontech-specific setting */ | ||
37 | struct hoontech_spec { | ||
38 | unsigned char boxbits[4]; | ||
39 | unsigned int config; | ||
40 | unsigned short boxconfig[4]; | ||
41 | }; | ||
36 | 42 | ||
37 | static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte) | 43 | static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte) |
38 | { | 44 | { |
@@ -49,169 +55,182 @@ static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, un | |||
49 | 55 | ||
50 | static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) | 56 | static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) |
51 | { | 57 | { |
58 | struct hoontech_spec *spec = ice->spec; | ||
52 | mutex_lock(&ice->gpio_mutex); | 59 | mutex_lock(&ice->gpio_mutex); |
53 | ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, activate); | 60 | ICE1712_STDSP24_0_DAREAR(spec->boxbits, activate); |
54 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); | 61 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); |
55 | mutex_unlock(&ice->gpio_mutex); | 62 | mutex_unlock(&ice->gpio_mutex); |
56 | } | 63 | } |
57 | 64 | ||
58 | static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) | 65 | static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) |
59 | { | 66 | { |
67 | struct hoontech_spec *spec = ice->spec; | ||
60 | mutex_lock(&ice->gpio_mutex); | 68 | mutex_lock(&ice->gpio_mutex); |
61 | ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, activate); | 69 | ICE1712_STDSP24_3_MUTE(spec->boxbits, activate); |
62 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 70 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
63 | mutex_unlock(&ice->gpio_mutex); | 71 | mutex_unlock(&ice->gpio_mutex); |
64 | } | 72 | } |
65 | 73 | ||
66 | static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) | 74 | static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) |
67 | { | 75 | { |
76 | struct hoontech_spec *spec = ice->spec; | ||
68 | mutex_lock(&ice->gpio_mutex); | 77 | mutex_lock(&ice->gpio_mutex); |
69 | ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, activate); | 78 | ICE1712_STDSP24_3_INSEL(spec->boxbits, activate); |
70 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 79 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
71 | mutex_unlock(&ice->gpio_mutex); | 80 | mutex_unlock(&ice->gpio_mutex); |
72 | } | 81 | } |
73 | 82 | ||
74 | static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) | 83 | static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) |
75 | { | 84 | { |
85 | struct hoontech_spec *spec = ice->spec; | ||
86 | |||
76 | mutex_lock(&ice->gpio_mutex); | 87 | mutex_lock(&ice->gpio_mutex); |
77 | 88 | ||
78 | /* select box */ | 89 | /* select box */ |
79 | ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); | 90 | ICE1712_STDSP24_0_BOX(spec->boxbits, box); |
80 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); | 91 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); |
81 | 92 | ||
82 | /* prepare for write */ | 93 | /* prepare for write */ |
83 | if (chn == 3) | 94 | if (chn == 3) |
84 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 0); | 95 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 0); |
85 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, activate); | 96 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, activate); |
86 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 97 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
87 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 98 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
88 | 99 | ||
89 | ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); | 100 | ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); |
90 | ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); | 101 | ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); |
91 | ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); | 102 | ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); |
92 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); | 103 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); |
93 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); | 104 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); |
94 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 105 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
95 | udelay(100); | 106 | udelay(100); |
96 | if (chn == 3) { | 107 | if (chn == 3) { |
97 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 0); | 108 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 0); |
98 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 109 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
99 | } else { | 110 | } else { |
100 | switch (chn) { | 111 | switch (chn) { |
101 | case 0: ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 0); break; | 112 | case 0: ICE1712_STDSP24_1_CHN1(spec->boxbits, 0); break; |
102 | case 1: ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 0); break; | 113 | case 1: ICE1712_STDSP24_1_CHN2(spec->boxbits, 0); break; |
103 | case 2: ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 0); break; | 114 | case 2: ICE1712_STDSP24_1_CHN3(spec->boxbits, 0); break; |
104 | } | 115 | } |
105 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); | 116 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); |
106 | } | 117 | } |
107 | udelay(100); | 118 | udelay(100); |
108 | ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); | 119 | ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); |
109 | ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); | 120 | ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); |
110 | ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); | 121 | ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); |
111 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); | 122 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); |
112 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[1]); | 123 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[1]); |
113 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 124 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
114 | udelay(100); | 125 | udelay(100); |
115 | 126 | ||
116 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0); | 127 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0); |
117 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 128 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
118 | 129 | ||
119 | mutex_unlock(&ice->gpio_mutex); | 130 | mutex_unlock(&ice->gpio_mutex); |
120 | } | 131 | } |
121 | 132 | ||
122 | static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) | 133 | static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) |
123 | { | 134 | { |
135 | struct hoontech_spec *spec = ice->spec; | ||
136 | |||
124 | mutex_lock(&ice->gpio_mutex); | 137 | mutex_lock(&ice->gpio_mutex); |
125 | 138 | ||
126 | /* select box */ | 139 | /* select box */ |
127 | ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, box); | 140 | ICE1712_STDSP24_0_BOX(spec->boxbits, box); |
128 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[0]); | 141 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[0]); |
129 | 142 | ||
130 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); | 143 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); |
131 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, master); | 144 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, master); |
132 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 145 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
133 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 146 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
134 | 147 | ||
135 | udelay(100); | 148 | udelay(100); |
136 | 149 | ||
137 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 0); | 150 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 0); |
138 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 151 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
139 | 152 | ||
140 | mdelay(10); | 153 | mdelay(10); |
141 | 154 | ||
142 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); | 155 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); |
143 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[2]); | 156 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[2]); |
144 | 157 | ||
145 | mutex_unlock(&ice->gpio_mutex); | 158 | mutex_unlock(&ice->gpio_mutex); |
146 | } | 159 | } |
147 | 160 | ||
148 | static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) | 161 | static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) |
149 | { | 162 | { |
163 | struct hoontech_spec *spec = ice->spec; | ||
150 | mutex_lock(&ice->gpio_mutex); | 164 | mutex_lock(&ice->gpio_mutex); |
151 | ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, activate); | 165 | ICE1712_STDSP24_3_MIDI2(spec->boxbits, activate); |
152 | snd_ice1712_stdsp24_gpio_write(ice, ice->spec.hoontech.boxbits[3]); | 166 | snd_ice1712_stdsp24_gpio_write(ice, spec->boxbits[3]); |
153 | mutex_unlock(&ice->gpio_mutex); | 167 | mutex_unlock(&ice->gpio_mutex); |
154 | } | 168 | } |
155 | 169 | ||
156 | static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice) | 170 | static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice) |
157 | { | 171 | { |
172 | struct hoontech_spec *spec; | ||
158 | int box, chn; | 173 | int box, chn; |
159 | 174 | ||
160 | ice->num_total_dacs = 8; | 175 | ice->num_total_dacs = 8; |
161 | ice->num_total_adcs = 8; | 176 | ice->num_total_adcs = 8; |
162 | 177 | ||
163 | ice->spec.hoontech.boxbits[0] = | 178 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
164 | ice->spec.hoontech.boxbits[1] = | 179 | if (!spec) |
165 | ice->spec.hoontech.boxbits[2] = | 180 | return -ENOMEM; |
166 | ice->spec.hoontech.boxbits[3] = 0; /* should be already */ | 181 | ice->spec = spec; |
167 | 182 | ||
168 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 0); | 183 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 0); |
169 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 0, 1); | 184 | ICE1712_STDSP24_CLOCK(spec->boxbits, 0, 1); |
170 | ICE1712_STDSP24_0_BOX(ice->spec.hoontech.boxbits, 0); | 185 | ICE1712_STDSP24_0_BOX(spec->boxbits, 0); |
171 | ICE1712_STDSP24_0_DAREAR(ice->spec.hoontech.boxbits, 0); | 186 | ICE1712_STDSP24_0_DAREAR(spec->boxbits, 0); |
172 | 187 | ||
173 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 1); | 188 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 1); |
174 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 1, 1); | 189 | ICE1712_STDSP24_CLOCK(spec->boxbits, 1, 1); |
175 | ICE1712_STDSP24_1_CHN1(ice->spec.hoontech.boxbits, 1); | 190 | ICE1712_STDSP24_1_CHN1(spec->boxbits, 1); |
176 | ICE1712_STDSP24_1_CHN2(ice->spec.hoontech.boxbits, 1); | 191 | ICE1712_STDSP24_1_CHN2(spec->boxbits, 1); |
177 | ICE1712_STDSP24_1_CHN3(ice->spec.hoontech.boxbits, 1); | 192 | ICE1712_STDSP24_1_CHN3(spec->boxbits, 1); |
178 | 193 | ||
179 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 2); | 194 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 2); |
180 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 2, 1); | 195 | ICE1712_STDSP24_CLOCK(spec->boxbits, 2, 1); |
181 | ICE1712_STDSP24_2_CHN4(ice->spec.hoontech.boxbits, 1); | 196 | ICE1712_STDSP24_2_CHN4(spec->boxbits, 1); |
182 | ICE1712_STDSP24_2_MIDIIN(ice->spec.hoontech.boxbits, 1); | 197 | ICE1712_STDSP24_2_MIDIIN(spec->boxbits, 1); |
183 | ICE1712_STDSP24_2_MIDI1(ice->spec.hoontech.boxbits, 0); | 198 | ICE1712_STDSP24_2_MIDI1(spec->boxbits, 0); |
184 | 199 | ||
185 | ICE1712_STDSP24_SET_ADDR(ice->spec.hoontech.boxbits, 3); | 200 | ICE1712_STDSP24_SET_ADDR(spec->boxbits, 3); |
186 | ICE1712_STDSP24_CLOCK(ice->spec.hoontech.boxbits, 3, 1); | 201 | ICE1712_STDSP24_CLOCK(spec->boxbits, 3, 1); |
187 | ICE1712_STDSP24_3_MIDI2(ice->spec.hoontech.boxbits, 0); | 202 | ICE1712_STDSP24_3_MIDI2(spec->boxbits, 0); |
188 | ICE1712_STDSP24_3_MUTE(ice->spec.hoontech.boxbits, 1); | 203 | ICE1712_STDSP24_3_MUTE(spec->boxbits, 1); |
189 | ICE1712_STDSP24_3_INSEL(ice->spec.hoontech.boxbits, 0); | 204 | ICE1712_STDSP24_3_INSEL(spec->boxbits, 0); |
190 | 205 | ||
191 | /* let's go - activate only functions in first box */ | 206 | /* let's go - activate only functions in first box */ |
192 | ice->spec.hoontech.config = 0; | 207 | spec->config = 0; |
193 | /* ICE1712_STDSP24_MUTE | | 208 | /* ICE1712_STDSP24_MUTE | |
194 | ICE1712_STDSP24_INSEL | | 209 | ICE1712_STDSP24_INSEL | |
195 | ICE1712_STDSP24_DAREAR; */ | 210 | ICE1712_STDSP24_DAREAR; */ |
196 | ice->spec.hoontech.boxconfig[0] = ICE1712_STDSP24_BOX_CHN1 | | 211 | spec->boxconfig[0] = ICE1712_STDSP24_BOX_CHN1 | |
197 | ICE1712_STDSP24_BOX_CHN2 | | 212 | ICE1712_STDSP24_BOX_CHN2 | |
198 | ICE1712_STDSP24_BOX_CHN3 | | 213 | ICE1712_STDSP24_BOX_CHN3 | |
199 | ICE1712_STDSP24_BOX_CHN4 | | 214 | ICE1712_STDSP24_BOX_CHN4 | |
200 | ICE1712_STDSP24_BOX_MIDI1 | | 215 | ICE1712_STDSP24_BOX_MIDI1 | |
201 | ICE1712_STDSP24_BOX_MIDI2; | 216 | ICE1712_STDSP24_BOX_MIDI2; |
202 | ice->spec.hoontech.boxconfig[1] = | 217 | spec->boxconfig[1] = |
203 | ice->spec.hoontech.boxconfig[2] = | 218 | spec->boxconfig[2] = |
204 | ice->spec.hoontech.boxconfig[3] = 0; | 219 | spec->boxconfig[3] = 0; |
205 | snd_ice1712_stdsp24_darear(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_DAREAR) ? 1 : 0); | 220 | snd_ice1712_stdsp24_darear(ice, |
206 | snd_ice1712_stdsp24_mute(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_MUTE) ? 1 : 0); | 221 | (spec->config & ICE1712_STDSP24_DAREAR) ? 1 : 0); |
207 | snd_ice1712_stdsp24_insel(ice, (ice->spec.hoontech.config & ICE1712_STDSP24_INSEL) ? 1 : 0); | 222 | snd_ice1712_stdsp24_mute(ice, |
223 | (spec->config & ICE1712_STDSP24_MUTE) ? 1 : 0); | ||
224 | snd_ice1712_stdsp24_insel(ice, | ||
225 | (spec->config & ICE1712_STDSP24_INSEL) ? 1 : 0); | ||
208 | for (box = 0; box < 1; box++) { | 226 | for (box = 0; box < 1; box++) { |
209 | if (ice->spec.hoontech.boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) | 227 | if (spec->boxconfig[box] & ICE1712_STDSP24_BOX_MIDI2) |
210 | snd_ice1712_stdsp24_midi2(ice, 1); | 228 | snd_ice1712_stdsp24_midi2(ice, 1); |
211 | for (chn = 0; chn < 4; chn++) | 229 | for (chn = 0; chn < 4; chn++) |
212 | snd_ice1712_stdsp24_box_channel(ice, box, chn, (ice->spec.hoontech.boxconfig[box] & (1 << chn)) ? 1 : 0); | 230 | snd_ice1712_stdsp24_box_channel(ice, box, chn, |
231 | (spec->boxconfig[box] & (1 << chn)) ? 1 : 0); | ||
213 | snd_ice1712_stdsp24_box_midi(ice, box, | 232 | snd_ice1712_stdsp24_box_midi(ice, box, |
214 | (ice->spec.hoontech.boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0); | 233 | (spec->boxconfig[box] & ICE1712_STDSP24_BOX_MIDI1) ? 1 : 0); |
215 | } | 234 | } |
216 | 235 | ||
217 | return 0; | 236 | return 0; |