Lines Matching +full:invert +full:- +full:ext
1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * - sometimes record brokes playback with WSS portion of
8 * Yamaha OPL3-SA3 chip
9 * - CS4231 (GUS MAX) - still trouble with occasional noises
10 * - broken initialization?
77 0x00, /* 00/00 - lic */
78 0x00, /* 01/01 - ric */
79 0x9f, /* 02/02 - la1ic */
80 0x9f, /* 03/03 - ra1ic */
81 0x9f, /* 04/04 - la2ic */
82 0x9f, /* 05/05 - ra2ic */
83 0xbf, /* 06/06 - loc */
84 0xbf, /* 07/07 - roc */
85 0x20, /* 08/08 - pdfr */
86 CS4231_AUTOCALIB, /* 09/09 - ic */
87 0x00, /* 0a/10 - pc */
88 0x00, /* 0b/11 - ti */
89 CS4231_MODE2, /* 0c/12 - mi */
90 0xfc, /* 0d/13 - lbc */
91 0x00, /* 0e/14 - pbru */
92 0x00, /* 0f/15 - pbrl */
93 0x80, /* 10/16 - afei */
94 0x01, /* 11/17 - afeii */
95 0x9f, /* 12/18 - llic */
96 0x9f, /* 13/19 - rlic */
97 0x00, /* 14/20 - tlb */
98 0x00, /* 15/21 - thb */
99 0x00, /* 16/22 - la3mic/reserved */
100 0x00, /* 17/23 - ra3mic/reserved */
101 0x00, /* 18/24 - afs */
102 0x00, /* 19/25 - lamoc/version */
103 0xcf, /* 1a/26 - mioc */
104 0x00, /* 1b/27 - ramoc/reserved */
105 0x20, /* 1c/28 - cdfr */
106 0x00, /* 1d/29 - res4 */
107 0x00, /* 1e/30 - cbru */
108 0x00, /* 1f/31 - cbrl */
113 0x00, /* 00/00 - l_mixout_outctrl */
114 0x00, /* 01/01 - r_mixout_outctrl */
115 0x88, /* 02/02 - l_cd_inctrl */
116 0x88, /* 03/03 - r_cd_inctrl */
117 0x88, /* 04/04 - l_a1/fm_inctrl */
118 0x88, /* 05/05 - r_a1/fm_inctrl */
119 0x80, /* 06/06 - l_dac_inctrl */
120 0x80, /* 07/07 - r_dac_inctrl */
121 0x00, /* 08/08 - ply_dataform_reg */
122 0x00, /* 09/09 - if_conf */
123 0x00, /* 0a/10 - pin_ctrl */
124 0x00, /* 0b/11 - err_init_reg */
125 0x0a, /* 0c/12 - id_reg */
126 0x00, /* 0d/13 - reserved */
127 0x00, /* 0e/14 - ply_upcount_reg */
128 0x00, /* 0f/15 - ply_lowcount_reg */
129 0x88, /* 10/16 - reserved/l_a1_inctrl */
130 0x88, /* 11/17 - reserved/r_a1_inctrl */
131 0x88, /* 12/18 - l_line_inctrl */
132 0x88, /* 13/19 - r_line_inctrl */
133 0x88, /* 14/20 - l_mic_inctrl */
134 0x88, /* 15/21 - r_mic_inctrl */
135 0x80, /* 16/22 - l_out_outctrl */
136 0x80, /* 17/23 - r_out_outctrl */
137 0x00, /* 18/24 - reserved */
138 0x00, /* 19/25 - reserved */
139 0x00, /* 1a/26 - reserved */
140 0x00, /* 1b/27 - reserved */
141 0x00, /* 1c/28 - cap_dataform_reg */
142 0x00, /* 1d/29 - reserved */
143 0x00, /* 1e/30 - cap_upcount_reg */
144 0x00 /* 1f/31 - cap_lowcount_reg */
153 outb(val, chip->port + offset); in wss_outb()
158 return inb(chip->port + offset); in wss_inb()
167 timeout--) in snd_wss_wait()
178 timeout--) in snd_wss_dout()
180 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); in snd_wss_dout()
191 "- reg = 0x%x, value = 0x%x\n", reg, value); in snd_wss_out()
193 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); in snd_wss_out()
195 chip->image[reg] = value; in snd_wss_out()
197 snd_printdd("codec out - reg 0x%x = 0x%x\n", in snd_wss_out()
198 chip->mce_bit | reg, value); in snd_wss_out()
208 "- reg = 0x%x\n", reg); in snd_wss_in()
210 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | reg); in snd_wss_in()
219 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); in snd_cs4236_ext_out()
221 reg | (chip->image[CS4236_EXT_REG] & 0x01)); in snd_cs4236_ext_out()
223 chip->eimage[CS4236_REG(reg)] = val; in snd_cs4236_ext_out()
225 printk(KERN_DEBUG "ext out : reg = 0x%x, val = 0x%x\n", reg, val); in snd_cs4236_ext_out()
232 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | 0x17); in snd_cs4236_ext_in()
234 reg | (chip->image[CS4236_EXT_REG] & 0x01)); in snd_cs4236_ext_in()
241 printk(KERN_DEBUG "ext in : reg = 0x%x, val = 0x%x\n", in snd_cs4236_ext_in()
351 for (timeout = 5; timeout > 0; timeout--) in snd_wss_busy_wait()
356 timeout--) in snd_wss_busy_wait()
369 "mce_up - auto calibration time out (0)\n"); in snd_wss_mce_up()
371 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_mce_up()
372 chip->mce_bit |= CS4231_MCE; in snd_wss_mce_up()
376 "serious init problem - codec still busy\n", in snd_wss_mce_up()
377 chip->port); in snd_wss_mce_up()
380 chip->mce_bit | (timeout & 0x1f)); in snd_wss_mce_up()
381 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_mce_up()
396 snd_printk(KERN_DEBUG "mce_down [0x%lx] - " in snd_wss_mce_down()
400 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_mce_down()
401 chip->mce_bit &= ~CS4231_MCE; in snd_wss_mce_down()
403 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); in snd_wss_mce_down()
404 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_mce_down()
407 "serious init problem - codec still busy\n", in snd_wss_mce_down()
408 chip->port); in snd_wss_mce_down()
409 if ((timeout & CS4231_MCE) == 0 || !(chip->hardware & hw_mask)) in snd_wss_mce_down()
413 * Wait for (possible -- during init auto-calibration may not be set) in snd_wss_mce_down()
427 snd_printk(KERN_ERR "mce_down - " in snd_wss_mce_down()
440 snd_printk(KERN_ERR "mce_down - auto calibration time out (3)\n"); in snd_wss_mce_down()
447 snd_printd("mce_down - exit = 0x%x\n", wss_inb(chip, CS4231P(REGSEL))); in snd_wss_mce_down()
483 return -EINVAL; in snd_wss_trigger()
488 if (s == chip->playback_substream) { in snd_wss_trigger()
491 } else if (s == chip->capture_substream) { in snd_wss_trigger()
496 spin_lock(&chip->reg_lock); in snd_wss_trigger()
498 chip->image[CS4231_IFACE_CTRL] |= what; in snd_wss_trigger()
499 if (chip->trigger) in snd_wss_trigger()
500 chip->trigger(chip, what, 1); in snd_wss_trigger()
502 chip->image[CS4231_IFACE_CTRL] &= ~what; in snd_wss_trigger()
503 if (chip->trigger) in snd_wss_trigger()
504 chip->trigger(chip, what, 0); in snd_wss_trigger()
506 snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); in snd_wss_trigger()
507 spin_unlock(&chip->reg_lock); in snd_wss_trigger()
526 return freq_bits[ARRAY_SIZE(rates) - 1]; in snd_wss_get_rate()
556 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_calibrate_mute()
557 if (chip->calibrate_mute == mute) { in snd_wss_calibrate_mute()
558 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_calibrate_mute()
563 chip->image[CS4231_LEFT_INPUT]); in snd_wss_calibrate_mute()
565 chip->image[CS4231_RIGHT_INPUT]); in snd_wss_calibrate_mute()
567 chip->image[CS4231_LOOPBACK]); in snd_wss_calibrate_mute()
578 mute | chip->image[CS4231_AUX1_LEFT_INPUT]); in snd_wss_calibrate_mute()
580 mute | chip->image[CS4231_AUX1_RIGHT_INPUT]); in snd_wss_calibrate_mute()
582 mute | chip->image[CS4231_AUX2_LEFT_INPUT]); in snd_wss_calibrate_mute()
584 mute | chip->image[CS4231_AUX2_RIGHT_INPUT]); in snd_wss_calibrate_mute()
586 mute | chip->image[CS4231_LEFT_OUTPUT]); in snd_wss_calibrate_mute()
588 mute | chip->image[CS4231_RIGHT_OUTPUT]); in snd_wss_calibrate_mute()
589 if (!(chip->hardware & WSS_HW_AD1848_MASK)) { in snd_wss_calibrate_mute()
591 mute | chip->image[CS4231_LEFT_LINE_IN]); in snd_wss_calibrate_mute()
593 mute | chip->image[CS4231_RIGHT_LINE_IN]); in snd_wss_calibrate_mute()
595 mute ? 0xc0 : chip->image[CS4231_MONO_CTRL]); in snd_wss_calibrate_mute()
597 if (chip->hardware == WSS_HW_INTERWAVE) { in snd_wss_calibrate_mute()
599 mute | chip->image[CS4231_LEFT_MIC_INPUT]); in snd_wss_calibrate_mute()
601 mute | chip->image[CS4231_RIGHT_MIC_INPUT]); in snd_wss_calibrate_mute()
603 mute | chip->image[CS4231_LINE_LEFT_OUTPUT]); in snd_wss_calibrate_mute()
605 mute | chip->image[CS4231_LINE_RIGHT_OUTPUT]); in snd_wss_calibrate_mute()
607 chip->calibrate_mute = mute; in snd_wss_calibrate_mute()
608 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_calibrate_mute()
618 mutex_lock(&chip->mce_mutex); in snd_wss_playback_format()
619 if (chip->hardware == WSS_HW_CS4231A || in snd_wss_playback_format()
620 (chip->hardware & WSS_HW_CS4232_MASK)) { in snd_wss_playback_format()
621 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_playback_format()
622 if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (pdfr & 0x0f)) { /* rate is same? */ in snd_wss_playback_format()
624 chip->image[CS4231_ALT_FEATURE_1] | 0x10); in snd_wss_playback_format()
625 chip->image[CS4231_PLAYBK_FORMAT] = pdfr; in snd_wss_playback_format()
627 chip->image[CS4231_PLAYBK_FORMAT]); in snd_wss_playback_format()
629 chip->image[CS4231_ALT_FEATURE_1] &= ~0x10); in snd_wss_playback_format()
633 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_playback_format()
634 } else if (chip->hardware == WSS_HW_AD1845) { in snd_wss_playback_format()
646 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_playback_format()
651 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_playback_format()
655 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_playback_format()
656 if (chip->hardware != WSS_HW_INTERWAVE && !chip->single_dma) { in snd_wss_playback_format()
657 if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) in snd_wss_playback_format()
659 (chip->image[CS4231_REC_FORMAT] & 0x0f); in snd_wss_playback_format()
661 chip->image[CS4231_PLAYBK_FORMAT] = pdfr; in snd_wss_playback_format()
664 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_playback_format()
665 if (chip->hardware == WSS_HW_OPL3SA2) in snd_wss_playback_format()
669 mutex_unlock(&chip->mce_mutex); in snd_wss_playback_format()
679 mutex_lock(&chip->mce_mutex); in snd_wss_capture_format()
680 if (chip->hardware == WSS_HW_CS4231A || in snd_wss_capture_format()
681 (chip->hardware & WSS_HW_CS4232_MASK)) { in snd_wss_capture_format()
682 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_capture_format()
683 if ((chip->image[CS4231_PLAYBK_FORMAT] & 0x0f) == (cdfr & 0x0f) || /* rate is same? */ in snd_wss_capture_format()
684 (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { in snd_wss_capture_format()
686 chip->image[CS4231_ALT_FEATURE_1] | 0x20); in snd_wss_capture_format()
688 chip->image[CS4231_REC_FORMAT] = cdfr); in snd_wss_capture_format()
690 chip->image[CS4231_ALT_FEATURE_1] &= ~0x20); in snd_wss_capture_format()
693 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_capture_format()
694 } else if (chip->hardware == WSS_HW_AD1845) { in snd_wss_capture_format()
706 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_capture_format()
711 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_capture_format()
715 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_capture_format()
716 if (chip->hardware != WSS_HW_INTERWAVE && in snd_wss_capture_format()
717 !(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) { in snd_wss_capture_format()
718 if (chip->single_dma) in snd_wss_capture_format()
722 (chip->image[CS4231_PLAYBK_FORMAT] & 0xf0) | in snd_wss_capture_format()
724 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_capture_format()
727 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_capture_format()
729 if (chip->hardware & WSS_HW_AD1848_MASK) in snd_wss_capture_format()
733 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_capture_format()
736 mutex_unlock(&chip->mce_mutex); in snd_wss_capture_format()
746 if (chip->hardware & WSS_HW_CS4236B_MASK) in snd_wss_timer_resolution()
749 return chip->image[CS4231_PLAYBK_FORMAT] & 1 ? 9969 : 9920; in snd_wss_timer_resolution()
757 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_timer_start()
758 ticks = timer->sticks; in snd_wss_timer_start()
759 if ((chip->image[CS4231_ALT_FEATURE_1] & CS4231_TIMER_ENABLE) == 0 || in snd_wss_timer_start()
760 (unsigned char)(ticks >> 8) != chip->image[CS4231_TIMER_HIGH] || in snd_wss_timer_start()
761 (unsigned char)ticks != chip->image[CS4231_TIMER_LOW]) { in snd_wss_timer_start()
762 chip->image[CS4231_TIMER_HIGH] = (unsigned char) (ticks >> 8); in snd_wss_timer_start()
764 chip->image[CS4231_TIMER_HIGH]); in snd_wss_timer_start()
765 chip->image[CS4231_TIMER_LOW] = (unsigned char) ticks; in snd_wss_timer_start()
767 chip->image[CS4231_TIMER_LOW]); in snd_wss_timer_start()
769 chip->image[CS4231_ALT_FEATURE_1] | in snd_wss_timer_start()
772 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_timer_start()
780 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_timer_stop()
781 chip->image[CS4231_ALT_FEATURE_1] &= ~CS4231_TIMER_ENABLE; in snd_wss_timer_stop()
783 chip->image[CS4231_ALT_FEATURE_1]); in snd_wss_timer_stop()
784 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_timer_stop()
799 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_init()
800 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | in snd_wss_init()
805 chip->image[CS4231_IFACE_CTRL] |= CS4231_AUTOCALIB; in snd_wss_init()
806 snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); in snd_wss_init()
807 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_init()
815 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_init()
816 chip->image[CS4231_IFACE_CTRL] &= ~CS4231_AUTOCALIB; in snd_wss_init()
817 snd_wss_out(chip, CS4231_IFACE_CTRL, chip->image[CS4231_IFACE_CTRL]); in snd_wss_init()
819 CS4231_ALT_FEATURE_1, chip->image[CS4231_ALT_FEATURE_1]); in snd_wss_init()
820 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_init()
824 snd_printk(KERN_DEBUG "init: (3) - afei = 0x%x\n", in snd_wss_init()
825 chip->image[CS4231_ALT_FEATURE_1]); in snd_wss_init()
828 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_init()
830 chip->image[CS4231_ALT_FEATURE_2]); in snd_wss_init()
831 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_init()
834 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_init()
836 chip->image[CS4231_PLAYBK_FORMAT]); in snd_wss_init()
837 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_init()
845 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_init()
846 if (!(chip->hardware & WSS_HW_AD1848_MASK)) in snd_wss_init()
848 chip->image[CS4231_REC_FORMAT]); in snd_wss_init()
849 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_init()
862 mutex_lock(&chip->open_mutex); in snd_wss_open()
863 if ((chip->mode & mode) || in snd_wss_open()
864 ((chip->mode & WSS_MODE_OPEN) && chip->single_dma)) { in snd_wss_open()
865 mutex_unlock(&chip->open_mutex); in snd_wss_open()
866 return -EAGAIN; in snd_wss_open()
868 if (chip->mode & WSS_MODE_OPEN) { in snd_wss_open()
869 chip->mode |= mode; in snd_wss_open()
870 mutex_unlock(&chip->open_mutex); in snd_wss_open()
874 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_open()
875 if (!(chip->hardware & WSS_HW_AD1848_MASK)) { in snd_wss_open()
884 chip->image[CS4231_PIN_CTRL] |= CS4231_IRQ_ENABLE; in snd_wss_open()
885 snd_wss_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); in snd_wss_open()
886 if (!(chip->hardware & WSS_HW_AD1848_MASK)) { in snd_wss_open()
893 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_open()
895 chip->mode = mode; in snd_wss_open()
896 mutex_unlock(&chip->open_mutex); in snd_wss_open()
904 mutex_lock(&chip->open_mutex); in snd_wss_close()
905 chip->mode &= ~mode; in snd_wss_close()
906 if (chip->mode & WSS_MODE_OPEN) { in snd_wss_close()
907 mutex_unlock(&chip->open_mutex); in snd_wss_close()
911 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_close()
912 if (!(chip->hardware & WSS_HW_AD1848_MASK)) in snd_wss_close()
916 chip->image[CS4231_PIN_CTRL] &= ~CS4231_IRQ_ENABLE; in snd_wss_close()
917 snd_wss_out(chip, CS4231_PIN_CTRL, chip->image[CS4231_PIN_CTRL]); in snd_wss_close()
921 if (chip->image[CS4231_IFACE_CTRL] & (CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | in snd_wss_close()
923 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_close()
925 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_close()
926 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO | in snd_wss_close()
929 chip->image[CS4231_IFACE_CTRL]); in snd_wss_close()
930 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_close()
932 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_close()
936 if (!(chip->hardware & WSS_HW_AD1848_MASK)) in snd_wss_close()
940 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_close()
942 chip->mode = 0; in snd_wss_close()
943 mutex_unlock(&chip->open_mutex); in snd_wss_close()
989 chip->set_playback_format(chip, hw_params, new_pdfr); in snd_wss_playback_hw_params()
996 struct snd_pcm_runtime *runtime = substream->runtime; in snd_wss_playback_prepare()
1001 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_playback_prepare()
1002 chip->p_dma_size = size; in snd_wss_playback_prepare()
1003 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_PLAYBACK_ENABLE | CS4231_PLAYBACK_PIO); in snd_wss_playback_prepare()
1004 snd_dma_program(chip->dma1, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT); in snd_wss_playback_prepare()
1005 count = snd_wss_get_count(chip->image[CS4231_PLAYBK_FORMAT], count) - 1; in snd_wss_playback_prepare()
1008 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_playback_prepare()
1024 chip->set_capture_format(chip, hw_params, new_cdfr); in snd_wss_capture_hw_params()
1031 struct snd_pcm_runtime *runtime = substream->runtime; in snd_wss_capture_prepare()
1036 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_capture_prepare()
1037 chip->c_dma_size = size; in snd_wss_capture_prepare()
1038 chip->image[CS4231_IFACE_CTRL] &= ~(CS4231_RECORD_ENABLE | CS4231_RECORD_PIO); in snd_wss_capture_prepare()
1039 snd_dma_program(chip->dma2, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT); in snd_wss_capture_prepare()
1040 if (chip->hardware & WSS_HW_AD1848_MASK) in snd_wss_capture_prepare()
1041 count = snd_wss_get_count(chip->image[CS4231_PLAYBK_FORMAT], in snd_wss_capture_prepare()
1044 count = snd_wss_get_count(chip->image[CS4231_REC_FORMAT], in snd_wss_capture_prepare()
1046 count--; in snd_wss_capture_prepare()
1047 if (chip->single_dma && chip->hardware != WSS_HW_INTERWAVE) { in snd_wss_capture_prepare()
1056 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_capture_prepare()
1065 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_overrange()
1067 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_overrange()
1069 chip->capture_substream->runtime->overrange++; in snd_wss_overrange()
1078 if (chip->hardware & WSS_HW_AD1848_MASK) in snd_wss_interrupt()
1084 if (chip->timer) in snd_wss_interrupt()
1085 snd_timer_interrupt(chip->timer, chip->timer->sticks); in snd_wss_interrupt()
1087 if (chip->single_dma && chip->hardware != WSS_HW_INTERWAVE) { in snd_wss_interrupt()
1089 if (chip->mode & WSS_MODE_PLAY) { in snd_wss_interrupt()
1090 if (chip->playback_substream) in snd_wss_interrupt()
1091 snd_pcm_period_elapsed(chip->playback_substream); in snd_wss_interrupt()
1093 if (chip->mode & WSS_MODE_RECORD) { in snd_wss_interrupt()
1094 if (chip->capture_substream) { in snd_wss_interrupt()
1096 snd_pcm_period_elapsed(chip->capture_substream); in snd_wss_interrupt()
1102 if (chip->playback_substream) in snd_wss_interrupt()
1103 snd_pcm_period_elapsed(chip->playback_substream); in snd_wss_interrupt()
1106 if (chip->capture_substream) { in snd_wss_interrupt()
1108 snd_pcm_period_elapsed(chip->capture_substream); in snd_wss_interrupt()
1113 spin_lock(&chip->reg_lock); in snd_wss_interrupt()
1115 if (chip->hardware & WSS_HW_AD1848_MASK) in snd_wss_interrupt()
1119 spin_unlock(&chip->reg_lock); in snd_wss_interrupt()
1129 if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE)) in snd_wss_playback_pointer()
1131 ptr = snd_dma_pointer(chip->dma1, chip->p_dma_size); in snd_wss_playback_pointer()
1132 return bytes_to_frames(substream->runtime, ptr); in snd_wss_playback_pointer()
1140 if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE)) in snd_wss_capture_pointer()
1142 ptr = snd_dma_pointer(chip->dma2, chip->c_dma_size); in snd_wss_capture_pointer()
1143 return bytes_to_frames(substream->runtime, ptr); in snd_wss_capture_pointer()
1161 return -ENODEV; in snd_ad1848_probe()
1164 spin_lock_irqsave(&chip->reg_lock, flags); in snd_ad1848_probe()
1174 err = -ENODEV; in snd_ad1848_probe()
1183 err = -ENODEV; in snd_ad1848_probe()
1193 if ((chip->hardware & WSS_HW_TYPE_MASK) != WSS_HW_DETECT) in snd_ad1848_probe()
1197 chip->hardware = hardware; in snd_ad1848_probe()
1217 chip->hardware = WSS_HW_CMI8330; in snd_ad1848_probe()
1222 chip->hardware = WSS_HW_CS4248; in snd_ad1848_probe()
1224 chip->hardware = WSS_HW_AD1848; in snd_ad1848_probe()
1228 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_ad1848_probe()
1243 hw = chip->hardware; in snd_wss_probe()
1250 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_probe()
1254 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_probe()
1259 snd_printdd("wss: port = 0x%lx, id = 0x%x\n", chip->port, id); in snd_wss_probe()
1261 return -ENODEV; /* no valid device found */ in snd_wss_probe()
1269 chip->hardware = WSS_HW_AD1845; in snd_wss_probe()
1271 chip->hardware = WSS_HW_CS4231; in snd_wss_probe()
1273 chip->hardware = WSS_HW_CS4231A; in snd_wss_probe()
1275 chip->hardware = WSS_HW_CS4232; in snd_wss_probe()
1277 chip->hardware = WSS_HW_CS4232A; in snd_wss_probe()
1279 chip->hardware = WSS_HW_CS4236; in snd_wss_probe()
1281 chip->hardware = WSS_HW_CS4236B; in snd_wss_probe()
1285 return -ENODEV; /* unknown CS4231 chip? */ in snd_wss_probe()
1288 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_probe()
1292 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_probe()
1294 if (!(chip->hardware & WSS_HW_AD1848_MASK)) in snd_wss_probe()
1295 chip->image[CS4231_MISC_INFO] = CS4231_MODE2; in snd_wss_probe()
1296 switch (chip->hardware) { in snd_wss_probe()
1298 chip->image[CS4231_MISC_INFO] = CS4231_IW_MODE3; in snd_wss_probe()
1306 chip->image[CS4231_MISC_INFO] = CS4231_4236_MODE3; in snd_wss_probe()
1308 chip->hardware = WSS_HW_CS4236; in snd_wss_probe()
1312 chip->image[CS4231_IFACE_CTRL] = in snd_wss_probe()
1313 (chip->image[CS4231_IFACE_CTRL] & ~CS4231_SINGLE_DMA) | in snd_wss_probe()
1314 (chip->single_dma ? CS4231_SINGLE_DMA : 0); in snd_wss_probe()
1315 if (chip->hardware != WSS_HW_OPTI93X) { in snd_wss_probe()
1316 chip->image[CS4231_ALT_FEATURE_1] = 0x80; in snd_wss_probe()
1317 chip->image[CS4231_ALT_FEATURE_2] = in snd_wss_probe()
1318 chip->hardware == WSS_HW_INTERWAVE ? 0xc2 : 0x01; in snd_wss_probe()
1321 if (chip->hardware == WSS_HW_AD1845) in snd_wss_probe()
1322 chip->image[AD1845_PWR_DOWN] = 8; in snd_wss_probe()
1324 ptr = (unsigned char *) &chip->image; in snd_wss_probe()
1325 regnum = (chip->hardware & WSS_HW_AD1848_MASK) ? 16 : 32; in snd_wss_probe()
1327 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_probe()
1330 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_probe()
1338 if (chip->hardware == WSS_HW_CS4236B) { in snd_wss_probe()
1343 snd_printdd("CS4231: ext version; rev = 0x%x, id = 0x%x\n", rev, id); in snd_wss_probe()
1345 chip->hardware = WSS_HW_CS4235; in snd_wss_probe()
1363 chip->hardware = WSS_HW_CS4236B; in snd_wss_probe()
1372 chip->hardware = WSS_HW_CS4237B; in snd_wss_probe()
1386 chip->hardware = WSS_HW_CS4238B; in snd_wss_probe()
1399 chip->hardware = WSS_HW_CS4239; in snd_wss_probe()
1473 struct snd_pcm_runtime *runtime = substream->runtime; in snd_wss_playback_open()
1476 runtime->hw = snd_wss_playback; in snd_wss_playback_open()
1479 if (chip->hardware & WSS_HW_AD1848_MASK) in snd_wss_playback_open()
1480 runtime->hw.formats &= ~(SNDRV_PCM_FMTBIT_IMA_ADPCM | in snd_wss_playback_open()
1484 if (chip->hardware == WSS_HW_INTERWAVE && chip->dma1 > 3) in snd_wss_playback_open()
1485 runtime->hw.formats &= ~SNDRV_PCM_FMTBIT_MU_LAW; in snd_wss_playback_open()
1488 if (chip->hardware == WSS_HW_CS4235 || in snd_wss_playback_open()
1489 chip->hardware == WSS_HW_CS4239) in snd_wss_playback_open()
1490 runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE; in snd_wss_playback_open()
1492 snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.buffer_bytes_max); in snd_wss_playback_open()
1493 snd_pcm_limit_isa_dma_size(chip->dma1, &runtime->hw.period_bytes_max); in snd_wss_playback_open()
1495 if (chip->claim_dma) { in snd_wss_playback_open()
1496 err = chip->claim_dma(chip, chip->dma_private_data, chip->dma1); in snd_wss_playback_open()
1503 if (chip->release_dma) in snd_wss_playback_open()
1504 chip->release_dma(chip, chip->dma_private_data, chip->dma1); in snd_wss_playback_open()
1507 chip->playback_substream = substream; in snd_wss_playback_open()
1509 chip->rate_constraint(runtime); in snd_wss_playback_open()
1516 struct snd_pcm_runtime *runtime = substream->runtime; in snd_wss_capture_open()
1519 runtime->hw = snd_wss_capture; in snd_wss_capture_open()
1522 if (chip->hardware & WSS_HW_AD1848_MASK) in snd_wss_capture_open()
1523 runtime->hw.formats &= ~(SNDRV_PCM_FMTBIT_IMA_ADPCM | in snd_wss_capture_open()
1527 if (chip->hardware == WSS_HW_CS4235 || in snd_wss_capture_open()
1528 chip->hardware == WSS_HW_CS4239 || in snd_wss_capture_open()
1529 chip->hardware == WSS_HW_OPTI93X) in snd_wss_capture_open()
1530 runtime->hw.formats = SNDRV_PCM_FMTBIT_U8 | in snd_wss_capture_open()
1533 snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.buffer_bytes_max); in snd_wss_capture_open()
1534 snd_pcm_limit_isa_dma_size(chip->dma2, &runtime->hw.period_bytes_max); in snd_wss_capture_open()
1536 if (chip->claim_dma) { in snd_wss_capture_open()
1537 err = chip->claim_dma(chip, chip->dma_private_data, chip->dma2); in snd_wss_capture_open()
1544 if (chip->release_dma) in snd_wss_capture_open()
1545 chip->release_dma(chip, chip->dma_private_data, chip->dma2); in snd_wss_capture_open()
1548 chip->capture_substream = substream; in snd_wss_capture_open()
1550 chip->rate_constraint(runtime); in snd_wss_capture_open()
1558 chip->playback_substream = NULL; in snd_wss_playback_close()
1567 chip->capture_substream = NULL; in snd_wss_capture_close()
1576 if (!chip->thinkpad_flag) in snd_wss_thinkpad_twiddle()
1600 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_suspend()
1602 chip->image[reg] = snd_wss_in(chip, reg); in snd_wss_suspend()
1603 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_suspend()
1604 if (chip->thinkpad_flag) in snd_wss_suspend()
1615 if (chip->thinkpad_flag) in snd_wss_resume()
1618 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_resume()
1624 snd_wss_out(chip, reg, chip->image[reg]); in snd_wss_resume()
1629 if (chip->hardware == WSS_HW_OPL3SA2) in snd_wss_resume()
1631 chip->image[CS4231_PLAYBK_FORMAT]); in snd_wss_resume()
1632 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_resume()
1638 include rescheduling. -- iwai in snd_wss_resume()
1641 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_resume()
1642 chip->mce_bit &= ~CS4231_MCE; in snd_wss_resume()
1644 wss_outb(chip, CS4231P(REGSEL), chip->mce_bit | (timeout & 0x1f)); in snd_wss_resume()
1645 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_resume()
1648 "- codec still busy\n", chip->port); in snd_wss_resume()
1650 !(chip->hardware & (WSS_HW_CS4231_MASK | WSS_HW_CS4232_MASK))) { in snd_wss_resume()
1660 switch (chip->hardware) { in snd_wss_chip_id()
1684 return chip->card->shortname; in snd_wss_chip_id()
1711 chip = devm_kzalloc(card->dev, sizeof(*chip), GFP_KERNEL); in snd_wss_new()
1713 return -ENOMEM; in snd_wss_new()
1714 chip->hardware = hardware; in snd_wss_new()
1715 chip->hwshare = hwshare; in snd_wss_new()
1717 spin_lock_init(&chip->reg_lock); in snd_wss_new()
1718 mutex_init(&chip->mce_mutex); in snd_wss_new()
1719 mutex_init(&chip->open_mutex); in snd_wss_new()
1720 chip->card = card; in snd_wss_new()
1721 chip->rate_constraint = snd_wss_xrate; in snd_wss_new()
1722 chip->set_playback_format = snd_wss_playback_format; in snd_wss_new()
1723 chip->set_capture_format = snd_wss_capture_format; in snd_wss_new()
1724 if (chip->hardware == WSS_HW_OPTI93X) in snd_wss_new()
1725 memcpy(&chip->image, &snd_opti93x_original_image, in snd_wss_new()
1728 memcpy(&chip->image, &snd_wss_original_image, in snd_wss_new()
1730 if (chip->hardware & WSS_HW_AD1848_MASK) { in snd_wss_new()
1731 chip->image[CS4231_PIN_CTRL] = 0; in snd_wss_new()
1732 chip->image[CS4231_TEST_INIT] = 0; in snd_wss_new()
1754 chip->irq = -1; in snd_wss_create()
1755 chip->dma1 = -1; in snd_wss_create()
1756 chip->dma2 = -1; in snd_wss_create()
1758 chip->res_port = devm_request_region(card->dev, port, 4, "WSS"); in snd_wss_create()
1759 if (!chip->res_port) { in snd_wss_create()
1761 return -EBUSY; in snd_wss_create()
1763 chip->port = port; in snd_wss_create()
1765 chip->res_cport = devm_request_region(card->dev, cport, 8, in snd_wss_create()
1767 if (!chip->res_cport) { in snd_wss_create()
1770 return -ENODEV; in snd_wss_create()
1773 chip->cport = cport; in snd_wss_create()
1775 if (devm_request_irq(card->dev, irq, snd_wss_interrupt, 0, in snd_wss_create()
1778 return -EBUSY; in snd_wss_create()
1780 chip->irq = irq; in snd_wss_create()
1781 card->sync_irq = chip->irq; in snd_wss_create()
1783 snd_devm_request_dma(card->dev, dma1, "WSS - 1")) { in snd_wss_create()
1785 return -EBUSY; in snd_wss_create()
1787 chip->dma1 = dma1; in snd_wss_create()
1789 snd_devm_request_dma(card->dev, dma2, "WSS - 2")) { in snd_wss_create()
1791 return -EBUSY; in snd_wss_create()
1794 chip->single_dma = 1; in snd_wss_create()
1795 chip->dma2 = chip->dma1; in snd_wss_create()
1797 chip->dma2 = dma2; in snd_wss_create()
1800 chip->thinkpad_flag = 1; in snd_wss_create()
1801 chip->hardware = WSS_HW_DETECT; /* reset */ in snd_wss_create()
1807 return -ENODEV; in snd_wss_create()
1811 if (chip->hardware & WSS_HW_CS4232_MASK) { in snd_wss_create()
1812 if (chip->res_cport == NULL) in snd_wss_create()
1820 chip->suspend = snd_wss_suspend; in snd_wss_create()
1821 chip->resume = snd_wss_resume; in snd_wss_create()
1852 err = snd_pcm_new(chip->card, "WSS", device, 1, 1, &pcm); in snd_wss_pcm()
1860 pcm->private_data = chip; in snd_wss_pcm()
1861 pcm->info_flags = 0; in snd_wss_pcm()
1862 if (chip->single_dma) in snd_wss_pcm()
1863 pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; in snd_wss_pcm()
1864 if (chip->hardware != WSS_HW_INTERWAVE) in snd_wss_pcm()
1865 pcm->info_flags |= SNDRV_PCM_INFO_JOINT_DUPLEX; in snd_wss_pcm()
1866 strcpy(pcm->name, snd_wss_chip_id(chip)); in snd_wss_pcm()
1868 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev, in snd_wss_pcm()
1869 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); in snd_wss_pcm()
1871 chip->pcm = pcm; in snd_wss_pcm()
1878 struct snd_wss *chip = timer->private_data; in snd_wss_timer_free()
1879 chip->timer = NULL; in snd_wss_timer_free()
1891 tid.card = chip->card->number; in snd_wss_timer()
1894 err = snd_timer_new(chip->card, "CS4231", &tid, &timer); in snd_wss_timer()
1897 strcpy(timer->name, snd_wss_chip_id(chip)); in snd_wss_timer()
1898 timer->private_data = chip; in snd_wss_timer()
1899 timer->private_free = snd_wss_timer_free; in snd_wss_timer()
1900 timer->hw = snd_wss_timer_table; in snd_wss_timer()
1901 chip->timer = timer; in snd_wss_timer()
1925 if (snd_BUG_ON(!chip->card)) in snd_wss_info_mux()
1926 return -EINVAL; in snd_wss_info_mux()
1927 if (!strcmp(chip->card->driver, "GUS MAX")) in snd_wss_info_mux()
1929 switch (chip->hardware) { in snd_wss_info_mux()
1947 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_get_mux()
1948 ucontrol->value.enumerated.item[0] = (chip->image[CS4231_LEFT_INPUT] & CS4231_MIXS_ALL) >> 6; in snd_wss_get_mux()
1949 ucontrol->value.enumerated.item[1] = (chip->image[CS4231_RIGHT_INPUT] & CS4231_MIXS_ALL) >> 6; in snd_wss_get_mux()
1950 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_get_mux()
1962 if (ucontrol->value.enumerated.item[0] > 3 || in snd_wss_put_mux()
1963 ucontrol->value.enumerated.item[1] > 3) in snd_wss_put_mux()
1964 return -EINVAL; in snd_wss_put_mux()
1965 left = ucontrol->value.enumerated.item[0] << 6; in snd_wss_put_mux()
1966 right = ucontrol->value.enumerated.item[1] << 6; in snd_wss_put_mux()
1967 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_put_mux()
1968 left = (chip->image[CS4231_LEFT_INPUT] & ~CS4231_MIXS_ALL) | left; in snd_wss_put_mux()
1969 right = (chip->image[CS4231_RIGHT_INPUT] & ~CS4231_MIXS_ALL) | right; in snd_wss_put_mux()
1970 change = left != chip->image[CS4231_LEFT_INPUT] || in snd_wss_put_mux()
1971 right != chip->image[CS4231_RIGHT_INPUT]; in snd_wss_put_mux()
1974 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_put_mux()
1981 int mask = (kcontrol->private_value >> 16) & 0xff; in snd_wss_info_single()
1983 uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_wss_info_single()
1984 uinfo->count = 1; in snd_wss_info_single()
1985 uinfo->value.integer.min = 0; in snd_wss_info_single()
1986 uinfo->value.integer.max = mask; in snd_wss_info_single()
1996 int reg = kcontrol->private_value & 0xff; in snd_wss_get_single()
1997 int shift = (kcontrol->private_value >> 8) & 0xff; in snd_wss_get_single()
1998 int mask = (kcontrol->private_value >> 16) & 0xff; in snd_wss_get_single()
1999 int invert = (kcontrol->private_value >> 24) & 0xff; in snd_wss_get_single() local
2001 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_get_single()
2002 ucontrol->value.integer.value[0] = (chip->image[reg] >> shift) & mask; in snd_wss_get_single()
2003 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_get_single()
2004 if (invert) in snd_wss_get_single()
2005 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; in snd_wss_get_single()
2015 int reg = kcontrol->private_value & 0xff; in snd_wss_put_single()
2016 int shift = (kcontrol->private_value >> 8) & 0xff; in snd_wss_put_single()
2017 int mask = (kcontrol->private_value >> 16) & 0xff; in snd_wss_put_single()
2018 int invert = (kcontrol->private_value >> 24) & 0xff; in snd_wss_put_single() local
2022 val = (ucontrol->value.integer.value[0] & mask); in snd_wss_put_single()
2023 if (invert) in snd_wss_put_single()
2024 val = mask - val; in snd_wss_put_single()
2026 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_put_single()
2027 val = (chip->image[reg] & ~(mask << shift)) | val; in snd_wss_put_single()
2028 change = val != chip->image[reg]; in snd_wss_put_single()
2030 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_put_single()
2038 int mask = (kcontrol->private_value >> 24) & 0xff; in snd_wss_info_double()
2040 uinfo->type = mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_wss_info_double()
2041 uinfo->count = 2; in snd_wss_info_double()
2042 uinfo->value.integer.min = 0; in snd_wss_info_double()
2043 uinfo->value.integer.max = mask; in snd_wss_info_double()
2053 int left_reg = kcontrol->private_value & 0xff; in snd_wss_get_double()
2054 int right_reg = (kcontrol->private_value >> 8) & 0xff; in snd_wss_get_double()
2055 int shift_left = (kcontrol->private_value >> 16) & 0x07; in snd_wss_get_double()
2056 int shift_right = (kcontrol->private_value >> 19) & 0x07; in snd_wss_get_double()
2057 int mask = (kcontrol->private_value >> 24) & 0xff; in snd_wss_get_double()
2058 int invert = (kcontrol->private_value >> 22) & 1; in snd_wss_get_double() local
2060 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_get_double()
2061 ucontrol->value.integer.value[0] = (chip->image[left_reg] >> shift_left) & mask; in snd_wss_get_double()
2062 ucontrol->value.integer.value[1] = (chip->image[right_reg] >> shift_right) & mask; in snd_wss_get_double()
2063 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_get_double()
2064 if (invert) { in snd_wss_get_double()
2065 ucontrol->value.integer.value[0] = mask - ucontrol->value.integer.value[0]; in snd_wss_get_double()
2066 ucontrol->value.integer.value[1] = mask - ucontrol->value.integer.value[1]; in snd_wss_get_double()
2077 int left_reg = kcontrol->private_value & 0xff; in snd_wss_put_double()
2078 int right_reg = (kcontrol->private_value >> 8) & 0xff; in snd_wss_put_double()
2079 int shift_left = (kcontrol->private_value >> 16) & 0x07; in snd_wss_put_double()
2080 int shift_right = (kcontrol->private_value >> 19) & 0x07; in snd_wss_put_double()
2081 int mask = (kcontrol->private_value >> 24) & 0xff; in snd_wss_put_double()
2082 int invert = (kcontrol->private_value >> 22) & 1; in snd_wss_put_double() local
2086 val1 = ucontrol->value.integer.value[0] & mask; in snd_wss_put_double()
2087 val2 = ucontrol->value.integer.value[1] & mask; in snd_wss_put_double()
2088 if (invert) { in snd_wss_put_double()
2089 val1 = mask - val1; in snd_wss_put_double()
2090 val2 = mask - val2; in snd_wss_put_double()
2094 spin_lock_irqsave(&chip->reg_lock, flags); in snd_wss_put_double()
2096 val1 = (chip->image[left_reg] & ~(mask << shift_left)) | val1; in snd_wss_put_double()
2097 val2 = (chip->image[right_reg] & ~(mask << shift_right)) | val2; in snd_wss_put_double()
2098 change = val1 != chip->image[left_reg] || in snd_wss_put_double()
2099 val2 != chip->image[right_reg]; in snd_wss_put_double()
2104 val1 = (chip->image[left_reg] & ~mask) | val1 | val2; in snd_wss_put_double()
2105 change = val1 != chip->image[left_reg]; in snd_wss_put_double()
2108 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_wss_put_double()
2113 static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0);
2114 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
2116 static const DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0);
2172 if (snd_BUG_ON(!chip || !chip->pcm)) in snd_wss_mixer()
2173 return -EINVAL; in snd_wss_mixer()
2175 card = chip->card; in snd_wss_mixer()
2177 strcpy(card->mixername, chip->pcm->name); in snd_wss_mixer()
2180 if (chip->hardware & WSS_HW_AD1848_MASK) in snd_wss_mixer()
2183 else if (chip->hardware == WSS_HW_OPTI93X) in snd_wss_mixer()