Lines Matching +full:serial +full:- +full:shift +full:- +full:inv
1 // SPDX-License-Identifier: GPL-2.0-or-later
33 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&controls[idx], ac97)); in patch_build_controls()
46 kctl = snd_ctl_find_id_mixer(ac97->bus->card, name); in reset_tlv()
47 if (kctl && kctl->tlv.p) in reset_tlv()
48 kctl->tlv.p = tlv; in reset_tlv()
57 mutex_lock(&ac97->page_mutex); in ac97_update_bits_page()
62 mutex_unlock(&ac97->page_mutex); /* unlock paging */ in ac97_update_bits_page()
67 * shared line-in/mic controls
80 ucontrol->value.enumerated.item[0] = ac97->indep_surround; in ac97_surround_jack_mode_get()
87 unsigned char indep = !!ucontrol->value.enumerated.item[0]; in ac97_surround_jack_mode_put()
89 if (indep != ac97->indep_surround) { in ac97_surround_jack_mode_put()
90 ac97->indep_surround = indep; in ac97_surround_jack_mode_put()
91 if (ac97->build_ops->update_jacks) in ac97_surround_jack_mode_put()
92 ac97->build_ops->update_jacks(ac97); in ac97_surround_jack_mode_put()
102 return snd_ctl_enum_info(uinfo, 1, kcontrol->private_value, texts); in ac97_channel_mode_info()
109 ucontrol->value.enumerated.item[0] = ac97->channel_mode; in ac97_channel_mode_get()
116 unsigned char mode = ucontrol->value.enumerated.item[0]; in ac97_channel_mode_put()
118 if (mode >= kcontrol->private_value) in ac97_channel_mode_put()
119 return -EINVAL; in ac97_channel_mode_put()
121 if (mode != ac97->channel_mode) { in ac97_channel_mode_put()
122 ac97->channel_mode = mode; in ac97_channel_mode_put()
123 if (ac97->build_ops->update_jacks) in ac97_channel_mode_put()
124 ac97->build_ops->update_jacks(ac97); in ac97_channel_mode_put()
171 return ac97->channel_mode >= 1; in is_surround_on()
176 return ac97->channel_mode >= 2; in is_clfe_on()
182 return !ac97->indep_surround && is_surround_on(ac97); in is_shared_surrout()
188 return !ac97->indep_surround && is_clfe_on(ac97); in is_shared_clfeout()
194 return !ac97->indep_surround && !is_surround_on(ac97); in is_shared_linein()
200 return !ac97->indep_surround && !is_clfe_on(ac97); in is_shared_micin()
230 val = ac97->regs[AC97_YMF7X3_3D_MODE_SEL]; in snd_ac97_ymf7x3_get_speaker()
233 val--; in snd_ac97_ymf7x3_get_speaker()
234 ucontrol->value.enumerated.item[0] = val; in snd_ac97_ymf7x3_get_speaker()
244 if (ucontrol->value.enumerated.item[0] > 2) in snd_ac97_ymf7x3_put_speaker()
245 return -EINVAL; in snd_ac97_ymf7x3_put_speaker()
246 val = (ucontrol->value.enumerated.item[0] + 1) << 10; in snd_ac97_ymf7x3_put_speaker()
253 .name = "3D Control - Speaker",
264 static const char * const texts[2] = { "AC-Link", "A/D Converter" }; in snd_ac97_ymf7x3_spdif_source_info()
275 val = ac97->regs[AC97_YMF7X3_DIT_CTRL]; in snd_ac97_ymf7x3_spdif_source_get()
276 ucontrol->value.enumerated.item[0] = (val >> 1) & 1; in snd_ac97_ymf7x3_spdif_source_get()
286 if (ucontrol->value.enumerated.item[0] > 1) in snd_ac97_ymf7x3_spdif_source_put()
287 return -EINVAL; in snd_ac97_ymf7x3_spdif_source_put()
288 val = ucontrol->value.enumerated.item[0] << 1; in snd_ac97_ymf7x3_spdif_source_put()
298 err = snd_ctl_add(ac97->bus->card, kctl); in patch_yamaha_ymf7x3_3d()
301 strcpy(kctl->id.name, "3D Control - Wide"); in patch_yamaha_ymf7x3_3d()
302 kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 9, 7, 0); in patch_yamaha_ymf7x3_3d()
304 err = snd_ctl_add(ac97->bus->card, in patch_yamaha_ymf7x3_3d()
352 ac97->build_ops = &patch_yamaha_ymf743_ops; in patch_yamaha_ymf743()
353 ac97->caps |= AC97_BC_BASS_TREBLE; in patch_yamaha_ymf743()
354 ac97->caps |= 0x04 << 10; /* Yamaha 3D enhancement */ in patch_yamaha_ymf743()
355 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000; /* 48k only */ in patch_yamaha_ymf743()
356 ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ in patch_yamaha_ymf743()
363 There is also a bit to mute S/PDIF output in a vendor-specific register. */
376 val = ac97->regs[AC97_YMF7X3_DIT_CTRL]; in snd_ac97_ymf753_spdif_output_pin_get()
377 ucontrol->value.enumerated.item[0] = (val & 0x0008) ? 2 : (val & 0x0020) ? 1 : 0; in snd_ac97_ymf753_spdif_output_pin_get()
386 if (ucontrol->value.enumerated.item[0] > 2) in snd_ac97_ymf753_spdif_output_pin_put()
387 return -EINVAL; in snd_ac97_ymf753_spdif_output_pin_put()
388 val = (ucontrol->value.enumerated.item[0] == 2) ? 0x0008 : in snd_ac97_ymf753_spdif_output_pin_put()
389 (ucontrol->value.enumerated.item[0] == 1) ? 0x0020 : 0; in snd_ac97_ymf753_spdif_output_pin_put()
436 There is also a bit to mute S/PDIF output in a vendor-specific register. in patch_yamaha_ymf753()
438 ac97->build_ops = &patch_yamaha_ymf753_ops; in patch_yamaha_ymf753()
439 ac97->caps |= AC97_BC_BASS_TREBLE; in patch_yamaha_ymf753()
440 ac97->caps |= 0x04 << 10; /* Yamaha 3D enhancement */ in patch_yamaha_ymf753()
464 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9703_specific()
478 ac97->build_ops = &patch_wolfson_wm9703_ops; in patch_wolfson03()
495 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9704_specific()
511 ac97->build_ops = &patch_wolfson_wm9704_ops; in patch_wolfson04()
518 ac97->build_ops = &patch_wolfson_wm9703_ops; in patch_wolfson05()
521 ac97->flags |= AC97_HAS_NO_VIDEO | AC97_HAS_NO_AUX; in patch_wolfson05()
605 AC97_SINGLE("3D Upper Cut-off Switch", AC97_3D_CONTROL, 5, 1, 1),
606 AC97_SINGLE("3D Lower Cut-off Switch", AC97_3D_CONTROL, 4, 1, 1),
609 AC97_SINGLE("Bass Cut-off Switch", AC97_MASTER_TONE, 12, 1, 1),
610 AC97_SINGLE("Tone Cut-off Switch", AC97_MASTER_TONE, 4, 1, 1),
611 AC97_SINGLE("Playback Attenuate (-6dB) Switch", AC97_MASTER_TONE, 6, 1, 0),
625 AC97_SINGLE("Master Left Inv Switch", AC97_MASTER, 6, 1, 0),
636 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9711_specific()
656 ac97->build_ops = &patch_wolfson_wm9711_ops; in patch_wolfson11()
658 ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_MIC | in patch_wolfson11()
671 static const char* wm9713_mono_pga[] = {"Vmid", "Zh", "Mono Mix", "Inv 1"};
673 {"Vmid", "Zh", "Headphone Mix", "Master Mix", "Inv", "NC", "NC", "NC"};
675 static const char* wm9713_out3_pga[] = {"Vmid", "Zh", "Inv 1", "NC"};
676 static const char* wm9713_out4_pga[] = {"Vmid", "Zh", "Inv 2", "NC"};
785 AC97_SINGLE("Bass Cut-off Switch", AC97_GENERAL_PURPOSE, 12, 1, 1),
786 AC97_SINGLE("Tone Cut-off Switch", AC97_GENERAL_PURPOSE, 4, 1, 1),
787 AC97_SINGLE("Playback Attenuate (-6dB) Switch", AC97_GENERAL_PURPOSE, 6, 1, 0),
793 AC97_ENUM("Inv Input Mux", wm9713_enum[11]),
794 AC97_SINGLE("3D Upper Cut-off Switch", AC97_REC_GAIN_MIC, 5, 1, 0),
795 AC97_SINGLE("3D Lower Cut-off Switch", AC97_REC_GAIN_MIC, 4, 1, 0),
804 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97)); in patch_wolfson_wm9713_3d()
816 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9713_specific()
857 ac97->build_ops = &patch_wolfson_wm9713_ops; in patch_wolfson13()
859 ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_PHONE | in patch_wolfson13()
862 ac97->scaps &= ~AC97_SCAP_MODEM; in patch_wolfson13()
891 err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97)); in patch_sigmatel_stac9700_3d()
894 strcpy(kctl->id.name, "3D Control Sigmatel - Depth"); in patch_sigmatel_stac9700_3d()
895 kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 2, 3, 0); in patch_sigmatel_stac9700_3d()
906 err = snd_ctl_add(ac97->bus->card, kctl); in patch_sigmatel_stac9708_3d()
909 strcpy(kctl->id.name, "3D Control Sigmatel - Depth"); in patch_sigmatel_stac9708_3d()
910 kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 0, 3, 0); in patch_sigmatel_stac9708_3d()
912 err = snd_ctl_add(ac97->bus->card, kctl); in patch_sigmatel_stac9708_3d()
915 strcpy(kctl->id.name, "3D Control Sigmatel - Rear Depth"); in patch_sigmatel_stac9708_3d()
916 kctl->private_value = AC97_SINGLE_VALUE(AC97_3D_CONTROL, 2, 3, 0); in patch_sigmatel_stac9708_3d()
922 AC97_SINGLE("Sigmatel 4-Speaker Stereo Playback Switch",
970 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9700()
979 mutex_lock(&ac97->page_mutex); in snd_ac97_stac9708_put_bias()
982 (ucontrol->value.integer.value[0] & 1) << 4); in snd_ac97_stac9708_put_bias()
984 mutex_unlock(&ac97->page_mutex); in snd_ac97_stac9708_put_bias()
1020 ac97->build_ops = &patch_sigmatel_stac9708_ops; in patch_sigmatel_stac9708()
1021 ac97->caps |= 0x10; /* HP (sigmatel surround) support */ in patch_sigmatel_stac9708()
1044 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9721()
1059 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9744()
1061 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x0000); /* is this correct? --jk */ in patch_sigmatel_stac9744()
1071 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9756()
1073 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x0000); /* is this correct? --jk */ in patch_sigmatel_stac9756()
1092 int shift = kcontrol->private_value; in snd_ac97_stac9758_output_jack_get() local
1095 val = ac97->regs[AC97_SIGMATEL_OUTSEL] >> shift; in snd_ac97_stac9758_output_jack_get()
1097 ucontrol->value.enumerated.item[0] = 0; in snd_ac97_stac9758_output_jack_get()
1099 ucontrol->value.enumerated.item[0] = 1 + (val & 3); in snd_ac97_stac9758_output_jack_get()
1106 int shift = kcontrol->private_value; in snd_ac97_stac9758_output_jack_put() local
1109 if (ucontrol->value.enumerated.item[0] > 4) in snd_ac97_stac9758_output_jack_put()
1110 return -EINVAL; in snd_ac97_stac9758_output_jack_put()
1111 if (ucontrol->value.enumerated.item[0] == 0) in snd_ac97_stac9758_output_jack_put()
1114 val = 4 | (ucontrol->value.enumerated.item[0] - 1); in snd_ac97_stac9758_output_jack_put()
1116 7 << shift, val << shift, 0); in snd_ac97_stac9758_output_jack_put()
1131 int shift = kcontrol->private_value; in snd_ac97_stac9758_input_jack_get() local
1134 val = ac97->regs[AC97_SIGMATEL_INSEL]; in snd_ac97_stac9758_input_jack_get()
1135 ucontrol->value.enumerated.item[0] = (val >> shift) & 7; in snd_ac97_stac9758_input_jack_get()
1142 int shift = kcontrol->private_value; in snd_ac97_stac9758_input_jack_put() local
1144 return ac97_update_bits_page(ac97, AC97_SIGMATEL_INSEL, 7 << shift, in snd_ac97_stac9758_input_jack_put()
1145 ucontrol->value.enumerated.item[0] << shift, 0); in snd_ac97_stac9758_input_jack_put()
1161 ucontrol->value.enumerated.item[0] = ac97->regs[AC97_SIGMATEL_IOMISC] & 3; in snd_ac97_stac9758_phonesel_get()
1170 ucontrol->value.enumerated.item[0], 0); in snd_ac97_stac9758_phonesel_put()
1173 #define STAC9758_OUTPUT_JACK(xname, shift) \ argument
1178 .private_value = shift }
1179 #define STAC9758_INPUT_JACK(xname, shift) \ argument
1184 .private_value = shift }
1215 /* DAC-A direct */ in patch_sigmatel_stac9758_specific()
1217 /* DAC-A to Mix = PCM */ in patch_sigmatel_stac9758_specific()
1218 /* DAC-B direct = Surround */ in patch_sigmatel_stac9758_specific()
1219 /* DAC-B to Mix */ in patch_sigmatel_stac9758_specific()
1221 /* DAC-C direct = Center/LFE */ in patch_sigmatel_stac9758_specific()
1255 if (ac97->pci && in patch_sigmatel_stac9758()
1256 ac97->subsystem_vendor == 0x107b && in patch_sigmatel_stac9758()
1257 ac97->subsystem_device == 0x0601) in patch_sigmatel_stac9758()
1261 ac97->build_ops = &patch_sigmatel_stac9758_ops; in patch_sigmatel_stac9758()
1267 ac97->flags |= AC97_STEREO_MUTES; in patch_sigmatel_stac9758()
1276 AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "AC97-SPSA", AC97_CSR_ACMODE, 0, 3, 0)
1291 switch (ac97->id & AC97_ID_CS_MASK) { in patch_cirrus_build_spdif()
1310 /* Basically, the cs4201/cs4205/cs4297a has non-standard sp/dif registers. in patch_cirrus_spdif()
1312 - sp/dif EA ID is not set, but sp/dif is always present. in patch_cirrus_spdif()
1313 - enable/disable is spdif register bit 15. in patch_cirrus_spdif()
1314 - sp/dif control register is 0x68. differs from AC97: in patch_cirrus_spdif()
1315 - valid is bit 14 (vs 15) in patch_cirrus_spdif()
1316 - no DRS in patch_cirrus_spdif()
1317 - only 44.1/48k [00 = 48, 01=44,1] (AC97 is 00=44.1, 10=48) in patch_cirrus_spdif()
1318 - sp/dif ssource select is in 0x5e bits 0,1. in patch_cirrus_spdif()
1321 ac97->build_ops = &patch_cirrus_ops; in patch_cirrus_spdif()
1322 ac97->flags |= AC97_CS_SPDIF; in patch_cirrus_spdif()
1323 ac97->rates[AC97_RATES_SPDIF] &= ~SNDRV_PCM_RATE_32000; in patch_cirrus_spdif()
1324 ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ in patch_cirrus_spdif()
1332 ac97->flags |= AC97_HAS_PC_BEEP; in patch_cirrus_cs4299()
1369 ac97->build_ops = &patch_conexant_ops; in patch_conexant()
1370 ac97->flags |= AC97_CX_SPDIF; in patch_conexant()
1371 ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ in patch_conexant()
1372 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000; /* 48k only */ in patch_conexant()
1395 if (test_bit(reg, ac97->reg_accessed)) { in ad18xx_resume()
1396 snd_ac97_write(ac97, reg, ac97->regs[reg]); in ad18xx_resume()
1401 if (! (ac97->flags & AC97_AD_MULTI)) in ad18xx_resume()
1407 if (! ac97->spec.ad18xx.id[codec]) in ad18xx_resume()
1411 ac97->spec.ad18xx.unchained[codec] | ac97->spec.ad18xx.chained[codec]); in ad18xx_resume()
1412 ac97->bus->ops->write(ac97, AC97_AD_CODEC_CFG, ac97->spec.ad18xx.codec_cfg[codec]); in ad18xx_resume()
1421 if (test_bit(i, ac97->reg_accessed)) { in ad18xx_resume()
1425 if (! ac97->spec.ad18xx.id[codec]) in ad18xx_resume()
1429 ac97->spec.ad18xx.unchained[codec] | ac97->spec.ad18xx.chained[codec]); in ad18xx_resume()
1431 ac97->bus->ops->write(ac97, AC97_PCM, ac97->spec.ad18xx.pcmreg[codec]); in ad18xx_resume()
1441 snd_ac97_write(ac97, i, ac97->regs[i]); in ad18xx_resume()
1475 ac97->res_table = ad1819_restbl; in patch_ad1819()
1489 ac97->spec.ad18xx.unchained[idx] = mask; in patch_ad1881_unchained()
1490 ac97->spec.ad18xx.id[idx] = val; in patch_ad1881_unchained()
1491 ac97->spec.ad18xx.codec_cfg[idx] = 0x0000; in patch_ad1881_unchained()
1507 ac97->spec.ad18xx.chained[idx] = cfg_bits[idx]; in patch_ad1881_chained1()
1508 ac97->spec.ad18xx.id[idx] = val; in patch_ad1881_chained1()
1509 ac97->spec.ad18xx.codec_cfg[idx] = codec_bits ? codec_bits : 0x0004; in patch_ad1881_chained1()
1516 if (ac97->spec.ad18xx.unchained[cidx1] || ac97->spec.ad18xx.chained[cidx1]) in patch_ad1881_chained()
1517 cidx1 = -1; in patch_ad1881_chained()
1518 if (ac97->spec.ad18xx.unchained[cidx2] || ac97->spec.ad18xx.chained[cidx2]) in patch_ad1881_chained()
1519 cidx2 = -1; in patch_ad1881_chained()
1524 ac97->spec.ad18xx.unchained[unchained_idx]); in patch_ad1881_chained()
1526 ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002; in patch_ad1881_chained()
1568 if (ac97->spec.ad18xx.unchained[idx]) in patch_ad1881()
1571 if (ac97->spec.ad18xx.id[1]) { in patch_ad1881()
1572 ac97->flags |= AC97_AD_MULTI; in patch_ad1881()
1573 ac97->scaps |= AC97_SCAP_SURROUND_DAC; in patch_ad1881()
1575 if (ac97->spec.ad18xx.id[2]) { in patch_ad1881()
1576 ac97->flags |= AC97_AD_MULTI; in patch_ad1881()
1577 ac97->scaps |= AC97_SCAP_CENTER_LFE_DAC; in patch_ad1881()
1585 if (ac97->spec.ad18xx.id[idx]) in patch_ad1881()
1590 ac97->spec.ad18xx.codec_cfg[0] = in patch_ad1881()
1591 ac97->spec.ad18xx.codec_cfg[1] = in patch_ad1881()
1592 ac97->spec.ad18xx.codec_cfg[2] = 0x0000; in patch_ad1881()
1595 ac97->ext_id = snd_ac97_read(ac97, AC97_EXTENDED_ID); in patch_ad1881()
1596 if (ac97->spec.ad18xx.id[0]) { in patch_ad1881()
1597 ac97->id &= 0xffff0000; in patch_ad1881()
1598 ac97->id |= ac97->spec.ad18xx.id[0]; in patch_ad1881()
1600 ac97->build_ops = &patch_ad1881_build_ops; in patch_ad1881()
1613 static const DECLARE_TLV_DB_SCALE(db_scale_6bit_6db_max, -8850, 150, 0);
1643 ac97->build_ops = &patch_ad1885_build_ops; in patch_ad1885()
1667 ac97->build_ops = &patch_ad1886_build_ops; in patch_ad1886()
1676 #define AC97_AD198X_VREFD 0x0004 /* VREF high-Z */
1683 #define AC97_AD198X_2MIC 0x0040 /* 2-channel mic select */
1686 /* 0 = 6-to-4, 1 = 6-to-2 downmix */
1693 #define AC97_AD198X_DACZ 0x8000 /* DAC zero-fill mode */
1708 #define AC97_AD1986_2MIC 0x0040 /* 2-channel mic select */
1711 /* 0 = 6-to-4, 1 = 6-to-2 downmix */
1717 #define AC97_AD1986_DACZ 0x8000 /* DAC zero-fill mode */
1754 /* Serial Config bits (AD1986 register 0x74) (incomplete) */
1775 static const char * const texts[2] = { "AC-Link", "A/D Converter" }; in snd_ac97_ad198x_spdif_source_info()
1785 val = ac97->regs[AC97_AD_SERIAL_CFG]; in snd_ac97_ad198x_spdif_source_get()
1786 ucontrol->value.enumerated.item[0] = (val >> 2) & 1; in snd_ac97_ad198x_spdif_source_get()
1795 if (ucontrol->value.enumerated.item[0] > 1) in snd_ac97_ad198x_spdif_source_put()
1796 return -EINVAL; in snd_ac97_ad198x_spdif_source_put()
1797 val = ucontrol->value.enumerated.item[0] << 2; in snd_ac97_ad198x_spdif_source_put()
1819 /* deny list to avoid HP/Line jack-sense controls
1828 0x10140567, /* Thinkpad T43p 2668-G7U */
1829 0x10140581, /* Thinkpad X41-2527 */
1831 0x104380b0, /* Asus A7V8X-MX */
1832 0x11790241, /* Toshiba Satellite A-15 S127 */
1834 0x144dc01a, /* Samsung NP-X20C004/SEG */
1840 u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; in check_list()
1863 /* allow list to enable HP jack-sense bits
1875 0x17340088, /* FSC Scenic-W */
1889 ac97->build_ops = &patch_ad1981a_build_ops; in patch_ad1981a()
1891 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1981a()
1923 ac97->build_ops = &patch_ad1981b_build_ops; in patch_ad1981b()
1925 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1981b()
1937 val = ac97->regs[AC97_AD_MISC]; in snd_ac97_ad1888_lohpsel_get()
1938 ucontrol->value.integer.value[0] = !(val & AC97_AD198X_LOSEL); in snd_ac97_ad1888_lohpsel_get()
1939 if (ac97->spec.ad18xx.lo_as_master) in snd_ac97_ad1888_lohpsel_get()
1940 ucontrol->value.integer.value[0] = in snd_ac97_ad1888_lohpsel_get()
1941 !ucontrol->value.integer.value[0]; in snd_ac97_ad1888_lohpsel_get()
1950 val = !ucontrol->value.integer.value[0]; in snd_ac97_ad1888_lohpsel_put()
1951 if (ac97->spec.ad18xx.lo_as_master) in snd_ac97_ad1888_lohpsel_put()
1960 static const char * const texts[3] = {"Off", "6 -> 4", "6 -> 2"}; in snd_ac97_ad1888_downmix_info()
1970 val = ac97->regs[AC97_AD_MISC]; in snd_ac97_ad1888_downmix_get()
1972 ucontrol->value.enumerated.item[0] = 0; in snd_ac97_ad1888_downmix_get()
1974 ucontrol->value.enumerated.item[0] = 1 + ((val >> 8) & 1); in snd_ac97_ad1888_downmix_get()
1983 if (ucontrol->value.enumerated.item[0] > 2) in snd_ac97_ad1888_downmix_put()
1984 return -EINVAL; in snd_ac97_ad1888_downmix_put()
1985 if (ucontrol->value.enumerated.item[0] == 0) in snd_ac97_ad1888_downmix_put()
1989 ((ucontrol->value.enumerated.item[0] - 1) << 8); in snd_ac97_ad1888_downmix_put()
1998 if (!ac97->spec.ad18xx.lo_as_master && is_shared_linein(ac97)) in ad1888_update_jacks()
2003 /* shared Line-In */ in ad1888_update_jacks()
2035 if (!ac97->spec.ad18xx.lo_as_master) { in patch_ad1888_specific()
2059 ac97->build_ops = &patch_ad1888_build_ops; in patch_ad1888()
2062 * LO can be used as a real line-out on some devices, in patch_ad1888()
2065 if (ac97->subsystem_vendor == 0x1043 && in patch_ad1888()
2066 ac97->subsystem_device == 0x1193) /* ASUS A9T laptop */ in patch_ad1888()
2067 ac97->spec.ad18xx.lo_as_master = 1; in patch_ad1888()
2070 /* AD-compatible mode */ in patch_ad1888()
2073 if (!ac97->spec.ad18xx.lo_as_master) in patch_ad1888()
2074 /* Switch FRONT/SURROUND LINE-OUT/HP-OUT default connection */ in patch_ad1888()
2075 /* it seems that most vendors connect line-out connector to in patch_ad1888()
2081 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1888()
2107 ac97->build_ops = &patch_ad1980_build_ops; in patch_ad1980()
2115 "High-Z", "3.7 V", "2.25 V", "0 V" in snd_ac97_ad1985_vrefout_info()
2127 val = (ac97->regs[AC97_AD_MISC] & AC97_AD198X_VREF_MASK) in snd_ac97_ad1985_vrefout_get()
2129 ucontrol->value.enumerated.item[0] = reg2ctrl[val]; in snd_ac97_ad1985_vrefout_get()
2140 if (ucontrol->value.enumerated.item[0] > 3) in snd_ac97_ad1985_vrefout_put()
2141 return -EINVAL; in snd_ac97_ad1985_vrefout_put()
2142 val = ctrl2reg[ucontrol->value.enumerated.item[0]] in snd_ac97_ad1985_vrefout_put()
2220 ac97->build_ops = &patch_ad1985_build_ops; in patch_ad1985()
2222 /* switch front/surround line-out/hp-out */ in patch_ad1985()
2223 /* AD-compatible mode */ in patch_ad1985()
2230 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1985()
2236 ac97->ext_id = (ac97->ext_id & ~AC97_EI_REV_MASK) | AC97_EI_REV_23; in patch_ad1985()
2248 val = ac97->regs[AC97_AD_MISC3]; in snd_ac97_ad1986_lososel_get()
2249 ucontrol->value.integer.value[0] = (val & AC97_AD1986_LOSEL) != 0; in snd_ac97_ad1986_lososel_get()
2259 int sprd = (ac97->regs[AC97_AD_MISC] & AC97_AD1986_SPRD) != 0; in snd_ac97_ad1986_lososel_put()
2262 ucontrol->value.integer.value[0] != 0 in snd_ac97_ad1986_lososel_put()
2269 (ucontrol->value.integer.value[0] != 0 in snd_ac97_ad1986_lososel_put()
2284 val = ac97->regs[AC97_AD_MISC]; in snd_ac97_ad1986_spread_get()
2285 ucontrol->value.integer.value[0] = (val & AC97_AD1986_SPRD) != 0; in snd_ac97_ad1986_spread_get()
2295 int sprd = (ac97->regs[AC97_AD_MISC3] & AC97_AD1986_LOSEL) != 0; in snd_ac97_ad1986_spread_put()
2298 ucontrol->value.integer.value[0] != 0 in snd_ac97_ad1986_spread_put()
2305 (ucontrol->value.integer.value[0] != 0 in snd_ac97_ad1986_spread_put()
2319 ucontrol->value.integer.value[0] = ac97->spec.ad18xx.swap_mic_linein; in snd_ac97_ad1986_miclisel_get()
2327 unsigned char swap = ucontrol->value.integer.value[0] != 0; in snd_ac97_ad1986_miclisel_put()
2329 if (swap != ac97->spec.ad18xx.swap_mic_linein) { in snd_ac97_ad1986_miclisel_put()
2330 ac97->spec.ad18xx.swap_mic_linein = swap; in snd_ac97_ad1986_miclisel_put()
2331 if (ac97->build_ops->update_jacks) in snd_ac97_ad1986_miclisel_put()
2332 ac97->build_ops->update_jacks(ac97); in snd_ac97_ad1986_miclisel_put()
2344 unsigned short reg = ac97->regs[AC97_AD_MISC2]; in snd_ac97_ad1986_vrefout_get()
2353 ucontrol->value.enumerated.item[0] = val; in snd_ac97_ad1986_vrefout_get()
2368 switch (ucontrol->value.enumerated.item[0]) in snd_ac97_ad1986_vrefout_put()
2370 case 0: /* High-Z */ in snd_ac97_ad1986_vrefout_put()
2391 return -EINVAL; in snd_ac97_ad1986_vrefout_put()
2468 else if (ac97->spec.ad18xx.swap_mic_linein != 0) in ad1986_update_jacks()
2478 else if (ac97->spec.ad18xx.swap_mic_linein != 0) in ad1986_update_jacks()
2511 ac97->build_ops = &patch_ad1986_build_ops; in patch_ad1986()
2512 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1986()
2521 * realtek ALC203: use mono-out for pin 37
2536 /* shared Line-In / Surround Out */ in alc650_update_jacks()
2545 /* turn on/off center-on-mic */ in alc650_update_jacks()
2557 struct snd_pcm_chmap *map = ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK]; in alc650_swap_surround_put()
2560 if (ucontrol->value.integer.value[0]) in alc650_swap_surround_put()
2561 map->chmap = snd_pcm_std_chmaps; in alc650_swap_surround_put()
2563 map->chmap = snd_pcm_alt_chmaps; in alc650_swap_surround_put()
2578 /* 9: Line-In/Surround share */
2580 /* 11-13: in IEC958 controls */
2608 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_3db_max, -4350, 150, 0);
2617 if (ac97->ext_id & AC97_EI_SPDIF) { in patch_alc650_specific()
2622 if (ac97->id != AC97_ID_ALC650F) in patch_alc650_specific()
2637 ac97->build_ops = &patch_alc650_ops; in patch_alc650()
2642 ac97->id = 0x414c4720; /* Old version */ in patch_alc650()
2644 ac97->id = 0x414c4721; /* D version */ in patch_alc650()
2646 ac97->id = 0x414c4722; /* E version */ in patch_alc650()
2648 ac97->id = 0x414c4723; /* F version */ in patch_alc650()
2652 ac97->spec.dev_flags = (ac97->id == 0x414c4722 || in patch_alc650()
2653 ac97->id == 0x414c4723); in patch_alc650()
2659 /* Enable SPDIF-IN only on Rev.E and above */ in patch_alc650()
2662 if (ac97->spec.dev_flags && in patch_alc650()
2664 ! (ac97->subsystem_vendor == 0x1043 && in patch_alc650()
2665 ac97->subsystem_device == 0x1103)) in patch_alc650()
2672 spdif-in monitor off, analog-spdif off, spdif-in off in patch_alc650()
2673 center on mic off, surround on line-in off in patch_alc650()
2695 /* shared Line-In / Surround Out */ in alc655_update_jacks()
2724 if (ac97->spec.dev_flags) in alc655_iec958_route_info()
2735 val = ac97->regs[AC97_ALC650_MULTICH]; in alc655_iec958_route_get()
2737 if (ac97->spec.dev_flags && val == 3) in alc655_iec958_route_get()
2739 ucontrol->value.enumerated.item[0] = val; in alc655_iec958_route_get()
2748 (unsigned short)ucontrol->value.enumerated.item[0] << 12, in alc655_iec958_route_put()
2772 if (ac97->ext_id & AC97_EI_SPDIF) { in patch_alc655_specific()
2789 if (ac97->id == AC97_ID_ALC658) { in patch_alc655()
2790 ac97->spec.dev_flags = 1; /* ALC658 */ in patch_alc655()
2792 ac97->id = AC97_ID_ALC658D; in patch_alc655()
2793 ac97->spec.dev_flags = 2; in patch_alc655()
2797 ac97->build_ops = &patch_alc655_ops; in patch_alc655()
2804 if (ac97->spec.dev_flags) /* ALC658 */ in patch_alc655()
2807 if (ac97->subsystem_vendor == 0x1462 && in patch_alc655()
2808 (ac97->subsystem_device == 0x0131 || /* MSI S270 laptop */ in patch_alc655()
2809 ac97->subsystem_device == 0x0161 || /* LG K1 Express */ in patch_alc655()
2810 ac97->subsystem_device == 0x0351 || /* MSI L725 laptop */ in patch_alc655()
2811 ac97->subsystem_device == 0x0471 || /* MSI L720 laptop */ in patch_alc655()
2812 ac97->subsystem_device == 0x0061)) /* MSI S250 laptop */ in patch_alc655()
2817 ac97->ext_id |= AC97_EI_SPDIF; in patch_alc655()
2821 /* set default: spdif-in enabled, in patch_alc655()
2822 spdif-in monitor off, spdif-in PCM off in patch_alc655()
2823 center on mic off, surround on line-in off in patch_alc655()
2833 if (ac97->id == AC97_ID_ALC658D) in patch_alc655()
2849 /* shared Line-In / Surround Out */ in alc850_update_jacks()
2854 /* LINE-IN = 0, SURROUND = 2 */ in alc850_update_jacks()
2862 /* MIC-IN = 1, CENTER-LFE = 5 */ in alc850_update_jacks()
2886 if (ac97->ext_id & AC97_EI_SPDIF) { in patch_alc850_specific()
2901 ac97->build_ops = &patch_alc850_ops; in patch_alc850()
2903 ac97->spec.dev_flags = 0; /* for IEC958 playback route - ALC655 compatible */ in patch_alc850()
2904 ac97->flags |= AC97_HAS_8CH; in patch_alc850()
2910 /* set default: spdif-in enabled, in patch_alc850()
2911 spdif-in monitor off, spdif-in PCM off in patch_alc850()
2912 center on mic off, surround on line-in off in patch_alc850()
2923 * UIO1: FRONT, Vref3: disable, UIO3: LINE, Front-Mic: mute in patch_alc850()
2937 snd_ac97_find_mixer_ctl(ac97, "3D Control - Center"); in patch_aztech_azf3328_specific()
2939 snd_ac97_find_mixer_ctl(ac97, "3D Control - Depth"); in patch_aztech_azf3328_specific()
2946 kctl_3d_center->private_value = in patch_aztech_azf3328_specific()
2949 "3D Control - Center", "3D Control - Width" in patch_aztech_azf3328_specific()
2953 kctl_3d_depth->private_value = in patch_aztech_azf3328_specific()
2974 ac97->build_ops = &patch_aztech_azf3328_ops; in patch_aztech_azf3328()
2979 * C-Media CM97xx codecs
2983 /* shared Line-In / Surround Out */ in cm9738_update_jacks()
3006 ac97->build_ops = &patch_cm9738_ops; in patch_cm9738()
3009 ac97->flags |= AC97_HAS_NO_PCM_VOL; in patch_cm9738()
3027 val = ac97->regs[AC97_CM9739_SPDIF_CTRL]; in snd_ac97_cmedia_spdif_playback_source_get()
3028 ucontrol->value.enumerated.item[0] = (val >> 1) & 0x01; in snd_ac97_cmedia_spdif_playback_source_get()
3038 (ucontrol->value.enumerated.item[0] & 0x01) << 1); in snd_ac97_cmedia_spdif_playback_source_put()
3042 /* BIT 0: SPDI_EN - always true */
3056 /* BIT 8: SPD32 - 32bit SPDIF - not supported yet */
3061 /* shared Line-In / Surround Out */ in cm9739_update_jacks()
3094 ac97->build_ops = &patch_cm9739_ops; in patch_cm9739()
3097 ac97->flags |= AC97_HAS_NO_MASTER_VOL | AC97_HAS_NO_PCM_VOL; in patch_cm9739()
3107 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000; /* 48k only */ in patch_cm9739()
3109 ac97->ext_id &= ~AC97_EI_SPDIF; /* disable extended-id */ in patch_cm9739()
3110 ac97->rates[AC97_RATES_SPDIF] = 0; in patch_cm9739()
3113 /* set-up multi channel */ in patch_cm9739()
3125 if (! (ac97->ext_id & AC97_EI_SPDIF)) in patch_cm9739()
3133 if (ac97->pci && in patch_cm9739()
3134 ac97->subsystem_vendor == 0x1043 && in patch_cm9739()
3135 ac97->subsystem_device == 0x1843) { in patch_cm9739()
3155 { 0x0008, 0x0000 }, /* 9761-78 & 82 */ in cm9761_update_jacks()
3156 { 0x0000, 0x0008 }, /* 9761-82 rev.B */ in cm9761_update_jacks()
3157 { 0x0000, 0x0008 }, /* 9761-83 */ in cm9761_update_jacks()
3160 { 0x0000, 0x1000 }, /* 9761-78 & 82 */ in cm9761_update_jacks()
3161 { 0x1000, 0x0000 }, /* 9761-82 rev.B */ in cm9761_update_jacks()
3162 { 0x0000, 0x1000 }, /* 9761-83 */ in cm9761_update_jacks()
3165 { 0x0000, 0x0400 }, /* 9761-78 & 82 */ in cm9761_update_jacks()
3166 { 0x0000, 0x0400 }, /* 9761-82 rev.B */ in cm9761_update_jacks()
3167 { 0x0000, 0x0400 }, /* 9761-83 */ in cm9761_update_jacks()
3170 { 0x2000, 0x0880 }, /* 9761-78 & 82 */ in cm9761_update_jacks()
3171 { 0x0000, 0x2880 }, /* 9761-82 rev.B */ in cm9761_update_jacks()
3172 { 0x2000, 0x0800 }, /* 9761-83 */ in cm9761_update_jacks()
3176 val |= surr_on[ac97->spec.dev_flags][is_surround_on(ac97)]; in cm9761_update_jacks()
3177 val |= clfe_on[ac97->spec.dev_flags][is_clfe_on(ac97)]; in cm9761_update_jacks()
3178 val |= surr_shared[ac97->spec.dev_flags][is_shared_surrout(ac97)]; in cm9761_update_jacks()
3179 val |= clfe_shared[ac97->spec.dev_flags][is_shared_clfeout(ac97)]; in cm9761_update_jacks()
3191 static const char * const texts[] = { "AC-Link", "ADC", "SPDIF-In" }; in cm9761_spdif_out_source_info()
3200 if (ac97->regs[AC97_CM9761_FUNC] & 0x1) in cm9761_spdif_out_source_get()
3201 ucontrol->value.enumerated.item[0] = 2; /* SPDIF-loopback */ in cm9761_spdif_out_source_get()
3202 else if (ac97->regs[AC97_CM9761_SPDIF_CTRL] & 0x2) in cm9761_spdif_out_source_get()
3203 ucontrol->value.enumerated.item[0] = 1; /* ADC loopback */ in cm9761_spdif_out_source_get()
3205 ucontrol->value.enumerated.item[0] = 0; /* AC-link */ in cm9761_spdif_out_source_get()
3213 if (ucontrol->value.enumerated.item[0] == 2) in cm9761_spdif_out_source_put()
3217 ucontrol->value.enumerated.item[0] == 1 ? 0x2 : 0); in cm9761_spdif_out_source_put()
3221 "AC-Link", "SPDIF-In", "Both"
3240 /* BIT 9-10: DAC_CTL */
3268 ac97->flags |= /*AC97_HAS_NO_MASTER_VOL |*/ AC97_HAS_NO_PCM_VOL; in patch_cm9761()
3272 ac97->spec.dev_flags = 0; /* 1 = model 82 revision B, 2 = model 83 */ in patch_cm9761()
3273 if (ac97->id == AC97_ID_CM9761_82) { in patch_cm9761()
3279 ac97->spec.dev_flags = tmp & 1; /* revision B? */ in patch_cm9761()
3281 } else if (ac97->id == AC97_ID_CM9761_83) in patch_cm9761()
3282 ac97->spec.dev_flags = 2; in patch_cm9761()
3284 ac97->build_ops = &patch_cm9761_ops; in patch_cm9761()
3287 /* force the SPDIF bit in ext_id - codec doesn't set this bit! */ in patch_cm9761()
3288 ac97->ext_id |= AC97_EI_SPDIF; in patch_cm9761()
3292 snd_ac97_write_cache(ac97, AC97_CM9761_SPDIF_CTRL, 0x0001); /* enable spdif-in */ in patch_cm9761()
3293 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000; /* 48k only */ in patch_cm9761()
3295 /* set-up multi channel */ in patch_cm9761()
3302 * bit 9: Analog-in mix -> surround in patch_cm9761()
3303 * bit 8: Analog-in mix -> CLFE in patch_cm9761()
3314 if (ac97->spec.dev_flags) in patch_cm9761()
3361 ac97->build_ops = &patch_cm9780_ops; in patch_cm9780()
3364 if (ac97->ext_id & AC97_EI_SPDIF) { in patch_cm9780()
3365 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_48000; /* 48k only */ in patch_cm9780()
3393 ac97->build_ops = &patch_vt1613_ops; in patch_vt1613()
3395 ac97->flags |= AC97_HAS_NO_VIDEO; in patch_vt1613()
3396 ac97->caps |= AC97_BC_HEADPHONE; in patch_vt1613()
3431 return snd_ctl_find_id_mixer(ac97->bus->card, name); in snd_ac97_find_mixer_ctl()
3444 return -ENOMEM; in snd_ac97_add_vmaster()
3445 err = snd_ctl_add(ac97->bus->card, kctl); in snd_ac97_add_vmaster()
3449 return snd_ctl_add_followers(ac97->bus->card, kctl, followers); in snd_ac97_add_vmaster()
3462 …patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616) - 1); in patch_vt1616_specific()
3469 return -EINVAL; in patch_vt1616_specific()
3474 kctl->tlv.p, follower_vols_vt1616); in patch_vt1616_specific()
3492 ac97->build_ops = &patch_vt1616_ops; in patch_vt1616()
3517 * counter-intuitive */ in snd_ac97_vt1617a_smart51_info()
3542 ucontrol->value.enumerated.item[0] = (usSM51 << 1) + usMS; in snd_ac97_vt1617a_smart51_get()
3556 usSM51 = ucontrol->value.enumerated.item[0] >> 1; in snd_ac97_vt1617a_smart51_put()
3557 usMS = ucontrol->value.enumerated.item[0] & 1; in snd_ac97_vt1617a_smart51_put()
3559 /* push our values into the register - consider that things will be left in snd_ac97_vt1617a_smart51_put()
3607 ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ in patch_vt1617a()
3608 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; in patch_vt1617a()
3609 ac97->build_ops = &patch_vt1616_ops; in patch_vt1617a()
3625 * OUT_O -> Front,
3626 * OUT_1 -> Surround,
3627 * OUT_2 -> C/LFE
3643 * CN700T, i have to set it to get 5.1 output - YMMV, bad
3652 unsigned short shift; member
3662 .shift = 0,
3670 .shift = 2,
3678 .shift = 4,
3689 vt1618_uaj[kcontrol->private_value].items); in snd_ac97_vt1618_UAJ_info()
3702 mutex_lock(&pac97->page_mutex); in snd_ac97_vt1618_UAJ_get()
3708 vt1618_uaj[kcontrol->private_value].mask; in snd_ac97_vt1618_UAJ_get()
3711 mutex_unlock(&pac97->page_mutex); in snd_ac97_vt1618_UAJ_get()
3713 ucontrol->value.enumerated.item[0] = uaj >> in snd_ac97_vt1618_UAJ_get()
3714 vt1618_uaj[kcontrol->private_value].shift; in snd_ac97_vt1618_UAJ_get()
3723 vt1618_uaj[kcontrol->private_value].mask, in snd_ac97_vt1618_UAJ_put()
3724 ucontrol->value.enumerated.item[0]<< in snd_ac97_vt1618_UAJ_put()
3725 vt1618_uaj[kcontrol->private_value].shift, in snd_ac97_vt1618_UAJ_put()
3729 /* config aux in jack - not found on 3 jack motherboards or soundcards */
3742 ucontrol->value.enumerated.item[0] = in snd_ac97_vt1618_aux_get()
3753 ucontrol->value.enumerated.item[0] << 3); in snd_ac97_vt1618_aux_put()
3758 ucontrol->value.enumerated.item[0] << 3); in snd_ac97_vt1618_aux_put()
3811 /* shared Line-In / Surround Out */ in it2646_update_jacks()
3849 ac97->build_ops = &patch_it2646_ops; in patch_it2646()
3871 err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97)); in patch_si3036_specific()
3884 ac97->build_ops = &patch_si3036_ops; in mpatch_si3036()
3916 ac97->res_table = lm4550_restbl; in patch_lm4550()