Lines Matching full:ac97

18 static struct snd_kcontrol *snd_ac97_find_mixer_ctl(struct snd_ac97 *ac97,
20 static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name,
28 static int patch_build_controls(struct snd_ac97 * ac97, const struct snd_kcontrol_new *controls, in… in patch_build_controls() argument
33 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&controls[idx], ac97)); in patch_build_controls()
41 static void reset_tlv(struct snd_ac97 *ac97, const char *name, in reset_tlv() argument
46 kctl = snd_ctl_find_id_mixer(ac97->bus->card, name); in reset_tlv()
52 static int ac97_update_bits_page(struct snd_ac97 *ac97, unsigned short reg, unsigned short mask, un… in ac97_update_bits_page() argument
57 mutex_lock(&ac97->page_mutex); in ac97_update_bits_page()
58 page_save = snd_ac97_read(ac97, AC97_INT_PAGING) & AC97_PAGE_MASK; in ac97_update_bits_page()
59 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page); in ac97_update_bits_page()
60 ret = snd_ac97_update_bits(ac97, reg, mask, value); in ac97_update_bits_page()
61 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, page_save); in ac97_update_bits_page()
62 mutex_unlock(&ac97->page_mutex); /* unlock paging */ in ac97_update_bits_page()
78 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in ac97_surround_jack_mode_get() local
80 ucontrol->value.enumerated.item[0] = ac97->indep_surround; in ac97_surround_jack_mode_get()
86 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in ac97_surround_jack_mode_put() local
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()
107 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in ac97_channel_mode_get() local
109 ucontrol->value.enumerated.item[0] = ac97->channel_mode; in ac97_channel_mode_get()
115 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in ac97_channel_mode_put() local
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()
169 static inline int is_surround_on(struct snd_ac97 *ac97) in is_surround_on() argument
171 return ac97->channel_mode >= 1; in is_surround_on()
174 static inline int is_clfe_on(struct snd_ac97 *ac97) in is_clfe_on() argument
176 return ac97->channel_mode >= 2; in is_clfe_on()
180 static inline int is_shared_surrout(struct snd_ac97 *ac97) in is_shared_surrout() argument
182 return !ac97->indep_surround && is_surround_on(ac97); in is_shared_surrout()
186 static inline int is_shared_clfeout(struct snd_ac97 *ac97) in is_shared_clfeout() argument
188 return !ac97->indep_surround && is_clfe_on(ac97); in is_shared_clfeout()
192 static inline int is_shared_linein(struct snd_ac97 *ac97) in is_shared_linein() argument
194 return !ac97->indep_surround && !is_surround_on(ac97); in is_shared_linein()
198 static inline int is_shared_micin(struct snd_ac97 *ac97) in is_shared_micin() argument
200 return !ac97->indep_surround && !is_clfe_on(ac97); in is_shared_micin()
203 static inline int alc850_is_aux_back_surround(struct snd_ac97 *ac97) in alc850_is_aux_back_surround() argument
205 return is_surround_on(ac97); in alc850_is_aux_back_surround()
227 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ymf7x3_get_speaker() local
230 val = ac97->regs[AC97_YMF7X3_3D_MODE_SEL]; in snd_ac97_ymf7x3_get_speaker()
241 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ymf7x3_put_speaker() local
247 return snd_ac97_update(ac97, AC97_YMF7X3_3D_MODE_SEL, val); in snd_ac97_ymf7x3_put_speaker()
272 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ymf7x3_spdif_source_get() local
275 val = ac97->regs[AC97_YMF7X3_DIT_CTRL]; in snd_ac97_ymf7x3_spdif_source_get()
283 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ymf7x3_spdif_source_put() local
289 return snd_ac97_update_bits(ac97, AC97_YMF7X3_DIT_CTRL, 0x0002, val); in snd_ac97_ymf7x3_spdif_source_put()
292 static int patch_yamaha_ymf7x3_3d(struct snd_ac97 *ac97) in patch_yamaha_ymf7x3_3d() argument
297 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); in patch_yamaha_ymf7x3_3d()
298 err = snd_ctl_add(ac97->bus->card, kctl); in patch_yamaha_ymf7x3_3d()
303 snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000); in patch_yamaha_ymf7x3_3d()
304 err = snd_ctl_add(ac97->bus->card, in patch_yamaha_ymf7x3_3d()
306 ac97)); in patch_yamaha_ymf7x3_3d()
309 snd_ac97_write_cache(ac97, AC97_YMF7X3_3D_MODE_SEL, 0x0c00); in patch_yamaha_ymf7x3_3d()
328 static int patch_yamaha_ymf743_build_spdif(struct snd_ac97 *ac97) in patch_yamaha_ymf743_build_spdif() argument
332 err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3); in patch_yamaha_ymf743_build_spdif()
335 err = patch_build_controls(ac97, in patch_yamaha_ymf743_build_spdif()
341 snd_ac97_write_cache(ac97, AC97_YMF7X3_DIT_CTRL, 0xa201); in patch_yamaha_ymf743_build_spdif()
350 static int patch_yamaha_ymf743(struct snd_ac97 *ac97) in patch_yamaha_ymf743() argument
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()
373 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ymf753_spdif_output_pin_get() local
376 val = ac97->regs[AC97_YMF7X3_DIT_CTRL]; in snd_ac97_ymf753_spdif_output_pin_get()
383 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ymf753_spdif_output_pin_put() local
390 return snd_ac97_update_bits(ac97, AC97_YMF7X3_DIT_CTRL, 0x0028, val); in snd_ac97_ymf753_spdif_output_pin_put()
392 snd_ac97_write_cache(ac97, 0x62, snd_ac97_read(ac97, 0x62) | 0x0008); */ in snd_ac97_ymf753_spdif_output_pin_put()
414 static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97) in patch_yamaha_ymf753_post_spdif() argument
418 …err = patch_build_controls(ac97, snd_ac97_ymf753_controls_spdif, ARRAY_SIZE(snd_ac97_ymf753_contro… in patch_yamaha_ymf753_post_spdif()
429 static int patch_yamaha_ymf753(struct snd_ac97 * ac97) in patch_yamaha_ymf753() argument
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()
455 static int patch_wolfson_wm9703_specific(struct snd_ac97 * ac97) in patch_wolfson_wm9703_specific() argument
464 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9703_specific()
468 snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); in patch_wolfson_wm9703_specific()
476 static int patch_wolfson03(struct snd_ac97 * ac97) in patch_wolfson03() argument
478 ac97->build_ops = &patch_wolfson_wm9703_ops; in patch_wolfson03()
491 static int patch_wolfson_wm9704_specific(struct snd_ac97 * ac97) in patch_wolfson_wm9704_specific() argument
495 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9704_specific()
500 snd_ac97_write_cache(ac97, AC97_WM9704_TEST, 0x0200); in patch_wolfson_wm9704_specific()
508 static int patch_wolfson04(struct snd_ac97 * ac97) in patch_wolfson04() argument
511 ac97->build_ops = &patch_wolfson_wm9704_ops; in patch_wolfson04()
515 static int patch_wolfson05(struct snd_ac97 * ac97) in patch_wolfson05() argument
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()
631 static int patch_wolfson_wm9711_specific(struct snd_ac97 * ac97) in patch_wolfson_wm9711_specific() argument
636 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9711_specific()
640 snd_ac97_write_cache(ac97, AC97_CODEC_CLASS_REV, 0x0808); in patch_wolfson_wm9711_specific()
641 snd_ac97_write_cache(ac97, AC97_PCI_SVID, 0x0808); in patch_wolfson_wm9711_specific()
642 snd_ac97_write_cache(ac97, AC97_VIDEO, 0x0808); in patch_wolfson_wm9711_specific()
643 snd_ac97_write_cache(ac97, AC97_AUX, 0x0808); in patch_wolfson_wm9711_specific()
644 snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808); in patch_wolfson_wm9711_specific()
645 snd_ac97_write_cache(ac97, AC97_CD, 0x0000); in patch_wolfson_wm9711_specific()
653 static int patch_wolfson11(struct snd_ac97 * ac97) in patch_wolfson11() argument
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()
799 static int patch_wolfson_wm9713_3d (struct snd_ac97 * ac97) in patch_wolfson_wm9713_3d() argument
804 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97)); in patch_wolfson_wm9713_3d()
811 static int patch_wolfson_wm9713_specific(struct snd_ac97 * ac97) in patch_wolfson_wm9713_specific() argument
816 err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97)); in patch_wolfson_wm9713_specific()
820 snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808); in patch_wolfson_wm9713_specific()
821 snd_ac97_write_cache(ac97, AC97_PHONE, 0x0808); in patch_wolfson_wm9713_specific()
822 snd_ac97_write_cache(ac97, AC97_MIC, 0x0808); in patch_wolfson_wm9713_specific()
823 snd_ac97_write_cache(ac97, AC97_LINE, 0x00da); in patch_wolfson_wm9713_specific()
824 snd_ac97_write_cache(ac97, AC97_CD, 0x0808); in patch_wolfson_wm9713_specific()
825 snd_ac97_write_cache(ac97, AC97_VIDEO, 0xd612); in patch_wolfson_wm9713_specific()
826 snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x1ba0); in patch_wolfson_wm9713_specific()
831 static void patch_wolfson_wm9713_suspend (struct snd_ac97 * ac97) in patch_wolfson_wm9713_suspend() argument
833 snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xfeff); in patch_wolfson_wm9713_suspend()
834 snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0xffff); in patch_wolfson_wm9713_suspend()
837 static void patch_wolfson_wm9713_resume (struct snd_ac97 * ac97) in patch_wolfson_wm9713_resume() argument
839 snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xda00); in patch_wolfson_wm9713_resume()
840 snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0x3810); in patch_wolfson_wm9713_resume()
841 snd_ac97_write_cache(ac97, AC97_POWERDOWN, 0x0); in patch_wolfson_wm9713_resume()
854 static int patch_wolfson13(struct snd_ac97 * ac97) in patch_wolfson13() argument
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()
864 snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xda00); in patch_wolfson13()
865 snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0x3810); in patch_wolfson13()
866 snd_ac97_write_cache(ac97, AC97_POWERDOWN, 0x0); in patch_wolfson13()
874 static int patch_tritech_tr28028(struct snd_ac97 * ac97) in patch_tritech_tr28028() argument
876 snd_ac97_write_cache(ac97, 0x26, 0x0300); in patch_tritech_tr28028()
877 snd_ac97_write_cache(ac97, 0x26, 0x0000); in patch_tritech_tr28028()
878 snd_ac97_write_cache(ac97, AC97_SURROUND_MASTER, 0x0000); in patch_tritech_tr28028()
879 snd_ac97_write_cache(ac97, AC97_SPDIF, 0x0000); in patch_tritech_tr28028()
886 static int patch_sigmatel_stac9700_3d(struct snd_ac97 * ac97) in patch_sigmatel_stac9700_3d() argument
891 err = snd_ctl_add(ac97->bus->card, kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97)); in patch_sigmatel_stac9700_3d()
896 snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000); in patch_sigmatel_stac9700_3d()
900 static int patch_sigmatel_stac9708_3d(struct snd_ac97 * ac97) in patch_sigmatel_stac9708_3d() argument
905 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); in patch_sigmatel_stac9708_3d()
906 err = snd_ctl_add(ac97->bus->card, kctl); in patch_sigmatel_stac9708_3d()
911 kctl = snd_ac97_cnew(&snd_ac97_controls_3d[0], ac97); in patch_sigmatel_stac9708_3d()
912 err = snd_ctl_add(ac97->bus->card, kctl); in patch_sigmatel_stac9708_3d()
917 snd_ac97_write_cache(ac97, AC97_3D_CONTROL, 0x0000); in patch_sigmatel_stac9708_3d()
935 static int patch_sigmatel_stac97xx_specific(struct snd_ac97 * ac97) in patch_sigmatel_stac97xx_specific() argument
939 …snd_ac97_write_cache(ac97, AC97_SIGMATEL_ANALOG, snd_ac97_read(ac97, AC97_SIGMATEL_ANALOG) & ~0x00… in patch_sigmatel_stac97xx_specific()
940 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 1)) { in patch_sigmatel_stac97xx_specific()
941 err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[0], 1); in patch_sigmatel_stac97xx_specific()
945 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_ANALOG, 0)) { in patch_sigmatel_stac97xx_specific()
946 err = patch_build_controls(ac97, &snd_ac97_sigmatel_controls[1], 1); in patch_sigmatel_stac97xx_specific()
950 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 2)) { in patch_sigmatel_stac97xx_specific()
951 err = patch_build_controls(ac97, &snd_ac97_sigmatel_4speaker, 1); in patch_sigmatel_stac97xx_specific()
955 if (snd_ac97_try_bit(ac97, AC97_SIGMATEL_DAC2INVERT, 3)) { in patch_sigmatel_stac97xx_specific()
956 err = patch_build_controls(ac97, &snd_ac97_sigmatel_phaseinvert, 1); in patch_sigmatel_stac97xx_specific()
968 static int patch_sigmatel_stac9700(struct snd_ac97 * ac97) in patch_sigmatel_stac9700() argument
970 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9700()
976 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_stac9708_put_bias() local
979 mutex_lock(&ac97->page_mutex); in snd_ac97_stac9708_put_bias()
980 snd_ac97_write(ac97, AC97_SIGMATEL_BIAS1, 0xabba); in snd_ac97_stac9708_put_bias()
981 err = snd_ac97_update_bits(ac97, AC97_SIGMATEL_BIAS2, 0x0010, in snd_ac97_stac9708_put_bias()
983 snd_ac97_write(ac97, AC97_SIGMATEL_BIAS1, 0); in snd_ac97_stac9708_put_bias()
984 mutex_unlock(&ac97->page_mutex); in snd_ac97_stac9708_put_bias()
997 static int patch_sigmatel_stac9708_specific(struct snd_ac97 *ac97) in patch_sigmatel_stac9708_specific() argument
1002 snd_ac97_remove_ctl(ac97, "PCM Out Path & Mute", NULL); in patch_sigmatel_stac9708_specific()
1004 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Sigmatel Surround Playback"); in patch_sigmatel_stac9708_specific()
1005 err = patch_build_controls(ac97, &snd_ac97_stac9708_bias_control, 1); in patch_sigmatel_stac9708_specific()
1008 return patch_sigmatel_stac97xx_specific(ac97); in patch_sigmatel_stac9708_specific()
1016 static int patch_sigmatel_stac9708(struct snd_ac97 * ac97) in patch_sigmatel_stac9708() argument
1020 ac97->build_ops = &patch_sigmatel_stac9708_ops; in patch_sigmatel_stac9708()
1021 ac97->caps |= 0x10; /* HP (sigmatel surround) support */ in patch_sigmatel_stac9708()
1023 codec72 = snd_ac97_read(ac97, AC97_SIGMATEL_BIAS2) & 0x8000; in patch_sigmatel_stac9708()
1024 codec6c = snd_ac97_read(ac97, AC97_SIGMATEL_ANALOG); in patch_sigmatel_stac9708()
1027 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba); in patch_sigmatel_stac9708()
1028 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x1000); in patch_sigmatel_stac9708()
1029 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS1, 0xabba); in patch_sigmatel_stac9708()
1030 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS2, 0x0007); in patch_sigmatel_stac9708()
1032 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba); in patch_sigmatel_stac9708()
1033 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x1001); in patch_sigmatel_stac9708()
1034 snd_ac97_write_cache(ac97, AC97_SIGMATEL_DAC2INVERT, 0x0008); in patch_sigmatel_stac9708()
1038 snd_ac97_write_cache(ac97, AC97_SIGMATEL_MULTICHN, 0x0000); in patch_sigmatel_stac9708()
1042 static int patch_sigmatel_stac9721(struct snd_ac97 * ac97) in patch_sigmatel_stac9721() argument
1044 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9721()
1045 if (snd_ac97_read(ac97, AC97_SIGMATEL_ANALOG) == 0) { in patch_sigmatel_stac9721()
1047 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba); in patch_sigmatel_stac9721()
1048 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x4000); in patch_sigmatel_stac9721()
1049 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS1, 0xabba); in patch_sigmatel_stac9721()
1050 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS2, 0x0002); in patch_sigmatel_stac9721()
1052 snd_ac97_write_cache(ac97, AC97_SIGMATEL_MULTICHN, 0x0000); in patch_sigmatel_stac9721()
1056 static int patch_sigmatel_stac9744(struct snd_ac97 * ac97) in patch_sigmatel_stac9744() argument
1059 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9744()
1060 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba); in patch_sigmatel_stac9744()
1061 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x0000); /* is this correct? --jk */ in patch_sigmatel_stac9744()
1062 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS1, 0xabba); in patch_sigmatel_stac9744()
1063 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS2, 0x0002); in patch_sigmatel_stac9744()
1064 snd_ac97_write_cache(ac97, AC97_SIGMATEL_MULTICHN, 0x0000); in patch_sigmatel_stac9744()
1068 static int patch_sigmatel_stac9756(struct snd_ac97 * ac97) in patch_sigmatel_stac9756() argument
1071 ac97->build_ops = &patch_sigmatel_stac9700_ops; in patch_sigmatel_stac9756()
1072 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC1, 0xabba); in patch_sigmatel_stac9756()
1073 snd_ac97_write_cache(ac97, AC97_SIGMATEL_CIC2, 0x0000); /* is this correct? --jk */ in patch_sigmatel_stac9756()
1074 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS1, 0xabba); in patch_sigmatel_stac9756()
1075 snd_ac97_write_cache(ac97, AC97_SIGMATEL_BIAS2, 0x0002); in patch_sigmatel_stac9756()
1076 snd_ac97_write_cache(ac97, AC97_SIGMATEL_MULTICHN, 0x0000); in patch_sigmatel_stac9756()
1091 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_stac9758_output_jack_get() local
1095 val = ac97->regs[AC97_SIGMATEL_OUTSEL] >> shift; in snd_ac97_stac9758_output_jack_get()
1105 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_stac9758_output_jack_put() local
1115 return ac97_update_bits_page(ac97, AC97_SIGMATEL_OUTSEL, in snd_ac97_stac9758_output_jack_put()
1130 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_stac9758_input_jack_get() local
1134 val = ac97->regs[AC97_SIGMATEL_INSEL]; in snd_ac97_stac9758_input_jack_get()
1141 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 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()
1159 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_stac9758_phonesel_get() local
1161 ucontrol->value.enumerated.item[0] = ac97->regs[AC97_SIGMATEL_IOMISC] & 3; in snd_ac97_stac9758_phonesel_get()
1167 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_stac9758_phonesel_put() local
1169 return ac97_update_bits_page(ac97, AC97_SIGMATEL_IOMISC, 3, in snd_ac97_stac9758_phonesel_put()
1204 static int patch_sigmatel_stac9758_specific(struct snd_ac97 *ac97) in patch_sigmatel_stac9758_specific() argument
1208 err = patch_sigmatel_stac97xx_specific(ac97); in patch_sigmatel_stac9758_specific()
1211 err = patch_build_controls(ac97, snd_ac97_sigmatel_stac9758_controls, in patch_sigmatel_stac9758_specific()
1216 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Front Playback"); in patch_sigmatel_stac9758_specific()
1220 snd_ac97_rename_vol_ctl(ac97, "Video Playback", "Surround Mix Playback"); in patch_sigmatel_stac9758_specific()
1231 static int patch_sigmatel_stac9758(struct snd_ac97 * ac97) in patch_sigmatel_stac9758() argument
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()
1263 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, AC97_PAGE_VENDOR); in patch_sigmatel_stac9758()
1265 snd_ac97_write_cache(ac97, regs[i], pregs[i]); 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)
1279 static int patch_cirrus_build_spdif(struct snd_ac97 * ac97) in patch_cirrus_build_spdif() argument
1284 err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3); in patch_cirrus_build_spdif()
1288 err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[0], 1); in patch_cirrus_build_spdif()
1291 switch (ac97->id & AC97_ID_CS_MASK) { in patch_cirrus_build_spdif()
1293 err = patch_build_controls(ac97, &snd_ac97_cirrus_controls_spdif[1], 1); in patch_cirrus_build_spdif()
1300 snd_ac97_write_cache(ac97, AC97_CSR_SPDIF, 0x0a20); in patch_cirrus_build_spdif()
1308 static int patch_cirrus_spdif(struct snd_ac97 * ac97) in patch_cirrus_spdif() argument
1314 - sp/dif control register is 0x68. differs from AC97: 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()
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()
1325 snd_ac97_write_cache(ac97, AC97_CSR_ACMODE, 0x0080); in patch_cirrus_spdif()
1329 static int patch_cirrus_cs4299(struct snd_ac97 * ac97) in patch_cirrus_cs4299() argument
1332 ac97->flags |= AC97_HAS_PC_BEEP; in patch_cirrus_cs4299()
1334 return patch_cirrus_spdif(ac97); in patch_cirrus_cs4299()
1344 static int patch_conexant_build_spdif(struct snd_ac97 * ac97) in patch_conexant_build_spdif() argument
1349 err = patch_build_controls(ac97, &snd_ac97_controls_spdif[0], 3); in patch_conexant_build_spdif()
1353 err = patch_build_controls(ac97, &snd_ac97_conexant_controls_spdif[0], 1); in patch_conexant_build_spdif()
1358 snd_ac97_write_cache(ac97, AC97_CXR_AUDIO_MISC, in patch_conexant_build_spdif()
1359 …snd_ac97_read(ac97, AC97_CXR_AUDIO_MISC) & ~(AC97_CXR_SPDIFEN|AC97_CXR_COPYRGT|AC97_CXR_SPDIF_MASK… in patch_conexant_build_spdif()
1367 static int patch_conexant(struct snd_ac97 * ac97) in patch_conexant() argument
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()
1376 static int patch_cx20551(struct snd_ac97 *ac97) in patch_cx20551() argument
1378 snd_ac97_update_bits(ac97, 0x5c, 0x01, 0x01); in patch_cx20551()
1386 static void ad18xx_resume(struct snd_ac97 *ac97) in ad18xx_resume() argument
1395 if (test_bit(reg, ac97->reg_accessed)) { in ad18xx_resume()
1396 snd_ac97_write(ac97, reg, ac97->regs[reg]); in ad18xx_resume()
1397 snd_ac97_read(ac97, reg); in ad18xx_resume()
1401 if (! (ac97->flags & AC97_AD_MULTI)) in ad18xx_resume()
1403 snd_ac97_restore_status(ac97); in ad18xx_resume()
1407 if (! ac97->spec.ad18xx.id[codec]) in ad18xx_resume()
1410 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 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()
1415 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000); in ad18xx_resume()
1421 if (test_bit(i, ac97->reg_accessed)) { in ad18xx_resume()
1425 if (! ac97->spec.ad18xx.id[codec]) in ad18xx_resume()
1428 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 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()
1434 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000); in ad18xx_resume()
1441 snd_ac97_write(ac97, i, ac97->regs[i]); in ad18xx_resume()
1442 snd_ac97_read(ac97, i); in ad18xx_resume()
1446 snd_ac97_restore_iec958(ac97); in ad18xx_resume()
1449 static void ad1888_resume(struct snd_ac97 *ac97) in ad1888_resume() argument
1451 ad18xx_resume(ac97); in ad1888_resume()
1452 snd_ac97_write_cache(ac97, AC97_CODEC_CLASS_REV, 0x8080); in ad1888_resume()
1468 static int patch_ad1819(struct snd_ac97 * ac97) in patch_ad1819() argument
1473 scfg = snd_ac97_read(ac97, AC97_AD_SERIAL_CFG); in patch_ad1819()
1474 snd_ac97_write_cache(ac97, AC97_AD_SERIAL_CFG, scfg | 0x7000); /* select all codecs */ in patch_ad1819()
1475 ac97->res_table = ad1819_restbl; in patch_ad1819()
1479 static unsigned short patch_ad1881_unchained(struct snd_ac97 * ac97, int idx, unsigned short mask) in patch_ad1881_unchained() argument
1484 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, mask); in patch_ad1881_unchained()
1485 snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0000); /* ID0C, ID1C, SDIE = off */ in patch_ad1881_unchained()
1486 val = snd_ac97_read(ac97, AC97_VENDOR_ID2); in patch_ad1881_unchained()
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()
1495 static int patch_ad1881_chained1(struct snd_ac97 * ac97, int idx, unsigned short codec_bits) in patch_ad1881_chained1() argument
1500 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, cfg_bits[idx]); in patch_ad1881_chained1()
1501 snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0004); // SDIE in patch_ad1881_chained1()
1502 val = snd_ac97_read(ac97, AC97_VENDOR_ID2); in patch_ad1881_chained1()
1506 snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, codec_bits); in patch_ad1881_chained1()
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()
1513 static void patch_ad1881_chained(struct snd_ac97 * ac97, int unchained_idx, int cidx1, int cidx2) in patch_ad1881_chained() argument
1516 if (ac97->spec.ad18xx.unchained[cidx1] || ac97->spec.ad18xx.chained[cidx1]) in patch_ad1881_chained()
1518 if (ac97->spec.ad18xx.unchained[cidx2] || ac97->spec.ad18xx.chained[cidx2]) in patch_ad1881_chained()
1523 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, in patch_ad1881_chained()
1524 ac97->spec.ad18xx.unchained[unchained_idx]); in patch_ad1881_chained()
1525 snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0002); // ID1C in patch_ad1881_chained()
1526 ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002; in patch_ad1881_chained()
1529 patch_ad1881_chained1(ac97, cidx1, 0); in patch_ad1881_chained()
1530 else if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C in patch_ad1881_chained()
1531 patch_ad1881_chained1(ac97, cidx2, 0); in patch_ad1881_chained()
1532 else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) // SDIE | ID1C in patch_ad1881_chained()
1533 patch_ad1881_chained1(ac97, cidx1, 0); in patch_ad1881_chained()
1535 patch_ad1881_chained1(ac97, cidx2, 0); in patch_ad1881_chained()
1545 static int patch_ad1881(struct snd_ac97 * ac97) in patch_ad1881() argument
1558 val = snd_ac97_read(ac97, AC97_AD_SERIAL_CFG); in patch_ad1881()
1559 snd_ac97_write_cache(ac97, AC97_AD_SERIAL_CFG, val); in patch_ad1881()
1560 codecs[0] = patch_ad1881_unchained(ac97, 0, (1<<12)); in patch_ad1881()
1561 codecs[1] = patch_ad1881_unchained(ac97, 1, (1<<14)); in patch_ad1881()
1562 codecs[2] = patch_ad1881_unchained(ac97, 2, (1<<13)); in patch_ad1881()
1568 if (ac97->spec.ad18xx.unchained[idx]) in patch_ad1881()
1569 patch_ad1881_chained(ac97, idx, cfg_idxs[idx][0], cfg_idxs[idx][1]); 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()
1582 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x7000, 0x7000); in patch_ad1881()
1585 if (ac97->spec.ad18xx.id[idx]) in patch_ad1881()
1589 snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0000); 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()
1615 static int patch_ad1885_specific(struct snd_ac97 * ac97) in patch_ad1885_specific() argument
1619 err = patch_build_controls(ac97, snd_ac97_controls_ad1885, ARRAY_SIZE(snd_ac97_controls_ad1885)); in patch_ad1885_specific()
1622 reset_tlv(ac97, "Headphone Playback Volume", in patch_ad1885_specific()
1634 static int patch_ad1885(struct snd_ac97 * ac97) in patch_ad1885() argument
1636 patch_ad1881(ac97); in patch_ad1885()
1641 snd_ac97_write_cache(ac97, AC97_AD_MISC, 0x0404); in patch_ad1885()
1643 ac97->build_ops = &patch_ad1885_build_ops; in patch_ad1885()
1647 static int patch_ad1886_specific(struct snd_ac97 * ac97) in patch_ad1886_specific() argument
1649 reset_tlv(ac97, "Headphone Playback Volume", in patch_ad1886_specific()
1661 static int patch_ad1886(struct snd_ac97 * ac97) in patch_ad1886() argument
1663 patch_ad1881(ac97); in patch_ad1886()
1666 snd_ac97_write_cache(ac97, AC97_AD_JACK_SPDIF, 0x0010); in patch_ad1886()
1667 ac97->build_ops = &patch_ad1886_build_ops; in patch_ad1886()
1692 #define AC97_AD198X_AC97NC 0x4000 /* AC97 no compatible mode */
1716 #define AC97_AD1986_AC97NC 0x4000 /* AC97 no compatible mode (r/o 1) */
1782 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad198x_spdif_source_get() local
1785 val = ac97->regs[AC97_AD_SERIAL_CFG]; in snd_ac97_ad198x_spdif_source_get()
1792 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad198x_spdif_source_put() local
1798 return snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 0x0004, val); in snd_ac97_ad198x_spdif_source_put()
1809 static int patch_ad198x_post_spdif(struct snd_ac97 * ac97) in patch_ad198x_post_spdif() argument
1811 return patch_build_controls(ac97, &snd_ac97_ad198x_spdif_source, 1); in patch_ad198x_post_spdif()
1838 static int check_list(struct snd_ac97 *ac97, const unsigned int *list) in check_list() argument
1840 u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; in check_list()
1847 static int patch_ad1981a_specific(struct snd_ac97 * ac97) in patch_ad1981a_specific() argument
1849 if (check_list(ac97, ad1981_jacks_denylist)) in patch_ad1981a_specific()
1851 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, in patch_ad1981a_specific()
1879 static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97) in check_ad1981_hp_jack_sense() argument
1881 if (check_list(ac97, ad1981_jacks_allowlist)) in check_ad1981_hp_jack_sense()
1883 snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11); in check_ad1981_hp_jack_sense()
1886 static int patch_ad1981a(struct snd_ac97 *ac97) in patch_ad1981a() argument
1888 patch_ad1881(ac97); in patch_ad1981a()
1889 ac97->build_ops = &patch_ad1981a_build_ops; in patch_ad1981a()
1890 snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD198X_MSPLT, AC97_AD198X_MSPLT); in patch_ad1981a()
1891 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1981a()
1892 check_ad1981_hp_jack_sense(ac97); in patch_ad1981a()
1899 static int patch_ad1981b_specific(struct snd_ac97 *ac97) in patch_ad1981b_specific() argument
1903 err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); in patch_ad1981b_specific()
1906 if (check_list(ac97, ad1981_jacks_denylist)) in patch_ad1981b_specific()
1908 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, in patch_ad1981b_specific()
1920 static int patch_ad1981b(struct snd_ac97 *ac97) in patch_ad1981b() argument
1922 patch_ad1881(ac97); in patch_ad1981b()
1923 ac97->build_ops = &patch_ad1981b_build_ops; in patch_ad1981b()
1924 snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD198X_MSPLT, AC97_AD198X_MSPLT); in patch_ad1981b()
1925 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1981b()
1926 check_ad1981_hp_jack_sense(ac97); in patch_ad1981b()
1934 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1888_lohpsel_get() local
1937 val = ac97->regs[AC97_AD_MISC]; in snd_ac97_ad1888_lohpsel_get()
1939 if (ac97->spec.ad18xx.lo_as_master) in snd_ac97_ad1888_lohpsel_get()
1947 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1888_lohpsel_put() local
1951 if (ac97->spec.ad18xx.lo_as_master) in snd_ac97_ad1888_lohpsel_put()
1954 return snd_ac97_update_bits(ac97, AC97_AD_MISC, in snd_ac97_ad1888_lohpsel_put()
1967 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1888_downmix_get() local
1970 val = ac97->regs[AC97_AD_MISC]; in snd_ac97_ad1888_downmix_get()
1980 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1888_downmix_put() local
1990 return snd_ac97_update_bits(ac97, AC97_AD_MISC, in snd_ac97_ad1888_downmix_put()
1994 static void ad1888_update_jacks(struct snd_ac97 *ac97) in ad1888_update_jacks() argument
1998 if (!ac97->spec.ad18xx.lo_as_master && is_shared_linein(ac97)) in ad1888_update_jacks()
2001 if (is_shared_micin(ac97)) in ad1888_update_jacks()
2004 snd_ac97_update_bits(ac97, AC97_AD_MISC, (1 << 11) | (1 << 12), val); in ad1888_update_jacks()
2033 static int patch_ad1888_specific(struct snd_ac97 *ac97) in patch_ad1888_specific() argument
2035 if (!ac97->spec.ad18xx.lo_as_master) { in patch_ad1888_specific()
2037 snd_ac97_rename_vol_ctl(ac97, "Master Playback", in patch_ad1888_specific()
2039 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", in patch_ad1888_specific()
2042 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls)); in patch_ad1888_specific()
2054 static int patch_ad1888(struct snd_ac97 * ac97) in patch_ad1888() argument
2058 patch_ad1881(ac97); in patch_ad1888()
2059 ac97->build_ops = &patch_ad1888_build_ops; 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()
2069 misc = snd_ac97_read(ac97, AC97_AD_MISC); in patch_ad1888()
2073 if (!ac97->spec.ad18xx.lo_as_master) in patch_ad1888()
2080 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc); in patch_ad1888()
2081 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1888()
2085 static int patch_ad1980_specific(struct snd_ac97 *ac97) in patch_ad1980_specific() argument
2089 err = patch_ad1888_specific(ac97); in patch_ad1980_specific()
2092 return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); in patch_ad1980_specific()
2104 static int patch_ad1980(struct snd_ac97 * ac97) in patch_ad1980() argument
2106 patch_ad1888(ac97); in patch_ad1980()
2107 ac97->build_ops = &patch_ad1980_build_ops; in patch_ad1980()
2125 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1985_vrefout_get() local
2127 val = (ac97->regs[AC97_AD_MISC] & AC97_AD198X_VREF_MASK) in snd_ac97_ad1985_vrefout_get()
2137 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1985_vrefout_put() local
2144 return snd_ac97_update_bits(ac97, AC97_AD_MISC, in snd_ac97_ad1985_vrefout_put()
2181 static void ad1985_update_jacks(struct snd_ac97 *ac97) in ad1985_update_jacks() argument
2183 ad1888_update_jacks(ac97); in ad1985_update_jacks()
2185 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 1 << 9, in ad1985_update_jacks()
2186 is_shared_micin(ac97) ? 1 << 9 : 0); in ad1985_update_jacks()
2189 static int patch_ad1985_specific(struct snd_ac97 *ac97) in patch_ad1985_specific() argument
2194 snd_ac97_rename_vol_ctl(ac97, "Master Playback", in patch_ad1985_specific()
2196 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback"); in patch_ad1985_specific()
2198 err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); in patch_ad1985_specific()
2202 return patch_build_controls(ac97, snd_ac97_ad1985_controls, in patch_ad1985_specific()
2215 static int patch_ad1985(struct snd_ac97 * ac97) in patch_ad1985() argument
2219 patch_ad1881(ac97); in patch_ad1985()
2220 ac97->build_ops = &patch_ad1985_build_ops; in patch_ad1985()
2221 misc = snd_ac97_read(ac97, AC97_AD_MISC); in patch_ad1985()
2225 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc | in patch_ad1985()
2230 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1985()
2233 ad1985_update_jacks(ac97); in patch_ad1985()
2236 ac97->ext_id = (ac97->ext_id & ~AC97_EI_REV_MASK) | AC97_EI_REV_23; in patch_ad1985()
2245 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_lososel_get() local
2248 val = ac97->regs[AC97_AD_MISC3]; in snd_ac97_ad1986_lososel_get()
2256 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_lososel_put() local
2259 int sprd = (ac97->regs[AC97_AD_MISC] & AC97_AD1986_SPRD) != 0; in snd_ac97_ad1986_lososel_put()
2261 ret0 = snd_ac97_update_bits(ac97, AC97_AD_MISC3, AC97_AD1986_LOSEL, in snd_ac97_ad1986_lososel_put()
2268 ret1 = snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD1986_SOSEL, in snd_ac97_ad1986_lososel_put()
2281 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_spread_get() local
2284 val = ac97->regs[AC97_AD_MISC]; in snd_ac97_ad1986_spread_get()
2292 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_spread_put() local
2295 int sprd = (ac97->regs[AC97_AD_MISC3] & AC97_AD1986_LOSEL) != 0; in snd_ac97_ad1986_spread_put()
2297 ret0 = snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD1986_SPRD, in snd_ac97_ad1986_spread_put()
2304 ret1 = snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD1986_SOSEL, in snd_ac97_ad1986_spread_put()
2317 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_miclisel_get() local
2319 ucontrol->value.integer.value[0] = ac97->spec.ad18xx.swap_mic_linein; in snd_ac97_ad1986_miclisel_get()
2326 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_miclisel_put() local
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()
2342 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_vrefout_get() local
2344 unsigned short reg = ac97->regs[AC97_AD_MISC2]; in snd_ac97_ad1986_vrefout_get()
2360 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_ad1986_vrefout_put() local
2394 cret = snd_ac97_update_bits(ac97, AC97_AD_MISC2, in snd_ac97_ad1986_vrefout_put()
2398 lret = snd_ac97_update_bits(ac97, AC97_AD_MISC3, in snd_ac97_ad1986_vrefout_put()
2402 mret = snd_ac97_update_bits(ac97, AC97_AD_MISC2, in snd_ac97_ad1986_vrefout_put()
2454 static void ad1986_update_jacks(struct snd_ac97 *ac97) in ad1986_update_jacks() argument
2460 if (!is_surround_on(ac97)) in ad1986_update_jacks()
2462 if (!is_clfe_on(ac97)) in ad1986_update_jacks()
2466 if (is_shared_linein(ac97)) in ad1986_update_jacks()
2468 else if (ac97->spec.ad18xx.swap_mic_linein != 0) in ad1986_update_jacks()
2470 snd_ac97_update_bits(ac97, AC97_AD_MISC, in ad1986_update_jacks()
2476 if (is_shared_micin(ac97)) in ad1986_update_jacks()
2478 else if (ac97->spec.ad18xx.swap_mic_linein != 0) in ad1986_update_jacks()
2482 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, in ad1986_update_jacks()
2487 static int patch_ad1986_specific(struct snd_ac97 *ac97) in patch_ad1986_specific() argument
2491 err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); in patch_ad1986_specific()
2495 return patch_build_controls(ac97, snd_ac97_ad1986_controls, in patch_ad1986_specific()
2508 static int patch_ad1986(struct snd_ac97 * ac97) in patch_ad1986() argument
2510 patch_ad1881(ac97); in patch_ad1986()
2511 ac97->build_ops = &patch_ad1986_build_ops; in patch_ad1986()
2512 ac97->flags |= AC97_STEREO_MUTES; in patch_ad1986()
2515 ad1986_update_jacks(ac97); in patch_ad1986()
2523 static int patch_alc203(struct snd_ac97 *ac97) in patch_alc203() argument
2525 snd_ac97_update_bits(ac97, 0x7a, 0x400, 0x400); in patch_alc203()
2532 static void alc650_update_jacks(struct snd_ac97 *ac97) in alc650_update_jacks() argument
2537 shared = is_shared_surrout(ac97); in alc650_update_jacks()
2538 snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 1 << 9, in alc650_update_jacks()
2541 shared = is_shared_clfeout(ac97); in alc650_update_jacks()
2543 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12, in alc650_update_jacks()
2546 snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 1 << 10, in alc650_update_jacks()
2549 snd_ac97_update_bits(ac97, AC97_ALC650_GPIO_STATUS, 0x100, in alc650_update_jacks()
2556 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in alc650_swap_surround_put() local
2557 struct snd_pcm_chmap *map = ac97->chmaps[SNDRV_PCM_STREAM_PLAYBACK]; in alc650_swap_surround_put()
2610 static int patch_alc650_specific(struct snd_ac97 * ac97) in patch_alc650_specific() argument
2614 err = patch_build_controls(ac97, snd_ac97_controls_alc650, ARRAY_SIZE(snd_ac97_controls_alc650)); in patch_alc650_specific()
2617 if (ac97->ext_id & AC97_EI_SPDIF) { in patch_alc650_specific()
2618 …err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc650, ARRAY_SIZE(snd_ac97_spdif_control… in patch_alc650_specific()
2622 if (ac97->id != AC97_ID_ALC650F) in patch_alc650_specific()
2623 reset_tlv(ac97, "Master Playback Volume", in patch_alc650_specific()
2633 static int patch_alc650(struct snd_ac97 * ac97) in patch_alc650() argument
2637 ac97->build_ops = &patch_alc650_ops; in patch_alc650()
2640 val = snd_ac97_read(ac97, AC97_ALC650_REVISION) & 0x3f; 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()
2656 snd_ac97_write_cache(ac97, AC97_ALC650_GPIO_STATUS, in patch_alc650()
2657 snd_ac97_read(ac97, AC97_ALC650_GPIO_STATUS) | 0x8000); in patch_alc650()
2660 val = snd_ac97_read(ac97, AC97_ALC650_CLOCK); 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()
2669 snd_ac97_write_cache(ac97, AC97_ALC650_CLOCK, val); in patch_alc650()
2676 snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 0); in patch_alc650()
2680 snd_ac97_write_cache(ac97, AC97_ALC650_GPIO_SETUP, in patch_alc650()
2681 snd_ac97_read(ac97, AC97_ALC650_GPIO_SETUP) | 0x01); in patch_alc650()
2682 snd_ac97_write_cache(ac97, AC97_ALC650_GPIO_STATUS, in patch_alc650()
2683 (snd_ac97_read(ac97, AC97_ALC650_GPIO_STATUS) | 0x100) & ~0x10); in patch_alc650()
2686 snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); in patch_alc650()
2687 snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); in patch_alc650()
2691 static void alc655_update_jacks(struct snd_ac97 *ac97) in alc655_update_jacks() argument
2696 shared = is_shared_surrout(ac97); in alc655_update_jacks()
2697 ac97_update_bits_page(ac97, AC97_ALC650_MULTICH, 1 << 9, in alc655_update_jacks()
2700 shared = is_shared_clfeout(ac97); in alc655_update_jacks()
2702 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12, in alc655_update_jacks()
2704 ac97_update_bits_page(ac97, AC97_ALC650_MULTICH, 1 << 10, in alc655_update_jacks()
2722 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in alc655_iec958_route_info() local
2724 if (ac97->spec.dev_flags) in alc655_iec958_route_info()
2732 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in alc655_iec958_route_get() local
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()
2745 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in alc655_iec958_route_put() local
2747 return ac97_update_bits_page(ac97, AC97_ALC650_MULTICH, 3 << 12, in alc655_iec958_route_put()
2765 static int patch_alc655_specific(struct snd_ac97 * ac97) in patch_alc655_specific() argument
2769 err = patch_build_controls(ac97, snd_ac97_controls_alc655, ARRAY_SIZE(snd_ac97_controls_alc655)); in patch_alc655_specific()
2772 if (ac97->ext_id & AC97_EI_SPDIF) { in patch_alc655_specific()
2773 …err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_control… in patch_alc655_specific()
2785 static int patch_alc655(struct snd_ac97 * ac97) in patch_alc655() argument
2789 if (ac97->id == AC97_ID_ALC658) { in patch_alc655()
2790 ac97->spec.dev_flags = 1; /* ALC658 */ in patch_alc655()
2791 if ((snd_ac97_read(ac97, AC97_ALC650_REVISION) & 0x3f) == 2) { 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()
2800 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, AC97_PAGE_VENDOR); in patch_alc655()
2803 val = snd_ac97_read(ac97, 0x7a); /* misc control */ 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()
2820 snd_ac97_write_cache(ac97, 0x7a, val); in patch_alc655()
2826 snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 1<<15); in patch_alc655()
2829 snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); in patch_alc655()
2830 snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); in patch_alc655()
2833 if (ac97->id == AC97_ID_ALC658D) in patch_alc655()
2834 snd_ac97_update_bits(ac97, 0x74, 0x0800, 0x0800); in patch_alc655()
2844 static void alc850_update_jacks(struct snd_ac97 *ac97) in alc850_update_jacks() argument
2850 shared = is_shared_surrout(ac97); in alc850_update_jacks()
2852 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<4)|(1<<5), in alc850_update_jacks()
2855 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 12, in alc850_update_jacks()
2858 shared = is_shared_clfeout(ac97); in alc850_update_jacks()
2860 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13), in alc850_update_jacks()
2863 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4, in alc850_update_jacks()
2866 aux_is_back_surround = alc850_is_aux_back_surround(ac97); in alc850_update_jacks()
2868 snd_ac97_update_bits(ac97, AC97_ALC850_MULTICH, 1 << 10, in alc850_update_jacks()
2879 static int patch_alc850_specific(struct snd_ac97 *ac97) in patch_alc850_specific() argument
2883 err = patch_build_controls(ac97, snd_ac97_controls_alc850, ARRAY_SIZE(snd_ac97_controls_alc850)); in patch_alc850_specific()
2886 if (ac97->ext_id & AC97_EI_SPDIF) { in patch_alc850_specific()
2887 …err = patch_build_controls(ac97, snd_ac97_spdif_controls_alc655, ARRAY_SIZE(snd_ac97_spdif_control… in patch_alc850_specific()
2899 static int patch_alc850(struct snd_ac97 *ac97) in patch_alc850() argument
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()
2907 snd_ac97_update_bits(ac97, AC97_INT_PAGING, AC97_PAGE_MASK, AC97_PAGE_VENDOR); in patch_alc850()
2916 snd_ac97_write_cache(ac97, AC97_ALC650_MULTICH, 1<<15); in patch_alc850()
2920 snd_ac97_write_cache(ac97, 0x7a, (1<<1)|(1<<4)|(0<<5)|(1<<6)| in patch_alc850()
2925 snd_ac97_write_cache(ac97, 0x76, (0<<0)|(0<<2)|(1<<4)|(1<<7)|(2<<8)| in patch_alc850()
2929 snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); in patch_alc850()
2930 snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); in patch_alc850()
2934 static int patch_aztech_azf3328_specific(struct snd_ac97 *ac97) in patch_aztech_azf3328_specific() argument
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()
2942 * 3D register is different from AC97 standard layout in patch_aztech_azf3328_specific()
2948 snd_ac97_rename_vol_ctl(ac97, in patch_aztech_azf3328_specific()
2958 snd_ac97_rename_vol_ctl(ac97, in patch_aztech_azf3328_specific()
2961 snd_ac97_rename_vol_ctl(ac97, in patch_aztech_azf3328_specific()
2972 static int patch_aztech_azf3328(struct snd_ac97 *ac97) in patch_aztech_azf3328() argument
2974 ac97->build_ops = &patch_aztech_azf3328_ops; in patch_aztech_azf3328()
2981 static void cm9738_update_jacks(struct snd_ac97 *ac97) in cm9738_update_jacks() argument
2984 snd_ac97_update_bits(ac97, AC97_CM9738_VENDOR_CTRL, 1 << 10, in cm9738_update_jacks()
2985 is_shared_surrout(ac97) ? (1 << 10) : 0); in cm9738_update_jacks()
2994 static int patch_cm9738_specific(struct snd_ac97 * ac97) in patch_cm9738_specific() argument
2996 return patch_build_controls(ac97, snd_ac97_cm9738_controls, ARRAY_SIZE(snd_ac97_cm9738_controls)); in patch_cm9738_specific()
3004 static int patch_cm9738(struct snd_ac97 * ac97) in patch_cm9738() argument
3006 ac97->build_ops = &patch_cm9738_ops; in patch_cm9738()
3009 ac97->flags |= AC97_HAS_NO_PCM_VOL; in patch_cm9738()
3010 snd_ac97_write_cache(ac97, AC97_PCM, 0x8000); in patch_cm9738()
3024 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_cmedia_spdif_playback_source_get() local
3027 val = ac97->regs[AC97_CM9739_SPDIF_CTRL]; in snd_ac97_cmedia_spdif_playback_source_get()
3034 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in snd_ac97_cmedia_spdif_playback_source_put() local
3036 return snd_ac97_update_bits(ac97, AC97_CM9739_SPDIF_CTRL, in snd_ac97_cmedia_spdif_playback_source_put()
3059 static void cm9739_update_jacks(struct snd_ac97 *ac97) in cm9739_update_jacks() argument
3062 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 1 << 10, in cm9739_update_jacks()
3063 is_shared_surrout(ac97) ? (1 << 10) : 0); in cm9739_update_jacks()
3065 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 0x3000, in cm9739_update_jacks()
3066 is_shared_clfeout(ac97) ? 0x1000 : 0x2000); in cm9739_update_jacks()
3074 static int patch_cm9739_specific(struct snd_ac97 * ac97) in patch_cm9739_specific() argument
3076 return patch_build_controls(ac97, snd_ac97_cm9739_controls, ARRAY_SIZE(snd_ac97_cm9739_controls)); in patch_cm9739_specific()
3079 static int patch_cm9739_post_spdif(struct snd_ac97 * ac97) in patch_cm9739_post_spdif() argument
3081 …return patch_build_controls(ac97, snd_ac97_cm9739_controls_spdif, ARRAY_SIZE(snd_ac97_cm9739_contr… in patch_cm9739_post_spdif()
3090 static int patch_cm9739(struct snd_ac97 * ac97) in patch_cm9739() argument
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()
3098 snd_ac97_write_cache(ac97, AC97_MASTER, 0x8000); in patch_cm9739()
3099 snd_ac97_write_cache(ac97, AC97_PCM, 0x8000); in patch_cm9739()
3102 val = snd_ac97_read(ac97, AC97_EXTENDED_STATUS); in patch_cm9739()
3105 snd_ac97_write_cache(ac97, AC97_CM9739_SPDIF_CTRL, in patch_cm9739()
3106 snd_ac97_read(ac97, AC97_CM9739_SPDIF_CTRL) | 0x01); 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()
3122 val = snd_ac97_read(ac97, AC97_CM9739_MULTI_CHAN) & (1 << 4); in patch_cm9739()
3125 if (! (ac97->ext_id & AC97_EI_SPDIF)) in patch_cm9739()
3127 snd_ac97_write_cache(ac97, AC97_CM9739_MULTI_CHAN, val); in patch_cm9739()
3130 snd_ac97_write_cache(ac97, 0x70, 0x0100); in patch_cm9739()
3131 snd_ac97_write_cache(ac97, 0x72, 0x0020); 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()
3136 snd_ac97_write_cache(ac97, AC97_CM9739_SPDIF_CTRL, in patch_cm9739()
3137 snd_ac97_read(ac97, AC97_CM9739_SPDIF_CTRL) & ~0x01); in patch_cm9739()
3138 snd_ac97_write_cache(ac97, AC97_CM9739_MULTI_CHAN, in patch_cm9739()
3139 snd_ac97_read(ac97, AC97_CM9739_MULTI_CHAN) | (1 << 14)); in patch_cm9739()
3149 static void cm9761_update_jacks(struct snd_ac97 *ac97) in cm9761_update_jacks() argument
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()
3181 snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3c88, val); in cm9761_update_jacks()
3198 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in cm9761_spdif_out_source_get() local
3200 if (ac97->regs[AC97_CM9761_FUNC] & 0x1) in cm9761_spdif_out_source_get()
3202 else if (ac97->regs[AC97_CM9761_SPDIF_CTRL] & 0x2) in cm9761_spdif_out_source_get()
3211 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); in cm9761_spdif_out_source_put() local
3214 return snd_ac97_update_bits(ac97, AC97_CM9761_FUNC, 0x1, 0x1); in cm9761_spdif_out_source_put()
3215 snd_ac97_update_bits(ac97, AC97_CM9761_FUNC, 0x1, 0); in cm9761_spdif_out_source_put()
3216 return snd_ac97_update_bits(ac97, AC97_CM9761_SPDIF_CTRL, 0x2, in cm9761_spdif_out_source_put()
3244 static int patch_cm9761_post_spdif(struct snd_ac97 * ac97) in patch_cm9761_post_spdif() argument
3246 …return patch_build_controls(ac97, snd_ac97_cm9761_controls_spdif, ARRAY_SIZE(snd_ac97_cm9761_contr… in patch_cm9761_post_spdif()
3249 static int patch_cm9761_specific(struct snd_ac97 * ac97) in patch_cm9761_specific() argument
3251 return patch_build_controls(ac97, snd_ac97_cm9761_controls, ARRAY_SIZE(snd_ac97_cm9761_controls)); in patch_cm9761_specific()
3260 static int patch_cm9761(struct snd_ac97 *ac97) in patch_cm9761() argument
3268 ac97->flags |= /*AC97_HAS_NO_MASTER_VOL |*/ AC97_HAS_NO_PCM_VOL; in patch_cm9761()
3269 snd_ac97_write_cache(ac97, AC97_MASTER, 0x8808); in patch_cm9761()
3270 snd_ac97_write_cache(ac97, AC97_PCM, 0x8808); 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()
3276 val = snd_ac97_read(ac97, AC97_INT_PAGING); in patch_cm9761()
3277 snd_ac97_write_cache(ac97, AC97_INT_PAGING, (val & ~0x0f) | 0x01); in patch_cm9761()
3278 tmp = snd_ac97_read(ac97, 0x60); in patch_cm9761()
3279 ac97->spec.dev_flags = tmp & 1; /* revision B? */ in patch_cm9761()
3280 snd_ac97_write_cache(ac97, AC97_INT_PAGING, val); 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()
3288 ac97->ext_id |= AC97_EI_SPDIF; in patch_cm9761()
3290 snd_ac97_write_cache(ac97, AC97_EXTENDED_STATUS, 0x05c0); 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()
3314 if (ac97->spec.dev_flags) in patch_cm9761()
3319 val = snd_ac97_read(ac97, AC97_CM9761_MULTI_CHAN); in patch_cm9761()
3321 snd_ac97_write_cache(ac97, AC97_CM9761_MULTI_CHAN, val); in patch_cm9761()
3324 snd_ac97_write_cache(ac97, 0x70, 0x0100); in patch_cm9761()
3325 snd_ac97_write_cache(ac97, 0x72, 0x0020); in patch_cm9761()
3347 static int patch_cm9780_specific(struct snd_ac97 *ac97) in patch_cm9780_specific() argument
3349 return patch_build_controls(ac97, cm9780_controls, ARRAY_SIZE(cm9780_controls)); in patch_cm9780_specific()
3357 static int patch_cm9780(struct snd_ac97 *ac97) in patch_cm9780() argument
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()
3366 val = snd_ac97_read(ac97, AC97_CM9780_SPDIF); in patch_cm9780()
3368 snd_ac97_write_cache(ac97, AC97_CM9780_SPDIF, val); in patch_cm9780()
3381 static int patch_vt1613_specific(struct snd_ac97 *ac97) in patch_vt1613_specific() argument
3383 return patch_build_controls(ac97, &snd_ac97_controls_vt1613[0], in patch_vt1613_specific()
3391 static int patch_vt1613(struct snd_ac97 *ac97) in patch_vt1613() argument
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()
3428 static struct snd_kcontrol *snd_ac97_find_mixer_ctl(struct snd_ac97 *ac97, in snd_ac97_find_mixer_ctl() argument
3431 return snd_ctl_find_id_mixer(ac97->bus->card, name); in snd_ac97_find_mixer_ctl()
3435 static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name, in snd_ac97_add_vmaster() argument
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()
3452 static int patch_vt1616_specific(struct snd_ac97 * ac97) in patch_vt1616_specific() argument
3457 if (snd_ac97_try_bit(ac97, 0x5a, 9)) { in patch_vt1616_specific()
3458 err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[0], 1); in patch_vt1616_specific()
3462 …err = patch_build_controls(ac97, &snd_ac97_controls_vt1616[1], ARRAY_SIZE(snd_ac97_controls_vt1616… in patch_vt1616_specific()
3467 kctl = snd_ac97_find_mixer_ctl(ac97, "Master Playback Volume"); in patch_vt1616_specific()
3471 snd_ac97_rename_vol_ctl(ac97, "Master Playback", "Front Playback"); in patch_vt1616_specific()
3473 err = snd_ac97_add_vmaster(ac97, "Master Playback Volume", in patch_vt1616_specific()
3478 err = snd_ac97_add_vmaster(ac97, "Master Playback Switch", in patch_vt1616_specific()
3490 static int patch_vt1616(struct snd_ac97 * ac97) in patch_vt1616() argument
3492 ac97->build_ops = &patch_vt1616_ops; in patch_vt1616()
3586 static int patch_vt1617a(struct snd_ac97 * ac97) in patch_vt1617a() argument
3594 err = patch_build_controls(ac97, &snd_ac97_controls_vt1617a[0], in patch_vt1617a()
3603 val = snd_ac97_read(ac97, 0x5c); in patch_vt1617a()
3605 snd_ac97_write_cache(ac97, 0x5c, 0x20); in patch_vt1617a()
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()
3614 /* VIA VT1618 8 CHANNEL AC97 CODEC
3801 static int patch_vt1618(struct snd_ac97 *ac97) in patch_vt1618() argument
3803 return patch_build_controls(ac97, snd_ac97_controls_vt1618, in patch_vt1618()
3809 static void it2646_update_jacks(struct snd_ac97 *ac97) in it2646_update_jacks() argument
3812 snd_ac97_update_bits(ac97, 0x76, 1 << 9, in it2646_update_jacks()
3813 is_shared_surrout(ac97) ? (1<<9) : 0); in it2646_update_jacks()
3815 snd_ac97_update_bits(ac97, 0x76, 1 << 10, in it2646_update_jacks()
3816 is_shared_clfeout(ac97) ? (1<<10) : 0); in it2646_update_jacks()
3830 static int patch_it2646_specific(struct snd_ac97 * ac97) in patch_it2646_specific() argument
3833 err = patch_build_controls(ac97, snd_ac97_controls_it2646, ARRAY_SIZE(snd_ac97_controls_it2646)); in patch_it2646_specific()
3836 …err = patch_build_controls(ac97, snd_ac97_spdif_controls_it2646, ARRAY_SIZE(snd_ac97_spdif_control… in patch_it2646_specific()
3847 static int patch_it2646(struct snd_ac97 * ac97) in patch_it2646() argument
3849 ac97->build_ops = &patch_it2646_ops; in patch_it2646()
3851 snd_ac97_write_cache(ac97, 0x5E, 0x0808); in patch_it2646()
3852 snd_ac97_write_cache(ac97, 0x7A, 0x0808); in patch_it2646()
3867 static int patch_si3036_specific(struct snd_ac97 * ac97) in patch_si3036_specific() argument
3871 err = snd_ctl_add(ac97->bus->card, snd_ctl_new1(&snd_ac97_controls_si3036[idx], ac97)); in patch_si3036_specific()
3882 static int mpatch_si3036(struct snd_ac97 * ac97) in mpatch_si3036() argument
3884 ac97->build_ops = &patch_si3036_ops; in mpatch_si3036()
3885 snd_ac97_write_cache(ac97, 0x5c, 0xf210 ); in mpatch_si3036()
3886 snd_ac97_write_cache(ac97, 0x68, 0); in mpatch_si3036()
3914 static int patch_lm4550(struct snd_ac97 *ac97) in patch_lm4550() argument
3916 ac97->res_table = lm4550_restbl; in patch_lm4550()