Lines Matching +full:diff +full:- +full:channels

1 // SPDX-License-Identifier: GPL-2.0-or-later
36 #define PCXHR_INPB(mgr, x) inb((mgr)->port[PCXHR_DSP] + (x))
37 #define PCXHR_OUTPB(mgr, x, data) outb((data), (mgr)->port[PCXHR_DSP] + (x))
72 /* values for PCHR_XLX_STATUS register - READ */
78 /* values for PCHR_XLX_STATUS register - WRITE */
96 /* values for PCXHR_XLX_SELMIC register - WRITE */
103 0x00, /* [000] -49.5 dB: AKM[000] = -1.#INF dB (mute) */
104 0x01, /* [001] -49.0 dB: AKM[001] = -48.131 dB (diff=0.86920 dB) */
105 0x01, /* [002] -48.5 dB: AKM[001] = -48.131 dB (diff=0.36920 dB) */
106 0x01, /* [003] -48.0 dB: AKM[001] = -48.131 dB (diff=0.13080 dB) */
107 0x01, /* [004] -47.5 dB: AKM[001] = -48.131 dB (diff=0.63080 dB) */
108 0x01, /* [005] -46.5 dB: AKM[001] = -48.131 dB (diff=1.63080 dB) */
109 0x01, /* [006] -47.0 dB: AKM[001] = -48.131 dB (diff=1.13080 dB) */
110 0x01, /* [007] -46.0 dB: AKM[001] = -48.131 dB (diff=2.13080 dB) */
111 0x01, /* [008] -45.5 dB: AKM[001] = -48.131 dB (diff=2.63080 dB) */
112 0x02, /* [009] -45.0 dB: AKM[002] = -42.110 dB (diff=2.88980 dB) */
113 0x02, /* [010] -44.5 dB: AKM[002] = -42.110 dB (diff=2.38980 dB) */
114 0x02, /* [011] -44.0 dB: AKM[002] = -42.110 dB (diff=1.88980 dB) */
115 0x02, /* [012] -43.5 dB: AKM[002] = -42.110 dB (diff=1.38980 dB) */
116 0x02, /* [013] -43.0 dB: AKM[002] = -42.110 dB (diff=0.88980 dB) */
117 0x02, /* [014] -42.5 dB: AKM[002] = -42.110 dB (diff=0.38980 dB) */
118 0x02, /* [015] -42.0 dB: AKM[002] = -42.110 dB (diff=0.11020 dB) */
119 0x02, /* [016] -41.5 dB: AKM[002] = -42.110 dB (diff=0.61020 dB) */
120 0x02, /* [017] -41.0 dB: AKM[002] = -42.110 dB (diff=1.11020 dB) */
121 0x02, /* [018] -40.5 dB: AKM[002] = -42.110 dB (diff=1.61020 dB) */
122 0x03, /* [019] -40.0 dB: AKM[003] = -38.588 dB (diff=1.41162 dB) */
123 0x03, /* [020] -39.5 dB: AKM[003] = -38.588 dB (diff=0.91162 dB) */
124 0x03, /* [021] -39.0 dB: AKM[003] = -38.588 dB (diff=0.41162 dB) */
125 0x03, /* [022] -38.5 dB: AKM[003] = -38.588 dB (diff=0.08838 dB) */
126 0x03, /* [023] -38.0 dB: AKM[003] = -38.588 dB (diff=0.58838 dB) */
127 0x03, /* [024] -37.5 dB: AKM[003] = -38.588 dB (diff=1.08838 dB) */
128 0x04, /* [025] -37.0 dB: AKM[004] = -36.090 dB (diff=0.91040 dB) */
129 0x04, /* [026] -36.5 dB: AKM[004] = -36.090 dB (diff=0.41040 dB) */
130 0x04, /* [027] -36.0 dB: AKM[004] = -36.090 dB (diff=0.08960 dB) */
131 0x04, /* [028] -35.5 dB: AKM[004] = -36.090 dB (diff=0.58960 dB) */
132 0x05, /* [029] -35.0 dB: AKM[005] = -34.151 dB (diff=0.84860 dB) */
133 0x05, /* [030] -34.5 dB: AKM[005] = -34.151 dB (diff=0.34860 dB) */
134 0x05, /* [031] -34.0 dB: AKM[005] = -34.151 dB (diff=0.15140 dB) */
135 0x05, /* [032] -33.5 dB: AKM[005] = -34.151 dB (diff=0.65140 dB) */
136 0x06, /* [033] -33.0 dB: AKM[006] = -32.568 dB (diff=0.43222 dB) */
137 0x06, /* [034] -32.5 dB: AKM[006] = -32.568 dB (diff=0.06778 dB) */
138 0x06, /* [035] -32.0 dB: AKM[006] = -32.568 dB (diff=0.56778 dB) */
139 0x07, /* [036] -31.5 dB: AKM[007] = -31.229 dB (diff=0.27116 dB) */
140 0x07, /* [037] -31.0 dB: AKM[007] = -31.229 dB (diff=0.22884 dB) */
141 0x08, /* [038] -30.5 dB: AKM[008] = -30.069 dB (diff=0.43100 dB) */
142 0x08, /* [039] -30.0 dB: AKM[008] = -30.069 dB (diff=0.06900 dB) */
143 0x09, /* [040] -29.5 dB: AKM[009] = -29.046 dB (diff=0.45405 dB) */
144 0x09, /* [041] -29.0 dB: AKM[009] = -29.046 dB (diff=0.04595 dB) */
145 0x0a, /* [042] -28.5 dB: AKM[010] = -28.131 dB (diff=0.36920 dB) */
146 0x0a, /* [043] -28.0 dB: AKM[010] = -28.131 dB (diff=0.13080 dB) */
147 0x0b, /* [044] -27.5 dB: AKM[011] = -27.303 dB (diff=0.19705 dB) */
148 0x0b, /* [045] -27.0 dB: AKM[011] = -27.303 dB (diff=0.30295 dB) */
149 0x0c, /* [046] -26.5 dB: AKM[012] = -26.547 dB (diff=0.04718 dB) */
150 0x0d, /* [047] -26.0 dB: AKM[013] = -25.852 dB (diff=0.14806 dB) */
151 0x0e, /* [048] -25.5 dB: AKM[014] = -25.208 dB (diff=0.29176 dB) */
152 0x0e, /* [049] -25.0 dB: AKM[014] = -25.208 dB (diff=0.20824 dB) */
153 0x0f, /* [050] -24.5 dB: AKM[015] = -24.609 dB (diff=0.10898 dB) */
154 0x10, /* [051] -24.0 dB: AKM[016] = -24.048 dB (diff=0.04840 dB) */
155 0x11, /* [052] -23.5 dB: AKM[017] = -23.522 dB (diff=0.02183 dB) */
156 0x12, /* [053] -23.0 dB: AKM[018] = -23.025 dB (diff=0.02535 dB) */
157 0x13, /* [054] -22.5 dB: AKM[019] = -22.556 dB (diff=0.05573 dB) */
158 0x14, /* [055] -22.0 dB: AKM[020] = -22.110 dB (diff=0.11020 dB) */
159 0x15, /* [056] -21.5 dB: AKM[021] = -21.686 dB (diff=0.18642 dB) */
160 0x17, /* [057] -21.0 dB: AKM[023] = -20.896 dB (diff=0.10375 dB) */
161 0x18, /* [058] -20.5 dB: AKM[024] = -20.527 dB (diff=0.02658 dB) */
162 0x1a, /* [059] -20.0 dB: AKM[026] = -19.831 dB (diff=0.16866 dB) */
163 0x1b, /* [060] -19.5 dB: AKM[027] = -19.504 dB (diff=0.00353 dB) */
164 0x1d, /* [061] -19.0 dB: AKM[029] = -18.883 dB (diff=0.11716 dB) */
165 0x1e, /* [062] -18.5 dB: AKM[030] = -18.588 dB (diff=0.08838 dB) */
166 0x20, /* [063] -18.0 dB: AKM[032] = -18.028 dB (diff=0.02780 dB) */
167 0x22, /* [064] -17.5 dB: AKM[034] = -17.501 dB (diff=0.00123 dB) */
168 0x24, /* [065] -17.0 dB: AKM[036] = -17.005 dB (diff=0.00475 dB) */
169 0x26, /* [066] -16.5 dB: AKM[038] = -16.535 dB (diff=0.03513 dB) */
170 0x28, /* [067] -16.0 dB: AKM[040] = -16.090 dB (diff=0.08960 dB) */
171 0x2b, /* [068] -15.5 dB: AKM[043] = -15.461 dB (diff=0.03857 dB) */
172 0x2d, /* [069] -15.0 dB: AKM[045] = -15.067 dB (diff=0.06655 dB) */
173 0x30, /* [070] -14.5 dB: AKM[048] = -14.506 dB (diff=0.00598 dB) */
174 0x33, /* [071] -14.0 dB: AKM[051] = -13.979 dB (diff=0.02060 dB) */
175 0x36, /* [072] -13.5 dB: AKM[054] = -13.483 dB (diff=0.01707 dB) */
176 0x39, /* [073] -13.0 dB: AKM[057] = -13.013 dB (diff=0.01331 dB) */
177 0x3c, /* [074] -12.5 dB: AKM[060] = -12.568 dB (diff=0.06778 dB) */
178 0x40, /* [075] -12.0 dB: AKM[064] = -12.007 dB (diff=0.00720 dB) */
179 0x44, /* [076] -11.5 dB: AKM[068] = -11.481 dB (diff=0.01937 dB) */
180 0x48, /* [077] -11.0 dB: AKM[072] = -10.984 dB (diff=0.01585 dB) */
181 0x4c, /* [078] -10.5 dB: AKM[076] = -10.515 dB (diff=0.01453 dB) */
182 0x51, /* [079] -10.0 dB: AKM[081] = -9.961 dB (diff=0.03890 dB) */
183 0x55, /* [080] -9.5 dB: AKM[085] = -9.542 dB (diff=0.04243 dB) */
184 0x5a, /* [081] -9.0 dB: AKM[090] = -9.046 dB (diff=0.04595 dB) */
185 0x60, /* [082] -8.5 dB: AKM[096] = -8.485 dB (diff=0.01462 dB) */
186 0x66, /* [083] -8.0 dB: AKM[102] = -7.959 dB (diff=0.04120 dB) */
187 0x6c, /* [084] -7.5 dB: AKM[108] = -7.462 dB (diff=0.03767 dB) */
188 0x72, /* [085] -7.0 dB: AKM[114] = -6.993 dB (diff=0.00729 dB) */
189 0x79, /* [086] -6.5 dB: AKM[121] = -6.475 dB (diff=0.02490 dB) */
190 0x80, /* [087] -6.0 dB: AKM[128] = -5.987 dB (diff=0.01340 dB) */
191 0x87, /* [088] -5.5 dB: AKM[135] = -5.524 dB (diff=0.02413 dB) */
192 0x8f, /* [089] -5.0 dB: AKM[143] = -5.024 dB (diff=0.02408 dB) */
193 0x98, /* [090] -4.5 dB: AKM[152] = -4.494 dB (diff=0.00607 dB) */
194 0xa1, /* [091] -4.0 dB: AKM[161] = -3.994 dB (diff=0.00571 dB) */
195 0xaa, /* [092] -3.5 dB: AKM[170] = -3.522 dB (diff=0.02183 dB) */
196 0xb5, /* [093] -3.0 dB: AKM[181] = -2.977 dB (diff=0.02277 dB) */
197 0xbf, /* [094] -2.5 dB: AKM[191] = -2.510 dB (diff=0.01014 dB) */
198 0xcb, /* [095] -2.0 dB: AKM[203] = -1.981 dB (diff=0.01912 dB) */
199 0xd7, /* [096] -1.5 dB: AKM[215] = -1.482 dB (diff=0.01797 dB) */
200 0xe3, /* [097] -1.0 dB: AKM[227] = -1.010 dB (diff=0.01029 dB) */
201 0xf1, /* [098] -0.5 dB: AKM[241] = -0.490 dB (diff=0.00954 dB) */
202 0xff, /* [099] +0.0 dB: AKM[255] = +0.000 dB (diff=0.00000 dB) */
229 return -EINVAL; in hr222_set_hw_playback_level()
251 if (!mgr->capture_chips) in hr222_set_hw_capture_level()
252 return -EINVAL; /* no PCX22 */ in hr222_set_hw_capture_level()
255 data |= ((level_mic & 0xff) << 16); /* level on both channels */ in hr222_set_hw_capture_level()
275 mgr->board_has_analog = 1; /* analog always available */ in hr222_sub_init()
276 mgr->xlx_cfg = PCXHR_CFG_SYNCDSP_MASK; in hr222_sub_init()
280 mgr->board_has_mic = 1; /* microphone available */ in hr222_sub_init()
281 dev_dbg(&mgr->pci->dev, in hr222_sub_init()
282 "MIC input available = %d\n", mgr->board_has_mic); in hr222_sub_init()
288 mgr->dsp_reset = PCXHR_DSP_RESET_DSP | in hr222_sub_init()
291 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset); in hr222_sub_init()
317 return -EINVAL; in hr222_pll_freq_register()
319 reg = (reg - 1) / 2; in hr222_pll_freq_register()
346 switch (mgr->use_clock_type) { in hr222_sub_set_clock()
352 mgr->xlx_cfg &= ~(PCXHR_CFG_CLOCKIN_SEL_MASK | in hr222_sub_set_clock()
356 mgr->xlx_cfg |= PCXHR_CFG_CLOCKIN_SEL_MASK; in hr222_sub_set_clock()
357 mgr->xlx_cfg &= ~PCXHR_CFG_CLOCK_UER1_SEL_MASK; in hr222_sub_set_clock()
360 if (!mgr->board_has_aes1) in hr222_sub_set_clock()
361 return -EINVAL; in hr222_sub_set_clock()
363 mgr->xlx_cfg |= (PCXHR_CFG_CLOCKIN_SEL_MASK | in hr222_sub_set_clock()
367 return -EINVAL; in hr222_sub_set_clock()
371 if (mgr->use_clock_type == HR22_CLOCK_TYPE_INTERNAL) { in hr222_sub_set_clock()
377 PCXHR_OUTPB(mgr, PCXHR_XLX_CFG, mgr->xlx_cfg); in hr222_sub_set_clock()
381 if (mgr->codec_speed != speed) { in hr222_sub_set_clock()
382 mgr->codec_speed = speed; in hr222_sub_set_clock()
389 mgr->sample_rate_real = realfreq; in hr222_sub_set_clock()
390 mgr->cur_clock_type = mgr->use_clock_type; in hr222_sub_set_clock()
397 dev_dbg(&mgr->pci->dev, "set_clock to %dHz (realfreq=%d pllreg=%x)\n", in hr222_sub_set_clock()
416 } else if (clock_type == HR22_CLOCK_TYPE_AES_1 && mgr->board_has_aes1) { in hr222_get_external_clock()
423 dev_dbg(&mgr->pci->dev, in hr222_get_external_clock()
426 return -EINVAL; /* other clocks not supported */ in hr222_get_external_clock()
430 dev_dbg(&mgr->pci->dev, in hr222_get_external_clock()
441 if (mgr->last_reg_stat != reg) { in hr222_get_external_clock()
443 mgr->last_reg_stat = reg; in hr222_get_external_clock()
489 dev_dbg(&mgr->pci->dev, "External clock is at %d Hz (measured %d Hz)\n", in hr222_get_external_clock()
503 *value = (int)(mgr->dsp_reset & PCXHR_DSP_RESET_GPO_MASK) >> in hr222_read_gpio()
512 unsigned char reg = mgr->dsp_reset & ~PCXHR_DSP_RESET_GPO_MASK; in hr222_write_gpo()
518 mgr->dsp_reset = reg; in hr222_write_gpo()
525 mgr->dsp_reset |= PCXHR_DSP_RESET_SMPTE; in hr222_manage_timecode()
527 mgr->dsp_reset &= ~PCXHR_DSP_RESET_SMPTE; in hr222_manage_timecode()
529 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset); in hr222_manage_timecode()
536 dev_dbg(chip->card->dev, in hr222_update_analog_audio_level()
542 if (chip->analog_capture_active) { in hr222_update_analog_audio_level()
543 level_l = chip->analog_capture_volume[0]; in hr222_update_analog_audio_level()
544 level_r = chip->analog_capture_volume[1]; in hr222_update_analog_audio_level()
549 if (chip->mic_active) in hr222_update_analog_audio_level()
550 level_mic = chip->mic_volume; in hr222_update_analog_audio_level()
553 return hr222_set_hw_capture_level(chip->mgr, in hr222_update_analog_audio_level()
557 if (chip->analog_playback_active[channel]) in hr222_update_analog_audio_level()
558 vol = chip->analog_playback_volume[channel]; in hr222_update_analog_audio_level()
561 return hr222_set_hw_playback_level(chip->mgr, channel, vol); in hr222_update_analog_audio_level()
577 chip->mgr->xlx_cfg &= ~(PCXHR_CFG_SRC_MASK | in hr222_set_audio_source()
581 if (chip->audio_capture_source == SOURCE_DIGISRC) { in hr222_set_audio_source()
582 chip->mgr->xlx_cfg |= PCXHR_CFG_SRC_MASK; in hr222_set_audio_source()
585 if (chip->audio_capture_source == SOURCE_DIGITAL) in hr222_set_audio_source()
589 chip->mgr->xlx_cfg |= PCXHR_CFG_DATAIN_SEL_MASK; in hr222_set_audio_source()
590 if (chip->mgr->board_has_aes1) { in hr222_set_audio_source()
592 chip->mgr->xlx_cfg |= PCXHR_CFG_DATA_UER1_SEL_MASK; in hr222_set_audio_source()
594 /* chip->mic_active = 0; */ in hr222_set_audio_source()
595 /* chip->analog_capture_active = 0; */ in hr222_set_audio_source()
598 chip->analog_capture_active = 0; in hr222_set_audio_source()
599 chip->mic_active = 0; in hr222_set_audio_source()
600 if (chip->audio_capture_source == SOURCE_LINE || in hr222_set_audio_source()
601 chip->audio_capture_source == SOURCE_LINEMIC) { in hr222_set_audio_source()
602 if (chip->analog_capture_active == 0) in hr222_set_audio_source()
604 chip->analog_capture_active = 1; in hr222_set_audio_source()
606 if (chip->audio_capture_source == SOURCE_MIC || in hr222_set_audio_source()
607 chip->audio_capture_source == SOURCE_LINEMIC) { in hr222_set_audio_source()
608 if (chip->mic_active == 0) in hr222_set_audio_source()
610 chip->mic_active = 1; in hr222_set_audio_source()
618 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_CFG, chip->mgr->xlx_cfg); in hr222_set_audio_source()
628 unsigned char mask = chip->mgr->board_has_aes1 ? in hr222_iec958_capture_byte()
632 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_RUER, idx++); /* idx < 192 */ in hr222_iec958_capture_byte()
634 if (PCXHR_INPB(chip->mgr, PCXHR_XLX_CSUER) & mask) in hr222_iec958_capture_byte()
637 dev_dbg(chip->card->dev, "read iec958 AES %d byte %d = 0x%x\n", in hr222_iec958_capture_byte()
638 chip->chip_idx, aes_idx, temp); in hr222_iec958_capture_byte()
649 unsigned char old_bits = chip->aes_bits[aes_idx]; in hr222_iec958_update_byte()
654 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_RUER, idx); in hr222_iec958_update_byte()
656 PCXHR_OUTPB(chip->mgr, PCXHR_XLX_CSUER, new_bits&0x01 ? in hr222_iec958_update_byte()
663 chip->aes_bits[aes_idx] = aes_bits; in hr222_iec958_update_byte()
674 mgr->xlx_selmic &= ~PCXHR_SELMIC_PREAMPLI_MASK; in hr222_micro_boost()
675 mgr->xlx_selmic |= boost_mask; in hr222_micro_boost()
677 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic); in hr222_micro_boost()
679 dev_dbg(&mgr->pci->dev, "hr222_micro_boost : set %x\n", boost_mask); in hr222_micro_boost()
685 mgr->xlx_selmic |= PCXHR_SELMIC_PHANTOM_ALIM; in hr222_phantom_power()
687 mgr->xlx_selmic &= ~PCXHR_SELMIC_PHANTOM_ALIM; in hr222_phantom_power()
689 PCXHR_OUTPB(mgr, PCXHR_XLX_SELMIC, mgr->xlx_selmic); in hr222_phantom_power()
691 dev_dbg(&mgr->pci->dev, "hr222_phantom_power : set %d\n", power); in hr222_phantom_power()
696 static const DECLARE_TLV_DB_SCALE(db_scale_mic_hr222, -9850, 50, 650);
701 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in hr222_mic_vol_info()
702 uinfo->count = 1; in hr222_mic_vol_info()
703 uinfo->value.integer.min = HR222_MICRO_CAPTURE_LEVEL_MIN; /* -98 dB */ in hr222_mic_vol_info()
705 uinfo->value.integer.max = HR222_MICRO_CAPTURE_LEVEL_MAX; /* +7 dB */ in hr222_mic_vol_info()
713 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_vol_get()
714 ucontrol->value.integer.value[0] = chip->mic_volume; in hr222_mic_vol_get()
715 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_vol_get()
724 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_vol_put()
725 if (chip->mic_volume != ucontrol->value.integer.value[0]) { in hr222_mic_vol_put()
727 chip->mic_volume = ucontrol->value.integer.value[0]; in hr222_mic_vol_put()
730 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_vol_put()
752 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in hr222_mic_boost_info()
753 uinfo->count = 1; in hr222_mic_boost_info()
754 uinfo->value.integer.min = 0; /* 0 dB */ in hr222_mic_boost_info()
755 uinfo->value.integer.max = 3; /* 54 dB */ in hr222_mic_boost_info()
763 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_boost_get()
764 ucontrol->value.integer.value[0] = chip->mic_boost; in hr222_mic_boost_get()
765 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_boost_get()
774 mutex_lock(&chip->mgr->mixer_mutex); in hr222_mic_boost_put()
775 if (chip->mic_boost != ucontrol->value.integer.value[0]) { in hr222_mic_boost_put()
777 chip->mic_boost = ucontrol->value.integer.value[0]; in hr222_mic_boost_put()
778 hr222_micro_boost(chip->mgr, chip->mic_boost); in hr222_mic_boost_put()
780 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_mic_boost_put()
803 mutex_lock(&chip->mgr->mixer_mutex); in hr222_phantom_power_get()
804 ucontrol->value.integer.value[0] = chip->phantom_power; in hr222_phantom_power_get()
805 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_phantom_power_get()
815 mutex_lock(&chip->mgr->mixer_mutex); in hr222_phantom_power_put()
816 power = !!ucontrol->value.integer.value[0]; in hr222_phantom_power_put()
817 if (chip->phantom_power != power) { in hr222_phantom_power_put()
818 hr222_phantom_power(chip->mgr, power); in hr222_phantom_power_put()
819 chip->phantom_power = power; in hr222_phantom_power_put()
822 mutex_unlock(&chip->mgr->mixer_mutex); in hr222_phantom_power_put()
838 if (!chip->mgr->board_has_mic) in hr222_add_mic_controls()
842 err = snd_ctl_add(chip->card, snd_ctl_new1(&hr222_control_mic_level, in hr222_add_mic_controls()
847 err = snd_ctl_add(chip->card, snd_ctl_new1(&hr222_control_mic_boost, in hr222_add_mic_controls()
852 err = snd_ctl_add(chip->card, snd_ctl_new1(&hr222_phantom_power_switch, in hr222_add_mic_controls()