diff options
author | Krzysztof Helt <krzysztof.h1@wp.pl> | 2008-07-31 15:03:41 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-08-06 09:39:49 -0400 |
commit | 7779f75f072784d3fccf721b8ec43107f93619a0 (patch) | |
tree | ada616dd3efdea7192aef3cd4ddb743f980bc39b /sound/isa/wss | |
parent | 61ef19d7e771ce021edb0dff0da134b6d688d4aa (diff) |
ALSA: wss_lib: rename cs4321_foo to wss_foo
Rename functions and structures from the former
cs4321_lib to names more corresponding with the
new name: wss_lib.
Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Reviewed-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/isa/wss')
-rw-r--r-- | sound/isa/wss/wss_lib.c | 1247 |
1 files changed, 701 insertions, 546 deletions
diff --git a/sound/isa/wss/wss_lib.c b/sound/isa/wss/wss_lib.c index 549e6ab34b03..a982997805c4 100644 --- a/sound/isa/wss/wss_lib.c +++ b/sound/isa/wss/wss_lib.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * - sometimes record brokes playback with WSS portion of | 6 | * - sometimes record brokes playback with WSS portion of |
7 | * Yamaha OPL3-SA3 chip | 7 | * Yamaha OPL3-SA3 chip |
8 | * - CS4231 (GUS MAX) - still trouble with occasional noises | 8 | * - CS4231 (GUS MAX) - still trouble with occasional noises |
9 | * - broken initialization? | 9 | * - broken initialization? |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
12 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License as published by |
@@ -78,12 +78,13 @@ static struct snd_pcm_hw_constraint_list hw_constraints_rates = { | |||
78 | .mask = 0, | 78 | .mask = 0, |
79 | }; | 79 | }; |
80 | 80 | ||
81 | static int snd_cs4231_xrate(struct snd_pcm_runtime *runtime) | 81 | static int snd_wss_xrate(struct snd_pcm_runtime *runtime) |
82 | { | 82 | { |
83 | return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); | 83 | return snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, |
84 | &hw_constraints_rates); | ||
84 | } | 85 | } |
85 | 86 | ||
86 | static unsigned char snd_cs4231_original_image[32] = | 87 | static unsigned char snd_wss_original_image[32] = |
87 | { | 88 | { |
88 | 0x00, /* 00/00 - lic */ | 89 | 0x00, /* 00/00 - lic */ |
89 | 0x00, /* 01/01 - ric */ | 90 | 0x00, /* 01/01 - ric */ |
@@ -159,150 +160,209 @@ static unsigned char snd_opti93x_original_image[32] = | |||
159 | * Basic I/O functions | 160 | * Basic I/O functions |
160 | */ | 161 | */ |
161 | 162 | ||
162 | static inline void cs4231_outb(struct snd_cs4231 *chip, u8 offset, u8 val) | 163 | static inline void wss_outb(struct snd_wss *chip, u8 offset, u8 val) |
163 | { | 164 | { |
164 | outb(val, chip->port + offset); | 165 | outb(val, chip->port + offset); |
165 | } | 166 | } |
166 | 167 | ||
167 | static inline u8 cs4231_inb(struct snd_cs4231 *chip, u8 offset) | 168 | static inline u8 wss_inb(struct snd_wss *chip, u8 offset) |
168 | { | 169 | { |
169 | return inb(chip->port + offset); | 170 | return inb(chip->port + offset); |
170 | } | 171 | } |
171 | 172 | ||
172 | static void snd_cs4231_wait(struct snd_cs4231 *chip) | 173 | static void snd_wss_wait(struct snd_wss *chip) |
173 | { | 174 | { |
174 | int timeout; | 175 | int timeout; |
175 | 176 | ||
176 | for (timeout = 250; | 177 | for (timeout = 250; |
177 | timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); | 178 | timeout > 0 && (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); |
178 | timeout--) | 179 | timeout--) |
179 | udelay(100); | 180 | udelay(100); |
180 | } | 181 | } |
181 | 182 | ||
182 | static void snd_cs4231_outm(struct snd_cs4231 *chip, unsigned char reg, | 183 | static void snd_wss_outm(struct snd_wss *chip, unsigned char reg, |
183 | unsigned char mask, unsigned char value) | 184 | unsigned char mask, unsigned char value) |
184 | { | 185 | { |
185 | unsigned char tmp = (chip->image[reg] & mask) | value; | 186 | unsigned char tmp = (chip->image[reg] & mask) | value; |
186 | 187 | ||
187 | snd_cs4231_wait(chip); | 188 | snd_wss_wait(chip); |
188 | #ifdef CONFIG_SND_DEBUG | 189 | #ifdef CONFIG_SND_DEBUG |
189 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 190 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
190 | snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | 191 | snd_printk("outm: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); |
191 | #endif | 192 | #endif |
192 | chip->image[reg] = tmp; | 193 | chip->image[reg] = tmp; |
193 | if (!chip->calibrate_mute) { | 194 | if (!chip->calibrate_mute) { |
194 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 195 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
195 | wmb(); | 196 | wmb(); |
196 | cs4231_outb(chip, CS4231P(REG), tmp); | 197 | wss_outb(chip, CS4231P(REG), tmp); |
197 | mb(); | 198 | mb(); |
198 | } | 199 | } |
199 | } | 200 | } |
200 | 201 | ||
201 | static void snd_cs4231_dout(struct snd_cs4231 *chip, unsigned char reg, unsigned char value) | 202 | static void snd_wss_dout(struct snd_wss *chip, unsigned char reg, |
203 | unsigned char value) | ||
202 | { | 204 | { |
203 | int timeout; | 205 | int timeout; |
204 | 206 | ||
205 | for (timeout = 250; | 207 | for (timeout = 250; |
206 | timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); | 208 | timeout > 0 && (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); |
207 | timeout--) | 209 | timeout--) |
208 | udelay(10); | 210 | udelay(10); |
209 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 211 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
210 | cs4231_outb(chip, CS4231P(REG), value); | 212 | wss_outb(chip, CS4231P(REG), value); |
211 | mb(); | 213 | mb(); |
212 | } | 214 | } |
213 | 215 | ||
214 | void snd_cs4231_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char value) | 216 | void snd_wss_out(struct snd_wss *chip, unsigned char reg, unsigned char value) |
215 | { | 217 | { |
216 | snd_cs4231_wait(chip); | 218 | snd_wss_wait(chip); |
217 | #ifdef CONFIG_SND_DEBUG | 219 | #ifdef CONFIG_SND_DEBUG |
218 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 220 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
219 | snd_printk("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); | 221 | snd_printk("out: auto calibration time out - reg = 0x%x, value = 0x%x\n", reg, value); |
220 | #endif | 222 | #endif |
221 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 223 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
222 | cs4231_outb(chip, CS4231P(REG), value); | 224 | wss_outb(chip, CS4231P(REG), value); |
223 | chip->image[reg] = value; | 225 | chip->image[reg] = value; |
224 | mb(); | 226 | mb(); |
225 | snd_printdd("codec out - reg 0x%x = 0x%x\n", | 227 | snd_printdd("codec out - reg 0x%x = 0x%x\n", |
226 | chip->mce_bit | reg, value); | 228 | chip->mce_bit | reg, value); |
227 | } | 229 | } |
230 | EXPORT_SYMBOL(snd_wss_out); | ||
228 | 231 | ||
229 | unsigned char snd_cs4231_in(struct snd_cs4231 *chip, unsigned char reg) | 232 | unsigned char snd_wss_in(struct snd_wss *chip, unsigned char reg) |
230 | { | 233 | { |
231 | snd_cs4231_wait(chip); | 234 | snd_wss_wait(chip); |
232 | #ifdef CONFIG_SND_DEBUG | 235 | #ifdef CONFIG_SND_DEBUG |
233 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 236 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
234 | snd_printk("in: auto calibration time out - reg = 0x%x\n", reg); | 237 | snd_printk("in: auto calibration time out - reg = 0x%x\n", reg); |
235 | #endif | 238 | #endif |
236 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); | 239 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); |
237 | mb(); | 240 | mb(); |
238 | return cs4231_inb(chip, CS4231P(REG)); | 241 | return wss_inb(chip, CS4231P(REG)); |
239 | } | 242 | } |
243 | EXPORT_SYMBOL(snd_wss_in); | ||
240 | 244 | ||
241 | void snd_cs4236_ext_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val) | 245 | void snd_cs4236_ext_out(struct snd_wss *chip, unsigned char reg, |
246 | unsigned char val) | ||
242 | { | 247 | { |
243 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); | 248 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); |
244 | cs4231_outb(chip, CS4231P(REG), reg | (chip->image[CS4236_EXT_REG] & 0x01)); | 249 | wss_outb(chip, CS4231P(REG), |
245 | cs4231_outb(chip, CS4231P(REG), val); | 250 | reg | (chip->image[CS4236_EXT_REG] & 0x01)); |
251 | wss_outb(chip, CS4231P(REG), val); | ||
246 | chip->eimage[CS4236_REG(reg)] = val; | 252 | chip->eimage[CS4236_REG(reg)] = val; |
247 | #if 0 | 253 | #if 0 |
248 | printk("ext out : reg = 0x%x, val = 0x%x\n", reg, val); | 254 | printk("ext out : reg = 0x%x, val = 0x%x\n", reg, val); |
249 | #endif | 255 | #endif |
250 | } | 256 | } |
257 | EXPORT_SYMBOL(snd_cs4236_ext_out); | ||
251 | 258 | ||
252 | unsigned char snd_cs4236_ext_in(struct snd_cs4231 *chip, unsigned char reg) | 259 | unsigned char snd_cs4236_ext_in(struct snd_wss *chip, unsigned char reg) |
253 | { | 260 | { |
254 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); | 261 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); |
255 | cs4231_outb(chip, CS4231P(REG), reg | (chip->image[CS4236_EXT_REG] & 0x01)); | 262 | wss_outb(chip, CS4231P(REG), |
263 | reg | (chip->image[CS4236_EXT_REG] & 0x01)); | ||
256 | #if 1 | 264 | #if 1 |
257 | return cs4231_inb(chip, CS4231P(REG)); | 265 | return wss_inb(chip, CS4231P(REG)); |
258 | #else | 266 | #else |
259 | { | 267 | { |
260 | unsigned char res; | 268 | unsigned char res; |
261 | res = cs4231_inb(chip, CS4231P(REG)); | 269 | res = wss_inb(chip, CS4231P(REG)); |
262 | printk("ext in : reg = 0x%x, val = 0x%x\n", reg, res); | 270 | printk("ext in : reg = 0x%x, val = 0x%x\n", reg, res); |
263 | return res; | 271 | return res; |
264 | } | 272 | } |
265 | #endif | 273 | #endif |
266 | } | 274 | } |
275 | EXPORT_SYMBOL(snd_cs4236_ext_in); | ||
267 | 276 | ||
268 | #if 0 | 277 | #if 0 |
269 | 278 | ||
270 | static void snd_cs4231_debug(struct snd_cs4231 *chip) | 279 | static void snd_wss_debug(struct snd_wss *chip) |
271 | { | 280 | { |
272 | printk("CS4231 REGS: INDEX = 0x%02x ", cs4231_inb(chip, CS4231P(REGSEL))); | 281 | printk(KERN_DEBUG |
273 | printk(" STATUS = 0x%02x\n", cs4231_inb(chip, CS4231P(STATUS))); | 282 | "CS4231 REGS: INDEX = 0x%02x " |
274 | printk(" 0x00: left input = 0x%02x ", snd_cs4231_in(chip, 0x00)); | 283 | " STATUS = 0x%02x\n", |
275 | printk(" 0x10: alt 1 (CFIG 2) = 0x%02x\n", snd_cs4231_in(chip, 0x10)); | 284 | wss_inb(chip, CS4231P(REGSEL), |
276 | printk(" 0x01: right input = 0x%02x ", snd_cs4231_in(chip, 0x01)); | 285 | wss_inb(chip, CS4231P(STATUS))); |
277 | printk(" 0x11: alt 2 (CFIG 3) = 0x%02x\n", snd_cs4231_in(chip, 0x11)); | 286 | printk(KERN_DEBUG |
278 | printk(" 0x02: GF1 left input = 0x%02x ", snd_cs4231_in(chip, 0x02)); | 287 | " 0x00: left input = 0x%02x " |
279 | printk(" 0x12: left line in = 0x%02x\n", snd_cs4231_in(chip, 0x12)); | 288 | " 0x10: alt 1 (CFIG 2) = 0x%02x\n", |
280 | printk(" 0x03: GF1 right input = 0x%02x ", snd_cs4231_in(chip, 0x03)); | 289 | snd_wss_in(chip, 0x00), |
281 | printk(" 0x13: right line in = 0x%02x\n", snd_cs4231_in(chip, 0x13)); | 290 | snd_wss_in(chip, 0x10)); |
282 | printk(" 0x04: CD left input = 0x%02x ", snd_cs4231_in(chip, 0x04)); | 291 | printk(KERN_DEBUG |
283 | printk(" 0x14: timer low = 0x%02x\n", snd_cs4231_in(chip, 0x14)); | 292 | " 0x01: right input = 0x%02x " |
284 | printk(" 0x05: CD right input = 0x%02x ", snd_cs4231_in(chip, 0x05)); | 293 | " 0x11: alt 2 (CFIG 3) = 0x%02x\n", |
285 | printk(" 0x15: timer high = 0x%02x\n", snd_cs4231_in(chip, 0x15)); | 294 | snd_wss_in(chip, 0x01), |
286 | printk(" 0x06: left output = 0x%02x ", snd_cs4231_in(chip, 0x06)); | 295 | snd_wss_in(chip, 0x11)); |
287 | printk(" 0x16: left MIC (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x16)); | 296 | printk(KERN_DEBUG |
288 | printk(" 0x07: right output = 0x%02x ", snd_cs4231_in(chip, 0x07)); | 297 | " 0x02: GF1 left input = 0x%02x " |
289 | printk(" 0x17: right MIC (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x17)); | 298 | " 0x12: left line in = 0x%02x\n", |
290 | printk(" 0x08: playback format = 0x%02x ", snd_cs4231_in(chip, 0x08)); | 299 | snd_wss_in(chip, 0x02), |
291 | printk(" 0x18: IRQ status = 0x%02x\n", snd_cs4231_in(chip, 0x18)); | 300 | snd_wss_in(chip, 0x12)); |
292 | printk(" 0x09: iface (CFIG 1) = 0x%02x ", snd_cs4231_in(chip, 0x09)); | 301 | printk(KERN_DEBUG |
293 | printk(" 0x19: left line out = 0x%02x\n", snd_cs4231_in(chip, 0x19)); | 302 | " 0x03: GF1 right input = 0x%02x " |
294 | printk(" 0x0a: pin control = 0x%02x ", snd_cs4231_in(chip, 0x0a)); | 303 | " 0x13: right line in = 0x%02x\n", |
295 | printk(" 0x1a: mono control = 0x%02x\n", snd_cs4231_in(chip, 0x1a)); | 304 | snd_wss_in(chip, 0x03), |
296 | printk(" 0x0b: init & status = 0x%02x ", snd_cs4231_in(chip, 0x0b)); | 305 | snd_wss_in(chip, 0x13)); |
297 | printk(" 0x1b: right line out = 0x%02x\n", snd_cs4231_in(chip, 0x1b)); | 306 | printk(KERN_DEBUG |
298 | printk(" 0x0c: revision & mode = 0x%02x ", snd_cs4231_in(chip, 0x0c)); | 307 | " 0x04: CD left input = 0x%02x " |
299 | printk(" 0x1c: record format = 0x%02x\n", snd_cs4231_in(chip, 0x1c)); | 308 | " 0x14: timer low = 0x%02x\n", |
300 | printk(" 0x0d: loopback = 0x%02x ", snd_cs4231_in(chip, 0x0d)); | 309 | snd_wss_in(chip, 0x04), |
301 | printk(" 0x1d: var freq (PnP) = 0x%02x\n", snd_cs4231_in(chip, 0x1d)); | 310 | snd_wss_in(chip, 0x14)); |
302 | printk(" 0x0e: ply upr count = 0x%02x ", snd_cs4231_in(chip, 0x0e)); | 311 | printk(KERN_DEBUG |
303 | printk(" 0x1e: ply lwr count = 0x%02x\n", snd_cs4231_in(chip, 0x1e)); | 312 | " 0x05: CD right input = 0x%02x " |
304 | printk(" 0x0f: rec upr count = 0x%02x ", snd_cs4231_in(chip, 0x0f)); | 313 | " 0x15: timer high = 0x%02x\n", |
305 | printk(" 0x1f: rec lwr count = 0x%02x\n", snd_cs4231_in(chip, 0x1f)); | 314 | snd_wss_in(chip, 0x05), |
315 | snd_wss_in(chip, 0x15)); | ||
316 | printk(KERN_DEBUG | ||
317 | " 0x06: left output = 0x%02x " | ||
318 | " 0x16: left MIC (PnP) = 0x%02x\n", | ||
319 | snd_wss_in(chip, 0x06), | ||
320 | snd_wss_in(chip, 0x16)); | ||
321 | printk(KERN_DEBUG | ||
322 | " 0x07: right output = 0x%02x " | ||
323 | " 0x17: right MIC (PnP) = 0x%02x\n", | ||
324 | snd_wss_in(chip, 0x07), | ||
325 | snd_wss_in(chip, 0x17)); | ||
326 | printk(KERN_DEBUG | ||
327 | " 0x08: playback format = 0x%02x " | ||
328 | " 0x18: IRQ status = 0x%02x\n", | ||
329 | snd_wss_in(chip, 0x08), | ||
330 | snd_wss_in(chip, 0x18)); | ||
331 | printk(KERN_DEBUG | ||
332 | " 0x09: iface (CFIG 1) = 0x%02x " | ||
333 | " 0x19: left line out = 0x%02x\n", | ||
334 | snd_wss_in(chip, 0x09), | ||
335 | snd_wss_in(chip, 0x19)); | ||
336 | printk(KERN_DEBUG | ||
337 | " 0x0a: pin control = 0x%02x " | ||
338 | " 0x1a: mono control = 0x%02x\n", | ||
339 | snd_wss_in(chip, 0x0a), | ||
340 | snd_wss_in(chip, 0x1a)); | ||
341 | printk(KERN_DEBUG | ||
342 | " 0x0b: init & status = 0x%02x " | ||
343 | " 0x1b: right line out = 0x%02x\n", | ||
344 | snd_wss_in(chip, 0x0b), | ||
345 | snd_wss_in(chip, 0x1b)); | ||
346 | printk(KERN_DEBUG | ||
347 | " 0x0c: revision & mode = 0x%02x " | ||
348 | " 0x1c: record format = 0x%02x\n", | ||
349 | snd_wss_in(chip, 0x0c), | ||
350 | snd_wss_in(chip, 0x1c)); | ||
351 | printk(KERN_DEBUG | ||
352 | " 0x0d: loopback = 0x%02x " | ||
353 | " 0x1d: var freq (PnP) = 0x%02x\n", | ||
354 | snd_wss_in(chip, 0x0d), | ||
355 | snd_wss_in(chip, 0x1d)); | ||
356 | printk(KERN_DEBUG | ||
357 | " 0x0e: ply upr count = 0x%02x " | ||
358 | " 0x1e: ply lwr count = 0x%02x\n", | ||
359 | snd_wss_in(chip, 0x0e), | ||
360 | snd_wss_in(chip, 0x1e)); | ||
361 | printk(KERN_DEBUG | ||
362 | " 0x0f: rec upr count = 0x%02x " | ||
363 | " 0x1f: rec lwr count = 0x%02x\n", | ||
364 | snd_wss_in(chip, 0x0f), | ||
365 | snd_wss_in(chip, 0x1f)); | ||
306 | } | 366 | } |
307 | 367 | ||
308 | #endif | 368 | #endif |
@@ -311,61 +371,63 @@ static void snd_cs4231_debug(struct snd_cs4231 *chip) | |||
311 | * CS4231 detection / MCE routines | 371 | * CS4231 detection / MCE routines |
312 | */ | 372 | */ |
313 | 373 | ||
314 | static void snd_cs4231_busy_wait(struct snd_cs4231 *chip) | 374 | static void snd_wss_busy_wait(struct snd_wss *chip) |
315 | { | 375 | { |
316 | int timeout; | 376 | int timeout; |
317 | 377 | ||
318 | /* huh.. looks like this sequence is proper for CS4231A chip (GUS MAX) */ | 378 | /* huh.. looks like this sequence is proper for CS4231A chip (GUS MAX) */ |
319 | for (timeout = 5; timeout > 0; timeout--) | 379 | for (timeout = 5; timeout > 0; timeout--) |
320 | cs4231_inb(chip, CS4231P(REGSEL)); | 380 | wss_inb(chip, CS4231P(REGSEL)); |
321 | /* end of cleanup sequence */ | 381 | /* end of cleanup sequence */ |
322 | for (timeout = 250; | 382 | for (timeout = 250; |
323 | timeout > 0 && (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); | 383 | timeout > 0 && (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT); |
324 | timeout--) | 384 | timeout--) |
325 | udelay(10); | 385 | udelay(10); |
326 | } | 386 | } |
327 | 387 | ||
328 | void snd_cs4231_mce_up(struct snd_cs4231 *chip) | 388 | void snd_wss_mce_up(struct snd_wss *chip) |
329 | { | 389 | { |
330 | unsigned long flags; | 390 | unsigned long flags; |
331 | int timeout; | 391 | int timeout; |
332 | 392 | ||
333 | snd_cs4231_wait(chip); | 393 | snd_wss_wait(chip); |
334 | #ifdef CONFIG_SND_DEBUG | 394 | #ifdef CONFIG_SND_DEBUG |
335 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 395 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
336 | snd_printk("mce_up - auto calibration time out (0)\n"); | 396 | snd_printk("mce_up - auto calibration time out (0)\n"); |
337 | #endif | 397 | #endif |
338 | spin_lock_irqsave(&chip->reg_lock, flags); | 398 | spin_lock_irqsave(&chip->reg_lock, flags); |
339 | chip->mce_bit |= CS4231_MCE; | 399 | chip->mce_bit |= CS4231_MCE; |
340 | timeout = cs4231_inb(chip, CS4231P(REGSEL)); | 400 | timeout = wss_inb(chip, CS4231P(REGSEL)); |
341 | if (timeout == 0x80) | 401 | if (timeout == 0x80) |
342 | snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); | 402 | snd_printk("mce_up [0x%lx]: serious init problem - codec still busy\n", chip->port); |
343 | if (!(timeout & CS4231_MCE)) | 403 | if (!(timeout & CS4231_MCE)) |
344 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); | 404 | wss_outb(chip, CS4231P(REGSEL), |
405 | chip->mce_bit | (timeout & 0x1f)); | ||
345 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 406 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
346 | } | 407 | } |
408 | EXPORT_SYMBOL(snd_wss_mce_up); | ||
347 | 409 | ||
348 | void snd_cs4231_mce_down(struct snd_cs4231 *chip) | 410 | void snd_wss_mce_down(struct snd_wss *chip) |
349 | { | 411 | { |
350 | unsigned long flags; | 412 | unsigned long flags; |
351 | unsigned long end_time; | 413 | unsigned long end_time; |
352 | int timeout; | 414 | int timeout; |
353 | 415 | ||
354 | snd_cs4231_busy_wait(chip); | 416 | snd_wss_busy_wait(chip); |
355 | 417 | ||
356 | #ifdef CONFIG_SND_DEBUG | 418 | #ifdef CONFIG_SND_DEBUG |
357 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 419 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
358 | snd_printk("mce_down [0x%lx] - auto calibration time out (0)\n", (long)CS4231P(REGSEL)); | 420 | snd_printk("mce_down [0x%lx] - auto calibration time out (0)\n", (long)CS4231P(REGSEL)); |
359 | #endif | 421 | #endif |
360 | spin_lock_irqsave(&chip->reg_lock, flags); | 422 | spin_lock_irqsave(&chip->reg_lock, flags); |
361 | chip->mce_bit &= ~CS4231_MCE; | 423 | chip->mce_bit &= ~CS4231_MCE; |
362 | timeout = cs4231_inb(chip, CS4231P(REGSEL)); | 424 | timeout = wss_inb(chip, CS4231P(REGSEL)); |
363 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); | 425 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); |
364 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 426 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
365 | if (timeout == 0x80) | 427 | if (timeout == 0x80) |
366 | snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); | 428 | snd_printk("mce_down [0x%lx]: serious init problem - codec still busy\n", chip->port); |
367 | if ((timeout & CS4231_MCE) == 0 || | 429 | if ((timeout & CS4231_MCE) == 0 || |
368 | !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) { | 430 | !(chip->hardware & (WSS_HW_CS4231_MASK | WSS_HW_CS4232_MASK))) { |
369 | return; | 431 | return; |
370 | } | 432 | } |
371 | 433 | ||
@@ -380,7 +442,7 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
380 | 442 | ||
381 | /* check condition up to 250 ms */ | 443 | /* check condition up to 250 ms */ |
382 | end_time = jiffies + msecs_to_jiffies(250); | 444 | end_time = jiffies + msecs_to_jiffies(250); |
383 | while (snd_cs4231_in(chip, CS4231_TEST_INIT) & | 445 | while (snd_wss_in(chip, CS4231_TEST_INIT) & |
384 | CS4231_CALIB_IN_PROGRESS) { | 446 | CS4231_CALIB_IN_PROGRESS) { |
385 | 447 | ||
386 | if (time_after(jiffies, end_time)) { | 448 | if (time_after(jiffies, end_time)) { |
@@ -395,7 +457,7 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
395 | 457 | ||
396 | /* check condition up to 100 ms */ | 458 | /* check condition up to 100 ms */ |
397 | end_time = jiffies + msecs_to_jiffies(100); | 459 | end_time = jiffies + msecs_to_jiffies(100); |
398 | while (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { | 460 | while (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) { |
399 | if (time_after(jiffies, end_time)) { | 461 | if (time_after(jiffies, end_time)) { |
400 | snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); | 462 | snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); |
401 | return; | 463 | return; |
@@ -404,10 +466,11 @@ void snd_cs4231_mce_down(struct snd_cs4231 *chip) | |||
404 | } | 466 | } |
405 | 467 | ||
406 | snd_printdd("(3) jiffies = %lu\n", jiffies); | 468 | snd_printdd("(3) jiffies = %lu\n", jiffies); |
407 | snd_printd("mce_down - exit = 0x%x\n", cs4231_inb(chip, CS4231P(REGSEL))); | 469 | snd_printd("mce_down - exit = 0x%x\n", wss_inb(chip, CS4231P(REGSEL))); |
408 | } | 470 | } |
471 | EXPORT_SYMBOL(snd_wss_mce_down); | ||
409 | 472 | ||
410 | static unsigned int snd_cs4231_get_count(unsigned char format, unsigned int size) | 473 | static unsigned int snd_wss_get_count(unsigned char format, unsigned int size) |
411 | { | 474 | { |
412 | switch (format & 0xe0) { | 475 | switch (format & 0xe0) { |
413 | case CS4231_LINEAR_16: | 476 | case CS4231_LINEAR_16: |
@@ -422,19 +485,15 @@ static unsigned int snd_cs4231_get_count(unsigned char format, unsigned int size | |||
422 | return size; | 485 | return size; |
423 | } | 486 | } |
424 | 487 | ||
425 | static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | 488 | static int snd_wss_trigger(struct snd_pcm_substream *substream, |
426 | int cmd) | 489 | int cmd) |
427 | { | 490 | { |
428 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 491 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
429 | int result = 0; | 492 | int result = 0; |
430 | unsigned int what; | 493 | unsigned int what; |
431 | struct snd_pcm_substream *s; | 494 | struct snd_pcm_substream *s; |
432 | int do_start; | 495 | int do_start; |
433 | 496 | ||
434 | #if 0 | ||
435 | printk("codec trigger!!! - what = %i, enable = %i, status = 0x%x\n", what, enable, cs4231_inb(chip, CS4231P(STATUS))); | ||
436 | #endif | ||
437 | |||
438 | switch (cmd) { | 497 | switch (cmd) { |
439 | case SNDRV_PCM_TRIGGER_START: | 498 | case SNDRV_PCM_TRIGGER_START: |
440 | case SNDRV_PCM_TRIGGER_RESUME: | 499 | case SNDRV_PCM_TRIGGER_RESUME: |
@@ -466,10 +525,10 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | |||
466 | if (chip->trigger) | 525 | if (chip->trigger) |
467 | chip->trigger(chip, what, 0); | 526 | chip->trigger(chip, what, 0); |
468 | } | 527 | } |
469 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 528 | snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); |
470 | spin_unlock(&chip->reg_lock); | 529 | spin_unlock(&chip->reg_lock); |
471 | #if 0 | 530 | #if 0 |
472 | snd_cs4231_debug(chip); | 531 | snd_wss_debug(chip); |
473 | #endif | 532 | #endif |
474 | return result; | 533 | return result; |
475 | } | 534 | } |
@@ -478,7 +537,7 @@ static int snd_cs4231_trigger(struct snd_pcm_substream *substream, | |||
478 | * CODEC I/O | 537 | * CODEC I/O |
479 | */ | 538 | */ |
480 | 539 | ||
481 | static unsigned char snd_cs4231_get_rate(unsigned int rate) | 540 | static unsigned char snd_wss_get_rate(unsigned int rate) |
482 | { | 541 | { |
483 | int i; | 542 | int i; |
484 | 543 | ||
@@ -489,9 +548,9 @@ static unsigned char snd_cs4231_get_rate(unsigned int rate) | |||
489 | return freq_bits[ARRAY_SIZE(rates) - 1]; | 548 | return freq_bits[ARRAY_SIZE(rates) - 1]; |
490 | } | 549 | } |
491 | 550 | ||
492 | static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, | 551 | static unsigned char snd_wss_get_format(struct snd_wss *chip, |
493 | int format, | 552 | int format, |
494 | int channels) | 553 | int channels) |
495 | { | 554 | { |
496 | unsigned char rformat; | 555 | unsigned char rformat; |
497 | 556 | ||
@@ -511,7 +570,7 @@ static unsigned char snd_cs4231_get_format(struct snd_cs4231 *chip, | |||
511 | return rformat; | 570 | return rformat; |
512 | } | 571 | } |
513 | 572 | ||
514 | static void snd_cs4231_calibrate_mute(struct snd_cs4231 *chip, int mute) | 573 | static void snd_wss_calibrate_mute(struct snd_wss *chip, int mute) |
515 | { | 574 | { |
516 | unsigned long flags; | 575 | unsigned long flags; |
517 | 576 | ||
@@ -522,30 +581,46 @@ static void snd_cs4231_calibrate_mute(struct snd_cs4231 *chip, int mute) | |||
522 | return; | 581 | return; |
523 | } | 582 | } |
524 | if (!mute) { | 583 | if (!mute) { |
525 | snd_cs4231_dout(chip, CS4231_LEFT_INPUT, chip->image[CS4231_LEFT_INPUT]); | 584 | snd_wss_dout(chip, CS4231_LEFT_INPUT, |
526 | snd_cs4231_dout(chip, CS4231_RIGHT_INPUT, chip->image[CS4231_RIGHT_INPUT]); | 585 | chip->image[CS4231_LEFT_INPUT]); |
527 | snd_cs4231_dout(chip, CS4231_LOOPBACK, chip->image[CS4231_LOOPBACK]); | 586 | snd_wss_dout(chip, CS4231_RIGHT_INPUT, |
587 | chip->image[CS4231_RIGHT_INPUT]); | ||
588 | snd_wss_dout(chip, CS4231_LOOPBACK, | ||
589 | chip->image[CS4231_LOOPBACK]); | ||
528 | } | 590 | } |
529 | snd_cs4231_dout(chip, CS4231_AUX1_LEFT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX1_LEFT_INPUT]); | 591 | snd_wss_dout(chip, CS4231_AUX1_LEFT_INPUT, |
530 | snd_cs4231_dout(chip, CS4231_AUX1_RIGHT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX1_RIGHT_INPUT]); | 592 | mute ? 0x80 : chip->image[CS4231_AUX1_LEFT_INPUT]); |
531 | snd_cs4231_dout(chip, CS4231_AUX2_LEFT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX2_LEFT_INPUT]); | 593 | snd_wss_dout(chip, CS4231_AUX1_RIGHT_INPUT, |
532 | snd_cs4231_dout(chip, CS4231_AUX2_RIGHT_INPUT, mute ? 0x80 : chip->image[CS4231_AUX2_RIGHT_INPUT]); | 594 | mute ? 0x80 : chip->image[CS4231_AUX1_RIGHT_INPUT]); |
533 | snd_cs4231_dout(chip, CS4231_LEFT_OUTPUT, mute ? 0x80 : chip->image[CS4231_LEFT_OUTPUT]); | 595 | snd_wss_dout(chip, CS4231_AUX2_LEFT_INPUT, |
534 | snd_cs4231_dout(chip, CS4231_RIGHT_OUTPUT, mute ? 0x80 : chip->image[CS4231_RIGHT_OUTPUT]); | 596 | mute ? 0x80 : chip->image[CS4231_AUX2_LEFT_INPUT]); |
535 | snd_cs4231_dout(chip, CS4231_LEFT_LINE_IN, mute ? 0x80 : chip->image[CS4231_LEFT_LINE_IN]); | 597 | snd_wss_dout(chip, CS4231_AUX2_RIGHT_INPUT, |
536 | snd_cs4231_dout(chip, CS4231_RIGHT_LINE_IN, mute ? 0x80 : chip->image[CS4231_RIGHT_LINE_IN]); | 598 | mute ? 0x80 : chip->image[CS4231_AUX2_RIGHT_INPUT]); |
537 | snd_cs4231_dout(chip, CS4231_MONO_CTRL, mute ? 0xc0 : chip->image[CS4231_MONO_CTRL]); | 599 | snd_wss_dout(chip, CS4231_LEFT_OUTPUT, |
538 | if (chip->hardware == CS4231_HW_INTERWAVE) { | 600 | mute ? 0x80 : chip->image[CS4231_LEFT_OUTPUT]); |
539 | snd_cs4231_dout(chip, CS4231_LEFT_MIC_INPUT, mute ? 0x80 : chip->image[CS4231_LEFT_MIC_INPUT]); | 601 | snd_wss_dout(chip, CS4231_RIGHT_OUTPUT, |
540 | snd_cs4231_dout(chip, CS4231_RIGHT_MIC_INPUT, mute ? 0x80 : chip->image[CS4231_RIGHT_MIC_INPUT]); | 602 | mute ? 0x80 : chip->image[CS4231_RIGHT_OUTPUT]); |
541 | snd_cs4231_dout(chip, CS4231_LINE_LEFT_OUTPUT, mute ? 0x80 : chip->image[CS4231_LINE_LEFT_OUTPUT]); | 603 | snd_wss_dout(chip, CS4231_LEFT_LINE_IN, |
542 | snd_cs4231_dout(chip, CS4231_LINE_RIGHT_OUTPUT, mute ? 0x80 : chip->image[CS4231_LINE_RIGHT_OUTPUT]); | 604 | mute ? 0x80 : chip->image[CS4231_LEFT_LINE_IN]); |
605 | snd_wss_dout(chip, CS4231_RIGHT_LINE_IN, | ||
606 | mute ? 0x80 : chip->image[CS4231_RIGHT_LINE_IN]); | ||
607 | snd_wss_dout(chip, CS4231_MONO_CTRL, | ||
608 | mute ? 0xc0 : chip->image[CS4231_MONO_CTRL]); | ||
609 | if (chip->hardware == WSS_HW_INTERWAVE) { | ||
610 | snd_wss_dout(chip, CS4231_LEFT_MIC_INPUT, | ||
611 | mute ? 0x80 : chip->image[CS4231_LEFT_MIC_INPUT]); | ||
612 | snd_wss_dout(chip, CS4231_RIGHT_MIC_INPUT, | ||
613 | mute ? 0x80 : chip->image[CS4231_RIGHT_MIC_INPUT]); | ||
614 | snd_wss_dout(chip, CS4231_LINE_LEFT_OUTPUT, | ||
615 | mute ? 0x80 : chip->image[CS4231_LINE_LEFT_OUTPUT]); | ||
616 | snd_wss_dout(chip, CS4231_LINE_RIGHT_OUTPUT, | ||
617 | mute ? 0x80 : chip->image[CS4231_LINE_RIGHT_OUTPUT]); | ||
543 | } | 618 | } |
544 | chip->calibrate_mute = mute; | 619 | chip->calibrate_mute = mute; |
545 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 620 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
546 | } | 621 | } |
547 | 622 | ||
548 | static void snd_cs4231_playback_format(struct snd_cs4231 *chip, | 623 | static void snd_wss_playback_format(struct snd_wss *chip, |
549 | struct snd_pcm_hw_params *params, | 624 | struct snd_pcm_hw_params *params, |
550 | unsigned char pdfr) | 625 | unsigned char pdfr) |
551 | { | 626 | { |
@@ -553,79 +628,88 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, | |||
553 | int full_calib = 1; | 628 | int full_calib = 1; |
554 | 629 | ||
555 | mutex_lock(&chip->mce_mutex); | 630 | mutex_lock(&chip->mce_mutex); |
556 | snd_cs4231_calibrate_mute(chip, 1); | 631 | snd_wss_calibrate_mute(chip, 1); |
557 | if (chip->hardware == CS4231_HW_CS4231A || | 632 | if (chip->hardware == WSS_HW_CS4231A || |
558 | (chip->hardware & CS4231_HW_CS4232_MASK)) { | 633 | (chip->hardware & WSS_HW_CS4232_MASK)) { |
559 | spin_lock_irqsave(&chip->reg_lock, flags); | 634 | spin_lock_irqsave(&chip->reg_lock, flags); |
560 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (pdfr & 0x0f)) { /* rate is same? */ | 635 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (pdfr & 0x0f)) { /* rate is same? */ |
561 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x10); | 636 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, |
562 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT] = pdfr); | 637 | chip->image[CS4231_ALT_FEATURE_1] | 0x10); |
563 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] &= ~0x10); | 638 | chip->image[CS4231_PLAYBK_FORMAT] = pdfr; |
639 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, | ||
640 | chip->image[CS4231_PLAYBK_FORMAT]); | ||
641 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
642 | chip->image[CS4231_ALT_FEATURE_1] &= ~0x10); | ||
564 | udelay(100); /* Fixes audible clicks at least on GUS MAX */ | 643 | udelay(100); /* Fixes audible clicks at least on GUS MAX */ |
565 | full_calib = 0; | 644 | full_calib = 0; |
566 | } | 645 | } |
567 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 646 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
568 | } | 647 | } |
569 | if (full_calib) { | 648 | if (full_calib) { |
570 | snd_cs4231_mce_up(chip); | 649 | snd_wss_mce_up(chip); |
571 | spin_lock_irqsave(&chip->reg_lock, flags); | 650 | spin_lock_irqsave(&chip->reg_lock, flags); |
572 | if (chip->hardware != CS4231_HW_INTERWAVE && !chip->single_dma) { | 651 | if (chip->hardware != WSS_HW_INTERWAVE && !chip->single_dma) { |
573 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, | 652 | if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) |
574 | (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) ? | 653 | pdfr = (pdfr & 0xf0) | |
575 | (pdfr & 0xf0) | (chip->image[CS4231_REC_FORMAT] & 0x0f) : | 654 | (chip->image[CS4231_REC_FORMAT] & 0x0f); |
576 | pdfr); | ||
577 | } else { | 655 | } else { |
578 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT] = pdfr); | 656 | chip->image[CS4231_PLAYBK_FORMAT] = pdfr; |
579 | } | 657 | } |
658 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr); | ||
580 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 659 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
581 | if (chip->hardware == CS4231_HW_OPL3SA2) | 660 | if (chip->hardware == WSS_HW_OPL3SA2) |
582 | udelay(100); /* this seems to help */ | 661 | udelay(100); /* this seems to help */ |
583 | snd_cs4231_mce_down(chip); | 662 | snd_wss_mce_down(chip); |
584 | } | 663 | } |
585 | snd_cs4231_calibrate_mute(chip, 0); | 664 | snd_wss_calibrate_mute(chip, 0); |
586 | mutex_unlock(&chip->mce_mutex); | 665 | mutex_unlock(&chip->mce_mutex); |
587 | } | 666 | } |
588 | 667 | ||
589 | static void snd_cs4231_capture_format(struct snd_cs4231 *chip, | 668 | static void snd_wss_capture_format(struct snd_wss *chip, |
590 | struct snd_pcm_hw_params *params, | 669 | struct snd_pcm_hw_params *params, |
591 | unsigned char cdfr) | 670 | unsigned char cdfr) |
592 | { | 671 | { |
593 | unsigned long flags; | 672 | unsigned long flags; |
594 | int full_calib = 1; | 673 | int full_calib = 1; |
595 | 674 | ||
596 | mutex_lock(&chip->mce_mutex); | 675 | mutex_lock(&chip->mce_mutex); |
597 | snd_cs4231_calibrate_mute(chip, 1); | 676 | snd_wss_calibrate_mute(chip, 1); |
598 | if (chip->hardware == CS4231_HW_CS4231A || | 677 | if (chip->hardware == WSS_HW_CS4231A || |
599 | (chip->hardware & CS4231_HW_CS4232_MASK)) { | 678 | (chip->hardware & WSS_HW_CS4232_MASK)) { |
600 | spin_lock_irqsave(&chip->reg_lock, flags); | 679 | spin_lock_irqsave(&chip->reg_lock, flags); |
601 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (cdfr & 0x0f) || /* rate is same? */ | 680 | if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (cdfr & 0x0f) || /* rate is same? */ |
602 | (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { | 681 | (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { |
603 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x20); | 682 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, |
604 | snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT] = cdfr); | 683 | chip->image[CS4231_ALT_FEATURE_1] | 0x20); |
605 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] &= ~0x20); | 684 | snd_wss_out(chip, CS4231_REC_FORMAT, |
685 | chip->image[CS4231_REC_FORMAT] = cdfr); | ||
686 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
687 | chip->image[CS4231_ALT_FEATURE_1] &= ~0x20); | ||
606 | full_calib = 0; | 688 | full_calib = 0; |
607 | } | 689 | } |
608 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 690 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
609 | } | 691 | } |
610 | if (full_calib) { | 692 | if (full_calib) { |
611 | snd_cs4231_mce_up(chip); | 693 | snd_wss_mce_up(chip); |
612 | spin_lock_irqsave(&chip->reg_lock, flags); | 694 | spin_lock_irqsave(&chip->reg_lock, flags); |
613 | if (chip->hardware != CS4231_HW_INTERWAVE) { | 695 | if (chip->hardware != WSS_HW_INTERWAVE && |
614 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { | 696 | !(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { |
615 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, | 697 | if (chip->single_dma) |
616 | ((chip->single_dma ? cdfr : chip->image[CS4231_PLAYBK_FORMAT]) & 0xf0) | | 698 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, cdfr); |
617 | (cdfr & 0x0f)); | 699 | else |
618 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 700 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, |
619 | snd_cs4231_mce_down(chip); | 701 | (chip->image[CS4231_PLAYBK_FORMAT] & 0xf0) | |
620 | snd_cs4231_mce_up(chip); | 702 | (cdfr & 0x0f)); |
621 | spin_lock_irqsave(&chip->reg_lock, flags); | 703 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
622 | } | 704 | snd_wss_mce_down(chip); |
705 | snd_wss_mce_up(chip); | ||
706 | spin_lock_irqsave(&chip->reg_lock, flags); | ||
623 | } | 707 | } |
624 | snd_cs4231_out(chip, CS4231_REC_FORMAT, cdfr); | 708 | snd_wss_out(chip, CS4231_REC_FORMAT, cdfr); |
625 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 709 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
626 | snd_cs4231_mce_down(chip); | 710 | snd_wss_mce_down(chip); |
627 | } | 711 | } |
628 | snd_cs4231_calibrate_mute(chip, 0); | 712 | snd_wss_calibrate_mute(chip, 0); |
629 | mutex_unlock(&chip->mce_mutex); | 713 | mutex_unlock(&chip->mce_mutex); |
630 | } | 714 | } |
631 | 715 | ||
@@ -633,130 +717,146 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, | |||
633 | * Timer interface | 717 | * Timer interface |
634 | */ | 718 | */ |
635 | 719 | ||
636 | static unsigned long snd_cs4231_timer_resolution(struct snd_timer * timer) | 720 | static unsigned long snd_wss_timer_resolution(struct snd_timer *timer) |
637 | { | 721 | { |
638 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 722 | struct snd_wss *chip = snd_timer_chip(timer); |
639 | if (chip->hardware & CS4231_HW_CS4236B_MASK) | 723 | if (chip->hardware & WSS_HW_CS4236B_MASK) |
640 | return 14467; | 724 | return 14467; |
641 | else | 725 | else |
642 | return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920; | 726 | return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920; |
643 | } | 727 | } |
644 | 728 | ||
645 | static int snd_cs4231_timer_start(struct snd_timer * timer) | 729 | static int snd_wss_timer_start(struct snd_timer *timer) |
646 | { | 730 | { |
647 | unsigned long flags; | 731 | unsigned long flags; |
648 | unsigned int ticks; | 732 | unsigned int ticks; |
649 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 733 | struct snd_wss *chip = snd_timer_chip(timer); |
650 | spin_lock_irqsave(&chip->reg_lock, flags); | 734 | spin_lock_irqsave(&chip->reg_lock, flags); |
651 | ticks = timer->sticks; | 735 | ticks = timer->sticks; |
652 | if ((chip->image[CS4231_ALT_FEATURE_1] & CS4231_TIMER_ENABLE) == 0 || | 736 | if ((chip->image[CS4231_ALT_FEATURE_1] & CS4231_TIMER_ENABLE) == 0 || |
653 | (unsigned char)(ticks >> 8) != chip->image[CS4231_TIMER_HIGH] || | 737 | (unsigned char)(ticks >> 8) != chip->image[CS4231_TIMER_HIGH] || |
654 | (unsigned char)ticks != chip->image[CS4231_TIMER_LOW]) { | 738 | (unsigned char)ticks != chip->image[CS4231_TIMER_LOW]) { |
655 | snd_cs4231_out(chip, CS4231_TIMER_HIGH, chip->image[CS4231_TIMER_HIGH] = (unsigned char) (ticks >> 8)); | 739 | chip->image[CS4231_TIMER_HIGH] = (unsigned char) (ticks >> 8); |
656 | snd_cs4231_out(chip, CS4231_TIMER_LOW, chip->image[CS4231_TIMER_LOW] = (unsigned char) ticks); | 740 | snd_wss_out(chip, CS4231_TIMER_HIGH, |
657 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | CS4231_TIMER_ENABLE); | 741 | chip->image[CS4231_TIMER_HIGH]); |
742 | chip->image[CS4231_TIMER_LOW] = (unsigned char) ticks; | ||
743 | snd_wss_out(chip, CS4231_TIMER_LOW, | ||
744 | chip->image[CS4231_TIMER_LOW]); | ||
745 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
746 | chip->image[CS4231_ALT_FEATURE_1] | | ||
747 | CS4231_TIMER_ENABLE); | ||
658 | } | 748 | } |
659 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 749 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
660 | return 0; | 750 | return 0; |
661 | } | 751 | } |
662 | 752 | ||
663 | static int snd_cs4231_timer_stop(struct snd_timer * timer) | 753 | static int snd_wss_timer_stop(struct snd_timer *timer) |
664 | { | 754 | { |
665 | unsigned long flags; | 755 | unsigned long flags; |
666 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 756 | struct snd_wss *chip = snd_timer_chip(timer); |
667 | spin_lock_irqsave(&chip->reg_lock, flags); | 757 | spin_lock_irqsave(&chip->reg_lock, flags); |
668 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] &= ~CS4231_TIMER_ENABLE); | 758 | chip->image[CS4231_ALT_FEATURE_1] &= ~CS4231_TIMER_ENABLE; |
759 | snd_wss_out(chip, CS4231_ALT_FEATURE_1, | ||
760 | chip->image[CS4231_ALT_FEATURE_1]); | ||
669 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 761 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
670 | return 0; | 762 | return 0; |
671 | } | 763 | } |
672 | 764 | ||
673 | static void snd_cs4231_init(struct snd_cs4231 *chip) | 765 | static void snd_wss_init(struct snd_wss *chip) |
674 | { | 766 | { |
675 | unsigned long flags; | 767 | unsigned long flags; |
676 | 768 | ||
677 | snd_cs4231_mce_down(chip); | 769 | snd_wss_mce_down(chip); |
678 | 770 | ||
679 | #ifdef SNDRV_DEBUG_MCE | 771 | #ifdef SNDRV_DEBUG_MCE |
680 | snd_printk("init: (1)\n"); | 772 | snd_printk("init: (1)\n"); |
681 | #endif | 773 | #endif |
682 | snd_cs4231_mce_up(chip); | 774 | snd_wss_mce_up(chip); |
683 | spin_lock_irqsave(&chip->reg_lock, flags); | 775 | spin_lock_irqsave(&chip->reg_lock, flags); |
684 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 776 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | |
685 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO | | 777 | CS4231_PLAYBACK_PIO | |
686 | CS4231_CALIB_MODE); | 778 | CS4231_RECORD_ENABLE | |
779 | CS4231_RECORD_PIO | | ||
780 | CS4231_CALIB_MODE); | ||
687 | chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB; | 781 | chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB; |
688 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 782 | snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); |
689 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 783 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
690 | snd_cs4231_mce_down(chip); | 784 | snd_wss_mce_down(chip); |
691 | 785 | ||
692 | #ifdef SNDRV_DEBUG_MCE | 786 | #ifdef SNDRV_DEBUG_MCE |
693 | snd_printk("init: (2)\n"); | 787 | snd_printk("init: (2)\n"); |
694 | #endif | 788 | #endif |
695 | 789 | ||
696 | snd_cs4231_mce_up(chip); | 790 | snd_wss_mce_up(chip); |
697 | spin_lock_irqsave(&chip->reg_lock, flags); | 791 | spin_lock_irqsave(&chip->reg_lock, flags); |
698 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); | 792 | snd_wss_out(chip, |
793 | CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); | ||
699 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 794 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
700 | snd_cs4231_mce_down(chip); | 795 | snd_wss_mce_down(chip); |
701 | 796 | ||
702 | #ifdef SNDRV_DEBUG_MCE | 797 | #ifdef SNDRV_DEBUG_MCE |
703 | snd_printk("init: (3) - afei = 0x%x\n", chip->image[CS4231_ALT_FEATURE_1]); | 798 | snd_printk("init: (3) - afei = 0x%x\n", |
799 | chip->image[CS4231_ALT_FEATURE_1]); | ||
704 | #endif | 800 | #endif |
705 | 801 | ||
706 | spin_lock_irqsave(&chip->reg_lock, flags); | 802 | spin_lock_irqsave(&chip->reg_lock, flags); |
707 | snd_cs4231_out(chip, CS4231_ALT_FEATURE_2, chip->image[CS4231_ALT_FEATURE_2]); | 803 | snd_wss_out(chip, CS4231_ALT_FEATURE_2, |
804 | chip->image[CS4231_ALT_FEATURE_2]); | ||
708 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 805 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
709 | 806 | ||
710 | snd_cs4231_mce_up(chip); | 807 | snd_wss_mce_up(chip); |
711 | spin_lock_irqsave(&chip->reg_lock, flags); | 808 | spin_lock_irqsave(&chip->reg_lock, flags); |
712 | snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, chip->image[CS4231_PLAYBK_FORMAT]); | 809 | snd_wss_out(chip, CS4231_PLAYBK_FORMAT, |
810 | chip->image[CS4231_PLAYBK_FORMAT]); | ||
713 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 811 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
714 | snd_cs4231_mce_down(chip); | 812 | snd_wss_mce_down(chip); |
715 | 813 | ||
716 | #ifdef SNDRV_DEBUG_MCE | 814 | #ifdef SNDRV_DEBUG_MCE |
717 | snd_printk("init: (4)\n"); | 815 | snd_printk("init: (4)\n"); |
718 | #endif | 816 | #endif |
719 | 817 | ||
720 | snd_cs4231_mce_up(chip); | 818 | snd_wss_mce_up(chip); |
721 | spin_lock_irqsave(&chip->reg_lock, flags); | 819 | spin_lock_irqsave(&chip->reg_lock, flags); |
722 | snd_cs4231_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]); | 820 | snd_wss_out(chip, CS4231_REC_FORMAT, chip->image[CS4231_REC_FORMAT]); |
723 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 821 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
724 | snd_cs4231_mce_down(chip); | 822 | snd_wss_mce_down(chip); |
725 | 823 | ||
726 | #ifdef SNDRV_DEBUG_MCE | 824 | #ifdef SNDRV_DEBUG_MCE |
727 | snd_printk("init: (5)\n"); | 825 | snd_printk("init: (5)\n"); |
728 | #endif | 826 | #endif |
729 | } | 827 | } |
730 | 828 | ||
731 | static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) | 829 | static int snd_wss_open(struct snd_wss *chip, unsigned int mode) |
732 | { | 830 | { |
733 | unsigned long flags; | 831 | unsigned long flags; |
734 | 832 | ||
735 | mutex_lock(&chip->open_mutex); | 833 | mutex_lock(&chip->open_mutex); |
736 | if ((chip->mode & mode) || | 834 | if ((chip->mode & mode) || |
737 | ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) { | 835 | ((chip->mode & WSS_MODE_OPEN) && chip->single_dma)) { |
738 | mutex_unlock(&chip->open_mutex); | 836 | mutex_unlock(&chip->open_mutex); |
739 | return -EAGAIN; | 837 | return -EAGAIN; |
740 | } | 838 | } |
741 | if (chip->mode & CS4231_MODE_OPEN) { | 839 | if (chip->mode & WSS_MODE_OPEN) { |
742 | chip->mode |= mode; | 840 | chip->mode |= mode; |
743 | mutex_unlock(&chip->open_mutex); | 841 | mutex_unlock(&chip->open_mutex); |
744 | return 0; | 842 | return 0; |
745 | } | 843 | } |
746 | /* ok. now enable and ack CODEC IRQ */ | 844 | /* ok. now enable and ack CODEC IRQ */ |
747 | spin_lock_irqsave(&chip->reg_lock, flags); | 845 | spin_lock_irqsave(&chip->reg_lock, flags); |
748 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, CS4231_PLAYBACK_IRQ | | 846 | snd_wss_out(chip, CS4231_IRQ_STATUS, |
749 | CS4231_RECORD_IRQ | | 847 | CS4231_PLAYBACK_IRQ | |
750 | CS4231_TIMER_IRQ); | 848 | CS4231_RECORD_IRQ | |
751 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 849 | CS4231_TIMER_IRQ); |
752 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 850 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); |
753 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 851 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
852 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | ||
754 | chip->image[CS4231_PIN_CTRL] |= CS4231_IRQ_ENABLE; | 853 | chip->image[CS4231_PIN_CTRL] |= CS4231_IRQ_ENABLE; |
755 | snd_cs4231_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); | 854 | snd_wss_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); |
756 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, CS4231_PLAYBACK_IRQ | | 855 | snd_wss_out(chip, CS4231_IRQ_STATUS, |
757 | CS4231_RECORD_IRQ | | 856 | CS4231_PLAYBACK_IRQ | |
758 | CS4231_TIMER_IRQ); | 857 | CS4231_RECORD_IRQ | |
759 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 858 | CS4231_TIMER_IRQ); |
859 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); | ||
760 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 860 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
761 | 861 | ||
762 | chip->mode = mode; | 862 | chip->mode = mode; |
@@ -764,48 +864,49 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) | |||
764 | return 0; | 864 | return 0; |
765 | } | 865 | } |
766 | 866 | ||
767 | static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) | 867 | static void snd_wss_close(struct snd_wss *chip, unsigned int mode) |
768 | { | 868 | { |
769 | unsigned long flags; | 869 | unsigned long flags; |
770 | 870 | ||
771 | mutex_lock(&chip->open_mutex); | 871 | mutex_lock(&chip->open_mutex); |
772 | chip->mode &= ~mode; | 872 | chip->mode &= ~mode; |
773 | if (chip->mode & CS4231_MODE_OPEN) { | 873 | if (chip->mode & WSS_MODE_OPEN) { |
774 | mutex_unlock(&chip->open_mutex); | 874 | mutex_unlock(&chip->open_mutex); |
775 | return; | 875 | return; |
776 | } | 876 | } |
777 | snd_cs4231_calibrate_mute(chip, 1); | 877 | snd_wss_calibrate_mute(chip, 1); |
778 | 878 | ||
779 | /* disable IRQ */ | 879 | /* disable IRQ */ |
780 | spin_lock_irqsave(&chip->reg_lock, flags); | 880 | spin_lock_irqsave(&chip->reg_lock, flags); |
781 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 881 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); |
782 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 882 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
783 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 883 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
784 | chip->image[CS4231_PIN_CTRL] &= ~CS4231_IRQ_ENABLE; | 884 | chip->image[CS4231_PIN_CTRL] &= ~CS4231_IRQ_ENABLE; |
785 | snd_cs4231_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); | 885 | snd_wss_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); |
786 | 886 | ||
787 | /* now disable record & playback */ | 887 | /* now disable record & playback */ |
788 | 888 | ||
789 | if (chip->image[CS4231_IFACE_CTRL] & (CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 889 | if (chip->image[CS4231_IFACE_CTRL] & (CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | |
790 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO)) { | 890 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO)) { |
791 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 891 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
792 | snd_cs4231_mce_up(chip); | 892 | snd_wss_mce_up(chip); |
793 | spin_lock_irqsave(&chip->reg_lock, flags); | 893 | spin_lock_irqsave(&chip->reg_lock, flags); |
794 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | | 894 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | |
795 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); | 895 | CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); |
796 | snd_cs4231_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); | 896 | snd_wss_out(chip, CS4231_IFACE_CTRL, |
897 | chip->image[CS4231_IFACE_CTRL]); | ||
797 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 898 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
798 | snd_cs4231_mce_down(chip); | 899 | snd_wss_mce_down(chip); |
799 | spin_lock_irqsave(&chip->reg_lock, flags); | 900 | spin_lock_irqsave(&chip->reg_lock, flags); |
800 | } | 901 | } |
801 | 902 | ||
802 | /* clear IRQ again */ | 903 | /* clear IRQ again */ |
803 | snd_cs4231_out(chip, CS4231_IRQ_STATUS, 0); | 904 | snd_wss_out(chip, CS4231_IRQ_STATUS, 0); |
804 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 905 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
805 | cs4231_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ | 906 | wss_outb(chip, CS4231P(STATUS), 0); /* clear IRQ */ |
806 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 907 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
807 | 908 | ||
808 | snd_cs4231_calibrate_mute(chip, 0); | 909 | snd_wss_calibrate_mute(chip, 0); |
809 | 910 | ||
810 | chip->mode = 0; | 911 | chip->mode = 0; |
811 | mutex_unlock(&chip->open_mutex); | 912 | mutex_unlock(&chip->open_mutex); |
@@ -815,59 +916,60 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) | |||
815 | * timer open/close | 916 | * timer open/close |
816 | */ | 917 | */ |
817 | 918 | ||
818 | static int snd_cs4231_timer_open(struct snd_timer * timer) | 919 | static int snd_wss_timer_open(struct snd_timer *timer) |
819 | { | 920 | { |
820 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 921 | struct snd_wss *chip = snd_timer_chip(timer); |
821 | snd_cs4231_open(chip, CS4231_MODE_TIMER); | 922 | snd_wss_open(chip, WSS_MODE_TIMER); |
822 | return 0; | 923 | return 0; |
823 | } | 924 | } |
824 | 925 | ||
825 | static int snd_cs4231_timer_close(struct snd_timer * timer) | 926 | static int snd_wss_timer_close(struct snd_timer *timer) |
826 | { | 927 | { |
827 | struct snd_cs4231 *chip = snd_timer_chip(timer); | 928 | struct snd_wss *chip = snd_timer_chip(timer); |
828 | snd_cs4231_close(chip, CS4231_MODE_TIMER); | 929 | snd_wss_close(chip, WSS_MODE_TIMER); |
829 | return 0; | 930 | return 0; |
830 | } | 931 | } |
831 | 932 | ||
832 | static struct snd_timer_hardware snd_cs4231_timer_table = | 933 | static struct snd_timer_hardware snd_wss_timer_table = |
833 | { | 934 | { |
834 | .flags = SNDRV_TIMER_HW_AUTO, | 935 | .flags = SNDRV_TIMER_HW_AUTO, |
835 | .resolution = 9945, | 936 | .resolution = 9945, |
836 | .ticks = 65535, | 937 | .ticks = 65535, |
837 | .open = snd_cs4231_timer_open, | 938 | .open = snd_wss_timer_open, |
838 | .close = snd_cs4231_timer_close, | 939 | .close = snd_wss_timer_close, |
839 | .c_resolution = snd_cs4231_timer_resolution, | 940 | .c_resolution = snd_wss_timer_resolution, |
840 | .start = snd_cs4231_timer_start, | 941 | .start = snd_wss_timer_start, |
841 | .stop = snd_cs4231_timer_stop, | 942 | .stop = snd_wss_timer_stop, |
842 | }; | 943 | }; |
843 | 944 | ||
844 | /* | 945 | /* |
845 | * ok.. exported functions.. | 946 | * ok.. exported functions.. |
846 | */ | 947 | */ |
847 | 948 | ||
848 | static int snd_cs4231_playback_hw_params(struct snd_pcm_substream *substream, | 949 | static int snd_wss_playback_hw_params(struct snd_pcm_substream *substream, |
849 | struct snd_pcm_hw_params *hw_params) | 950 | struct snd_pcm_hw_params *hw_params) |
850 | { | 951 | { |
851 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 952 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
852 | unsigned char new_pdfr; | 953 | unsigned char new_pdfr; |
853 | int err; | 954 | int err; |
854 | 955 | ||
855 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) | 956 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) |
856 | return err; | 957 | return err; |
857 | new_pdfr = snd_cs4231_get_format(chip, params_format(hw_params), params_channels(hw_params)) | | 958 | new_pdfr = snd_wss_get_format(chip, params_format(hw_params), |
858 | snd_cs4231_get_rate(params_rate(hw_params)); | 959 | params_channels(hw_params)) | |
960 | snd_wss_get_rate(params_rate(hw_params)); | ||
859 | chip->set_playback_format(chip, hw_params, new_pdfr); | 961 | chip->set_playback_format(chip, hw_params, new_pdfr); |
860 | return 0; | 962 | return 0; |
861 | } | 963 | } |
862 | 964 | ||
863 | static int snd_cs4231_playback_hw_free(struct snd_pcm_substream *substream) | 965 | static int snd_wss_playback_hw_free(struct snd_pcm_substream *substream) |
864 | { | 966 | { |
865 | return snd_pcm_lib_free_pages(substream); | 967 | return snd_pcm_lib_free_pages(substream); |
866 | } | 968 | } |
867 | 969 | ||
868 | static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream) | 970 | static int snd_wss_playback_prepare(struct snd_pcm_substream *substream) |
869 | { | 971 | { |
870 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 972 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
871 | struct snd_pcm_runtime *runtime = substream->runtime; | 973 | struct snd_pcm_runtime *runtime = substream->runtime; |
872 | unsigned long flags; | 974 | unsigned long flags; |
873 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 975 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
@@ -877,39 +979,40 @@ static int snd_cs4231_playback_prepare(struct snd_pcm_substream *substream) | |||
877 | chip->p_dma_size = size; | 979 | chip->p_dma_size = size; |
878 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); | 980 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); |
879 | snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); | 981 | snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); |
880 | count = snd_cs4231_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1; | 982 | count = snd_wss_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1; |
881 | snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); | 983 | snd_wss_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); |
882 | snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8)); | 984 | snd_wss_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8)); |
883 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 985 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
884 | #if 0 | 986 | #if 0 |
885 | snd_cs4231_debug(chip); | 987 | snd_wss_debug(chip); |
886 | #endif | 988 | #endif |
887 | return 0; | 989 | return 0; |
888 | } | 990 | } |
889 | 991 | ||
890 | static int snd_cs4231_capture_hw_params(struct snd_pcm_substream *substream, | 992 | static int snd_wss_capture_hw_params(struct snd_pcm_substream *substream, |
891 | struct snd_pcm_hw_params *hw_params) | 993 | struct snd_pcm_hw_params *hw_params) |
892 | { | 994 | { |
893 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 995 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
894 | unsigned char new_cdfr; | 996 | unsigned char new_cdfr; |
895 | int err; | 997 | int err; |
896 | 998 | ||
897 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) | 999 | if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) |
898 | return err; | 1000 | return err; |
899 | new_cdfr = snd_cs4231_get_format(chip, params_format(hw_params), params_channels(hw_params)) | | 1001 | new_cdfr = snd_wss_get_format(chip, params_format(hw_params), |
900 | snd_cs4231_get_rate(params_rate(hw_params)); | 1002 | params_channels(hw_params)) | |
1003 | snd_wss_get_rate(params_rate(hw_params)); | ||
901 | chip->set_capture_format(chip, hw_params, new_cdfr); | 1004 | chip->set_capture_format(chip, hw_params, new_cdfr); |
902 | return 0; | 1005 | return 0; |
903 | } | 1006 | } |
904 | 1007 | ||
905 | static int snd_cs4231_capture_hw_free(struct snd_pcm_substream *substream) | 1008 | static int snd_wss_capture_hw_free(struct snd_pcm_substream *substream) |
906 | { | 1009 | { |
907 | return snd_pcm_lib_free_pages(substream); | 1010 | return snd_pcm_lib_free_pages(substream); |
908 | } | 1011 | } |
909 | 1012 | ||
910 | static int snd_cs4231_capture_prepare(struct snd_pcm_substream *substream) | 1013 | static int snd_wss_capture_prepare(struct snd_pcm_substream *substream) |
911 | { | 1014 | { |
912 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1015 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
913 | struct snd_pcm_runtime *runtime = substream->runtime; | 1016 | struct snd_pcm_runtime *runtime = substream->runtime; |
914 | unsigned long flags; | 1017 | unsigned long flags; |
915 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); | 1018 | unsigned int size = snd_pcm_lib_buffer_bytes(substream); |
@@ -919,49 +1022,52 @@ static int snd_cs4231_capture_prepare(struct snd_pcm_substream *substream) | |||
919 | chip->c_dma_size = size; | 1022 | chip->c_dma_size = size; |
920 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); | 1023 | chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); |
921 | snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); | 1024 | snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); |
922 | count = snd_cs4231_get_count(chip->image[CS4231_REC_FORMAT], count) - 1; | 1025 | count = snd_wss_get_count(chip->image[CS4231_REC_FORMAT], count) - 1; |
923 | if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) { | 1026 | if (chip->single_dma && chip->hardware != WSS_HW_INTERWAVE) { |
924 | snd_cs4231_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); | 1027 | snd_wss_out(chip, CS4231_PLY_LWR_CNT, (unsigned char) count); |
925 | snd_cs4231_out(chip, CS4231_PLY_UPR_CNT, (unsigned char) (count >> 8)); | 1028 | snd_wss_out(chip, CS4231_PLY_UPR_CNT, |
1029 | (unsigned char) (count >> 8)); | ||
926 | } else { | 1030 | } else { |
927 | snd_cs4231_out(chip, CS4231_REC_LWR_CNT, (unsigned char) count); | 1031 | snd_wss_out(chip, CS4231_REC_LWR_CNT, (unsigned char) count); |
928 | snd_cs4231_out(chip, CS4231_REC_UPR_CNT, (unsigned char) (count >> 8)); | 1032 | snd_wss_out(chip, CS4231_REC_UPR_CNT, |
1033 | (unsigned char) (count >> 8)); | ||
929 | } | 1034 | } |
930 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1035 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
931 | return 0; | 1036 | return 0; |
932 | } | 1037 | } |
933 | 1038 | ||
934 | void snd_cs4231_overrange(struct snd_cs4231 *chip) | 1039 | void snd_wss_overrange(struct snd_wss *chip) |
935 | { | 1040 | { |
936 | unsigned long flags; | 1041 | unsigned long flags; |
937 | unsigned char res; | 1042 | unsigned char res; |
938 | 1043 | ||
939 | spin_lock_irqsave(&chip->reg_lock, flags); | 1044 | spin_lock_irqsave(&chip->reg_lock, flags); |
940 | res = snd_cs4231_in(chip, CS4231_TEST_INIT); | 1045 | res = snd_wss_in(chip, CS4231_TEST_INIT); |
941 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1046 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
942 | if (res & (0x08 | 0x02)) /* detect overrange only above 0dB; may be user selectable? */ | 1047 | if (res & (0x08 | 0x02)) /* detect overrange only above 0dB; may be user selectable? */ |
943 | chip->capture_substream->runtime->overrange++; | 1048 | chip->capture_substream->runtime->overrange++; |
944 | } | 1049 | } |
1050 | EXPORT_SYMBOL(snd_wss_overrange); | ||
945 | 1051 | ||
946 | irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id) | 1052 | irqreturn_t snd_wss_interrupt(int irq, void *dev_id) |
947 | { | 1053 | { |
948 | struct snd_cs4231 *chip = dev_id; | 1054 | struct snd_wss *chip = dev_id; |
949 | unsigned char status; | 1055 | unsigned char status; |
950 | 1056 | ||
951 | status = snd_cs4231_in(chip, CS4231_IRQ_STATUS); | 1057 | status = snd_wss_in(chip, CS4231_IRQ_STATUS); |
952 | if (status & CS4231_TIMER_IRQ) { | 1058 | if (status & CS4231_TIMER_IRQ) { |
953 | if (chip->timer) | 1059 | if (chip->timer) |
954 | snd_timer_interrupt(chip->timer, chip->timer->sticks); | 1060 | snd_timer_interrupt(chip->timer, chip->timer->sticks); |
955 | } | 1061 | } |
956 | if (chip->single_dma && chip->hardware != CS4231_HW_INTERWAVE) { | 1062 | if (chip->single_dma && chip->hardware != WSS_HW_INTERWAVE) { |
957 | if (status & CS4231_PLAYBACK_IRQ) { | 1063 | if (status & CS4231_PLAYBACK_IRQ) { |
958 | if (chip->mode & CS4231_MODE_PLAY) { | 1064 | if (chip->mode & WSS_MODE_PLAY) { |
959 | if (chip->playback_substream) | 1065 | if (chip->playback_substream) |
960 | snd_pcm_period_elapsed(chip->playback_substream); | 1066 | snd_pcm_period_elapsed(chip->playback_substream); |
961 | } | 1067 | } |
962 | if (chip->mode & CS4231_MODE_RECORD) { | 1068 | if (chip->mode & WSS_MODE_RECORD) { |
963 | if (chip->capture_substream) { | 1069 | if (chip->capture_substream) { |
964 | snd_cs4231_overrange(chip); | 1070 | snd_wss_overrange(chip); |
965 | snd_pcm_period_elapsed(chip->capture_substream); | 1071 | snd_pcm_period_elapsed(chip->capture_substream); |
966 | } | 1072 | } |
967 | } | 1073 | } |
@@ -973,21 +1079,22 @@ irqreturn_t snd_cs4231_interrupt(int irq, void *dev_id) | |||
973 | } | 1079 | } |
974 | if (status & CS4231_RECORD_IRQ) { | 1080 | if (status & CS4231_RECORD_IRQ) { |
975 | if (chip->capture_substream) { | 1081 | if (chip->capture_substream) { |
976 | snd_cs4231_overrange(chip); | 1082 | snd_wss_overrange(chip); |
977 | snd_pcm_period_elapsed(chip->capture_substream); | 1083 | snd_pcm_period_elapsed(chip->capture_substream); |
978 | } | 1084 | } |
979 | } | 1085 | } |
980 | } | 1086 | } |
981 | 1087 | ||
982 | spin_lock(&chip->reg_lock); | 1088 | spin_lock(&chip->reg_lock); |
983 | snd_cs4231_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0); | 1089 | snd_wss_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0); |
984 | spin_unlock(&chip->reg_lock); | 1090 | spin_unlock(&chip->reg_lock); |
985 | return IRQ_HANDLED; | 1091 | return IRQ_HANDLED; |
986 | } | 1092 | } |
1093 | EXPORT_SYMBOL(snd_wss_interrupt); | ||
987 | 1094 | ||
988 | static snd_pcm_uframes_t snd_cs4231_playback_pointer(struct snd_pcm_substream *substream) | 1095 | static snd_pcm_uframes_t snd_wss_playback_pointer(struct snd_pcm_substream *substream) |
989 | { | 1096 | { |
990 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1097 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
991 | size_t ptr; | 1098 | size_t ptr; |
992 | 1099 | ||
993 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) | 1100 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) |
@@ -996,9 +1103,9 @@ static snd_pcm_uframes_t snd_cs4231_playback_pointer(struct snd_pcm_substream *s | |||
996 | return bytes_to_frames(substream->runtime, ptr); | 1103 | return bytes_to_frames(substream->runtime, ptr); |
997 | } | 1104 | } |
998 | 1105 | ||
999 | static snd_pcm_uframes_t snd_cs4231_capture_pointer(struct snd_pcm_substream *substream) | 1106 | static snd_pcm_uframes_t snd_wss_capture_pointer(struct snd_pcm_substream *substream) |
1000 | { | 1107 | { |
1001 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1108 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1002 | size_t ptr; | 1109 | size_t ptr; |
1003 | 1110 | ||
1004 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) | 1111 | if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) |
@@ -1011,7 +1118,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(struct snd_pcm_substream *su | |||
1011 | 1118 | ||
1012 | */ | 1119 | */ |
1013 | 1120 | ||
1014 | static int snd_cs4231_probe(struct snd_cs4231 *chip) | 1121 | static int snd_wss_probe(struct snd_wss *chip) |
1015 | { | 1122 | { |
1016 | unsigned long flags; | 1123 | unsigned long flags; |
1017 | int i, id, rev; | 1124 | int i, id, rev; |
@@ -1019,103 +1126,104 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1019 | unsigned int hw; | 1126 | unsigned int hw; |
1020 | 1127 | ||
1021 | #if 0 | 1128 | #if 0 |
1022 | snd_cs4231_debug(chip); | 1129 | snd_wss_debug(chip); |
1023 | #endif | 1130 | #endif |
1024 | id = 0; | 1131 | id = 0; |
1025 | for (i = 0; i < 50; i++) { | 1132 | for (i = 0; i < 50; i++) { |
1026 | mb(); | 1133 | mb(); |
1027 | if (cs4231_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) | 1134 | if (wss_inb(chip, CS4231P(REGSEL)) & CS4231_INIT) |
1028 | udelay(2000); | 1135 | udelay(2000); |
1029 | else { | 1136 | else { |
1030 | spin_lock_irqsave(&chip->reg_lock, flags); | 1137 | spin_lock_irqsave(&chip->reg_lock, flags); |
1031 | snd_cs4231_out(chip, CS4231_MISC_INFO, CS4231_MODE2); | 1138 | snd_wss_out(chip, CS4231_MISC_INFO, CS4231_MODE2); |
1032 | id = snd_cs4231_in(chip, CS4231_MISC_INFO) & 0x0f; | 1139 | id = snd_wss_in(chip, CS4231_MISC_INFO) & 0x0f; |
1033 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1140 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1034 | if (id == 0x0a) | 1141 | if (id == 0x0a) |
1035 | break; /* this is valid value */ | 1142 | break; /* this is valid value */ |
1036 | } | 1143 | } |
1037 | } | 1144 | } |
1038 | snd_printdd("cs4231: port = 0x%lx, id = 0x%x\n", chip->port, id); | 1145 | snd_printdd("wss: port = 0x%lx, id = 0x%x\n", chip->port, id); |
1039 | if (id != 0x0a) | 1146 | if (id != 0x0a) |
1040 | return -ENODEV; /* no valid device found */ | 1147 | return -ENODEV; /* no valid device found */ |
1041 | 1148 | ||
1042 | if (((hw = chip->hardware) & CS4231_HW_TYPE_MASK) == CS4231_HW_DETECT) { | 1149 | hw = chip->hardware; |
1043 | rev = snd_cs4231_in(chip, CS4231_VERSION) & 0xe7; | 1150 | if ((hw & WSS_HW_TYPE_MASK) == WSS_HW_DETECT) { |
1151 | rev = snd_wss_in(chip, CS4231_VERSION) & 0xe7; | ||
1044 | snd_printdd("CS4231: VERSION (I25) = 0x%x\n", rev); | 1152 | snd_printdd("CS4231: VERSION (I25) = 0x%x\n", rev); |
1045 | if (rev == 0x80) { | 1153 | if (rev == 0x80) { |
1046 | unsigned char tmp = snd_cs4231_in(chip, 23); | 1154 | unsigned char tmp = snd_wss_in(chip, 23); |
1047 | snd_cs4231_out(chip, 23, ~tmp); | 1155 | snd_wss_out(chip, 23, ~tmp); |
1048 | if (snd_cs4231_in(chip, 23) != tmp) | 1156 | if (snd_wss_in(chip, 23) != tmp) |
1049 | chip->hardware = CS4231_HW_AD1845; | 1157 | chip->hardware = WSS_HW_AD1845; |
1050 | else | 1158 | else |
1051 | chip->hardware = CS4231_HW_CS4231; | 1159 | chip->hardware = WSS_HW_CS4231; |
1052 | } else if (rev == 0xa0) { | 1160 | } else if (rev == 0xa0) { |
1053 | chip->hardware = CS4231_HW_CS4231A; | 1161 | chip->hardware = WSS_HW_CS4231A; |
1054 | } else if (rev == 0xa2) { | 1162 | } else if (rev == 0xa2) { |
1055 | chip->hardware = CS4231_HW_CS4232; | 1163 | chip->hardware = WSS_HW_CS4232; |
1056 | } else if (rev == 0xb2) { | 1164 | } else if (rev == 0xb2) { |
1057 | chip->hardware = CS4231_HW_CS4232A; | 1165 | chip->hardware = WSS_HW_CS4232A; |
1058 | } else if (rev == 0x83) { | 1166 | } else if (rev == 0x83) { |
1059 | chip->hardware = CS4231_HW_CS4236; | 1167 | chip->hardware = WSS_HW_CS4236; |
1060 | } else if (rev == 0x03) { | 1168 | } else if (rev == 0x03) { |
1061 | chip->hardware = CS4231_HW_CS4236B; | 1169 | chip->hardware = WSS_HW_CS4236B; |
1062 | } else { | 1170 | } else { |
1063 | snd_printk("unknown CS chip with version 0x%x\n", rev); | 1171 | snd_printk("unknown CS chip with version 0x%x\n", rev); |
1064 | return -ENODEV; /* unknown CS4231 chip? */ | 1172 | return -ENODEV; /* unknown CS4231 chip? */ |
1065 | } | 1173 | } |
1066 | } | 1174 | } |
1067 | spin_lock_irqsave(&chip->reg_lock, flags); | 1175 | spin_lock_irqsave(&chip->reg_lock, flags); |
1068 | cs4231_inb(chip, CS4231P(STATUS)); /* clear any pendings IRQ */ | 1176 | wss_inb(chip, CS4231P(STATUS)); /* clear any pendings IRQ */ |
1069 | cs4231_outb(chip, CS4231P(STATUS), 0); | 1177 | wss_outb(chip, CS4231P(STATUS), 0); |
1070 | mb(); | 1178 | mb(); |
1071 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1179 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1072 | 1180 | ||
1073 | chip->image[CS4231_MISC_INFO] = CS4231_MODE2; | 1181 | chip->image[CS4231_MISC_INFO] = CS4231_MODE2; |
1074 | switch (chip->hardware) { | 1182 | switch (chip->hardware) { |
1075 | case CS4231_HW_INTERWAVE: | 1183 | case WSS_HW_INTERWAVE: |
1076 | chip->image[CS4231_MISC_INFO] = CS4231_IW_MODE3; | 1184 | chip->image[CS4231_MISC_INFO] = CS4231_IW_MODE3; |
1077 | break; | 1185 | break; |
1078 | case CS4231_HW_CS4235: | 1186 | case WSS_HW_CS4235: |
1079 | case CS4231_HW_CS4236B: | 1187 | case WSS_HW_CS4236B: |
1080 | case CS4231_HW_CS4237B: | 1188 | case WSS_HW_CS4237B: |
1081 | case CS4231_HW_CS4238B: | 1189 | case WSS_HW_CS4238B: |
1082 | case CS4231_HW_CS4239: | 1190 | case WSS_HW_CS4239: |
1083 | if (hw == CS4231_HW_DETECT3) | 1191 | if (hw == WSS_HW_DETECT3) |
1084 | chip->image[CS4231_MISC_INFO] = CS4231_4236_MODE3; | 1192 | chip->image[CS4231_MISC_INFO] = CS4231_4236_MODE3; |
1085 | else | 1193 | else |
1086 | chip->hardware = CS4231_HW_CS4236; | 1194 | chip->hardware = WSS_HW_CS4236; |
1087 | break; | 1195 | break; |
1088 | } | 1196 | } |
1089 | 1197 | ||
1090 | chip->image[CS4231_IFACE_CTRL] = | 1198 | chip->image[CS4231_IFACE_CTRL] = |
1091 | (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | | 1199 | (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | |
1092 | (chip->single_dma ? CS4231_SINGLE_DMA : 0); | 1200 | (chip->single_dma ? CS4231_SINGLE_DMA : 0); |
1093 | if (chip->hardware != CS4231_HW_OPTI93X) { | 1201 | if (chip->hardware != WSS_HW_OPTI93X) { |
1094 | chip->image[CS4231_ALT_FEATURE_1] = 0x80; | 1202 | chip->image[CS4231_ALT_FEATURE_1] = 0x80; |
1095 | chip->image[CS4231_ALT_FEATURE_2] = | 1203 | chip->image[CS4231_ALT_FEATURE_2] = |
1096 | chip->hardware == CS4231_HW_INTERWAVE ? 0xc2 : 0x01; | 1204 | chip->hardware == WSS_HW_INTERWAVE ? 0xc2 : 0x01; |
1097 | } | 1205 | } |
1098 | ptr = (unsigned char *) &chip->image; | 1206 | ptr = (unsigned char *) &chip->image; |
1099 | snd_cs4231_mce_down(chip); | 1207 | snd_wss_mce_down(chip); |
1100 | spin_lock_irqsave(&chip->reg_lock, flags); | 1208 | spin_lock_irqsave(&chip->reg_lock, flags); |
1101 | for (i = 0; i < 32; i++) /* ok.. fill all CS4231 registers */ | 1209 | for (i = 0; i < 32; i++) /* ok.. fill all CS4231 registers */ |
1102 | snd_cs4231_out(chip, i, *ptr++); | 1210 | snd_wss_out(chip, i, *ptr++); |
1103 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1211 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1104 | snd_cs4231_mce_up(chip); | 1212 | snd_wss_mce_up(chip); |
1105 | snd_cs4231_mce_down(chip); | 1213 | snd_wss_mce_down(chip); |
1106 | 1214 | ||
1107 | mdelay(2); | 1215 | mdelay(2); |
1108 | 1216 | ||
1109 | /* ok.. try check hardware version for CS4236+ chips */ | 1217 | /* ok.. try check hardware version for CS4236+ chips */ |
1110 | if ((hw & CS4231_HW_TYPE_MASK) == CS4231_HW_DETECT) { | 1218 | if ((hw & WSS_HW_TYPE_MASK) == WSS_HW_DETECT) { |
1111 | if (chip->hardware == CS4231_HW_CS4236B) { | 1219 | if (chip->hardware == WSS_HW_CS4236B) { |
1112 | rev = snd_cs4236_ext_in(chip, CS4236_VERSION); | 1220 | rev = snd_cs4236_ext_in(chip, CS4236_VERSION); |
1113 | snd_cs4236_ext_out(chip, CS4236_VERSION, 0xff); | 1221 | snd_cs4236_ext_out(chip, CS4236_VERSION, 0xff); |
1114 | id = snd_cs4236_ext_in(chip, CS4236_VERSION); | 1222 | id = snd_cs4236_ext_in(chip, CS4236_VERSION); |
1115 | snd_cs4236_ext_out(chip, CS4236_VERSION, rev); | 1223 | snd_cs4236_ext_out(chip, CS4236_VERSION, rev); |
1116 | snd_printdd("CS4231: ext version; rev = 0x%x, id = 0x%x\n", rev, id); | 1224 | snd_printdd("CS4231: ext version; rev = 0x%x, id = 0x%x\n", rev, id); |
1117 | if ((id & 0x1f) == 0x1d) { /* CS4235 */ | 1225 | if ((id & 0x1f) == 0x1d) { /* CS4235 */ |
1118 | chip->hardware = CS4231_HW_CS4235; | 1226 | chip->hardware = WSS_HW_CS4235; |
1119 | switch (id >> 5) { | 1227 | switch (id >> 5) { |
1120 | case 4: | 1228 | case 4: |
1121 | case 5: | 1229 | case 5: |
@@ -1130,13 +1238,13 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1130 | case 5: | 1238 | case 5: |
1131 | case 6: | 1239 | case 6: |
1132 | case 7: | 1240 | case 7: |
1133 | chip->hardware = CS4231_HW_CS4236B; | 1241 | chip->hardware = WSS_HW_CS4236B; |
1134 | break; | 1242 | break; |
1135 | default: | 1243 | default: |
1136 | snd_printk("unknown CS4236 chip (enhanced version = 0x%x)\n", id); | 1244 | snd_printk("unknown CS4236 chip (enhanced version = 0x%x)\n", id); |
1137 | } | 1245 | } |
1138 | } else if ((id & 0x1f) == 0x08) { /* CS4237B */ | 1246 | } else if ((id & 0x1f) == 0x08) { /* CS4237B */ |
1139 | chip->hardware = CS4231_HW_CS4237B; | 1247 | chip->hardware = WSS_HW_CS4237B; |
1140 | switch (id >> 5) { | 1248 | switch (id >> 5) { |
1141 | case 4: | 1249 | case 4: |
1142 | case 5: | 1250 | case 5: |
@@ -1147,7 +1255,7 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1147 | snd_printk("unknown CS4237B chip (enhanced version = 0x%x)\n", id); | 1255 | snd_printk("unknown CS4237B chip (enhanced version = 0x%x)\n", id); |
1148 | } | 1256 | } |
1149 | } else if ((id & 0x1f) == 0x09) { /* CS4238B */ | 1257 | } else if ((id & 0x1f) == 0x09) { /* CS4238B */ |
1150 | chip->hardware = CS4231_HW_CS4238B; | 1258 | chip->hardware = WSS_HW_CS4238B; |
1151 | switch (id >> 5) { | 1259 | switch (id >> 5) { |
1152 | case 5: | 1260 | case 5: |
1153 | case 6: | 1261 | case 6: |
@@ -1157,7 +1265,7 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1157 | snd_printk("unknown CS4238B chip (enhanced version = 0x%x)\n", id); | 1265 | snd_printk("unknown CS4238B chip (enhanced version = 0x%x)\n", id); |
1158 | } | 1266 | } |
1159 | } else if ((id & 0x1f) == 0x1e) { /* CS4239 */ | 1267 | } else if ((id & 0x1f) == 0x1e) { /* CS4239 */ |
1160 | chip->hardware = CS4231_HW_CS4239; | 1268 | chip->hardware = WSS_HW_CS4239; |
1161 | switch (id >> 5) { | 1269 | switch (id >> 5) { |
1162 | case 4: | 1270 | case 4: |
1163 | case 5: | 1271 | case 5: |
@@ -1178,7 +1286,7 @@ static int snd_cs4231_probe(struct snd_cs4231 *chip) | |||
1178 | 1286 | ||
1179 | */ | 1287 | */ |
1180 | 1288 | ||
1181 | static struct snd_pcm_hardware snd_cs4231_playback = | 1289 | static struct snd_pcm_hardware snd_wss_playback = |
1182 | { | 1290 | { |
1183 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1291 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1184 | SNDRV_PCM_INFO_MMAP_VALID | | 1292 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -1199,7 +1307,7 @@ static struct snd_pcm_hardware snd_cs4231_playback = | |||
1199 | .fifo_size = 0, | 1307 | .fifo_size = 0, |
1200 | }; | 1308 | }; |
1201 | 1309 | ||
1202 | static struct snd_pcm_hardware snd_cs4231_capture = | 1310 | static struct snd_pcm_hardware snd_wss_capture = |
1203 | { | 1311 | { |
1204 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1312 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1205 | SNDRV_PCM_INFO_MMAP_VALID | | 1313 | SNDRV_PCM_INFO_MMAP_VALID | |
@@ -1224,21 +1332,21 @@ static struct snd_pcm_hardware snd_cs4231_capture = | |||
1224 | 1332 | ||
1225 | */ | 1333 | */ |
1226 | 1334 | ||
1227 | static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) | 1335 | static int snd_wss_playback_open(struct snd_pcm_substream *substream) |
1228 | { | 1336 | { |
1229 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1337 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1230 | struct snd_pcm_runtime *runtime = substream->runtime; | 1338 | struct snd_pcm_runtime *runtime = substream->runtime; |
1231 | int err; | 1339 | int err; |
1232 | 1340 | ||
1233 | runtime->hw = snd_cs4231_playback; | 1341 | runtime->hw = snd_wss_playback; |
1234 | 1342 | ||
1235 | /* hardware bug in InterWave chipset */ | 1343 | /* hardware bug in InterWave chipset */ |
1236 | if (chip->hardware == CS4231_HW_INTERWAVE && chip->dma1 > 3) | 1344 | if (chip->hardware == WSS_HW_INTERWAVE && chip->dma1 > 3) |
1237 | runtime->hw.formats &= ~SNDRV_PCM_FMTBIT_MU_LAW; | 1345 | runtime->hw.formats &= ~SNDRV_PCM_FMTBIT_MU_LAW; |
1238 | 1346 | ||
1239 | /* hardware limitation of cheap chips */ | 1347 | /* hardware limitation of cheap chips */ |
1240 | if (chip->hardware == CS4231_HW_CS4235 || | 1348 | if (chip->hardware == WSS_HW_CS4235 || |
1241 | chip->hardware == CS4231_HW_CS4239) | 1349 | chip->hardware == WSS_HW_CS4239) |
1242 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; | 1350 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; |
1243 | 1351 | ||
1244 | snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); | 1352 | snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); |
@@ -1249,7 +1357,8 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) | |||
1249 | return err; | 1357 | return err; |
1250 | } | 1358 | } |
1251 | 1359 | ||
1252 | if ((err = snd_cs4231_open(chip, CS4231_MODE_PLAY)) < 0) { | 1360 | err = snd_wss_open(chip, WSS_MODE_PLAY); |
1361 | if (err < 0) { | ||
1253 | if (chip->release_dma) | 1362 | if (chip->release_dma) |
1254 | chip->release_dma(chip, chip->dma_private_data, chip->dma1); | 1363 | chip->release_dma(chip, chip->dma_private_data, chip->dma1); |
1255 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); | 1364 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); |
@@ -1261,17 +1370,17 @@ static int snd_cs4231_playback_open(struct snd_pcm_substream *substream) | |||
1261 | return 0; | 1370 | return 0; |
1262 | } | 1371 | } |
1263 | 1372 | ||
1264 | static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) | 1373 | static int snd_wss_capture_open(struct snd_pcm_substream *substream) |
1265 | { | 1374 | { |
1266 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1375 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1267 | struct snd_pcm_runtime *runtime = substream->runtime; | 1376 | struct snd_pcm_runtime *runtime = substream->runtime; |
1268 | int err; | 1377 | int err; |
1269 | 1378 | ||
1270 | runtime->hw = snd_cs4231_capture; | 1379 | runtime->hw = snd_wss_capture; |
1271 | 1380 | ||
1272 | /* hardware limitation of cheap chips */ | 1381 | /* hardware limitation of cheap chips */ |
1273 | if (chip->hardware == CS4231_HW_CS4235 || | 1382 | if (chip->hardware == WSS_HW_CS4235 || |
1274 | chip->hardware == CS4231_HW_CS4239) | 1383 | chip->hardware == WSS_HW_CS4239) |
1275 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; | 1384 | runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; |
1276 | 1385 | ||
1277 | snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); | 1386 | snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); |
@@ -1282,7 +1391,8 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) | |||
1282 | return err; | 1391 | return err; |
1283 | } | 1392 | } |
1284 | 1393 | ||
1285 | if ((err = snd_cs4231_open(chip, CS4231_MODE_RECORD)) < 0) { | 1394 | err = snd_wss_open(chip, WSS_MODE_RECORD); |
1395 | if (err < 0) { | ||
1286 | if (chip->release_dma) | 1396 | if (chip->release_dma) |
1287 | chip->release_dma(chip, chip->dma_private_data, chip->dma2); | 1397 | chip->release_dma(chip, chip->dma_private_data, chip->dma2); |
1288 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); | 1398 | snd_free_pages(runtime->dma_area, runtime->dma_bytes); |
@@ -1294,28 +1404,28 @@ static int snd_cs4231_capture_open(struct snd_pcm_substream *substream) | |||
1294 | return 0; | 1404 | return 0; |
1295 | } | 1405 | } |
1296 | 1406 | ||
1297 | static int snd_cs4231_playback_close(struct snd_pcm_substream *substream) | 1407 | static int snd_wss_playback_close(struct snd_pcm_substream *substream) |
1298 | { | 1408 | { |
1299 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1409 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1300 | 1410 | ||
1301 | chip->playback_substream = NULL; | 1411 | chip->playback_substream = NULL; |
1302 | snd_cs4231_close(chip, CS4231_MODE_PLAY); | 1412 | snd_wss_close(chip, WSS_MODE_PLAY); |
1303 | return 0; | 1413 | return 0; |
1304 | } | 1414 | } |
1305 | 1415 | ||
1306 | static int snd_cs4231_capture_close(struct snd_pcm_substream *substream) | 1416 | static int snd_wss_capture_close(struct snd_pcm_substream *substream) |
1307 | { | 1417 | { |
1308 | struct snd_cs4231 *chip = snd_pcm_substream_chip(substream); | 1418 | struct snd_wss *chip = snd_pcm_substream_chip(substream); |
1309 | 1419 | ||
1310 | chip->capture_substream = NULL; | 1420 | chip->capture_substream = NULL; |
1311 | snd_cs4231_close(chip, CS4231_MODE_RECORD); | 1421 | snd_wss_close(chip, WSS_MODE_RECORD); |
1312 | return 0; | 1422 | return 0; |
1313 | } | 1423 | } |
1314 | 1424 | ||
1315 | #ifdef CONFIG_PM | 1425 | #ifdef CONFIG_PM |
1316 | 1426 | ||
1317 | /* lowlevel suspend callback for CS4231 */ | 1427 | /* lowlevel suspend callback for CS4231 */ |
1318 | static void snd_cs4231_suspend(struct snd_cs4231 *chip) | 1428 | static void snd_wss_suspend(struct snd_wss *chip) |
1319 | { | 1429 | { |
1320 | int reg; | 1430 | int reg; |
1321 | unsigned long flags; | 1431 | unsigned long flags; |
@@ -1323,67 +1433,68 @@ static void snd_cs4231_suspend(struct snd_cs4231 *chip) | |||
1323 | snd_pcm_suspend_all(chip->pcm); | 1433 | snd_pcm_suspend_all(chip->pcm); |
1324 | spin_lock_irqsave(&chip->reg_lock, flags); | 1434 | spin_lock_irqsave(&chip->reg_lock, flags); |
1325 | for (reg = 0; reg < 32; reg++) | 1435 | for (reg = 0; reg < 32; reg++) |
1326 | chip->image[reg] = snd_cs4231_in(chip, reg); | 1436 | chip->image[reg] = snd_wss_in(chip, reg); |
1327 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1437 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1328 | } | 1438 | } |
1329 | 1439 | ||
1330 | /* lowlevel resume callback for CS4231 */ | 1440 | /* lowlevel resume callback for CS4231 */ |
1331 | static void snd_cs4231_resume(struct snd_cs4231 *chip) | 1441 | static void snd_wss_resume(struct snd_wss *chip) |
1332 | { | 1442 | { |
1333 | int reg; | 1443 | int reg; |
1334 | unsigned long flags; | 1444 | unsigned long flags; |
1335 | /* int timeout; */ | 1445 | /* int timeout; */ |
1336 | 1446 | ||
1337 | snd_cs4231_mce_up(chip); | 1447 | snd_wss_mce_up(chip); |
1338 | spin_lock_irqsave(&chip->reg_lock, flags); | 1448 | spin_lock_irqsave(&chip->reg_lock, flags); |
1339 | for (reg = 0; reg < 32; reg++) { | 1449 | for (reg = 0; reg < 32; reg++) { |
1340 | switch (reg) { | 1450 | switch (reg) { |
1341 | case CS4231_VERSION: | 1451 | case CS4231_VERSION: |
1342 | break; | 1452 | break; |
1343 | default: | 1453 | default: |
1344 | snd_cs4231_out(chip, reg, chip->image[reg]); | 1454 | snd_wss_out(chip, reg, chip->image[reg]); |
1345 | break; | 1455 | break; |
1346 | } | 1456 | } |
1347 | } | 1457 | } |
1348 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1458 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1349 | #if 1 | 1459 | #if 1 |
1350 | snd_cs4231_mce_down(chip); | 1460 | snd_wss_mce_down(chip); |
1351 | #else | 1461 | #else |
1352 | /* The following is a workaround to avoid freeze after resume on TP600E. | 1462 | /* The following is a workaround to avoid freeze after resume on TP600E. |
1353 | This is the first half of copy of snd_cs4231_mce_down(), but doesn't | 1463 | This is the first half of copy of snd_wss_mce_down(), but doesn't |
1354 | include rescheduling. -- iwai | 1464 | include rescheduling. -- iwai |
1355 | */ | 1465 | */ |
1356 | snd_cs4231_busy_wait(chip); | 1466 | snd_wss_busy_wait(chip); |
1357 | spin_lock_irqsave(&chip->reg_lock, flags); | 1467 | spin_lock_irqsave(&chip->reg_lock, flags); |
1358 | chip->mce_bit &= ~CS4231_MCE; | 1468 | chip->mce_bit &= ~CS4231_MCE; |
1359 | timeout = cs4231_inb(chip, CS4231P(REGSEL)); | 1469 | timeout = wss_inb(chip, CS4231P(REGSEL)); |
1360 | cs4231_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); | 1470 | wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); |
1361 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1471 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1362 | if (timeout == 0x80) | 1472 | if (timeout == 0x80) |
1363 | snd_printk("down [0x%lx]: serious init problem - codec still busy\n", chip->port); | 1473 | snd_printk("down [0x%lx]: serious init problem - codec still busy\n", chip->port); |
1364 | if ((timeout & CS4231_MCE) == 0 || | 1474 | if ((timeout & CS4231_MCE) == 0 || |
1365 | !(chip->hardware & (CS4231_HW_CS4231_MASK | CS4231_HW_CS4232_MASK))) { | 1475 | !(chip->hardware & (WSS_HW_CS4231_MASK | WSS_HW_CS4232_MASK))) { |
1366 | return; | 1476 | return; |
1367 | } | 1477 | } |
1368 | snd_cs4231_busy_wait(chip); | 1478 | snd_wss_busy_wait(chip); |
1369 | #endif | 1479 | #endif |
1370 | } | 1480 | } |
1371 | #endif /* CONFIG_PM */ | 1481 | #endif /* CONFIG_PM */ |
1372 | 1482 | ||
1373 | static int snd_cs4231_free(struct snd_cs4231 *chip) | 1483 | static int snd_wss_free(struct snd_wss *chip) |
1374 | { | 1484 | { |
1375 | release_and_free_resource(chip->res_port); | 1485 | release_and_free_resource(chip->res_port); |
1376 | release_and_free_resource(chip->res_cport); | 1486 | release_and_free_resource(chip->res_cport); |
1377 | if (chip->irq >= 0) { | 1487 | if (chip->irq >= 0) { |
1378 | disable_irq(chip->irq); | 1488 | disable_irq(chip->irq); |
1379 | if (!(chip->hwshare & CS4231_HWSHARE_IRQ)) | 1489 | if (!(chip->hwshare & WSS_HWSHARE_IRQ)) |
1380 | free_irq(chip->irq, (void *) chip); | 1490 | free_irq(chip->irq, (void *) chip); |
1381 | } | 1491 | } |
1382 | if (!(chip->hwshare & CS4231_HWSHARE_DMA1) && chip->dma1 >= 0) { | 1492 | if (!(chip->hwshare & WSS_HWSHARE_DMA1) && chip->dma1 >= 0) { |
1383 | snd_dma_disable(chip->dma1); | 1493 | snd_dma_disable(chip->dma1); |
1384 | free_dma(chip->dma1); | 1494 | free_dma(chip->dma1); |
1385 | } | 1495 | } |
1386 | if (!(chip->hwshare & CS4231_HWSHARE_DMA2) && chip->dma2 >= 0 && chip->dma2 != chip->dma1) { | 1496 | if (!(chip->hwshare & WSS_HWSHARE_DMA2) && |
1497 | chip->dma2 >= 0 && chip->dma2 != chip->dma1) { | ||
1387 | snd_dma_disable(chip->dma2); | 1498 | snd_dma_disable(chip->dma2); |
1388 | free_dma(chip->dma2); | 1499 | free_dma(chip->dma2); |
1389 | } | 1500 | } |
@@ -1393,39 +1504,55 @@ static int snd_cs4231_free(struct snd_cs4231 *chip) | |||
1393 | return 0; | 1504 | return 0; |
1394 | } | 1505 | } |
1395 | 1506 | ||
1396 | static int snd_cs4231_dev_free(struct snd_device *device) | 1507 | static int snd_wss_dev_free(struct snd_device *device) |
1397 | { | 1508 | { |
1398 | struct snd_cs4231 *chip = device->device_data; | 1509 | struct snd_wss *chip = device->device_data; |
1399 | return snd_cs4231_free(chip); | 1510 | return snd_wss_free(chip); |
1400 | } | 1511 | } |
1401 | 1512 | ||
1402 | const char *snd_cs4231_chip_id(struct snd_cs4231 *chip) | 1513 | const char *snd_wss_chip_id(struct snd_wss *chip) |
1403 | { | 1514 | { |
1404 | switch (chip->hardware) { | 1515 | switch (chip->hardware) { |
1405 | case CS4231_HW_CS4231: return "CS4231"; | 1516 | case WSS_HW_CS4231: |
1406 | case CS4231_HW_CS4231A: return "CS4231A"; | 1517 | return "CS4231"; |
1407 | case CS4231_HW_CS4232: return "CS4232"; | 1518 | case WSS_HW_CS4231A: |
1408 | case CS4231_HW_CS4232A: return "CS4232A"; | 1519 | return "CS4231A"; |
1409 | case CS4231_HW_CS4235: return "CS4235"; | 1520 | case WSS_HW_CS4232: |
1410 | case CS4231_HW_CS4236: return "CS4236"; | 1521 | return "CS4232"; |
1411 | case CS4231_HW_CS4236B: return "CS4236B"; | 1522 | case WSS_HW_CS4232A: |
1412 | case CS4231_HW_CS4237B: return "CS4237B"; | 1523 | return "CS4232A"; |
1413 | case CS4231_HW_CS4238B: return "CS4238B"; | 1524 | case WSS_HW_CS4235: |
1414 | case CS4231_HW_CS4239: return "CS4239"; | 1525 | return "CS4235"; |
1415 | case CS4231_HW_INTERWAVE: return "AMD InterWave"; | 1526 | case WSS_HW_CS4236: |
1416 | case CS4231_HW_OPL3SA2: return chip->card->shortname; | 1527 | return "CS4236"; |
1417 | case CS4231_HW_AD1845: return "AD1845"; | 1528 | case WSS_HW_CS4236B: |
1418 | case CS4231_HW_OPTI93X: return "OPTi 93x"; | 1529 | return "CS4236B"; |
1419 | default: return "???"; | 1530 | case WSS_HW_CS4237B: |
1531 | return "CS4237B"; | ||
1532 | case WSS_HW_CS4238B: | ||
1533 | return "CS4238B"; | ||
1534 | case WSS_HW_CS4239: | ||
1535 | return "CS4239"; | ||
1536 | case WSS_HW_INTERWAVE: | ||
1537 | return "AMD InterWave"; | ||
1538 | case WSS_HW_OPL3SA2: | ||
1539 | return chip->card->shortname; | ||
1540 | case WSS_HW_AD1845: | ||
1541 | return "AD1845"; | ||
1542 | case WSS_HW_OPTI93X: | ||
1543 | return "OPTi 93x"; | ||
1544 | default: | ||
1545 | return "???"; | ||
1420 | } | 1546 | } |
1421 | } | 1547 | } |
1548 | EXPORT_SYMBOL(snd_wss_chip_id); | ||
1422 | 1549 | ||
1423 | static int snd_cs4231_new(struct snd_card *card, | 1550 | static int snd_wss_new(struct snd_card *card, |
1424 | unsigned short hardware, | 1551 | unsigned short hardware, |
1425 | unsigned short hwshare, | 1552 | unsigned short hwshare, |
1426 | struct snd_cs4231 ** rchip) | 1553 | struct snd_wss **rchip) |
1427 | { | 1554 | { |
1428 | struct snd_cs4231 *chip; | 1555 | struct snd_wss *chip; |
1429 | 1556 | ||
1430 | *rchip = NULL; | 1557 | *rchip = NULL; |
1431 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 1558 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
@@ -1438,35 +1565,35 @@ static int snd_cs4231_new(struct snd_card *card, | |||
1438 | mutex_init(&chip->mce_mutex); | 1565 | mutex_init(&chip->mce_mutex); |
1439 | mutex_init(&chip->open_mutex); | 1566 | mutex_init(&chip->open_mutex); |
1440 | chip->card = card; | 1567 | chip->card = card; |
1441 | chip->rate_constraint = snd_cs4231_xrate; | 1568 | chip->rate_constraint = snd_wss_xrate; |
1442 | chip->set_playback_format = snd_cs4231_playback_format; | 1569 | chip->set_playback_format = snd_wss_playback_format; |
1443 | chip->set_capture_format = snd_cs4231_capture_format; | 1570 | chip->set_capture_format = snd_wss_capture_format; |
1444 | if (chip->hardware == CS4231_HW_OPTI93X) | 1571 | if (chip->hardware == WSS_HW_OPTI93X) |
1445 | memcpy(&chip->image, &snd_opti93x_original_image, | 1572 | memcpy(&chip->image, &snd_opti93x_original_image, |
1446 | sizeof(snd_opti93x_original_image)); | 1573 | sizeof(snd_opti93x_original_image)); |
1447 | else | 1574 | else |
1448 | memcpy(&chip->image, &snd_cs4231_original_image, | 1575 | memcpy(&chip->image, &snd_wss_original_image, |
1449 | sizeof(snd_cs4231_original_image)); | 1576 | sizeof(snd_wss_original_image)); |
1450 | 1577 | ||
1451 | *rchip = chip; | 1578 | *rchip = chip; |
1452 | return 0; | 1579 | return 0; |
1453 | } | 1580 | } |
1454 | 1581 | ||
1455 | int snd_cs4231_create(struct snd_card *card, | 1582 | int snd_wss_create(struct snd_card *card, |
1456 | unsigned long port, | 1583 | unsigned long port, |
1457 | unsigned long cport, | 1584 | unsigned long cport, |
1458 | int irq, int dma1, int dma2, | 1585 | int irq, int dma1, int dma2, |
1459 | unsigned short hardware, | 1586 | unsigned short hardware, |
1460 | unsigned short hwshare, | 1587 | unsigned short hwshare, |
1461 | struct snd_cs4231 ** rchip) | 1588 | struct snd_wss **rchip) |
1462 | { | 1589 | { |
1463 | static struct snd_device_ops ops = { | 1590 | static struct snd_device_ops ops = { |
1464 | .dev_free = snd_cs4231_dev_free, | 1591 | .dev_free = snd_wss_dev_free, |
1465 | }; | 1592 | }; |
1466 | struct snd_cs4231 *chip; | 1593 | struct snd_wss *chip; |
1467 | int err; | 1594 | int err; |
1468 | 1595 | ||
1469 | err = snd_cs4231_new(card, hardware, hwshare, &chip); | 1596 | err = snd_wss_new(card, hardware, hwshare, &chip); |
1470 | if (err < 0) | 1597 | if (err < 0) |
1471 | return err; | 1598 | return err; |
1472 | 1599 | ||
@@ -1474,33 +1601,41 @@ int snd_cs4231_create(struct snd_card *card, | |||
1474 | chip->dma1 = -1; | 1601 | chip->dma1 = -1; |
1475 | chip->dma2 = -1; | 1602 | chip->dma2 = -1; |
1476 | 1603 | ||
1477 | if ((chip->res_port = request_region(port, 4, "CS4231")) == NULL) { | 1604 | chip->res_port = request_region(port, 4, "CS4231"); |
1478 | snd_printk(KERN_ERR "cs4231: can't grab port 0x%lx\n", port); | 1605 | if (!chip->res_port) { |
1479 | snd_cs4231_free(chip); | 1606 | snd_printk(KERN_ERR "wss: can't grab port 0x%lx\n", port); |
1607 | snd_wss_free(chip); | ||
1480 | return -EBUSY; | 1608 | return -EBUSY; |
1481 | } | 1609 | } |
1482 | chip->port = port; | 1610 | chip->port = port; |
1483 | if ((long)cport >= 0 && (chip->res_cport = request_region(cport, 8, "CS4232 Control")) == NULL) { | 1611 | if ((long)cport >= 0) { |
1484 | snd_printk(KERN_ERR "cs4231: can't grab control port 0x%lx\n", cport); | 1612 | chip->res_cport = request_region(cport, 8, "CS4232 Control"); |
1485 | snd_cs4231_free(chip); | 1613 | if (!chip->res_cport) { |
1486 | return -ENODEV; | 1614 | snd_printk(KERN_ERR |
1615 | "wss: can't grab control port 0x%lx\n", cport); | ||
1616 | snd_wss_free(chip); | ||
1617 | return -ENODEV; | ||
1618 | } | ||
1487 | } | 1619 | } |
1488 | chip->cport = cport; | 1620 | chip->cport = cport; |
1489 | if (!(hwshare & CS4231_HWSHARE_IRQ) && request_irq(irq, snd_cs4231_interrupt, IRQF_DISABLED, "CS4231", (void *) chip)) { | 1621 | if (!(hwshare & WSS_HWSHARE_IRQ)) |
1490 | snd_printk(KERN_ERR "cs4231: can't grab IRQ %d\n", irq); | 1622 | if (request_irq(irq, snd_wss_interrupt, IRQF_DISABLED, |
1491 | snd_cs4231_free(chip); | 1623 | "CS4231", (void *) chip)) { |
1492 | return -EBUSY; | 1624 | snd_printk(KERN_ERR "wss: can't grab IRQ %d\n", irq); |
1493 | } | 1625 | snd_wss_free(chip); |
1626 | return -EBUSY; | ||
1627 | } | ||
1494 | chip->irq = irq; | 1628 | chip->irq = irq; |
1495 | if (!(hwshare & CS4231_HWSHARE_DMA1) && request_dma(dma1, "CS4231 - 1")) { | 1629 | if (!(hwshare & WSS_HWSHARE_DMA1) && request_dma(dma1, "CS4231 - 1")) { |
1496 | snd_printk(KERN_ERR "cs4231: can't grab DMA1 %d\n", dma1); | 1630 | snd_printk(KERN_ERR "wss: can't grab DMA1 %d\n", dma1); |
1497 | snd_cs4231_free(chip); | 1631 | snd_wss_free(chip); |
1498 | return -EBUSY; | 1632 | return -EBUSY; |
1499 | } | 1633 | } |
1500 | chip->dma1 = dma1; | 1634 | chip->dma1 = dma1; |
1501 | if (!(hwshare & CS4231_HWSHARE_DMA2) && dma1 != dma2 && dma2 >= 0 && request_dma(dma2, "CS4231 - 2")) { | 1635 | if (!(hwshare & WSS_HWSHARE_DMA2) && dma1 != dma2 && |
1502 | snd_printk(KERN_ERR "cs4231: can't grab DMA2 %d\n", dma2); | 1636 | dma2 >= 0 && request_dma(dma2, "CS4231 - 2")) { |
1503 | snd_cs4231_free(chip); | 1637 | snd_printk(KERN_ERR "wss: can't grab DMA2 %d\n", dma2); |
1638 | snd_wss_free(chip); | ||
1504 | return -EBUSY; | 1639 | return -EBUSY; |
1505 | } | 1640 | } |
1506 | if (dma1 == dma2 || dma2 < 0) { | 1641 | if (dma1 == dma2 || dma2 < 0) { |
@@ -1510,58 +1645,60 @@ int snd_cs4231_create(struct snd_card *card, | |||
1510 | chip->dma2 = dma2; | 1645 | chip->dma2 = dma2; |
1511 | 1646 | ||
1512 | /* global setup */ | 1647 | /* global setup */ |
1513 | if (snd_cs4231_probe(chip) < 0) { | 1648 | if (snd_wss_probe(chip) < 0) { |
1514 | snd_cs4231_free(chip); | 1649 | snd_wss_free(chip); |
1515 | return -ENODEV; | 1650 | return -ENODEV; |
1516 | } | 1651 | } |
1517 | snd_cs4231_init(chip); | 1652 | snd_wss_init(chip); |
1518 | 1653 | ||
1519 | #if 0 | 1654 | #if 0 |
1520 | if (chip->hardware & CS4231_HW_CS4232_MASK) { | 1655 | if (chip->hardware & WSS_HW_CS4232_MASK) { |
1521 | if (chip->res_cport == NULL) | 1656 | if (chip->res_cport == NULL) |
1522 | snd_printk("CS4232 control port features are not accessible\n"); | 1657 | snd_printk("CS4232 control port features are not accessible\n"); |
1523 | } | 1658 | } |
1524 | #endif | 1659 | #endif |
1525 | 1660 | ||
1526 | /* Register device */ | 1661 | /* Register device */ |
1527 | if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) { | 1662 | err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); |
1528 | snd_cs4231_free(chip); | 1663 | if (err < 0) { |
1664 | snd_wss_free(chip); | ||
1529 | return err; | 1665 | return err; |
1530 | } | 1666 | } |
1531 | 1667 | ||
1532 | #ifdef CONFIG_PM | 1668 | #ifdef CONFIG_PM |
1533 | /* Power Management */ | 1669 | /* Power Management */ |
1534 | chip->suspend = snd_cs4231_suspend; | 1670 | chip->suspend = snd_wss_suspend; |
1535 | chip->resume = snd_cs4231_resume; | 1671 | chip->resume = snd_wss_resume; |
1536 | #endif | 1672 | #endif |
1537 | 1673 | ||
1538 | *rchip = chip; | 1674 | *rchip = chip; |
1539 | return 0; | 1675 | return 0; |
1540 | } | 1676 | } |
1677 | EXPORT_SYMBOL(snd_wss_create); | ||
1541 | 1678 | ||
1542 | static struct snd_pcm_ops snd_cs4231_playback_ops = { | 1679 | static struct snd_pcm_ops snd_wss_playback_ops = { |
1543 | .open = snd_cs4231_playback_open, | 1680 | .open = snd_wss_playback_open, |
1544 | .close = snd_cs4231_playback_close, | 1681 | .close = snd_wss_playback_close, |
1545 | .ioctl = snd_pcm_lib_ioctl, | 1682 | .ioctl = snd_pcm_lib_ioctl, |
1546 | .hw_params = snd_cs4231_playback_hw_params, | 1683 | .hw_params = snd_wss_playback_hw_params, |
1547 | .hw_free = snd_cs4231_playback_hw_free, | 1684 | .hw_free = snd_wss_playback_hw_free, |
1548 | .prepare = snd_cs4231_playback_prepare, | 1685 | .prepare = snd_wss_playback_prepare, |
1549 | .trigger = snd_cs4231_trigger, | 1686 | .trigger = snd_wss_trigger, |
1550 | .pointer = snd_cs4231_playback_pointer, | 1687 | .pointer = snd_wss_playback_pointer, |
1551 | }; | 1688 | }; |
1552 | 1689 | ||
1553 | static struct snd_pcm_ops snd_cs4231_capture_ops = { | 1690 | static struct snd_pcm_ops snd_wss_capture_ops = { |
1554 | .open = snd_cs4231_capture_open, | 1691 | .open = snd_wss_capture_open, |
1555 | .close = snd_cs4231_capture_close, | 1692 | .close = snd_wss_capture_close, |
1556 | .ioctl = snd_pcm_lib_ioctl, | 1693 | .ioctl = snd_pcm_lib_ioctl, |
1557 | .hw_params = snd_cs4231_capture_hw_params, | 1694 | .hw_params = snd_wss_capture_hw_params, |
1558 | .hw_free = snd_cs4231_capture_hw_free, | 1695 | .hw_free = snd_wss_capture_hw_free, |
1559 | .prepare = snd_cs4231_capture_prepare, | 1696 | .prepare = snd_wss_capture_prepare, |
1560 | .trigger = snd_cs4231_trigger, | 1697 | .trigger = snd_wss_trigger, |
1561 | .pointer = snd_cs4231_capture_pointer, | 1698 | .pointer = snd_wss_capture_pointer, |
1562 | }; | 1699 | }; |
1563 | 1700 | ||
1564 | int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) | 1701 | int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm) |
1565 | { | 1702 | { |
1566 | struct snd_pcm *pcm; | 1703 | struct snd_pcm *pcm; |
1567 | int err; | 1704 | int err; |
@@ -1573,17 +1710,17 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) | |||
1573 | mutex_init(&chip->mce_mutex); | 1710 | mutex_init(&chip->mce_mutex); |
1574 | mutex_init(&chip->open_mutex); | 1711 | mutex_init(&chip->open_mutex); |
1575 | 1712 | ||
1576 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops); | 1713 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_wss_playback_ops); |
1577 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops); | 1714 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_wss_capture_ops); |
1578 | 1715 | ||
1579 | /* global setup */ | 1716 | /* global setup */ |
1580 | pcm->private_data = chip; | 1717 | pcm->private_data = chip; |
1581 | pcm->info_flags = 0; | 1718 | pcm->info_flags = 0; |
1582 | if (chip->single_dma) | 1719 | if (chip->single_dma) |
1583 | pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; | 1720 | pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; |
1584 | if (chip->hardware != CS4231_HW_INTERWAVE) | 1721 | if (chip->hardware != WSS_HW_INTERWAVE) |
1585 | pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX; | 1722 | pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX; |
1586 | strcpy(pcm->name, snd_cs4231_chip_id(chip)); | 1723 | strcpy(pcm->name, snd_wss_chip_id(chip)); |
1587 | 1724 | ||
1588 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 1725 | snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
1589 | snd_dma_isa_data(), | 1726 | snd_dma_isa_data(), |
@@ -1594,14 +1731,15 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) | |||
1594 | *rpcm = pcm; | 1731 | *rpcm = pcm; |
1595 | return 0; | 1732 | return 0; |
1596 | } | 1733 | } |
1734 | EXPORT_SYMBOL(snd_wss_pcm); | ||
1597 | 1735 | ||
1598 | static void snd_cs4231_timer_free(struct snd_timer *timer) | 1736 | static void snd_wss_timer_free(struct snd_timer *timer) |
1599 | { | 1737 | { |
1600 | struct snd_cs4231 *chip = timer->private_data; | 1738 | struct snd_wss *chip = timer->private_data; |
1601 | chip->timer = NULL; | 1739 | chip->timer = NULL; |
1602 | } | 1740 | } |
1603 | 1741 | ||
1604 | int snd_cs4231_timer(struct snd_cs4231 *chip, int device, struct snd_timer **rtimer) | 1742 | int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer) |
1605 | { | 1743 | { |
1606 | struct snd_timer *timer; | 1744 | struct snd_timer *timer; |
1607 | struct snd_timer_id tid; | 1745 | struct snd_timer_id tid; |
@@ -1615,21 +1753,23 @@ int snd_cs4231_timer(struct snd_cs4231 *chip, int device, struct snd_timer **rti | |||
1615 | tid.subdevice = 0; | 1753 | tid.subdevice = 0; |
1616 | if ((err = snd_timer_new(chip->card, "CS4231", &tid, &timer)) < 0) | 1754 | if ((err = snd_timer_new(chip->card, "CS4231", &tid, &timer)) < 0) |
1617 | return err; | 1755 | return err; |
1618 | strcpy(timer->name, snd_cs4231_chip_id(chip)); | 1756 | strcpy(timer->name, snd_wss_chip_id(chip)); |
1619 | timer->private_data = chip; | 1757 | timer->private_data = chip; |
1620 | timer->private_free = snd_cs4231_timer_free; | 1758 | timer->private_free = snd_wss_timer_free; |
1621 | timer->hw = snd_cs4231_timer_table; | 1759 | timer->hw = snd_wss_timer_table; |
1622 | chip->timer = timer; | 1760 | chip->timer = timer; |
1623 | if (rtimer) | 1761 | if (rtimer) |
1624 | *rtimer = timer; | 1762 | *rtimer = timer; |
1625 | return 0; | 1763 | return 0; |
1626 | } | 1764 | } |
1765 | EXPORT_SYMBOL(snd_wss_timer); | ||
1627 | 1766 | ||
1628 | /* | 1767 | /* |
1629 | * MIXER part | 1768 | * MIXER part |
1630 | */ | 1769 | */ |
1631 | 1770 | ||
1632 | static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1771 | static int snd_wss_info_mux(struct snd_kcontrol *kcontrol, |
1772 | struct snd_ctl_elem_info *uinfo) | ||
1633 | { | 1773 | { |
1634 | static char *texts[4] = { | 1774 | static char *texts[4] = { |
1635 | "Line", "Aux", "Mic", "Mix" | 1775 | "Line", "Aux", "Mic", "Mix" |
@@ -1641,7 +1781,7 @@ static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
1641 | "Line", "Synth", "Mic", "Mix" | 1781 | "Line", "Synth", "Mic", "Mix" |
1642 | }; | 1782 | }; |
1643 | char **ptexts = texts; | 1783 | char **ptexts = texts; |
1644 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1784 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1645 | 1785 | ||
1646 | snd_assert(chip->card != NULL, return -EINVAL); | 1786 | snd_assert(chip->card != NULL, return -EINVAL); |
1647 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1787 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
@@ -1652,16 +1792,21 @@ static int snd_cs4231_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_ele | |||
1652 | if (!strcmp(chip->card->driver, "GUS MAX")) | 1792 | if (!strcmp(chip->card->driver, "GUS MAX")) |
1653 | ptexts = gusmax_texts; | 1793 | ptexts = gusmax_texts; |
1654 | switch (chip->hardware) { | 1794 | switch (chip->hardware) { |
1655 | case CS4231_HW_INTERWAVE: ptexts = gusmax_texts; break; | 1795 | case WSS_HW_INTERWAVE: |
1656 | case CS4231_HW_OPL3SA2: ptexts = opl3sa_texts; break; | 1796 | ptexts = gusmax_texts; |
1797 | break; | ||
1798 | case WSS_HW_OPL3SA2: | ||
1799 | ptexts = opl3sa_texts; | ||
1800 | break; | ||
1657 | } | 1801 | } |
1658 | strcpy(uinfo->value.enumerated.name, ptexts[uinfo->value.enumerated.item]); | 1802 | strcpy(uinfo->value.enumerated.name, ptexts[uinfo->value.enumerated.item]); |
1659 | return 0; | 1803 | return 0; |
1660 | } | 1804 | } |
1661 | 1805 | ||
1662 | static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1806 | static int snd_wss_get_mux(struct snd_kcontrol *kcontrol, |
1807 | struct snd_ctl_elem_value *ucontrol) | ||
1663 | { | 1808 | { |
1664 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1809 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1665 | unsigned long flags; | 1810 | unsigned long flags; |
1666 | 1811 | ||
1667 | spin_lock_irqsave(&chip->reg_lock, flags); | 1812 | spin_lock_irqsave(&chip->reg_lock, flags); |
@@ -1671,9 +1816,10 @@ static int snd_cs4231_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
1671 | return 0; | 1816 | return 0; |
1672 | } | 1817 | } |
1673 | 1818 | ||
1674 | static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1819 | static int snd_wss_put_mux(struct snd_kcontrol *kcontrol, |
1820 | struct snd_ctl_elem_value *ucontrol) | ||
1675 | { | 1821 | { |
1676 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1822 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1677 | unsigned long flags; | 1823 | unsigned long flags; |
1678 | unsigned short left, right; | 1824 | unsigned short left, right; |
1679 | int change; | 1825 | int change; |
@@ -1687,14 +1833,15 @@ static int snd_cs4231_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
1687 | left = (chip->image[CS4231_LEFT_INPUT] & ~CS4231_MIXS_ALL) | left; | 1833 | left = (chip->image[CS4231_LEFT_INPUT] & ~CS4231_MIXS_ALL) | left; |
1688 | right = (chip->image[CS4231_RIGHT_INPUT] & ~CS4231_MIXS_ALL) | right; | 1834 | right = (chip->image[CS4231_RIGHT_INPUT] & ~CS4231_MIXS_ALL) | right; |
1689 | change = left != chip->image[CS4231_LEFT_INPUT] || | 1835 | change = left != chip->image[CS4231_LEFT_INPUT] || |
1690 | right != chip->image[CS4231_RIGHT_INPUT]; | 1836 | right != chip->image[CS4231_RIGHT_INPUT]; |
1691 | snd_cs4231_out(chip, CS4231_LEFT_INPUT, left); | 1837 | snd_wss_out(chip, CS4231_LEFT_INPUT, left); |
1692 | snd_cs4231_out(chip, CS4231_RIGHT_INPUT, right); | 1838 | snd_wss_out(chip, CS4231_RIGHT_INPUT, right); |
1693 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1839 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1694 | return change; | 1840 | return change; |
1695 | } | 1841 | } |
1696 | 1842 | ||
1697 | int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1843 | int snd_wss_info_single(struct snd_kcontrol *kcontrol, |
1844 | struct snd_ctl_elem_info *uinfo) | ||
1698 | { | 1845 | { |
1699 | int mask = (kcontrol->private_value >> 16) & 0xff; | 1846 | int mask = (kcontrol->private_value >> 16) & 0xff; |
1700 | 1847 | ||
@@ -1704,10 +1851,12 @@ int snd_cs4231_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
1704 | uinfo->value.integer.max = mask; | 1851 | uinfo->value.integer.max = mask; |
1705 | return 0; | 1852 | return 0; |
1706 | } | 1853 | } |
1854 | EXPORT_SYMBOL(snd_wss_info_single); | ||
1707 | 1855 | ||
1708 | int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1856 | int snd_wss_get_single(struct snd_kcontrol *kcontrol, |
1857 | struct snd_ctl_elem_value *ucontrol) | ||
1709 | { | 1858 | { |
1710 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1859 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1711 | unsigned long flags; | 1860 | unsigned long flags; |
1712 | int reg = kcontrol->private_value & 0xff; | 1861 | int reg = kcontrol->private_value & 0xff; |
1713 | int shift = (kcontrol->private_value >> 8) & 0xff; | 1862 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -1721,10 +1870,12 @@ int snd_cs4231_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1721 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; | 1870 | ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; |
1722 | return 0; | 1871 | return 0; |
1723 | } | 1872 | } |
1873 | EXPORT_SYMBOL(snd_wss_get_single); | ||
1724 | 1874 | ||
1725 | int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1875 | int snd_wss_put_single(struct snd_kcontrol *kcontrol, |
1876 | struct snd_ctl_elem_value *ucontrol) | ||
1726 | { | 1877 | { |
1727 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1878 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1728 | unsigned long flags; | 1879 | unsigned long flags; |
1729 | int reg = kcontrol->private_value & 0xff; | 1880 | int reg = kcontrol->private_value & 0xff; |
1730 | int shift = (kcontrol->private_value >> 8) & 0xff; | 1881 | int shift = (kcontrol->private_value >> 8) & 0xff; |
@@ -1740,12 +1891,14 @@ int snd_cs4231_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1740 | spin_lock_irqsave(&chip->reg_lock, flags); | 1891 | spin_lock_irqsave(&chip->reg_lock, flags); |
1741 | val = (chip->image[reg] & ~(mask << shift)) | val; | 1892 | val = (chip->image[reg] & ~(mask << shift)) | val; |
1742 | change = val != chip->image[reg]; | 1893 | change = val != chip->image[reg]; |
1743 | snd_cs4231_out(chip, reg, val); | 1894 | snd_wss_out(chip, reg, val); |
1744 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1895 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1745 | return change; | 1896 | return change; |
1746 | } | 1897 | } |
1898 | EXPORT_SYMBOL(snd_wss_put_single); | ||
1747 | 1899 | ||
1748 | int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1900 | int snd_wss_info_double(struct snd_kcontrol *kcontrol, |
1901 | struct snd_ctl_elem_info *uinfo) | ||
1749 | { | 1902 | { |
1750 | int mask = (kcontrol->private_value >> 24) & 0xff; | 1903 | int mask = (kcontrol->private_value >> 24) & 0xff; |
1751 | 1904 | ||
@@ -1755,10 +1908,12 @@ int snd_cs4231_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_in | |||
1755 | uinfo->value.integer.max = mask; | 1908 | uinfo->value.integer.max = mask; |
1756 | return 0; | 1909 | return 0; |
1757 | } | 1910 | } |
1911 | EXPORT_SYMBOL(snd_wss_info_double); | ||
1758 | 1912 | ||
1759 | int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1913 | int snd_wss_get_double(struct snd_kcontrol *kcontrol, |
1914 | struct snd_ctl_elem_value *ucontrol) | ||
1760 | { | 1915 | { |
1761 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1916 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1762 | unsigned long flags; | 1917 | unsigned long flags; |
1763 | int left_reg = kcontrol->private_value & 0xff; | 1918 | int left_reg = kcontrol->private_value & 0xff; |
1764 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 1919 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -1777,10 +1932,12 @@ int snd_cs4231_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1777 | } | 1932 | } |
1778 | return 0; | 1933 | return 0; |
1779 | } | 1934 | } |
1935 | EXPORT_SYMBOL(snd_wss_get_double); | ||
1780 | 1936 | ||
1781 | int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1937 | int snd_wss_put_double(struct snd_kcontrol *kcontrol, |
1938 | struct snd_ctl_elem_value *ucontrol) | ||
1782 | { | 1939 | { |
1783 | struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); | 1940 | struct snd_wss *chip = snd_kcontrol_chip(kcontrol); |
1784 | unsigned long flags; | 1941 | unsigned long flags; |
1785 | int left_reg = kcontrol->private_value & 0xff; | 1942 | int left_reg = kcontrol->private_value & 0xff; |
1786 | int right_reg = (kcontrol->private_value >> 8) & 0xff; | 1943 | int right_reg = (kcontrol->private_value >> 8) & 0xff; |
@@ -1803,81 +1960,98 @@ int snd_cs4231_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_val | |||
1803 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; | 1960 | val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; |
1804 | val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; | 1961 | val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; |
1805 | change = val1 != chip->image[left_reg] || val2 != chip->image[right_reg]; | 1962 | change = val1 != chip->image[left_reg] || val2 != chip->image[right_reg]; |
1806 | snd_cs4231_out(chip, left_reg, val1); | 1963 | snd_wss_out(chip, left_reg, val1); |
1807 | snd_cs4231_out(chip, right_reg, val2); | 1964 | snd_wss_out(chip, right_reg, val2); |
1808 | spin_unlock_irqrestore(&chip->reg_lock, flags); | 1965 | spin_unlock_irqrestore(&chip->reg_lock, flags); |
1809 | return change; | 1966 | return change; |
1810 | } | 1967 | } |
1811 | 1968 | EXPORT_SYMBOL(snd_wss_put_double); | |
1812 | static struct snd_kcontrol_new snd_cs4231_controls[] = { | 1969 | |
1813 | CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 1970 | static struct snd_kcontrol_new snd_wss_controls[] = { |
1814 | CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), | 1971 | WSS_DOUBLE("PCM Playback Switch", 0, |
1815 | CS4231_DOUBLE("Line Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 1972 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
1816 | CS4231_DOUBLE("Line Playback Volume", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), | 1973 | WSS_DOUBLE("PCM Playback Volume", 0, |
1817 | CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 1974 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), |
1818 | CS4231_DOUBLE("Aux Playback Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), | 1975 | WSS_DOUBLE("Line Playback Switch", 0, |
1819 | CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 1976 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
1820 | CS4231_DOUBLE("Aux Playback Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | 1977 | WSS_DOUBLE("Line Playback Volume", 0, |
1821 | CS4231_SINGLE("Mono Playback Switch", 0, CS4231_MONO_CTRL, 7, 1, 1), | 1978 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), |
1822 | CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), | 1979 | WSS_DOUBLE("Aux Playback Switch", 0, |
1823 | CS4231_SINGLE("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, 6, 1, 1), | 1980 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
1824 | CS4231_SINGLE("Mono Output Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), | 1981 | WSS_DOUBLE("Aux Playback Volume", 0, |
1825 | CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | 1982 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), |
1983 | WSS_DOUBLE("Aux Playback Switch", 1, | ||
1984 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | ||
1985 | WSS_DOUBLE("Aux Playback Volume", 1, | ||
1986 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), | ||
1987 | WSS_SINGLE("Mono Playback Switch", 0, | ||
1988 | CS4231_MONO_CTRL, 7, 1, 1), | ||
1989 | WSS_SINGLE("Mono Playback Volume", 0, | ||
1990 | CS4231_MONO_CTRL, 0, 15, 1), | ||
1991 | WSS_SINGLE("Mono Output Playback Switch", 0, | ||
1992 | CS4231_MONO_CTRL, 6, 1, 1), | ||
1993 | WSS_SINGLE("Mono Output Playback Bypass", 0, | ||
1994 | CS4231_MONO_CTRL, 5, 1, 0), | ||
1995 | WSS_DOUBLE("Capture Volume", 0, | ||
1996 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | ||
1826 | { | 1997 | { |
1827 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1998 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1828 | .name = "Capture Source", | 1999 | .name = "Capture Source", |
1829 | .info = snd_cs4231_info_mux, | 2000 | .info = snd_wss_info_mux, |
1830 | .get = snd_cs4231_get_mux, | 2001 | .get = snd_wss_get_mux, |
1831 | .put = snd_cs4231_put_mux, | 2002 | .put = snd_wss_put_mux, |
1832 | }, | 2003 | }, |
1833 | CS4231_DOUBLE("Mic Boost", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 2004 | WSS_DOUBLE("Mic Boost", 0, |
1834 | CS4231_SINGLE("Loopback Capture Switch", 0, CS4231_LOOPBACK, 0, 1, 0), | 2005 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), |
1835 | CS4231_SINGLE("Loopback Capture Volume", 0, CS4231_LOOPBACK, 2, 63, 1) | 2006 | WSS_SINGLE("Loopback Capture Switch", 0, |
2007 | CS4231_LOOPBACK, 0, 1, 0), | ||
2008 | WSS_SINGLE("Loopback Capture Volume", 0, | ||
2009 | CS4231_LOOPBACK, 2, 63, 1) | ||
1836 | }; | 2010 | }; |
1837 | 2011 | ||
1838 | static struct snd_kcontrol_new snd_opti93x_controls[] = { | 2012 | static struct snd_kcontrol_new snd_opti93x_controls[] = { |
1839 | CS4231_DOUBLE("Master Playback Switch", 0, | 2013 | WSS_DOUBLE("Master Playback Switch", 0, |
1840 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), | 2014 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), |
1841 | CS4231_DOUBLE("Master Playback Volume", 0, | 2015 | WSS_DOUBLE("Master Playback Volume", 0, |
1842 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), | 2016 | OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 1, 1, 31, 1), |
1843 | CS4231_DOUBLE("PCM Playback Switch", 0, | 2017 | WSS_DOUBLE("PCM Playback Switch", 0, |
1844 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), | 2018 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), |
1845 | CS4231_DOUBLE("PCM Playback Volume", 0, | 2019 | WSS_DOUBLE("PCM Playback Volume", 0, |
1846 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1), | 2020 | CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 31, 1), |
1847 | CS4231_DOUBLE("FM Playback Switch", 0, | 2021 | WSS_DOUBLE("FM Playback Switch", 0, |
1848 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), | 2022 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), |
1849 | CS4231_DOUBLE("FM Playback Volume", 0, | 2023 | WSS_DOUBLE("FM Playback Volume", 0, |
1850 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1), | 2024 | CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 1, 1, 15, 1), |
1851 | CS4231_DOUBLE("Line Playback Switch", 0, | 2025 | WSS_DOUBLE("Line Playback Switch", 0, |
1852 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), | 2026 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), |
1853 | CS4231_DOUBLE("Line Playback Volume", 0, | 2027 | WSS_DOUBLE("Line Playback Volume", 0, |
1854 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1), | 2028 | CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 15, 1), |
1855 | CS4231_DOUBLE("Mic Playback Switch", 0, | 2029 | WSS_DOUBLE("Mic Playback Switch", 0, |
1856 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), | 2030 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 7, 7, 1, 1), |
1857 | CS4231_DOUBLE("Mic Playback Volume", 0, | 2031 | WSS_DOUBLE("Mic Playback Volume", 0, |
1858 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), | 2032 | OPTi93X_MIC_LEFT_INPUT, OPTi93X_MIC_RIGHT_INPUT, 1, 1, 15, 1), |
1859 | CS4231_DOUBLE("Mic Boost", 0, | 2033 | WSS_DOUBLE("Mic Boost", 0, |
1860 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), | 2034 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 5, 5, 1, 0), |
1861 | CS4231_DOUBLE("CD Playback Switch", 0, | 2035 | WSS_DOUBLE("CD Playback Switch", 0, |
1862 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), | 2036 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), |
1863 | CS4231_DOUBLE("CD Playback Volume", 0, | 2037 | WSS_DOUBLE("CD Playback Volume", 0, |
1864 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1), | 2038 | CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 1, 1, 15, 1), |
1865 | CS4231_DOUBLE("Aux Playback Switch", 0, | 2039 | WSS_DOUBLE("Aux Playback Switch", 0, |
1866 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), | 2040 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 7, 7, 1, 1), |
1867 | CS4231_DOUBLE("Aux Playback Volume", 0, | 2041 | WSS_DOUBLE("Aux Playback Volume", 0, |
1868 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), | 2042 | OPTi931_AUX_LEFT_INPUT, OPTi931_AUX_RIGHT_INPUT, 1, 1, 15, 1), |
1869 | CS4231_DOUBLE("Capture Volume", 0, | 2043 | WSS_DOUBLE("Capture Volume", 0, |
1870 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), | 2044 | CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), |
1871 | { | 2045 | { |
1872 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2046 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1873 | .name = "Capture Source", | 2047 | .name = "Capture Source", |
1874 | .info = snd_cs4231_info_mux, | 2048 | .info = snd_wss_info_mux, |
1875 | .get = snd_cs4231_get_mux, | 2049 | .get = snd_wss_get_mux, |
1876 | .put = snd_cs4231_put_mux, | 2050 | .put = snd_wss_put_mux, |
1877 | } | 2051 | } |
1878 | }; | 2052 | }; |
1879 | 2053 | ||
1880 | int snd_cs4231_mixer(struct snd_cs4231 *chip) | 2054 | int snd_wss_mixer(struct snd_wss *chip) |
1881 | { | 2055 | { |
1882 | struct snd_card *card; | 2056 | struct snd_card *card; |
1883 | unsigned int idx; | 2057 | unsigned int idx; |
@@ -1889,7 +2063,7 @@ int snd_cs4231_mixer(struct snd_cs4231 *chip) | |||
1889 | 2063 | ||
1890 | strcpy(card->mixername, chip->pcm->name); | 2064 | strcpy(card->mixername, chip->pcm->name); |
1891 | 2065 | ||
1892 | if (chip->hardware == CS4231_HW_OPTI93X) | 2066 | if (chip->hardware == WSS_HW_OPTI93X) |
1893 | for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { | 2067 | for (idx = 0; idx < ARRAY_SIZE(snd_opti93x_controls); idx++) { |
1894 | err = snd_ctl_add(card, | 2068 | err = snd_ctl_add(card, |
1895 | snd_ctl_new1(&snd_opti93x_controls[idx], | 2069 | snd_ctl_new1(&snd_opti93x_controls[idx], |
@@ -1898,48 +2072,29 @@ int snd_cs4231_mixer(struct snd_cs4231 *chip) | |||
1898 | return err; | 2072 | return err; |
1899 | } | 2073 | } |
1900 | else | 2074 | else |
1901 | for (idx = 0; idx < ARRAY_SIZE(snd_cs4231_controls); idx++) { | 2075 | for (idx = 0; idx < ARRAY_SIZE(snd_wss_controls); idx++) { |
1902 | err = snd_ctl_add(card, | 2076 | err = snd_ctl_add(card, |
1903 | snd_ctl_new1(&snd_cs4231_controls[idx], | 2077 | snd_ctl_new1(&snd_wss_controls[idx], |
1904 | chip)); | 2078 | chip)); |
1905 | if (err < 0) | 2079 | if (err < 0) |
1906 | return err; | 2080 | return err; |
1907 | } | 2081 | } |
1908 | return 0; | 2082 | return 0; |
1909 | } | 2083 | } |
1910 | 2084 | EXPORT_SYMBOL(snd_wss_mixer); | |
1911 | EXPORT_SYMBOL(snd_cs4231_out); | ||
1912 | EXPORT_SYMBOL(snd_cs4231_in); | ||
1913 | EXPORT_SYMBOL(snd_cs4236_ext_out); | ||
1914 | EXPORT_SYMBOL(snd_cs4236_ext_in); | ||
1915 | EXPORT_SYMBOL(snd_cs4231_mce_up); | ||
1916 | EXPORT_SYMBOL(snd_cs4231_mce_down); | ||
1917 | EXPORT_SYMBOL(snd_cs4231_overrange); | ||
1918 | EXPORT_SYMBOL(snd_cs4231_interrupt); | ||
1919 | EXPORT_SYMBOL(snd_cs4231_chip_id); | ||
1920 | EXPORT_SYMBOL(snd_cs4231_create); | ||
1921 | EXPORT_SYMBOL(snd_cs4231_pcm); | ||
1922 | EXPORT_SYMBOL(snd_cs4231_mixer); | ||
1923 | EXPORT_SYMBOL(snd_cs4231_timer); | ||
1924 | EXPORT_SYMBOL(snd_cs4231_info_single); | ||
1925 | EXPORT_SYMBOL(snd_cs4231_get_single); | ||
1926 | EXPORT_SYMBOL(snd_cs4231_put_single); | ||
1927 | EXPORT_SYMBOL(snd_cs4231_info_double); | ||
1928 | EXPORT_SYMBOL(snd_cs4231_get_double); | ||
1929 | EXPORT_SYMBOL(snd_cs4231_put_double); | ||
1930 | 2085 | ||
1931 | /* | 2086 | /* |
1932 | * INIT part | 2087 | * INIT part |
1933 | */ | 2088 | */ |
1934 | 2089 | ||
1935 | static int __init alsa_cs4231_init(void) | 2090 | static int __init alsa_wss_init(void) |
1936 | { | 2091 | { |
1937 | return 0; | 2092 | return 0; |
1938 | } | 2093 | } |
1939 | 2094 | ||
1940 | static void __exit alsa_cs4231_exit(void) | 2095 | static void __exit alsa_wss_exit(void) |
1941 | { | 2096 | { |
1942 | } | 2097 | } |
1943 | 2098 | ||
1944 | module_init(alsa_cs4231_init) | 2099 | module_init(alsa_wss_init); |
1945 | module_exit(alsa_cs4231_exit) | 2100 | module_exit(alsa_wss_exit); |