Lines Matching refs:chip
122 static void snd_cs4236_ctrl_out(struct snd_wss *chip, in snd_cs4236_ctrl_out() argument
125 outb(reg, chip->cport + 3); in snd_cs4236_ctrl_out()
126 outb(chip->cimage[reg] = val, chip->cport + 4); in snd_cs4236_ctrl_out()
129 static unsigned char snd_cs4236_ctrl_in(struct snd_wss *chip, unsigned char reg) in snd_cs4236_ctrl_in() argument
131 outb(reg, chip->cport + 3); in snd_cs4236_ctrl_in()
132 return inb(chip->cport + 4); in snd_cs4236_ctrl_in()
182 static void snd_cs4236_playback_format(struct snd_wss *chip, in snd_cs4236_playback_format() argument
189 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_playback_format()
191 snd_wss_out(chip, CS4231_ALT_FEATURE_1, in snd_cs4236_playback_format()
192 chip->image[CS4231_ALT_FEATURE_1] | 0x10); in snd_cs4236_playback_format()
193 snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0); in snd_cs4236_playback_format()
194 snd_wss_out(chip, CS4231_ALT_FEATURE_1, in snd_cs4236_playback_format()
195 chip->image[CS4231_ALT_FEATURE_1] & ~0x10); in snd_cs4236_playback_format()
196 snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate); in snd_cs4236_playback_format()
197 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_playback_format()
200 static void snd_cs4236_capture_format(struct snd_wss *chip, in snd_cs4236_capture_format() argument
207 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_capture_format()
209 snd_wss_out(chip, CS4231_ALT_FEATURE_1, in snd_cs4236_capture_format()
210 chip->image[CS4231_ALT_FEATURE_1] | 0x20); in snd_cs4236_capture_format()
211 snd_wss_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0); in snd_cs4236_capture_format()
212 snd_wss_out(chip, CS4231_ALT_FEATURE_1, in snd_cs4236_capture_format()
213 chip->image[CS4231_ALT_FEATURE_1] & ~0x20); in snd_cs4236_capture_format()
214 snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate); in snd_cs4236_capture_format()
215 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_capture_format()
220 static void snd_cs4236_suspend(struct snd_wss *chip) in snd_cs4236_suspend() argument
225 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_suspend()
227 chip->image[reg] = snd_wss_in(chip, reg); in snd_cs4236_suspend()
229 chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg)); in snd_cs4236_suspend()
231 chip->cimage[reg] = snd_cs4236_ctrl_in(chip, reg); in snd_cs4236_suspend()
232 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_suspend()
235 static void snd_cs4236_resume(struct snd_wss *chip) in snd_cs4236_resume() argument
240 snd_wss_mce_up(chip); in snd_cs4236_resume()
241 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_resume()
250 snd_wss_out(chip, reg, chip->image[reg]); in snd_cs4236_resume()
255 snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), chip->eimage[reg]); in snd_cs4236_resume()
261 snd_cs4236_ctrl_out(chip, reg, chip->cimage[reg]); in snd_cs4236_resume()
264 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_resume()
265 snd_wss_mce_down(chip); in snd_cs4236_resume()
281 struct snd_wss *chip; in snd_cs4236_create() local
291 irq, dma1, dma2, hardware, hwshare, &chip); in snd_cs4236_create()
295 if ((chip->hardware & WSS_HW_CS4236B_MASK) == 0) { in snd_cs4236_create()
297 chip->hardware); in snd_cs4236_create()
298 *rchip = chip; in snd_cs4236_create()
306 idx, inb(chip->cport + idx)); in snd_cs4236_create()
309 idx, snd_cs4236_ctrl_in(chip, idx)); in snd_cs4236_create()
315 snd_device_free(card, chip); in snd_cs4236_create()
318 ver1 = snd_cs4236_ctrl_in(chip, 1); in snd_cs4236_create()
319 ver2 = snd_cs4236_ext_in(chip, CS4236_VERSION); in snd_cs4236_create()
325 snd_device_free(card, chip); in snd_cs4236_create()
328 snd_cs4236_ctrl_out(chip, 0, 0x00); in snd_cs4236_create()
329 snd_cs4236_ctrl_out(chip, 2, 0xff); in snd_cs4236_create()
330 snd_cs4236_ctrl_out(chip, 3, 0x00); in snd_cs4236_create()
331 snd_cs4236_ctrl_out(chip, 4, 0x80); in snd_cs4236_create()
334 snd_cs4236_ctrl_out(chip, 5, reg); in snd_cs4236_create()
335 snd_cs4236_ctrl_out(chip, 6, IEC958_AES1_CON_PCM_CODER >> 2); in snd_cs4236_create()
336 snd_cs4236_ctrl_out(chip, 7, 0x00); in snd_cs4236_create()
343 snd_cs4236_ctrl_out(chip, 8, 0x8c); in snd_cs4236_create()
344 chip->rate_constraint = snd_cs4236_xrate; in snd_cs4236_create()
345 chip->set_playback_format = snd_cs4236_playback_format; in snd_cs4236_create()
346 chip->set_capture_format = snd_cs4236_capture_format; in snd_cs4236_create()
348 chip->suspend = snd_cs4236_suspend; in snd_cs4236_create()
349 chip->resume = snd_cs4236_resume; in snd_cs4236_create()
354 snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), in snd_cs4236_create()
358 snd_wss_out(chip, CS4231_LEFT_INPUT, 0x40); in snd_cs4236_create()
359 snd_wss_out(chip, CS4231_RIGHT_INPUT, 0x40); in snd_cs4236_create()
360 snd_wss_out(chip, CS4231_AUX1_LEFT_INPUT, 0xff); in snd_cs4236_create()
361 snd_wss_out(chip, CS4231_AUX1_RIGHT_INPUT, 0xff); in snd_cs4236_create()
362 snd_wss_out(chip, CS4231_AUX2_LEFT_INPUT, 0xdf); in snd_cs4236_create()
363 snd_wss_out(chip, CS4231_AUX2_RIGHT_INPUT, 0xdf); in snd_cs4236_create()
364 snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff); in snd_cs4236_create()
365 snd_wss_out(chip, CS4231_LEFT_LINE_IN, 0xff); in snd_cs4236_create()
366 snd_wss_out(chip, CS4231_RIGHT_LINE_IN, 0xff); in snd_cs4236_create()
367 switch (chip->hardware) { in snd_cs4236_create()
370 snd_wss_out(chip, CS4235_LEFT_MASTER, 0xff); in snd_cs4236_create()
371 snd_wss_out(chip, CS4235_RIGHT_MASTER, 0xff); in snd_cs4236_create()
375 *rchip = chip; in snd_cs4236_create()
379 int snd_cs4236_pcm(struct snd_wss *chip, int device) in snd_cs4236_pcm() argument
383 err = snd_wss_pcm(chip, device); in snd_cs4236_pcm()
386 chip->pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX; in snd_cs4236_pcm()
421 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_get_single() local
428 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_get_single()
429 ucontrol->value.integer.value[0] = (chip->eimage[CS4236_REG(reg)] >> shift) & mask; in snd_cs4236_get_single()
430 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_get_single()
438 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_put_single() local
451 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_put_single()
452 val = (chip->eimage[CS4236_REG(reg)] & ~(mask << shift)) | val; in snd_cs4236_put_single()
453 change = val != chip->eimage[CS4236_REG(reg)]; in snd_cs4236_put_single()
454 snd_cs4236_ext_out(chip, reg, val); in snd_cs4236_put_single()
455 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_put_single()
467 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_get_singlec() local
474 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_get_singlec()
475 ucontrol->value.integer.value[0] = (chip->cimage[reg] >> shift) & mask; in snd_cs4236_get_singlec()
476 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_get_singlec()
484 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_put_singlec() local
497 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_put_singlec()
498 val = (chip->cimage[reg] & ~(mask << shift)) | val; in snd_cs4236_put_singlec()
499 change = val != chip->cimage[reg]; in snd_cs4236_put_singlec()
500 snd_cs4236_ctrl_out(chip, reg, val); in snd_cs4236_put_singlec()
501 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_put_singlec()
534 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_get_double() local
543 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_get_double()
544 ucontrol->value.integer.value[0] = (chip->eimage[CS4236_REG(left_reg)] >> shift_left) & mask; in snd_cs4236_get_double()
545 ucontrol->value.integer.value[1] = (chip->eimage[CS4236_REG(right_reg)] >> shift_right) & mask; in snd_cs4236_get_double()
546 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_get_double()
556 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_put_double() local
575 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_put_double()
577 val1 = (chip->eimage[CS4236_REG(left_reg)] & ~(mask << shift_left)) | val1; in snd_cs4236_put_double()
578 val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2; in snd_cs4236_put_double()
579 …change = val1 != chip->eimage[CS4236_REG(left_reg)] || val2 != chip->eimage[CS4236_REG(right_reg)]; in snd_cs4236_put_double()
580 snd_cs4236_ext_out(chip, left_reg, val1); in snd_cs4236_put_double()
581 snd_cs4236_ext_out(chip, right_reg, val2); in snd_cs4236_put_double()
583 …val1 = (chip->eimage[CS4236_REG(left_reg)] & ~((mask << shift_left) | (mask << shift_right))) | va… in snd_cs4236_put_double()
584 change = val1 != chip->eimage[CS4236_REG(left_reg)]; in snd_cs4236_put_double()
585 snd_cs4236_ext_out(chip, left_reg, val1); in snd_cs4236_put_double()
587 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_put_double()
610 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_get_double1() local
619 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_get_double1()
620 ucontrol->value.integer.value[0] = (chip->image[left_reg] >> shift_left) & mask; in snd_cs4236_get_double1()
621 ucontrol->value.integer.value[1] = (chip->eimage[CS4236_REG(right_reg)] >> shift_right) & mask; in snd_cs4236_get_double1()
622 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_get_double1()
632 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_put_double1() local
651 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_put_double1()
652 val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; in snd_cs4236_put_double1()
653 val2 = (chip->eimage[CS4236_REG(right_reg)] & ~(mask << shift_right)) | val2; in snd_cs4236_put_double1()
654 change = val1 != chip->image[left_reg] || val2 != chip->eimage[CS4236_REG(right_reg)]; in snd_cs4236_put_double1()
655 snd_wss_out(chip, left_reg, val1); in snd_cs4236_put_double1()
656 snd_cs4236_ext_out(chip, right_reg, val2); in snd_cs4236_put_double1()
657 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_put_double1()
676 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_get_master_digital() local
679 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_get_master_digital()
680 …ucontrol->value.integer.value[0] = snd_cs4236_mixer_master_digital_invert_volume(chip->eimage[CS42… in snd_cs4236_get_master_digital()
681 …ucontrol->value.integer.value[1] = snd_cs4236_mixer_master_digital_invert_volume(chip->eimage[CS42… in snd_cs4236_get_master_digital()
682 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_get_master_digital()
688 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_put_master_digital() local
695 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_put_master_digital()
696 val1 = (chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] & ~0x7f) | val1; in snd_cs4236_put_master_digital()
697 val2 = (chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)] & ~0x7f) | val2; in snd_cs4236_put_master_digital()
698 …change = val1 != chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] || val2 != chip->eimage[CS4236_REG(C… in snd_cs4236_put_master_digital()
699 snd_cs4236_ext_out(chip, CS4236_LEFT_MASTER, val1); in snd_cs4236_put_master_digital()
700 snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val2); in snd_cs4236_put_master_digital()
701 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_put_master_digital()
737 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4235_get_output_accu() local
740 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4235_get_output_accu()
741 …ucontrol->value.integer.value[0] = snd_cs4235_mixer_output_accu_get_volume(chip->image[CS4235_LEFT… in snd_cs4235_get_output_accu()
742 …ucontrol->value.integer.value[1] = snd_cs4235_mixer_output_accu_get_volume(chip->image[CS4235_RIGH… in snd_cs4235_get_output_accu()
743 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4235_get_output_accu()
749 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4235_put_output_accu() local
756 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4235_put_output_accu()
757 val1 = (chip->image[CS4235_LEFT_MASTER] & ~(3 << 5)) | val1; in snd_cs4235_put_output_accu()
758 val2 = (chip->image[CS4235_RIGHT_MASTER] & ~(3 << 5)) | val2; in snd_cs4235_put_output_accu()
759 change = val1 != chip->image[CS4235_LEFT_MASTER] || val2 != chip->image[CS4235_RIGHT_MASTER]; in snd_cs4235_put_output_accu()
760 snd_wss_out(chip, CS4235_LEFT_MASTER, val1); in snd_cs4235_put_output_accu()
761 snd_wss_out(chip, CS4235_RIGHT_MASTER, val2); in snd_cs4235_put_output_accu()
762 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4235_put_output_accu()
947 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_get_iec958_switch() local
950 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_get_iec958_switch()
951 ucontrol->value.integer.value[0] = chip->image[CS4231_ALT_FEATURE_1] & 0x02 ? 1 : 0; in snd_cs4236_get_iec958_switch()
955 snd_wss_in(chip, CS4231_ALT_FEATURE_1), in snd_cs4236_get_iec958_switch()
956 snd_cs4236_ctrl_in(chip, 3), in snd_cs4236_get_iec958_switch()
957 snd_cs4236_ctrl_in(chip, 4), in snd_cs4236_get_iec958_switch()
958 snd_cs4236_ctrl_in(chip, 5), in snd_cs4236_get_iec958_switch()
959 snd_cs4236_ctrl_in(chip, 6), in snd_cs4236_get_iec958_switch()
960 snd_cs4236_ctrl_in(chip, 8)); in snd_cs4236_get_iec958_switch()
962 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_get_iec958_switch()
968 struct snd_wss *chip = snd_kcontrol_chip(kcontrol); in snd_cs4236_put_iec958_switch() local
975 mutex_lock(&chip->mce_mutex); in snd_cs4236_put_iec958_switch()
976 snd_wss_mce_up(chip); in snd_cs4236_put_iec958_switch()
977 spin_lock_irqsave(&chip->reg_lock, flags); in snd_cs4236_put_iec958_switch()
978 val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); in snd_cs4236_put_iec958_switch()
979 change = val != chip->image[CS4231_ALT_FEATURE_1]; in snd_cs4236_put_iec958_switch()
980 snd_wss_out(chip, CS4231_ALT_FEATURE_1, val); in snd_cs4236_put_iec958_switch()
981 val = snd_cs4236_ctrl_in(chip, 4) | 0xc0; in snd_cs4236_put_iec958_switch()
982 snd_cs4236_ctrl_out(chip, 4, val); in snd_cs4236_put_iec958_switch()
985 snd_cs4236_ctrl_out(chip, 4, val); in snd_cs4236_put_iec958_switch()
986 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_cs4236_put_iec958_switch()
987 snd_wss_mce_down(chip); in snd_cs4236_put_iec958_switch()
988 mutex_unlock(&chip->mce_mutex); in snd_cs4236_put_iec958_switch()
993 snd_wss_in(chip, CS4231_ALT_FEATURE_1), in snd_cs4236_put_iec958_switch()
994 snd_cs4236_ctrl_in(chip, 3), in snd_cs4236_put_iec958_switch()
995 snd_cs4236_ctrl_in(chip, 4), in snd_cs4236_put_iec958_switch()
996 snd_cs4236_ctrl_in(chip, 5), in snd_cs4236_put_iec958_switch()
997 snd_cs4236_ctrl_in(chip, 6), in snd_cs4236_put_iec958_switch()
998 snd_cs4236_ctrl_in(chip, 8)); in snd_cs4236_put_iec958_switch()
1032 int snd_cs4236_mixer(struct snd_wss *chip) in snd_cs4236_mixer() argument
1039 if (snd_BUG_ON(!chip || !chip->card)) in snd_cs4236_mixer()
1041 card = chip->card; in snd_cs4236_mixer()
1042 strcpy(card->mixername, snd_wss_chip_id(chip)); in snd_cs4236_mixer()
1044 if (chip->hardware == WSS_HW_CS4235 || in snd_cs4236_mixer()
1045 chip->hardware == WSS_HW_CS4239) { in snd_cs4236_mixer()
1047 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4235_controls[idx], chip))) < 0) in snd_cs4236_mixer()
1052 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_controls[idx], chip))) < 0) in snd_cs4236_mixer()
1056 switch (chip->hardware) { in snd_cs4236_mixer()
1075 if ((err = snd_ctl_add(card, snd_ctl_new1(kcontrol, chip))) < 0) in snd_cs4236_mixer()
1078 if (chip->hardware == WSS_HW_CS4237B || in snd_cs4236_mixer()
1079 chip->hardware == WSS_HW_CS4238B) { in snd_cs4236_mixer()
1081 if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_cs4236_iec958_controls[idx], chip))) < 0) in snd_cs4236_mixer()