aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/cs423x/cs4236_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/cs423x/cs4236_lib.c')
-rw-r--r--sound/isa/cs423x/cs4236_lib.c344
1 files changed, 204 insertions, 140 deletions
diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c
index eb227d856d1e..33e9cf178b8b 100644
--- a/sound/isa/cs423x/cs4236_lib.c
+++ b/sound/isa/cs423x/cs4236_lib.c
@@ -121,13 +121,14 @@ static unsigned char snd_cs4236_ext_map[18] = {
121 * 121 *
122 */ 122 */
123 123
124static void snd_cs4236_ctrl_out(struct snd_cs4231 *chip, unsigned char reg, unsigned char val) 124static void snd_cs4236_ctrl_out(struct snd_wss *chip,
125 unsigned char reg, unsigned char val)
125{ 126{
126 outb(reg, chip->cport + 3); 127 outb(reg, chip->cport + 3);
127 outb(chip->cimage[reg] = val, chip->cport + 4); 128 outb(chip->cimage[reg] = val, chip->cport + 4);
128} 129}
129 130
130static unsigned char snd_cs4236_ctrl_in(struct snd_cs4231 *chip, unsigned char reg) 131static unsigned char snd_cs4236_ctrl_in(struct snd_wss *chip, unsigned char reg)
131{ 132{
132 outb(reg, chip->cport + 3); 133 outb(reg, chip->cport + 3);
133 return inb(chip->cport + 4); 134 return inb(chip->cport + 4);
@@ -180,44 +181,52 @@ static unsigned char divisor_to_rate_register(unsigned int divisor)
180 } 181 }
181} 182}
182 183
183static void snd_cs4236_playback_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char pdfr) 184static void snd_cs4236_playback_format(struct snd_wss *chip,
185 struct snd_pcm_hw_params *params,
186 unsigned char pdfr)
184{ 187{
185 unsigned long flags; 188 unsigned long flags;
186 unsigned char rate = divisor_to_rate_register(params->rate_den); 189 unsigned char rate = divisor_to_rate_register(params->rate_den);
187 190
188 spin_lock_irqsave(&chip->reg_lock, flags); 191 spin_lock_irqsave(&chip->reg_lock, flags);
189 /* set fast playback format change and clean playback FIFO */ 192 /* set fast playback format change and clean playback FIFO */
190 snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x10); 193 snd_wss_out(chip, CS4231_ALT_FEATURE_1,
191 snd_cs4231_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0); 194 chip->image[CS4231_ALT_FEATURE_1] | 0x10);
192 snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x10); 195 snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0);
196 snd_wss_out(chip, CS4231_ALT_FEATURE_1,
197 chip->image[CS4231_ALT_FEATURE_1] & ~0x10);
193 snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate); 198 snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate);
194 spin_unlock_irqrestore(&chip->reg_lock, flags); 199 spin_unlock_irqrestore(&chip->reg_lock, flags);
195} 200}
196 201
197static void snd_cs4236_capture_format(struct snd_cs4231 *chip, struct snd_pcm_hw_params *params, unsigned char cdfr) 202static void snd_cs4236_capture_format(struct snd_wss *chip,
203 struct snd_pcm_hw_params *params,
204 unsigned char cdfr)
198{ 205{
199 unsigned long flags; 206 unsigned long flags;
200 unsigned char rate = divisor_to_rate_register(params->rate_den); 207 unsigned char rate = divisor_to_rate_register(params->rate_den);
201 208
202 spin_lock_irqsave(&chip->reg_lock, flags); 209 spin_lock_irqsave(&chip->reg_lock, flags);
203 /* set fast capture format change and clean capture FIFO */ 210 /* set fast capture format change and clean capture FIFO */
204 snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] | 0x20); 211 snd_wss_out(chip, CS4231_ALT_FEATURE_1,
205 snd_cs4231_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0); 212 chip->image[CS4231_ALT_FEATURE_1] | 0x20);
206 snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1] & ~0x20); 213 snd_wss_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0);
214 snd_wss_out(chip, CS4231_ALT_FEATURE_1,
215 chip->image[CS4231_ALT_FEATURE_1] & ~0x20);
207 snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate); 216 snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate);
208 spin_unlock_irqrestore(&chip->reg_lock, flags); 217 spin_unlock_irqrestore(&chip->reg_lock, flags);
209} 218}
210 219
211#ifdef CONFIG_PM 220#ifdef CONFIG_PM
212 221
213static void snd_cs4236_suspend(struct snd_cs4231 *chip) 222static void snd_cs4236_suspend(struct snd_wss *chip)
214{ 223{
215 int reg; 224 int reg;
216 unsigned long flags; 225 unsigned long flags;
217 226
218 spin_lock_irqsave(&chip->reg_lock, flags); 227 spin_lock_irqsave(&chip->reg_lock, flags);
219 for (reg = 0; reg < 32; reg++) 228 for (reg = 0; reg < 32; reg++)
220 chip->image[reg] = snd_cs4231_in(chip, reg); 229 chip->image[reg] = snd_wss_in(chip, reg);
221 for (reg = 0; reg < 18; reg++) 230 for (reg = 0; reg < 18; reg++)
222 chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg)); 231 chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg));
223 for (reg = 2; reg < 9; reg++) 232 for (reg = 2; reg < 9; reg++)
@@ -225,12 +234,12 @@ static void snd_cs4236_suspend(struct snd_cs4231 *chip)
225 spin_unlock_irqrestore(&chip->reg_lock, flags); 234 spin_unlock_irqrestore(&chip->reg_lock, flags);
226} 235}
227 236
228static void snd_cs4236_resume(struct snd_cs4231 *chip) 237static void snd_cs4236_resume(struct snd_wss *chip)
229{ 238{
230 int reg; 239 int reg;
231 unsigned long flags; 240 unsigned long flags;
232 241
233 snd_cs4231_mce_up(chip); 242 snd_wss_mce_up(chip);
234 spin_lock_irqsave(&chip->reg_lock, flags); 243 spin_lock_irqsave(&chip->reg_lock, flags);
235 for (reg = 0; reg < 32; reg++) { 244 for (reg = 0; reg < 32; reg++) {
236 switch (reg) { 245 switch (reg) {
@@ -240,7 +249,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip)
240 case 29: /* why? CS4235 - master right */ 249 case 29: /* why? CS4235 - master right */
241 break; 250 break;
242 default: 251 default:
243 snd_cs4231_out(chip, reg, chip->image[reg]); 252 snd_wss_out(chip, reg, chip->image[reg]);
244 break; 253 break;
245 } 254 }
246 } 255 }
@@ -255,7 +264,7 @@ static void snd_cs4236_resume(struct snd_cs4231 *chip)
255 } 264 }
256 } 265 }
257 spin_unlock_irqrestore(&chip->reg_lock, flags); 266 spin_unlock_irqrestore(&chip->reg_lock, flags);
258 snd_cs4231_mce_down(chip); 267 snd_wss_mce_down(chip);
259} 268}
260 269
261#endif /* CONFIG_PM */ 270#endif /* CONFIG_PM */
@@ -266,24 +275,26 @@ int snd_cs4236_create(struct snd_card *card,
266 int irq, int dma1, int dma2, 275 int irq, int dma1, int dma2,
267 unsigned short hardware, 276 unsigned short hardware,
268 unsigned short hwshare, 277 unsigned short hwshare,
269 struct snd_cs4231 ** rchip) 278 struct snd_wss **rchip)
270{ 279{
271 struct snd_cs4231 *chip; 280 struct snd_wss *chip;
272 unsigned char ver1, ver2; 281 unsigned char ver1, ver2;
273 unsigned int reg; 282 unsigned int reg;
274 int err; 283 int err;
275 284
276 *rchip = NULL; 285 *rchip = NULL;
277 if (hardware == CS4231_HW_DETECT) 286 if (hardware == WSS_HW_DETECT)
278 hardware = CS4231_HW_DETECT3; 287 hardware = WSS_HW_DETECT3;
279 if (cport < 0x100) { 288 if (cport < 0x100) {
280 snd_printk("please, specify control port for CS4236+ chips\n"); 289 snd_printk("please, specify control port for CS4236+ chips\n");
281 return -ENODEV; 290 return -ENODEV;
282 } 291 }
283 if ((err = snd_cs4231_create(card, port, cport, irq, dma1, dma2, hardware, hwshare, &chip)) < 0) 292 err = snd_wss_create(card, port, cport,
293 irq, dma1, dma2, hardware, hwshare, &chip);
294 if (err < 0)
284 return err; 295 return err;
285 296
286 if (!(chip->hardware & CS4231_HW_CS4236B_MASK)) { 297 if (!(chip->hardware & WSS_HW_CS4236B_MASK)) {
287 snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware); 298 snd_printk("CS4236+: MODE3 and extended registers not available, hardware=0x%x\n",chip->hardware);
288 snd_device_free(card, chip); 299 snd_device_free(card, chip);
289 return -ENODEV; 300 return -ENODEV;
@@ -330,20 +341,20 @@ int snd_cs4236_create(struct snd_card *card,
330 snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]); 341 snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), snd_cs4236_ext_map[reg]);
331 342
332 /* initialize compatible but more featured registers */ 343 /* initialize compatible but more featured registers */
333 snd_cs4231_out(chip, CS4231_LEFT_INPUT, 0x40); 344 snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40);
334 snd_cs4231_out(chip, CS4231_RIGHT_INPUT, 0x40); 345 snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40);
335 snd_cs4231_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff); 346 snd_wss_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff);
336 snd_cs4231_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff); 347 snd_wss_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff);
337 snd_cs4231_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf); 348 snd_wss_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf);
338 snd_cs4231_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf); 349 snd_wss_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf);
339 snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff); 350 snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
340 snd_cs4231_out(chip, CS4231_LEFT_LINE_IN, 0xff); 351 snd_wss_out(chip, CS4231_LEFT_LINE_IN, 0xff);
341 snd_cs4231_out(chip, CS4231_RIGHT_LINE_IN, 0xff); 352 snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff);
342 switch (chip->hardware) { 353 switch (chip->hardware) {
343 case CS4231_HW_CS4235: 354 case WSS_HW_CS4235:
344 case CS4231_HW_CS4239: 355 case WSS_HW_CS4239:
345 snd_cs4231_out(chip, CS4235_LEFT_MASTER, 0xff); 356 snd_wss_out(chip, CS4235_LEFT_MASTER, 0xff);
346 snd_cs4231_out(chip, CS4235_RIGHT_MASTER, 0xff); 357 snd_wss_out(chip, CS4235_RIGHT_MASTER, 0xff);
347 break; 358 break;
348 } 359 }
349 360
@@ -351,12 +362,13 @@ int snd_cs4236_create(struct snd_card *card,
351 return 0; 362 return 0;
352} 363}
353 364
354int snd_cs4236_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) 365int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm)
355{ 366{
356 struct snd_pcm *pcm; 367 struct snd_pcm *pcm;
357 int err; 368 int err;
358 369
359 if ((err = snd_cs4231_pcm(chip, device, &pcm)) < 0) 370 err = snd_wss_pcm(chip, device, &pcm);
371 if (err < 0)
360 return err; 372 return err;
361 pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX; 373 pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX;
362 if (rpcm) 374 if (rpcm)
@@ -387,7 +399,7 @@ static int snd_cs4236_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_
387 399
388static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 400static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
389{ 401{
390 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 402 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
391 unsigned long flags; 403 unsigned long flags;
392 int reg = kcontrol->private_value & 0xff; 404 int reg = kcontrol->private_value & 0xff;
393 int shift = (kcontrol->private_value >> 8) & 0xff; 405 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -404,7 +416,7 @@ static int snd_cs4236_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
404 416
405static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 417static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
406{ 418{
407 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 419 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
408 unsigned long flags; 420 unsigned long flags;
409 int reg = kcontrol->private_value & 0xff; 421 int reg = kcontrol->private_value & 0xff;
410 int shift = (kcontrol->private_value >> 8) & 0xff; 422 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -433,7 +445,7 @@ static int snd_cs4236_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_e
433 445
434static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 446static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
435{ 447{
436 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 448 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
437 unsigned long flags; 449 unsigned long flags;
438 int reg = kcontrol->private_value & 0xff; 450 int reg = kcontrol->private_value & 0xff;
439 int shift = (kcontrol->private_value >> 8) & 0xff; 451 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -450,7 +462,7 @@ static int snd_cs4236_get_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_
450 462
451static int snd_cs4236_put_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 463static int snd_cs4236_put_singlec(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
452{ 464{
453 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 465 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
454 unsigned long flags; 466 unsigned long flags;
455 int reg = kcontrol->private_value & 0xff; 467 int reg = kcontrol->private_value & 0xff;
456 int shift = (kcontrol->private_value >> 8) & 0xff; 468 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -490,7 +502,7 @@ static int snd_cs4236_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
490 502
491static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 503static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
492{ 504{
493 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 505 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
494 unsigned long flags; 506 unsigned long flags;
495 int left_reg = kcontrol->private_value & 0xff; 507 int left_reg = kcontrol->private_value & 0xff;
496 int right_reg = (kcontrol->private_value >> 8) & 0xff; 508 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -512,7 +524,7 @@ static int snd_cs4236_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
512 524
513static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 525static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
514{ 526{
515 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 527 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
516 unsigned long flags; 528 unsigned long flags;
517 int left_reg = kcontrol->private_value & 0xff; 529 int left_reg = kcontrol->private_value & 0xff;
518 int right_reg = (kcontrol->private_value >> 8) & 0xff; 530 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -555,7 +567,7 @@ static int snd_cs4236_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e
555 567
556static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 568static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
557{ 569{
558 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 570 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
559 unsigned long flags; 571 unsigned long flags;
560 int left_reg = kcontrol->private_value & 0xff; 572 int left_reg = kcontrol->private_value & 0xff;
561 int right_reg = (kcontrol->private_value >> 8) & 0xff; 573 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -577,7 +589,7 @@ static int snd_cs4236_get_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_
577 589
578static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 590static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
579{ 591{
580 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 592 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
581 unsigned long flags; 593 unsigned long flags;
582 int left_reg = kcontrol->private_value & 0xff; 594 int left_reg = kcontrol->private_value & 0xff;
583 int right_reg = (kcontrol->private_value >> 8) & 0xff; 595 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -600,7 +612,7 @@ static int snd_cs4236_put_double1(struct snd_kcontrol *kcontrol, struct snd_ctl_
600 val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; 612 val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1;
601 val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2; 613 val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2;
602 change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)]; 614 change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)];
603 snd_cs4231_out(chip, left_reg, val1); 615 snd_wss_out(chip, left_reg, val1);
604 snd_cs4236_ext_out(chip, right_reg, val2); 616 snd_cs4236_ext_out(chip, right_reg, val2);
605 spin_unlock_irqrestore(&chip->reg_lock, flags); 617 spin_unlock_irqrestore(&chip->reg_lock, flags);
606 return change; 618 return change;
@@ -619,7 +631,7 @@ static inline int snd_cs4236_mixer_master_digital_invert_volume(int vol)
619 631
620static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 632static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
621{ 633{
622 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 634 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
623 unsigned long flags; 635 unsigned long flags;
624 636
625 spin_lock_irqsave(&chip->reg_lock, flags); 637 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -631,7 +643,7 @@ static int snd_cs4236_get_master_digital(struct snd_kcontrol *kcontrol, struct s
631 643
632static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 644static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
633{ 645{
634 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 646 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
635 unsigned long flags; 647 unsigned long flags;
636 int change; 648 int change;
637 unsigned short val1, val2; 649 unsigned short val1, val2;
@@ -678,7 +690,7 @@ static inline int snd_cs4235_mixer_output_accu_set_volume(int vol)
678 690
679static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 691static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
680{ 692{
681 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 693 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
682 unsigned long flags; 694 unsigned long flags;
683 695
684 spin_lock_irqsave(&chip->reg_lock, flags); 696 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -690,7 +702,7 @@ static int snd_cs4235_get_output_accu(struct snd_kcontrol *kcontrol, struct snd_
690 702
691static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 703static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
692{ 704{
693 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 705 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
694 unsigned long flags; 706 unsigned long flags;
695 int change; 707 int change;
696 unsigned short val1, val2; 708 unsigned short val1, val2;
@@ -701,108 +713,160 @@ static int snd_cs4235_put_output_accu(struct snd_kcontrol *kcontrol, struct snd_
701 val1 = (chip->image[CS4235_LEFT_MASTER] & ~(3 << 5)) | val1; 713 val1 = (chip->image[CS4235_LEFT_MASTER] & ~(3 << 5)) | val1;
702 val2 = (chip->image[CS4235_RIGHT_MASTER] & ~(3 << 5)) | val2; 714 val2 = (chip->image[CS4235_RIGHT_MASTER] & ~(3 << 5)) | val2;
703 change = val1 != chip->image[CS4235_LEFT_MASTER] || val2 != chip->image[CS4235_RIGHT_MASTER]; 715 change = val1 != chip->image[CS4235_LEFT_MASTER] || val2 != chip->image[CS4235_RIGHT_MASTER];
704 snd_cs4231_out(chip, CS4235_LEFT_MASTER, val1); 716 snd_wss_out(chip, CS4235_LEFT_MASTER, val1);
705 snd_cs4231_out(chip, CS4235_RIGHT_MASTER, val2); 717 snd_wss_out(chip, CS4235_RIGHT_MASTER, val2);
706 spin_unlock_irqrestore(&chip->reg_lock, flags); 718 spin_unlock_irqrestore(&chip->reg_lock, flags);
707 return change; 719 return change;
708} 720}
709 721
710static struct snd_kcontrol_new snd_cs4236_controls[] = { 722static struct snd_kcontrol_new snd_cs4236_controls[] = {
711 723
712CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), 724CS4236_DOUBLE("Master Digital Playback Switch", 0,
713CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), 725 CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
726CS4236_DOUBLE("Master Digital Capture Switch", 0,
727 CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
714CS4236_MASTER_DIGITAL("Master Digital Volume", 0), 728CS4236_MASTER_DIGITAL("Master Digital Volume", 0),
715 729
716CS4236_DOUBLE("Capture Boost Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), 730CS4236_DOUBLE("Capture Boost Volume", 0,
717 731 CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
718CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 732
719CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), 733WSS_DOUBLE("PCM Playback Switch", 0,
720 734 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
721CS4236_DOUBLE("DSP Playback Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), 735WSS_DOUBLE("PCM Playback Volume", 0,
722CS4236_DOUBLE("DSP Playback Volume", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1), 736 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
723 737
724CS4236_DOUBLE("FM Playback Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), 738CS4236_DOUBLE("DSP Playback Switch", 0,
725CS4236_DOUBLE("FM Playback Volume", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1), 739 CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
726 740CS4236_DOUBLE("DSP Playback Volume", 0,
727CS4236_DOUBLE("Wavetable Playback Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), 741 CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 0, 0, 63, 1),
728CS4236_DOUBLE("Wavetable Playback Volume", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1), 742
729 743CS4236_DOUBLE("FM Playback Switch", 0,
730CS4231_DOUBLE("Synth Playback Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 744 CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
731CS4231_DOUBLE("Synth Volume", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), 745CS4236_DOUBLE("FM Playback Volume", 0,
732CS4231_DOUBLE("Synth Capture Switch", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), 746 CS4236_LEFT_FM, CS4236_RIGHT_FM, 0, 0, 63, 1),
733CS4231_DOUBLE("Synth Capture Bypass", 0, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1), 747
734 748CS4236_DOUBLE("Wavetable Playback Switch", 0,
735CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), 749 CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
736CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), 750CS4236_DOUBLE("Wavetable Playback Volume", 0,
751 CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 0, 0, 63, 1),
752
753WSS_DOUBLE("Synth Playback Switch", 0,
754 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
755WSS_DOUBLE("Synth Volume", 0,
756 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
757WSS_DOUBLE("Synth Capture Switch", 0,
758 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
759WSS_DOUBLE("Synth Capture Bypass", 0,
760 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 5, 5, 1, 1),
761
762CS4236_DOUBLE("Mic Playback Switch", 0,
763 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
764CS4236_DOUBLE("Mic Capture Switch", 0,
765 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
737CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1), 766CS4236_DOUBLE("Mic Volume", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 0, 0, 31, 1),
738CS4236_DOUBLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0), 767CS4236_DOUBLE("Mic Playback Boost", 0,
739 768 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 5, 5, 1, 0),
740CS4231_DOUBLE("Line Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), 769
741CS4231_DOUBLE("Line Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), 770WSS_DOUBLE("Line Playback Switch", 0,
742CS4231_DOUBLE("Line Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), 771 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
743CS4231_DOUBLE("Line Capture Bypass", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1), 772WSS_DOUBLE("Line Volume", 0,
744 773 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
745CS4231_DOUBLE("CD Playback Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), 774WSS_DOUBLE("Line Capture Switch", 0,
746CS4231_DOUBLE("CD Volume", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), 775 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
747CS4231_DOUBLE("CD Capture Switch", 0, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), 776WSS_DOUBLE("Line Capture Bypass", 0,
748 777 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 5, 5, 1, 1),
749CS4236_DOUBLE1("Mono Output Playback Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), 778
750CS4236_DOUBLE1("Mono Playback Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), 779WSS_DOUBLE("CD Playback Switch", 0,
751CS4231_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), 780 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
752CS4231_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0), 781WSS_DOUBLE("CD Volume", 0,
753 782 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
754CS4231_DOUBLE("Capture Volume", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0), 783WSS_DOUBLE("CD Capture Switch", 0,
755CS4231_DOUBLE("Analog Loopback Capture Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), 784 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
756 785
757CS4231_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0), 786CS4236_DOUBLE1("Mono Output Playback Switch", 0,
758CS4236_DOUBLE1("Digital Loopback Playback Volume", 0, CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1) 787 CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
788CS4236_DOUBLE1("Mono Playback Switch", 0,
789 CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
790WSS_SINGLE("Mono Playback Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
791WSS_SINGLE("Mono Playback Bypass", 0, CS4231_MONO_CTRL, 5, 1, 0),
792
793WSS_DOUBLE("Capture Volume", 0,
794 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 0, 0, 15, 0),
795WSS_DOUBLE("Analog Loopback Capture Switch", 0,
796 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
797
798WSS_SINGLE("Digital Loopback Playback Switch", 0, CS4231_LOOPBACK, 0, 1, 0),
799CS4236_DOUBLE1("Digital Loopback Playback Volume", 0,
800 CS4231_LOOPBACK, CS4236_RIGHT_LOOPBACK, 2, 0, 63, 1)
759}; 801};
760 802
761static struct snd_kcontrol_new snd_cs4235_controls[] = { 803static struct snd_kcontrol_new snd_cs4235_controls[] = {
762 804
763CS4231_DOUBLE("Master Switch", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1), 805WSS_DOUBLE("Master Switch", 0,
764CS4231_DOUBLE("Master Volume", 0, CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1), 806 CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 7, 7, 1, 1),
807WSS_DOUBLE("Master Volume", 0,
808 CS4235_LEFT_MASTER, CS4235_RIGHT_MASTER, 0, 0, 31, 1),
765 809
766CS4235_OUTPUT_ACCU("Playback Volume", 0), 810CS4235_OUTPUT_ACCU("Playback Volume", 0),
767 811
768CS4236_DOUBLE("Master Digital Playback Switch", 0, CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1), 812CS4236_DOUBLE("Master Digital Playback Switch", 0,
769CS4236_DOUBLE("Master Digital Capture Switch", 0, CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1), 813 CS4236_LEFT_MASTER, CS4236_RIGHT_MASTER, 7, 7, 1, 1),
814CS4236_DOUBLE("Master Digital Capture Switch", 0,
815 CS4236_DAC_MUTE, CS4236_DAC_MUTE, 7, 6, 1, 1),
770CS4236_MASTER_DIGITAL("Master Digital Volume", 0), 816CS4236_MASTER_DIGITAL("Master Digital Volume", 0),
771 817
772CS4231_DOUBLE("Master Digital Playback Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1), 818WSS_DOUBLE("Master Digital Playback Switch", 1,
773CS4231_DOUBLE("Master Digital Capture Switch", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1), 819 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 7, 7, 1, 1),
774CS4231_DOUBLE("Master Digital Volume", 1, CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1), 820WSS_DOUBLE("Master Digital Capture Switch", 1,
821 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 6, 6, 1, 1),
822WSS_DOUBLE("Master Digital Volume", 1,
823 CS4231_LEFT_LINE_IN, CS4231_RIGHT_LINE_IN, 0, 0, 31, 1),
775 824
776CS4236_DOUBLE("Capture Volume", 0, CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1), 825CS4236_DOUBLE("Capture Volume", 0,
826 CS4236_LEFT_MIX_CTRL, CS4236_RIGHT_MIX_CTRL, 5, 5, 3, 1),
777 827
778CS4231_DOUBLE("PCM Switch", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 828WSS_DOUBLE("PCM Switch", 0,
779CS4231_DOUBLE("PCM Volume", 0, CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1), 829 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
830WSS_DOUBLE("PCM Volume", 0,
831 CS4231_LEFT_OUTPUT, CS4231_RIGHT_OUTPUT, 0, 0, 63, 1),
780 832
781CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1), 833CS4236_DOUBLE("DSP Switch", 0, CS4236_LEFT_DSP, CS4236_RIGHT_DSP, 7, 7, 1, 1),
782 834
783CS4236_DOUBLE("FM Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1), 835CS4236_DOUBLE("FM Switch", 0, CS4236_LEFT_FM, CS4236_RIGHT_FM, 7, 7, 1, 1),
784 836
785CS4236_DOUBLE("Wavetable Switch", 0, CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1), 837CS4236_DOUBLE("Wavetable Switch", 0,
838 CS4236_LEFT_WAVE, CS4236_RIGHT_WAVE, 7, 7, 1, 1),
786 839
787CS4236_DOUBLE("Mic Capture Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1), 840CS4236_DOUBLE("Mic Capture Switch", 0,
788CS4236_DOUBLE("Mic Playback Switch", 0, CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1), 841 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 7, 7, 1, 1),
842CS4236_DOUBLE("Mic Playback Switch", 0,
843 CS4236_LEFT_MIC, CS4236_RIGHT_MIC, 6, 6, 1, 1),
789CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1), 844CS4236_SINGLE("Mic Volume", 0, CS4236_LEFT_MIC, 0, 31, 1),
790CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0), 845CS4236_SINGLE("Mic Playback Boost", 0, CS4236_LEFT_MIC, 5, 1, 0),
791 846
792CS4231_DOUBLE("Aux Playback Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1), 847WSS_DOUBLE("Aux Playback Switch", 0,
793CS4231_DOUBLE("Aux Capture Switch", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1), 848 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 7, 7, 1, 1),
794CS4231_DOUBLE("Aux Volume", 0, CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1), 849WSS_DOUBLE("Aux Capture Switch", 0,
795 850 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 6, 6, 1, 1),
796CS4231_DOUBLE("Aux Playback Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1), 851WSS_DOUBLE("Aux Volume", 0,
797CS4231_DOUBLE("Aux Capture Switch", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1), 852 CS4231_AUX1_LEFT_INPUT, CS4231_AUX1_RIGHT_INPUT, 0, 0, 31, 1),
798CS4231_DOUBLE("Aux Volume", 1, CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1), 853
799 854WSS_DOUBLE("Aux Playback Switch", 1,
800CS4236_DOUBLE1("Master Mono Switch", 0, CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1), 855 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
801 856WSS_DOUBLE("Aux Capture Switch", 1,
802CS4236_DOUBLE1("Mono Switch", 0, CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1), 857 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 6, 6, 1, 1),
803CS4231_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1), 858WSS_DOUBLE("Aux Volume", 1,
804 859 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
805CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0), 860
861CS4236_DOUBLE1("Master Mono Switch", 0,
862 CS4231_MONO_CTRL, CS4236_RIGHT_MIX_CTRL, 6, 7, 1, 1),
863
864CS4236_DOUBLE1("Mono Switch", 0,
865 CS4231_MONO_CTRL, CS4236_LEFT_MIX_CTRL, 7, 7, 1, 1),
866WSS_SINGLE("Mono Volume", 0, CS4231_MONO_CTRL, 0, 15, 1),
867
868WSS_DOUBLE("Analog Loopback Switch", 0,
869 CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT, 7, 7, 1, 0),
806}; 870};
807 871
808#define CS4236_IEC958_ENABLE(xname, xindex) \ 872#define CS4236_IEC958_ENABLE(xname, xindex) \
@@ -813,14 +877,14 @@ CS4231_DOUBLE("Analog Loopback Switch", 0, CS4231_LEFT_INPUT, CS4231_RIGHT_INPUT
813 877
814static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 878static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
815{ 879{
816 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 880 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
817 unsigned long flags; 881 unsigned long flags;
818 882
819 spin_lock_irqsave(&chip->reg_lock, flags); 883 spin_lock_irqsave(&chip->reg_lock, flags);
820 ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0; 884 ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0;
821#if 0 885#if 0
822 printk("get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", 886 printk("get valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
823 snd_cs4231_in(chip, CS4231_ALT_FEATURE_1), 887 snd_wss_in(chip, CS4231_ALT_FEATURE_1),
824 snd_cs4236_ctrl_in(chip, 3), 888 snd_cs4236_ctrl_in(chip, 3),
825 snd_cs4236_ctrl_in(chip, 4), 889 snd_cs4236_ctrl_in(chip, 4),
826 snd_cs4236_ctrl_in(chip, 5), 890 snd_cs4236_ctrl_in(chip, 5),
@@ -833,7 +897,7 @@ static int snd_cs4236_get_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
833 897
834static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 898static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
835{ 899{
836 struct snd_cs4231 *chip = snd_kcontrol_chip(kcontrol); 900 struct snd_wss *chip = snd_kcontrol_chip(kcontrol);
837 unsigned long flags; 901 unsigned long flags;
838 int change; 902 int change;
839 unsigned short enable, val; 903 unsigned short enable, val;
@@ -841,23 +905,23 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn
841 enable = ucontrol->value.integer.value[0] & 1; 905 enable = ucontrol->value.integer.value[0] & 1;
842 906
843 mutex_lock(&chip->mce_mutex); 907 mutex_lock(&chip->mce_mutex);
844 snd_cs4231_mce_up(chip); 908 snd_wss_mce_up(chip);
845 spin_lock_irqsave(&chip->reg_lock, flags); 909 spin_lock_irqsave(&chip->reg_lock, flags);
846 val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); 910 val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1);
847 change = val != chip->image[CS4231_ALT_FEATURE_1]; 911 change = val != chip->image[CS4231_ALT_FEATURE_1];
848 snd_cs4231_out(chip, CS4231_ALT_FEATURE_1, val); 912 snd_wss_out(chip, CS4231_ALT_FEATURE_1, val);
849 val = snd_cs4236_ctrl_in(chip, 4) | 0xc0; 913 val = snd_cs4236_ctrl_in(chip, 4) | 0xc0;
850 snd_cs4236_ctrl_out(chip, 4, val); 914 snd_cs4236_ctrl_out(chip, 4, val);
851 udelay(100); 915 udelay(100);
852 val &= ~0x40; 916 val &= ~0x40;
853 snd_cs4236_ctrl_out(chip, 4, val); 917 snd_cs4236_ctrl_out(chip, 4, val);
854 spin_unlock_irqrestore(&chip->reg_lock, flags); 918 spin_unlock_irqrestore(&chip->reg_lock, flags);
855 snd_cs4231_mce_down(chip); 919 snd_wss_mce_down(chip);
856 mutex_unlock(&chip->mce_mutex); 920 mutex_unlock(&chip->mce_mutex);
857 921
858#if 0 922#if 0
859 printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", 923 printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n",
860 snd_cs4231_in(chip, CS4231_ALT_FEATURE_1), 924 snd_wss_in(chip, CS4231_ALT_FEATURE_1),
861 snd_cs4236_ctrl_in(chip, 3), 925 snd_cs4236_ctrl_in(chip, 3),
862 snd_cs4236_ctrl_in(chip, 4), 926 snd_cs4236_ctrl_in(chip, 4),
863 snd_cs4236_ctrl_in(chip, 5), 927 snd_cs4236_ctrl_in(chip, 5),
@@ -896,7 +960,7 @@ CS4236_SINGLEC("3D Control - Volume", 0, 2, 0, 15, 1),
896CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0) 960CS4236_SINGLEC("3D Control - IEC958", 0, 3, 5, 1, 0)
897}; 961};
898 962
899int snd_cs4236_mixer(struct snd_cs4231 *chip) 963int snd_cs4236_mixer(struct snd_wss *chip)
900{ 964{
901 struct snd_card *card; 965 struct snd_card *card;
902 unsigned int idx, count; 966 unsigned int idx, count;
@@ -905,10 +969,10 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
905 969
906 snd_assert(chip != NULL && chip->card != NULL, return -EINVAL); 970 snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
907 card = chip->card; 971 card = chip->card;
908 strcpy(card->mixername, snd_cs4231_chip_id(chip)); 972 strcpy(card->mixername, snd_wss_chip_id(chip));
909 973
910 if (chip->hardware == CS4231_HW_CS4235 || 974 if (chip->hardware == WSS_HW_CS4235 ||
911 chip->hardware == CS4231_HW_CS4239) { 975 chip->hardware == WSS_HW_CS4239) {
912 for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) { 976 for (idx = 0; idx < ARRAY_SIZE(snd_cs4235_controls); idx++) {
913 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0) 977 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0)
914 return err; 978 return err;
@@ -920,16 +984,16 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
920 } 984 }
921 } 985 }
922 switch (chip->hardware) { 986 switch (chip->hardware) {
923 case CS4231_HW_CS4235: 987 case WSS_HW_CS4235:
924 case CS4231_HW_CS4239: 988 case WSS_HW_CS4239:
925 count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235); 989 count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4235);
926 kcontrol = snd_cs4236_3d_controls_cs4235; 990 kcontrol = snd_cs4236_3d_controls_cs4235;
927 break; 991 break;
928 case CS4231_HW_CS4237B: 992 case WSS_HW_CS4237B:
929 count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237); 993 count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4237);
930 kcontrol = snd_cs4236_3d_controls_cs4237; 994 kcontrol = snd_cs4236_3d_controls_cs4237;
931 break; 995 break;
932 case CS4231_HW_CS4238B: 996 case WSS_HW_CS4238B:
933 count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238); 997 count = ARRAY_SIZE(snd_cs4236_3d_controls_cs4238);
934 kcontrol = snd_cs4236_3d_controls_cs4238; 998 kcontrol = snd_cs4236_3d_controls_cs4238;
935 break; 999 break;
@@ -941,8 +1005,8 @@ int snd_cs4236_mixer(struct snd_cs4231 *chip)
941 if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0) 1005 if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0)
942 return err; 1006 return err;
943 } 1007 }
944 if (chip->hardware == CS4231_HW_CS4237B || 1008 if (chip->hardware == WSS_HW_CS4237B ||
945 chip->hardware == CS4231_HW_CS4238B) { 1009 chip->hardware == WSS_HW_CS4238B) {
946 for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) { 1010 for (idx = 0; idx < ARRAY_SIZE(snd_cs4236_iec958_controls); idx++) {
947 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0) 1011 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0)
948 return err; 1012 return err;