28 #include <linux/slab.h>
29 #include <linux/pci.h>
30 #include <linux/module.h>
40 #define ALC_FRONT_EVENT 0x01
41 #define ALC_DCVOL_EVENT 0x02
42 #define ALC_HP_EVENT 0x04
43 #define ALC_MIC_EVENT 0x08
46 #define GPIO_MASK 0x03
66 unsigned int override:1;
82 #define MAX_VOL_NIDS 0x40
85 #define alc_apply_pincfgs snd_hda_apply_pincfgs
86 #define alc_apply_fixup snd_hda_apply_fixup
87 #define alc_pick_fixup snd_hda_pick_fixup
88 #define alc_fixup hda_fixup
89 #define alc_pincfg hda_pintbl
90 #define alc_model_fixup hda_model_fixup
92 #define ALC_FIXUP_PINS HDA_FIXUP_PINS
93 #define ALC_FIXUP_VERBS HDA_FIXUP_VERBS
94 #define ALC_FIXUP_FUNC HDA_FIXUP_FUNC
96 #define ALC_FIXUP_ACT_PRE_PROBE HDA_FIXUP_ACT_PRE_PROBE
97 #define ALC_FIXUP_ACT_PROBE HDA_FIXUP_ACT_PROBE
98 #define ALC_FIXUP_ACT_INIT HDA_FIXUP_ACT_INIT
99 #define ALC_FIXUP_ACT_BUILD HDA_FIXUP_ACT_BUILD
238 int dir,
unsigned int bits)
242 if (get_wcaps(codec, nid) & (1 << (dir + 1)))
248 #define nid_has_mute(codec, nid, dir) \
249 check_amp_caps(codec, nid, dir, AC_AMPCAP_MUTE)
250 #define nid_has_volume(codec, nid, dir) \
251 check_amp_caps(codec, nid, dir, AC_AMPCAP_NUM_STEPS)
256 static int alc_mux_enum_info(
struct snd_kcontrol *kcontrol,
261 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->
id);
264 if (!spec->
input_mux[mux_idx].num_items && mux_idx > 0)
269 static int alc_mux_enum_get(
struct snd_kcontrol *kcontrol,
274 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
276 ucontrol->
value.enumerated.item[0] = spec->
cur_mux[adc_idx];
280 static bool alc_dyn_adc_pcm_resetup(
struct hda_codec *codec,
int cur)
303 static void call_update_outputs(
struct hda_codec *codec);
304 static void alc_inv_dmic_sync(
struct hda_codec *codec,
bool force);
307 static void update_shared_mic_hp(
struct hda_codec *codec,
bool set_as_mic)
323 if (get_wcaps_type(get_wcaps(codec, vref_pin)) ==
AC_WID_PIN &&
327 snd_hda_set_pin_ctl(codec, vref_pin,
PIN_IN | (set_as_mic ? vref_val : 0));
332 snd_hda_set_pin_ctl(codec, pin, val);
335 call_update_outputs(codec);
339 static int alc_mux_select(
struct hda_codec *codec,
unsigned int adc_idx,
344 unsigned int mux_idx;
345 int i,
type, num_conns;
360 if (spec->
cur_mux[adc_idx] == idx && !force)
365 update_shared_mic_hp(codec, spec->
cur_mux[adc_idx]);
368 alc_dyn_adc_pcm_resetup(codec, idx);
372 nid = get_capsrc(spec, adc_idx);
375 num_conns = snd_hda_get_num_conns(codec, nid);
379 type = get_wcaps_type(get_wcaps(codec, nid));
383 for (i = 0; i < num_conns; i++) {
392 imux->
items[idx].index);
394 alc_inv_dmic_sync(codec,
true);
398 static int alc_mux_enum_put(
struct snd_kcontrol *kcontrol,
402 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
403 return alc_mux_select(codec, adc_idx,
404 ucontrol->
value.enumerated.item[0],
false);
413 unsigned int val =
PIN_IN;
416 snd_hda_set_pin_ctl(codec, nid, val);
435 static const struct hda_verb alc_gpio1_init_verbs[] = {
442 static const struct hda_verb alc_gpio2_init_verbs[] = {
449 static const struct hda_verb alc_gpio3_init_verbs[] = {
461 static void alc_fix_pll(
struct hda_codec *codec)
479 unsigned int coef_idx,
unsigned int coef_bit)
497 for (i = 0; i < num_pins; i++) {
508 bool mute,
bool hp_out)
512 unsigned int pin_bits = mute ? 0 : (hp_out ?
PIN_HP :
PIN_OUT);
515 for (i = 0; i < num_pins; i++) {
532 snd_hda_set_pin_ctl(codec, nid, val);
552 static void update_outputs(
struct hda_codec *codec)
571 spec->
autocfg.speaker_pins, on,
false);
584 spec->
autocfg.line_out_pins, on,
false);
587 static void call_update_outputs(
struct hda_codec *codec)
593 update_outputs(codec);
606 call_update_outputs(codec);
625 call_update_outputs(codec);
628 #define get_connection_index(codec, mux, nid) \
629 snd_hda_get_conn_index(codec, mux, nid, 0)
645 alc_mux_select(codec, 0, spec->
ext_mic_idx,
false);
650 alc_mux_select(codec, 0, spec->
int_mic_idx,
false);
671 kctl->
put(kctl, uctl);
675 static void alc880_unsol_event(
struct hda_codec *codec,
unsigned int res)
683 static void alc_inithook(
struct hda_codec *codec)
685 alc_hp_automute(codec,
NULL);
686 alc_line_automute(codec,
NULL);
687 alc_mic_automute(codec,
NULL);
691 static void alc888_coef_init(
struct hda_codec *codec)
698 if ((tmp & 0xf0) == 0x20)
709 static void alc889_coef_init(
struct hda_codec *codec)
722 if (get_wcaps_type(get_wcaps(codec, nid)) !=
AC_WID_PIN)
730 static void alc_auto_setup_eapd(
struct hda_codec *codec,
bool on)
734 0x0f, 0x10, 0x14, 0x15, 0
737 for (p = pins; *
p; p++)
738 set_eapd(codec, *p, on);
744 static void alc_eapd_shutup(
struct hda_codec *codec)
746 alc_auto_setup_eapd(codec,
false);
751 static void alc_auto_init_amp(
struct hda_codec *codec,
int type)
755 alc_auto_setup_eapd(codec,
true);
786 alc889_coef_init(codec);
789 alc888_coef_init(codec);
813 static int alc_automute_mode_info(
struct snd_kcontrol *kcontrol,
818 static const char *
const texts2[] = {
819 "Disabled",
"Enabled"
821 static const char *
const texts3[] = {
822 "Disabled",
"Speaker Only",
"Line Out+Speaker"
824 const char *
const *texts;
842 static int alc_automute_mode_get(
struct snd_kcontrol *kcontrol,
847 unsigned int val = 0;
853 ucontrol->
value.enumerated.item[0] =
val;
857 static int alc_automute_mode_put(
struct snd_kcontrol *kcontrol,
863 switch (ucontrol->
value.enumerated.item[0]) {
894 call_update_outputs(codec);
900 .name =
"Auto-Mute Mode",
901 .info = alc_automute_mode_info,
902 .get = alc_automute_mode_get,
903 .put = alc_automute_mode_put,
912 static int alc_add_automute_mode_enum(
struct hda_codec *codec)
917 knew = alc_kcontrol_new(spec);
920 *knew = alc_automute_mode_enum;
931 static void alc_init_automute(
struct hda_codec *codec)
963 for (i = 0; i < cfg->
hp_outs; i++) {
967 snd_printdd(
"realtek: Enable HP auto-muting on NID 0x%x\n",
981 "auto-muting on NID 0x%x\n", nid);
997 alc_add_automute_mode_enum(codec);
1004 for (i = 0; i < nums; i++)
1011 static bool alc_check_dyn_adc_switch(
struct hda_codec *codec)
1053 static bool alc_auto_mic_check_imux(
struct hda_codec *codec)
1064 if (!alc_check_dyn_adc_switch(codec)) {
1097 static void alc_init_auto_mic(
struct hda_codec *codec)
1109 fixed = ext = dock = 0;
1112 unsigned int defcfg;
1157 if (!alc_auto_mic_check_imux(codec))
1160 snd_printdd(
"realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1165 static void alc_auto_check_switches(
struct hda_codec *codec)
1167 alc_init_automute(codec);
1168 alc_init_auto_mic(codec);
1178 #define ALC_FIXUP_SKU_IGNORE (2)
1180 static void alc_fixup_sku_ignore(
struct hda_codec *codec,
1190 static int alc_auto_parse_customize_define(
struct hda_codec *codec)
1192 unsigned int ass,
tmp,
i;
1196 spec->
cdefine.enable_pcbeep = 1;
1206 if (ass != codec->
bus->pci->subsystem_device && (ass & 1))
1222 for (i = 1; i < 16; i++) {
1226 if (((ass >> 16) & 0xf) != tmp)
1229 spec->
cdefine.port_connectivity = ass >> 30;
1230 spec->
cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
1231 spec->
cdefine.check_sum = (ass >> 16) & 0xf;
1232 spec->
cdefine.customization = ass >> 8;
1235 spec->
cdefine.external_amp = (ass & 0x38) >> 3;
1236 spec->
cdefine.platform_type = (ass & 0x4) >> 2;
1237 spec->
cdefine.swap = (ass & 0x2) >> 1;
1238 spec->
cdefine.override = ass & 0x1;
1243 spec->
cdefine.port_connectivity);
1258 return find_idx_in_nid_list(nid, list, nums) >= 0;
1270 static int alc_subsystem_id(
struct hda_codec *codec,
1274 unsigned int ass,
tmp,
i;
1286 if ((ass != codec->
bus->pci->subsystem_device) && (ass & 1))
1303 "checking pincfg 0x%08x for NID 0x%x\n",
1307 if ((ass >> 30) != 1)
1312 for (i = 1; i < 16; i++) {
1316 if (((ass >> 16) & 0xf) != tmp)
1319 snd_printd(
"realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
1328 tmp = (ass & 0x38) >> 3;
1348 if (!(ass & 0x8000))
1357 if (!spec->
autocfg.hp_pins[0] &&
1358 !(spec->
autocfg.line_out_pins[0] &&
1361 tmp = (ass >> 11) & 0x3;
1372 if (found_in_nid_list(nid, spec->
autocfg.line_out_pins,
1375 spec->
autocfg.hp_pins[0] = nid;
1384 if (!alc_subsystem_id(codec, ports[0], ports[1], ports[2], ports[3])) {
1387 "Enable default setup for auto mode as fallback\n");
1395 static int alc_read_coef_idx(
struct hda_codec *codec,
1396 unsigned int coef_idx)
1406 static void alc_write_coef_idx(
struct hda_codec *codec,
unsigned int coef_idx,
1407 unsigned int coef_val)
1416 static unsigned int alc_get_coef0(
struct hda_codec *codec)
1420 spec->
coef0 = alc_read_coef_idx(codec, 0);
1429 static void alc_auto_init_digital(
struct hda_codec *codec)
1435 for (i = 0; i < spec->
autocfg.dig_outs; i++) {
1436 pin = spec->
autocfg.dig_out_pins[
i];
1439 snd_hda_set_pin_ctl(codec, pin,
PIN_OUT);
1450 pin = spec->
autocfg.dig_in_pin;
1452 snd_hda_set_pin_ctl(codec, pin,
PIN_IN);
1456 static void alc_auto_parse_digital(
struct hda_codec *codec)
1464 for (i = 0; i < spec->
autocfg.dig_outs; i++) {
1467 spec->
autocfg.dig_out_pins[i],
1473 spec->
multiout.dig_out_nid = dig_nid;
1484 if (spec->
autocfg.dig_in_pin) {
1486 for (i = 0; i < codec->
num_nodes; i++, dig_nid++) {
1487 unsigned int wcaps = get_wcaps(codec, dig_nid);
1507 static int alc_cap_vol_info(
struct snd_kcontrol *kcontrol,
1526 static int alc_cap_vol_tlv(
struct snd_kcontrol *kcontrol,
int op_flag,
1527 unsigned int size,
unsigned int __user *
tlv)
1548 static int alc_cap_getput_caller(
struct snd_kcontrol *kcontrol,
1562 err =
func(kcontrol, ucontrol);
1567 i = snd_ctl_get_ioffidx(kcontrol, &ucontrol->
id);
1576 err =
func(kcontrol, ucontrol);
1578 if (err >= 0 && is_put)
1579 alc_inv_dmic_sync(codec,
false);
1585 static int alc_cap_vol_get(
struct snd_kcontrol *kcontrol,
1588 return alc_cap_getput_caller(kcontrol, ucontrol,
1592 static int alc_cap_vol_put(
struct snd_kcontrol *kcontrol,
1595 return alc_cap_getput_caller(kcontrol, ucontrol,
1600 #define alc_cap_sw_info snd_ctl_boolean_stereo_info
1602 static int alc_cap_sw_get(
struct snd_kcontrol *kcontrol,
1605 return alc_cap_getput_caller(kcontrol, ucontrol,
1609 static int alc_cap_sw_put(
struct snd_kcontrol *kcontrol,
1612 return alc_cap_getput_caller(kcontrol, ucontrol,
1616 #define _DEFINE_CAPMIX(num) \
1618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1619 .name = "Capture Switch", \
1620 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \
1622 .info = alc_cap_sw_info, \
1623 .get = alc_cap_sw_get, \
1624 .put = alc_cap_sw_put, \
1627 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1628 .name = "Capture Volume", \
1629 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1630 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
1631 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK), \
1633 .info = alc_cap_vol_info, \
1634 .get = alc_cap_vol_get, \
1635 .put = alc_cap_vol_put, \
1636 .tlv = { .c = alc_cap_vol_tlv }, \
1639 #define _DEFINE_CAPSRC(num) \
1641 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1643 .name = "Input Source", \
1645 .info = alc_mux_enum_info, \
1646 .get = alc_mux_enum_get, \
1647 .put = alc_mux_enum_put, \
1650 #define DEFINE_CAPMIX(num) \
1651 static const struct snd_kcontrol_new alc_capture_mixer ## num[] = { \
1652 _DEFINE_CAPMIX(num), \
1653 _DEFINE_CAPSRC(num), \
1657 #define DEFINE_CAPMIX_NOSRC(num) \
1658 static const struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \
1659 _DEFINE_CAPMIX(num), \
1686 static void alc_inv_dmic_sync(
struct hda_codec *codec,
bool force)
1697 bool dmic_fixup =
false;
1704 if (!dmic_fixup && !force)
1726 static int alc_inv_dmic_sw_get(
struct snd_kcontrol *kcontrol,
1736 static int alc_inv_dmic_sw_put(
struct snd_kcontrol *kcontrol,
1741 unsigned int val = !ucontrol->
value.integer.value[0];
1746 alc_inv_dmic_sync(codec,
true);
1753 .get = alc_inv_dmic_sw_get,
1754 .put = alc_inv_dmic_sw_put,
1763 *knew = alc_inv_dmic_sw;
1774 static void alc_fixup_inv_dmic_0x12(
struct hda_codec *codec,
1778 alc_add_inv_dmic_mixer(codec, 0x12);
1788 static const char *
const alc_slave_pfxs[] = {
1789 "Front",
"Surround",
"Center",
"LFE",
"Side",
1790 "Headphone",
"Speaker",
"Mono",
"Line Out",
1791 "CLFE",
"Bass Speaker",
"PCM",
1799 #define NID_MAPPING (-1)
1801 #define SUBDEV_SPEAKER_ (0 << 6)
1802 #define SUBDEV_HP_ (1 << 6)
1803 #define SUBDEV_LINE_ (2 << 6)
1804 #define SUBDEV_SPEAKER(x) (SUBDEV_SPEAKER_ | ((x) & 0x3f))
1805 #define SUBDEV_HP(x) (SUBDEV_HP_ | ((x) & 0x3f))
1806 #define SUBDEV_LINE(x) (SUBDEV_LINE_ | ((x) & 0x3f))
1808 static void alc_free_kctls(
struct hda_codec *codec);
1810 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1819 static int __alc_build_controls(
struct hda_codec *codec)
1858 #ifdef CONFIG_SND_HDA_INPUT_BEEP
1862 for (knew = alc_beep_mixer; knew->
name; knew++) {
1878 unsigned int vmaster_tlv[4];
1882 vmaster_tlv, alc_slave_pfxs,
1890 NULL, alc_slave_pfxs,
1902 for (i = 0; kctl && i < kctl->
count; i++) {
1904 get_capsrc(spec, i));
1910 const char *kname = kctl ? kctl->
id.name :
NULL;
1915 for (i = 0; kctl && i < kctl->
count; i++) {
1926 for (knew = spec->
mixers[i]; knew->
name; knew++) {
1933 for (j = 0; j < 4; j++, u >>= 8) {
1939 nid = spec->
autocfg.speaker_pins[nid];
1942 nid = spec->
autocfg.line_out_pins[nid];
1945 nid = spec->
autocfg.hp_pins[nid];
1955 for (j = 0; j < 4; j++, u >>= 8) {
1966 alc_free_kctls(codec);
1971 static int alc_build_jacks(
struct hda_codec *codec)
1977 int nid = spec->
autocfg.inputs[1].pin;
1989 static int alc_build_controls(
struct hda_codec *codec)
1991 int err = __alc_build_controls(codec);
1995 err = alc_build_jacks(codec);
2007 static void alc_init_special_input_src(
struct hda_codec *codec);
2008 static void alc_auto_init_std(
struct hda_codec *codec);
2010 static int alc_init(
struct hda_codec *codec)
2018 alc_auto_init_amp(codec, spec->
init_amp);
2021 alc_init_special_input_src(codec);
2022 alc_auto_init_std(codec);
2026 hda_call_check_power_status(codec, 0x01);
2050 static int alc_playback_pcm_prepare(
struct hda_pcm_stream *hinfo,
2052 unsigned int stream_tag,
2058 stream_tag, format, substream);
2061 static int alc_playback_pcm_cleanup(
struct hda_pcm_stream *hinfo,
2072 static int alc_dig_playback_pcm_open(
struct hda_pcm_stream *hinfo,
2080 static int alc_dig_playback_pcm_prepare(
struct hda_pcm_stream *hinfo,
2082 unsigned int stream_tag,
2088 stream_tag, format, substream);
2091 static int alc_dig_playback_pcm_cleanup(
struct hda_pcm_stream *hinfo,
2099 static int alc_dig_playback_pcm_close(
struct hda_pcm_stream *hinfo,
2110 static int alc_alt_capture_pcm_prepare(
struct hda_pcm_stream *hinfo,
2112 unsigned int stream_tag,
2119 stream_tag, 0, format);
2123 static int alc_alt_capture_pcm_cleanup(
struct hda_pcm_stream *hinfo,
2135 static int dyn_adc_capture_pcm_prepare(
struct hda_pcm_stream *hinfo,
2137 unsigned int stream_tag,
2149 static int dyn_adc_capture_pcm_cleanup(
struct hda_pcm_stream *hinfo,
2159 static const struct hda_pcm_stream dyn_adc_pcm_analog_capture = {
2165 .prepare = dyn_adc_capture_pcm_prepare,
2166 .cleanup = dyn_adc_capture_pcm_cleanup
2178 .open = alc_playback_pcm_open,
2179 .prepare = alc_playback_pcm_prepare,
2180 .cleanup = alc_playback_pcm_cleanup
2191 static const struct hda_pcm_stream alc_pcm_analog_alt_playback = {
2198 static const struct hda_pcm_stream alc_pcm_analog_alt_capture = {
2204 .prepare = alc_alt_capture_pcm_prepare,
2205 .cleanup = alc_alt_capture_pcm_cleanup
2215 .open = alc_dig_playback_pcm_open,
2216 .close = alc_dig_playback_pcm_close,
2217 .prepare = alc_dig_playback_pcm_prepare,
2218 .cleanup = alc_dig_playback_pcm_cleanup
2236 static int alc_build_pcms(
struct hda_codec *codec)
2241 bool have_multi_adcs;
2257 p = &alc_pcm_analog_playback;
2267 p = &dyn_adc_pcm_analog_capture;
2269 p = &alc_pcm_analog_capture;
2301 p = &alc_pcm_digital_playback;
2308 p = &alc_pcm_digital_capture;
2333 p = &alc_pcm_analog_alt_playback;
2339 alc_pcm_null_stream;
2342 if (have_multi_adcs) {
2345 p = &alc_pcm_analog_alt_capture;
2353 alc_pcm_null_stream;
2361 static inline void alc_shutup(
struct hda_codec *codec)
2365 if (spec && spec->
shutup)
2370 static void alc_free_kctls(
struct hda_codec *codec)
2374 if (spec->
kctls.list) {
2377 for (i = 0; i < spec->
kctls.used; i++)
2383 static void alc_free_bind_ctls(
struct hda_codec *codec)
2389 for (i = 0; i < spec->
bind_ctls.used; i++)
2395 static void alc_free(
struct hda_codec *codec)
2403 alc_free_kctls(codec);
2404 alc_free_bind_ctls(codec);
2405 snd_hda_gen_free(&spec->
gen);
2411 static void alc_power_eapd(
struct hda_codec *codec)
2413 alc_auto_setup_eapd(codec,
false);
2416 static int alc_suspend(
struct hda_codec *codec)
2420 if (spec && spec->power_hook)
2421 spec->power_hook(codec);
2427 static int alc_resume(
struct hda_codec *codec)
2431 snd_hda_codec_resume_amp(codec);
2432 snd_hda_codec_resume_cache(codec);
2433 alc_inv_dmic_sync(codec,
true);
2434 hda_call_check_power_status(codec, 0x01);
2442 .build_controls = alc_build_controls,
2443 .build_pcms = alc_build_pcms,
2448 .resume = alc_resume,
2451 .suspend = alc_suspend,
2452 .check_power_status = alc_check_power_status,
2454 .reboot_notify = alc_shutup,
2459 static int alc_codec_rename(
struct hda_codec *codec,
const char *
name)
2481 { 0x10ec0269, 0xfff0, 0x3010,
"ALC277" },
2482 { 0x10ec0269, 0xf0f0, 0x2010,
"ALC259" },
2483 { 0x10ec0269, 0xf0f0, 0x3010,
"ALC258" },
2484 { 0x10ec0269, 0x00f0, 0x0010,
"ALC269VB" },
2485 { 0x10ec0269, 0xffff, 0xa023,
"ALC259" },
2486 { 0x10ec0269, 0xffff, 0x6023,
"ALC281X" },
2487 { 0x10ec0269, 0x00f0, 0x0020,
"ALC269VC" },
2488 { 0x10ec0269, 0x00f0, 0x0030,
"ALC269VD" },
2489 { 0x10ec0887, 0x00f0, 0x0030,
"ALC887-VD" },
2490 { 0x10ec0888, 0x00f0, 0x0030,
"ALC888-VD" },
2491 { 0x10ec0888, 0xf0f0, 0x3020,
"ALC886" },
2492 { 0x10ec0899, 0x2000, 0x2000,
"ALC899" },
2493 { 0x10ec0892, 0xffff, 0x8020,
"ALC661" },
2494 { 0x10ec0892, 0xffff, 0x8011,
"ALC661" },
2495 { 0x10ec0892, 0xffff, 0x4011,
"ALC656" },
2499 static int alc_codec_rename_from_preset(
struct hda_codec *codec)
2503 for (p = rename_tbl; p->
vendor_id; p++) {
2507 return alc_codec_rename(codec, p->
name);
2532 static int add_control(
struct alc_spec *spec,
int type,
const char *name,
2533 int cidx,
unsigned long val)
2537 knew = alc_kcontrol_new(spec);
2540 *knew = alc_control_templates[
type];
2551 static int add_control_with_pfx(
struct alc_spec *spec,
int type,
2552 const char *pfx,
const char *dir,
2553 const char *sfx,
int cidx,
unsigned long val)
2556 snprintf(name,
sizeof(name),
"%s %s %s", pfx, dir, sfx);
2557 return add_control(spec, type, name, cidx, val);
2560 #define add_pb_vol_ctrl(spec, type, pfx, val) \
2561 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", 0, val)
2562 #define add_pb_sw_ctrl(spec, type, pfx, val) \
2563 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", 0, val)
2564 #define __add_pb_vol_ctrl(spec, type, pfx, cidx, val) \
2565 add_control_with_pfx(spec, type, pfx, "Playback", "Volume", cidx, val)
2566 #define __add_pb_sw_ctrl(spec, type, pfx, cidx, val) \
2567 add_control_with_pfx(spec, type, pfx, "Playback", "Switch", cidx, val)
2569 static const char *
const channel_name[4] = {
2570 "Front",
"Surround",
"CLFE",
"Side"
2573 static const char *alc_get_line_out_pfx(
struct alc_spec *spec,
int ch,
2574 bool can_be_master,
int *
index)
2588 return ch ?
"Bass Speaker" :
"Speaker";
2606 return channel_name[ch];
2615 if (spec->num_loopbacks >=
ARRAY_SIZE(spec->loopback_list) - 1)
2617 list = spec->loopback_list + spec->num_loopbacks;
2621 spec->num_loopbacks++;
2622 spec->loopback.amplist = spec->loopback_list;
2625 #define add_loopback_list(spec, mix, idx)
2630 const char *ctlname,
int ctlidx,
2654 static int alc_auto_fill_adc_caps(
struct hda_codec *codec)
2664 for (i = 0; i < codec->
num_nodes; i++, nid++) {
2666 unsigned int caps = get_wcaps(codec, nid);
2667 int type = get_wcaps_type(caps);
2671 adc_nids[nums] = nid;
2672 cap_nids[nums] = nid;
2676 type = get_wcaps_type(get_wcaps(codec, src));
2680 cap_nids[nums] =
src;
2683 n = snd_hda_get_num_conns(codec, src);
2685 cap_nids[nums] =
src;
2692 if (++nums >= max_nums)
2702 static int alc_auto_create_input_ctls(
struct hda_codec *codec)
2710 const char *prev_label =
NULL;
2712 num_adcs = alc_auto_fill_adc_caps(codec);
2721 if (!alc_is_input_pin(codec, pin))
2726 label =
"Headphone Mic";
2727 if (prev_label && !
strcmp(label, prev_label))
2736 err = new_analog_input(spec, pin,
2744 for (c = 0; c < num_adcs; c++) {
2762 static int alc_auto_create_shared_input(
struct hda_codec *codec)
2766 unsigned int defcfg;
2786 cfg->
inputs[1].pin = nid;
2790 snd_printdd(
"realtek: Enable shared I/O jack on NID 0x%x\n", nid);
2795 unsigned int pin_type)
2797 snd_hda_set_pin_ctl(codec, nid, pin_type);
2812 static void alc_auto_init_analog_input(
struct hda_codec *codec)
2820 if (alc_is_input_pin(codec, nid)) {
2821 alc_set_input_pin(codec, nid, cfg->
inputs[i].type);
2831 int nums = snd_hda_get_num_conns(codec, spec->
mixer_nid);
2832 for (i = 0; i < nums; i++)
2848 for (i = 0; i < num; i++) {
2874 pin = alc_go_down_to_selector(codec, pin);
2876 for (i = 0; i < num; i++) {
2877 if (alc_auto_mix_to_dac(codec, mix[i]) == dac)
2890 pin = alc_go_down_to_selector(codec, pin);
2894 for (i = 0; i < num; i++) {
2895 if (alc_auto_mix_to_dac(codec, mix[i]) == dac) {
2908 if (found_in_nid_list(nid, spec->
multiout.dac_nids,
2910 found_in_nid_list(nid, spec->
multiout.hp_out_nid,
2912 found_in_nid_list(nid, spec->
multiout.extra_out_nid,
2928 pin = alc_go_down_to_selector(codec, pin);
2930 for (i = 0; i < num; i++) {
2931 hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
2934 if (!alc_is_dac_already_used(codec, nid))
2941 static bool alc_auto_is_dac_reachable(
struct hda_codec *codec,
2949 pin = alc_go_down_to_selector(codec, pin);
2951 for (i = 0; i < num; i++) {
2952 hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
2967 return alc_auto_look_for_dac(codec, pin);
2969 for (i = 0; i < num; i++) {
2972 nid = alc_auto_mix_to_dac(codec, srcs[i]);
2973 if (nid && !alc_is_dac_already_used(codec, nid)) {
2985 static inline unsigned int get_ctl_pos(
unsigned int data)
2992 return (nid << 1) | dir;
2995 #define is_ctl_used(bits, data) \
2996 test_bit(get_ctl_pos(data), bits)
2997 #define mark_ctl_usage(bits, data) \
2998 set_bit(get_ctl_pos(data), bits)
3000 static void clear_vol_marks(
struct hda_codec *codec)
3003 memset(spec->vol_ctls, 0,
sizeof(spec->vol_ctls));
3004 memset(spec->sw_ctls, 0,
sizeof(spec->sw_ctls));
3042 nid = alc_look_for_out_vol_nid(codec, pin, dac);
3051 nid = alc_look_for_out_mute_nid(codec, pin, dac);
3053 unsigned int wid_type = get_wcaps_type(get_wcaps(codec, nid));
3095 static int alc_auto_fill_dacs(
struct hda_codec *codec,
int num_outs,
3108 for (i = 0; i < num_outs; i++) {
3111 dacs[
i] = alc_auto_look_for_dac(codec, pin);
3112 if (!dacs[i] && !i) {
3113 for (j = 1; j < num_outs; j++) {
3114 if (alc_auto_is_dac_reachable(codec, pin, dacs[j])) {
3123 if (alc_auto_is_dac_reachable(codec, pin, dacs[0]))
3126 alc_auto_is_dac_reachable(codec, pin,
3136 }
else if (alc_auto_is_dac_reachable(codec, pin,
3146 badness += eval_shared_vol_badness(codec, pin, dac);
3152 static int alc_auto_fill_multi_ios(
struct hda_codec *codec,
3154 bool hardwired,
int offset);
3156 static bool alc_map_singles(
struct hda_codec *codec,
int outs,
3161 for (i = 0; i < outs; i++) {
3164 dacs[
i] = get_dac_if_single(codec, pins[i]);
3172 static int fill_and_eval_dacs(
struct hda_codec *codec,
3173 bool fill_hardwired,
3174 bool fill_mio_first)
3178 int i,
err, badness;
3187 clear_vol_marks(codec);
3191 if (fill_hardwired) {
3194 mapped = alc_map_singles(codec, cfg->
line_outs,
3197 mapped |= alc_map_singles(codec, cfg->
hp_outs,
3203 if (fill_mio_first && cfg->
line_outs == 1 &&
3205 err = alc_auto_fill_multi_ios(codec, cfg->
line_out_pins[0],
true, 0);
3229 if (fill_mio_first &&
3232 err = alc_auto_fill_multi_ios(codec, cfg->
line_out_pins[0],
false, 0);
3241 &extra_out_badness);
3250 &extra_out_badness);
3256 err = alc_auto_fill_multi_ios(codec, cfg->
line_out_pins[0],
false, 0);
3266 err = alc_auto_fill_multi_ios(codec, cfg->
hp_pins[0],
false,
3274 for (i = 0; i < 2; i++)
3286 #define DEBUG_BADNESS
3288 #ifdef DEBUG_BADNESS
3289 #define debug_badness snd_printdd
3291 #define debug_badness(...)
3324 static int alc_auto_fill_dac_nids(
struct hda_codec *codec)
3331 bool fill_hardwired =
true, fill_mio_first =
true;
3332 bool best_wired =
true, best_mio =
true;
3333 bool hp_spk_swapped =
false;
3341 badness = fill_and_eval_dacs(codec, fill_hardwired,
3347 debug_badness(
"==> lo_type=%d, wired=%d, mio=%d, badness=0x%x\n",
3350 debug_show_configs(spec, cfg);
3351 if (badness < best_badness) {
3352 best_badness = badness;
3354 best_wired = fill_hardwired;
3355 best_mio = fill_mio_first;
3359 fill_mio_first = !fill_mio_first;
3360 if (!fill_mio_first)
3362 fill_hardwired = !fill_hardwired;
3363 if (!fill_hardwired)
3367 hp_spk_swapped =
true;
3379 fill_hardwired =
true;
3393 fill_hardwired =
true;
3401 fill_and_eval_dacs(codec, best_wired, best_mio);
3403 debug_badness(
"==> Best config: lo_type=%d, wired=%d, mio=%d\n",
3405 debug_show_configs(spec, cfg);
3413 clear_vol_marks(codec);
3418 static int alc_auto_add_vol_ctl(
struct hda_codec *codec,
3419 const char *pfx,
int cidx,
3434 static int alc_auto_add_stereo_vol(
struct hda_codec *codec,
3435 const char *pfx,
int cidx,
3441 return alc_auto_add_vol_ctl(codec, pfx, cidx, nid, chs);
3447 static int alc_auto_add_sw_ctl(
struct hda_codec *codec,
3448 const char *pfx,
int cidx,
3457 wid_type = get_wcaps_type(get_wcaps(codec, nid));
3461 }
else if (snd_hda_get_num_conns(codec, nid) == 1) {
3474 static int alc_auto_add_stereo_sw(
struct hda_codec *codec,
const char *pfx,
3480 return alc_auto_add_sw_ctl(codec, pfx, cidx, nid, chs);
3486 hda_nid_t mix = alc_auto_dac_to_mix(codec, pin, dac);
3499 hda_nid_t mix = alc_auto_dac_to_mix(codec, pin, dac);
3510 static int alc_auto_create_multi_out_ctls(
struct hda_codec *codec,
3514 int i,
err, noutputs;
3520 for (i = 0; i < noutputs; i++) {
3532 name = channel_name[
i];
3535 name = alc_get_line_out_pfx(spec, i,
true, &index);
3538 sw = alc_look_for_out_mute_nid(codec, pin, dac);
3539 vol = alc_look_for_out_vol_nid(codec, pin, dac);
3540 if (!name || !
strcmp(name,
"CLFE")) {
3542 err = alc_auto_add_vol_ctl(codec,
"Center", 0, vol, 1);
3545 err = alc_auto_add_vol_ctl(codec,
"LFE", 0, vol, 2);
3548 err = alc_auto_add_sw_ctl(codec,
"Center", 0, sw, 1);
3551 err = alc_auto_add_sw_ctl(codec,
"LFE", 0, sw, 2);
3555 err = alc_auto_add_stereo_vol(codec, name, index, vol);
3558 err = alc_auto_add_stereo_sw(codec, name, index, sw);
3587 sw = alc_look_for_out_mute_nid(codec, pin, dac);
3588 vol = alc_look_for_out_vol_nid(codec, pin, dac);
3589 err = alc_auto_add_stereo_vol(codec, pfx, cidx, vol);
3592 err = alc_auto_add_stereo_sw(codec, pfx, cidx, sw);
3604 snd_array_init(&spec->
bind_ctls,
sizeof(ctl), 8);
3608 ctl = kzalloc(
sizeof(*ctl) +
sizeof(
long) * (nums + 1),
GFP_KERNEL);
3616 static int alc_auto_create_extra_outs(
struct hda_codec *codec,
int num_pins,
3626 if (!num_pins || !pins[0])
3629 if (num_pins == 1) {
3633 return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0);
3636 for (i = 0; i < num_pins; i++) {
3638 if (dacs[num_pins - 1])
3642 if (num_pins == 2 && i == 1 && !
strcmp(pfx,
"Speaker")) {
3643 err = alc_auto_create_extra_out(codec, pins[i], dac,
3645 }
else if (num_pins >= 3) {
3646 snprintf(name,
sizeof(name),
"%s %s",
3647 pfx, channel_name[i]);
3648 err = alc_auto_create_extra_out(codec, pins[i], dac,
3651 err = alc_auto_create_extra_out(codec, pins[i], dac,
3657 if (dacs[num_pins - 1])
3665 for (i = 0; i < num_pins; i++) {
3667 if (!pins[i] || !dacs[i])
3669 vol = alc_look_for_out_vol_nid(codec, pins[i], dacs[i]);
3675 snprintf(name,
sizeof(name),
"%s Playback Volume", pfx);
3683 static int alc_auto_create_hp_out(
struct hda_codec *codec)
3686 return alc_auto_create_extra_outs(codec, spec->
autocfg.hp_outs,
3692 static int alc_auto_create_speaker_out(
struct hda_codec *codec)
3695 return alc_auto_create_extra_outs(codec, spec->
autocfg.speaker_outs,
3701 static void alc_auto_set_output_and_unmute(
struct hda_codec *codec,
3709 alc_set_pin_output(codec, pin, pin_type);
3710 nid = alc_go_down_to_selector(codec, pin);
3712 for (i = 0; i < num; i++) {
3713 if (alc_auto_mix_to_dac(codec, srcs[i]) != dac)
3732 nid = alc_look_for_out_vol_nid(codec, pin, dac);
3738 nid = alc_look_for_out_mute_nid(codec, pin, dac);
3744 static void alc_auto_init_multi_out(
struct hda_codec *codec)
3747 int pin_type = get_pin_type(spec->
autocfg.line_out_type);
3753 alc_auto_set_output_and_unmute(codec, nid, pin_type,
3758 static void alc_auto_init_extra_out(
struct hda_codec *codec)
3764 for (i = 0; i < spec->
autocfg.hp_outs; i++) {
3772 if (i > 0 && spec->
multiout.hp_out_nid[0])
3773 dac = spec->
multiout.hp_out_nid[0];
3777 alc_auto_set_output_and_unmute(codec, pin,
PIN_HP, dac);
3779 for (i = 0; i < spec->
autocfg.speaker_outs; i++) {
3782 pin = spec->
autocfg.speaker_pins[
i];
3787 if (i > 0 && spec->
multiout.extra_out_nid[0])
3788 dac = spec->
multiout.extra_out_nid[0];
3792 alc_auto_set_output_and_unmute(codec, pin,
PIN_OUT, dac);
3797 static bool can_be_multiio_pin(
struct hda_codec *codec,
3800 unsigned int defcfg,
caps;
3821 static int alc_auto_fill_multi_ios(
struct hda_codec *codec,
3823 bool hardwired,
int offset)
3827 int type,
i,
j, dacs, num_pins, old_pins;
3839 if (cfg->
inputs[i].type != type)
3841 if (can_be_multiio_pin(codec, location,
3855 if (cfg->
inputs[i].type != type)
3857 if (!can_be_multiio_pin(codec, location, nid))
3863 if (j < spec->multi_ios)
3866 if (offset && offset + spec->
multi_ios < dacs) {
3868 if (!alc_auto_is_dac_reachable(codec, nid, dac))
3872 dac = get_dac_if_single(codec, nid);
3874 dac = alc_auto_look_for_dac(codec, nid);
3895 if (!hardwired && spec->
multi_ios < 2) {
3903 static int alc_auto_ch_mode_info(
struct snd_kcontrol *kcontrol,
3919 static int alc_auto_ch_mode_get(
struct snd_kcontrol *kcontrol,
3928 static int alc_set_multi_io(
struct hda_codec *codec,
int idx,
bool output)
3938 snd_hda_set_pin_ctl_cache(codec, nid,
PIN_OUT);
3939 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
3942 alc_auto_select_dac(codec, nid, spec->
multi_io[idx].dac);
3944 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
3947 snd_hda_set_pin_ctl_cache(codec, nid,
3953 static int alc_auto_ch_mode_put(
struct snd_kcontrol *kcontrol,
3960 ch = ucontrol->
value.enumerated.item[0];
3967 alc_set_multi_io(codec, i, i < ch);
3976 .name =
"Channel Mode",
3977 .info = alc_auto_ch_mode_info,
3978 .get = alc_auto_ch_mode_get,
3979 .put = alc_auto_ch_mode_put,
3982 static int alc_auto_add_multi_channel_mode(
struct hda_codec *codec)
3989 knew = alc_kcontrol_new(spec);
3992 *knew = alc_auto_channel_mode_enum;
4003 static void alc_remove_invalid_adc_nids(
struct hda_codec *codec)
4021 int num_conns = snd_hda_get_num_conns(codec, cap);
4027 }
else if (num_conns <= imux->
items[i].index)
4032 capsrc_nids[nums++] =
cap;
4037 if (!alc_check_dyn_adc_switch(codec)) {
4044 " using fallback 0x%x\n",
4059 alc_auto_mic_check_imux(codec);
4067 static void alc_auto_init_adc(
struct hda_codec *codec,
int adc_idx)
4089 static void alc_auto_init_input_src(
struct hda_codec *codec)
4095 alc_auto_init_adc(codec, c);
4100 for (c = 0; c < nums; c++)
4101 alc_mux_select(codec, c, spec->
cur_mux[c],
true);
4105 static int alc_auto_add_mic_boost(
struct hda_codec *codec)
4112 const char *prev_label =
NULL;
4120 char boost_label[32];
4124 label =
"Headphone Mic";
4125 if (prev_label && !
strcmp(label, prev_label))
4131 snprintf(boost_label,
sizeof(boost_label),
4132 "%s Boost Volume", label);
4134 boost_label, type_idx,
4150 }
else if (snd_hda_get_num_conns(codec, cap) > 1) {
4171 select_or_unmute_capsrc(codec, cap, idx);
4178 static void alc_init_special_input_src(
struct hda_codec *codec)
4183 for (i = 0; i < spec->
autocfg.num_inputs; i++)
4184 init_capsrc_for_pin(codec, spec->
autocfg.inputs[i].pin);
4188 static void set_capture_mixer(
struct hda_codec *codec)
4192 { alc_capture_mixer_nosrc1,
4193 alc_capture_mixer_nosrc2,
4194 alc_capture_mixer_nosrc3 },
4195 { alc_capture_mixer1,
4197 alc_capture_mixer3 },
4227 spec->
cap_mixer = caps[mux][num_adcs - 1];
4234 static void alc_auto_init_std(
struct hda_codec *codec)
4236 alc_auto_init_multi_out(codec);
4237 alc_auto_init_extra_out(codec);
4238 alc_auto_init_analog_input(codec);
4239 alc_auto_init_input_src(codec);
4240 alc_auto_init_digital(codec);
4241 alc_inithook(codec);
4247 #ifdef CONFIG_SND_HDA_INPUT_BEEP
4248 #define set_beep_amp(spec, nid, idx, dir) \
4249 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
4251 static const struct snd_pci_quirk beep_white_list[] = {
4252 SND_PCI_QUIRK(0x1043, 0x103c,
"ASUS", 1),
4253 SND_PCI_QUIRK(0x1043, 0x829f,
"ASUS", 1),
4254 SND_PCI_QUIRK(0x1043, 0x83ce,
"EeePC", 1),
4255 SND_PCI_QUIRK(0x1043, 0x831a,
"EeePC", 1),
4256 SND_PCI_QUIRK(0x1043, 0x834a,
"EeePC", 1),
4257 SND_PCI_QUIRK(0x1458, 0xa002,
"GA-MA790X", 1),
4258 SND_PCI_QUIRK(0x8086, 0xd613,
"Intel", 1),
4265 const struct snd_pci_quirk *
q;
4266 q = snd_pci_quirk_lookup(codec->
bus->pci, beep_white_list);
4269 return spec->
cdefine.enable_pcbeep;
4272 #define set_beep_amp(spec, nid, idx, dir)
4273 #define has_cdefine_beep(codec) 0
4280 static int alc_parse_auto_config(
struct hda_codec *codec,
4315 err = alc_auto_fill_dac_nids(codec);
4318 err = alc_auto_add_multi_channel_mode(codec);
4321 err = alc_auto_create_multi_out_ctls(codec, cfg);
4324 err = alc_auto_create_hp_out(codec);
4327 err = alc_auto_create_speaker_out(codec);
4330 err = alc_auto_create_shared_input(codec);
4333 err = alc_auto_create_input_ctls(codec);
4340 alc_auto_parse_digital(codec);
4343 alc_remove_invalid_adc_nids(codec);
4346 alc_ssid_check(codec, ssid_nids);
4349 alc_auto_check_switches(codec);
4350 err = alc_auto_add_mic_boost(codec);
4355 if (spec->
kctls.list)
4356 add_mixer(spec, spec->
kctls.list);
4359 set_capture_mixer(codec);
4374 snd_hda_gen_init(&spec->
gen);
4376 err = alc_codec_rename_from_preset(codec);
4384 static int alc880_parse_auto_config(
struct hda_codec *codec)
4386 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
4387 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
4388 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
4420 static void alc880_fixup_vol_knob(
struct hda_codec *codec,
4421 const struct alc_fixup *fix,
int action)
4427 static const struct alc_fixup alc880_fixups[] = {
4430 .v.verbs = alc_gpio1_init_verbs,
4434 .v.verbs = alc_gpio2_init_verbs,
4438 .v.verbs = (
const struct hda_verb[]) {
4450 { 0x16, 0x411111f0 },
4451 { 0x18, 0x411111f0 },
4452 { 0x1a, 0x411111f0 },
4460 { 0x17, 0x411111f0 },
4468 .v.verbs = (
const struct hda_verb[]) {
4477 .v.verbs = (
const struct hda_verb[]) {
4488 .v.func = alc880_fixup_vol_knob,
4494 { 0x14, 0x0121411f },
4495 { 0x15, 0x99030120 },
4496 { 0x16, 0x99030130 },
4497 { 0x17, 0x411111f0 },
4498 { 0x18, 0x411111f0 },
4499 { 0x19, 0x01a19950 },
4500 { 0x1a, 0x411111f0 },
4501 { 0x1b, 0x411111f0 },
4502 { 0x1c, 0x411111f0 },
4503 { 0x1d, 0x411111f0 },
4504 { 0x1e, 0x01454140 },
4514 { 0x14, 0x0121411f },
4515 { 0x15, 0x99030120 },
4516 { 0x16, 0x411111f0 },
4517 { 0x17, 0x411111f0 },
4518 { 0x18, 0x411111f0 },
4519 { 0x19, 0x01a19950 },
4520 { 0x1a, 0x411111f0 },
4521 { 0x1b, 0x411111f0 },
4522 { 0x1c, 0x411111f0 },
4523 { 0x1d, 0x411111f0 },
4524 { 0x1e, 0x411111f0 },
4534 { 0x14, 0x0121411f },
4535 { 0x15, 0x99030120 },
4536 { 0x16, 0x99030130 },
4544 { 0x17, 0x411111f0 },
4545 { 0x19, 0x411111f0 },
4546 { 0x1b, 0x411111f0 },
4547 { 0x1f, 0x411111f0 },
4555 { 0x14, 0x99030120 },
4556 { 0x15, 0x0121411f },
4557 { 0x16, 0x411111f0 },
4558 { 0x17, 0x411111f0 },
4559 { 0x18, 0x01a19950 },
4560 { 0x19, 0x411111f0 },
4561 { 0x1a, 0x01813031 },
4562 { 0x1b, 0x411111f0 },
4563 { 0x1c, 0x411111f0 },
4564 { 0x1d, 0x411111f0 },
4565 { 0x1e, 0x0144111e },
4572 { 0x14, 0x01014010 },
4573 { 0x15, 0x411111f0 },
4574 { 0x16, 0x411111f0 },
4575 { 0x17, 0x411111f0 },
4576 { 0x18, 0x01a19c30 },
4577 { 0x19, 0x0121411f },
4578 { 0x1a, 0x01813031 },
4579 { 0x1b, 0x02a19c40 },
4580 { 0x1c, 0x411111f0 },
4581 { 0x1d, 0x411111f0 },
4583 { 0x1f, 0x411111f0 },
4590 { 0x1e, 0x411111f0 },
4599 { 0x1e, 0x0144111e },
4608 { 0x14, 0x01014010 },
4609 { 0x15, 0x411111f0 },
4610 { 0x16, 0x01011411 },
4611 { 0x17, 0x01016412 },
4612 { 0x18, 0x01a19c30 },
4613 { 0x19, 0x0121411f },
4614 { 0x1a, 0x01813031 },
4615 { 0x1b, 0x02a19c40 },
4616 { 0x1c, 0x411111f0 },
4617 { 0x1d, 0x411111f0 },
4619 { 0x1f, 0x411111f0 },
4626 { 0x1e, 0x411111f0 },
4635 { 0x1e, 0x0144111e },
4644 { 0x14, 0x01014010 },
4645 { 0x15, 0x01016412 },
4646 { 0x16, 0x01011411 },
4647 { 0x17, 0x01012414 },
4648 { 0x18, 0x01a19c30 },
4649 { 0x19, 0x02a19c40 },
4650 { 0x1a, 0x01813031 },
4651 { 0x1b, 0x0121411f },
4652 { 0x1c, 0x411111f0 },
4653 { 0x1d, 0x411111f0 },
4655 { 0x1f, 0x411111f0 },
4662 { 0x1e, 0x411111f0 },
4671 { 0x1e, 0x0144111e },
4679 static const struct snd_pci_quirk alc880_fixup_tbl[] = {
4760 static int patch_alc880(
struct hda_codec *codec)
4765 err = alc_alloc_spec(codec, 0x0b);
4777 err = alc880_parse_auto_config(codec);
4789 codec->
patch_ops.unsol_event = alc880_unsol_event;
4805 static int alc260_parse_auto_config(
struct hda_codec *codec)
4807 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
4808 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
4809 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
4826 static void alc260_gpio1_automute(
struct hda_codec *codec)
4833 static void alc260_fixup_gpio1_toggle(
struct hda_codec *codec,
4834 const struct alc_fixup *fix,
int action)
4844 spec->
autocfg.hp_pins[0] = 0x0f;
4851 static void alc260_fixup_kn1(
struct hda_codec *codec,
4852 const struct alc_fixup *fix,
int action)
4856 { 0x0f, 0x02214000 },
4857 { 0x12, 0x90a60160 },
4858 { 0x13, 0x02a19000 },
4859 { 0x18, 0x01446000 },
4861 { 0x10, 0x411111f0 },
4862 { 0x11, 0x411111f0 },
4863 { 0x14, 0x411111f0 },
4864 { 0x15, 0x411111f0 },
4865 { 0x16, 0x411111f0 },
4866 { 0x17, 0x411111f0 },
4867 { 0x19, 0x411111f0 },
4881 static const struct alc_fixup alc260_fixups[] = {
4885 { 0x11, 0x90130110 },
4892 { 0x0f, 0x01214000 },
4898 .v.verbs = (
const struct hda_verb[]) {
4908 .v.verbs = alc_gpio1_init_verbs,
4912 .v.func = alc260_fixup_gpio1_toggle,
4918 .v.verbs = (
const struct hda_verb[]) {
4928 .v.func = alc260_fixup_gpio1_toggle,
4934 .v.func = alc260_fixup_kn1,
4938 static const struct snd_pci_quirk alc260_fixup_tbl[] = {
4953 static int patch_alc260(
struct hda_codec *codec)
4958 err = alc_alloc_spec(codec, 0x07);
4968 err = alc260_parse_auto_config(codec);
4980 spec->
shutup = alc_eapd_shutup;
5035 static void alc889_fixup_coef(
struct hda_codec *codec,
5036 const struct alc_fixup *fix,
int action)
5040 alc889_coef_init(codec);
5044 static void alc882_gpio_mute(
struct hda_codec *codec,
int pin,
int muted)
5046 unsigned int gpiostate, gpiomask, gpiodir;
5052 gpiostate |= (1 <<
pin);
5054 gpiostate &= ~(1 <<
pin);
5058 gpiomask |= (1 <<
pin);
5062 gpiodir |= (1 <<
pin);
5077 static void alc885_fixup_macpro_gpio(
struct hda_codec *codec,
5078 const struct alc_fixup *fix,
int action)
5082 alc882_gpio_mute(codec, 0, 0);
5083 alc882_gpio_mute(codec, 1, 0);
5090 static void alc889_fixup_dac_route(
struct hda_codec *codec,
5091 const struct alc_fixup *fix,
int action)
5103 hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
5112 static void alc889_fixup_mbp_vref(
struct hda_codec *codec,
5113 const struct alc_fixup *fix,
int action)
5116 static hda_nid_t nids[2] = { 0x14, 0x15 };
5128 snd_hda_set_pin_ctl(codec, nids[i], val);
5135 static void alc889_fixup_imac91_vref(
struct hda_codec *codec,
5136 const struct alc_fixup *fix,
int action)
5139 static hda_nid_t nids[2] = { 0x18, 0x1a };
5149 snd_hda_set_pin_ctl(codec, nids[i], val);
5157 static void alc882_fixup_no_primary_hp(
struct hda_codec *codec,
5158 const struct alc_fixup *fix,
int action)
5165 static const struct alc_fixup alc882_fixups[] = {
5169 { 0x15, 0x01080104 },
5170 { 0x16, 0x01011012 },
5171 { 0x17, 0x01016011 },
5178 { 0x15, 0x99130112 },
5179 { 0x16, 0x99130111 },
5185 .v.verbs = (
const struct hda_verb[]) {
5192 .v.func = alc_fixup_sku_ignore,
5197 { 0x16, 0x99130110 },
5204 { 0x1c, 0x993301f0 },
5211 { 0x17, 0x90170111 },
5217 .v.verbs = (
const struct hda_verb[]) {
5225 .v.verbs = (
const struct hda_verb[]) {
5234 .v.verbs = (
const struct hda_verb[]) {
5243 .v.verbs = (
const struct hda_verb[]) {
5252 .v.verbs = alc_gpio1_init_verbs,
5256 .v.verbs = alc_gpio2_init_verbs,
5260 .v.verbs = alc_gpio3_init_verbs,
5264 .v.verbs = alc_gpio1_init_verbs,
5270 .v.func = alc889_fixup_coef,
5275 { 0x16, 0x99130111 },
5276 { 0x17, 0x99130112 },
5285 { 0x16, 0x99130111 },
5286 { 0x1b, 0x99130112 },
5295 .v.verbs = (
const struct hda_verb[]) {
5329 .v.func = alc885_fixup_macpro_gpio,
5333 .v.func = alc889_fixup_dac_route,
5337 .v.func = alc889_fixup_mbp_vref,
5343 .v.func = alc889_fixup_imac91_vref,
5349 .v.func = alc_fixup_inv_dmic_0x12,
5353 .v.func = alc882_fixup_no_primary_hp,
5357 static const struct snd_pci_quirk alc882_fixup_tbl[] = {
5364 SND_PCI_QUIRK(0x1025, 0x013e,
"Acer Aspire 4930G",
5366 SND_PCI_QUIRK(0x1025, 0x013f,
"Acer Aspire 5930G",
5368 SND_PCI_QUIRK(0x1025, 0x0145,
"Acer Aspire 8930G",
5370 SND_PCI_QUIRK(0x1025, 0x0146,
"Acer Aspire 6935G",
5372 SND_PCI_QUIRK(0x1025, 0x015e,
"Acer Aspire 6930G",
5374 SND_PCI_QUIRK(0x1025, 0x0166,
"Acer Aspire 6530G",
5376 SND_PCI_QUIRK(0x1025, 0x0142,
"Acer Aspire 7730G",
5379 SND_PCI_QUIRK(0x1025, 0x021e,
"Acer Aspire 5739G",
5440 static int alc882_parse_auto_config(
struct hda_codec *codec)
5442 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
5443 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5444 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
5449 static int patch_alc882(
struct hda_codec *codec)
5454 err = alc_alloc_spec(codec, 0x0b);
5466 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
5474 alc_auto_parse_customize_define(codec);
5477 err = alc882_parse_auto_config(codec);
5503 static int alc262_parse_auto_config(
struct hda_codec *codec)
5505 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
5506 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5507 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
5523 static const struct alc_fixup alc262_fixups[] = {
5527 { 0x14, 0x99130110 },
5528 { 0x15, 0x0221142f },
5529 { 0x1b, 0x0121141f },
5536 { 0x16, 0x99130120 },
5543 { 0x14, 0x1993e1f0 },
5549 .v.verbs = (
const struct hda_verb[]) {
5558 .v.verbs = (
const struct hda_verb[]) {
5566 .v.verbs = (
const struct hda_verb[]) {
5574 .v.func = alc_fixup_inv_dmic_0x12,
5578 static const struct snd_pci_quirk alc262_fixup_tbl[] = {
5597 static int patch_alc262(
struct hda_codec *codec)
5602 err = alc_alloc_spec(codec, 0x0b);
5620 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
5626 alc_auto_parse_customize_define(codec);
5629 err = alc262_parse_auto_config(codec);
5641 spec->
shutup = alc_eapd_shutup;
5667 HDA_BIND_SW(
"Beep Playback Switch", &alc268_bind_beep_sw),
5672 static const struct hda_verb alc268_beep_init_verbs[] = {
5684 static const struct alc_fixup alc268_fixups[] = {
5687 .v.func = alc_fixup_inv_dmic_0x12,
5691 .v.verbs = (
const struct hda_verb[]) {
5704 static const struct snd_pci_quirk alc268_fixup_tbl[] = {
5715 static int alc268_parse_auto_config(
struct hda_codec *codec)
5717 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5719 int err = alc_parse_auto_config(codec,
NULL, alc268_ssids);
5722 add_mixer(spec, alc268_beep_mixer);
5731 static int patch_alc268(
struct hda_codec *codec)
5734 int i, has_beep,
err;
5737 err = alc_alloc_spec(codec, 0);
5743 alc_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
5747 err = alc268_parse_auto_config(codec);
5753 if (spec->
mixers[i] == alc268_beep_mixer) {
5773 spec->
shutup = alc_eapd_shutup;
5787 static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
5794 .open = alc_playback_pcm_open,
5795 .prepare = alc_playback_pcm_prepare,
5796 .cleanup = alc_playback_pcm_cleanup
5800 static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
5819 static int alc269_parse_auto_config(
struct hda_codec *codec)
5821 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
5822 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
5823 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
5830 ssids = alc269va_ssids;
5834 ssids = alc269_ssids;
5837 ssids = alc269_ssids;
5841 return alc_parse_auto_config(codec, alc269_ignore, ssids);
5844 static void alc269vb_toggle_power_output(
struct hda_codec *codec,
int power_up)
5846 int val = alc_read_coef_idx(codec, 0x04);
5851 alc_write_coef_idx(codec, 0x04, val);
5854 static void alc269_shutup(
struct hda_codec *codec)
5862 alc269vb_toggle_power_output(codec, 0);
5864 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
5870 static int alc269_resume(
struct hda_codec *codec)
5875 alc269vb_toggle_power_output(codec, 0);
5877 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
5884 alc269vb_toggle_power_output(codec, 1);
5886 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
5890 snd_hda_codec_resume_amp(codec);
5891 snd_hda_codec_resume_cache(codec);
5892 hda_call_check_power_status(codec, 0x01);
5897 static void alc269_fixup_pincfg_no_hp_to_lineout(
struct hda_codec *codec,
5898 const struct alc_fixup *fix,
int action)
5906 static void alc269_fixup_hweq(
struct hda_codec *codec,
5907 const struct alc_fixup *fix,
int action)
5913 coef = alc_read_coef_idx(codec, 0x1e);
5914 alc_write_coef_idx(codec, 0x1e, coef | 0x80);
5917 static void alc271_fixup_dmic(
struct hda_codec *codec,
5918 const struct alc_fixup *fix,
int action)
5920 static const struct hda_verb verbs[] = {
5934 static void alc269_fixup_pcm_44k(
struct hda_codec *codec,
5935 const struct alc_fixup *fix,
int action)
5949 static void alc269_fixup_stereo_dmic(
struct hda_codec *codec,
5950 const struct alc_fixup *fix,
int action)
5961 coef = alc_read_coef_idx(codec, 0x07);
5962 alc_write_coef_idx(codec, 0x07, coef | 0x80);
5965 static void alc269_quanta_automute(
struct hda_codec *codec)
5967 update_outputs(codec);
5980 static void alc269_fixup_quanta_mute(
struct hda_codec *codec,
5981 const struct alc_fixup *fix,
int action)
5993 unsigned int pinval = enabled ? 0x20 : 0x24;
5994 snd_hda_set_pin_ctl_cache(codec, 0x19, pinval);
5997 static void alc269_fixup_mic2_mute(
struct hda_codec *codec,
5998 const struct alc_fixup *fix,
int action)
6036 static const struct alc_fixup alc269_fixups[] = {
6039 .v.verbs = (
const struct hda_verb[]) {
6046 .v.verbs = (
const struct hda_verb[]) {
6057 .v.verbs = (
const struct hda_verb[]) {
6066 .v.func = alc_fixup_sku_ignore,
6071 { 0x17, 0x99130111 },
6077 .v.verbs = (
const struct hda_verb[]) {
6084 .v.func = alc269_fixup_hweq,
6090 .v.func = alc271_fixup_dmic,
6094 .v.func = alc269_fixup_pcm_44k,
6100 .v.func = alc269_fixup_stereo_dmic,
6104 .v.func = alc269_fixup_quanta_mute,
6109 { 0x1a, 0x2101103f },
6110 { 0x1b, 0x23a11040 },
6119 { 0x14, 0x99130110 },
6120 { 0x15, 0x0121401f },
6121 { 0x18, 0x01a19c20 },
6122 { 0x19, 0x99a3092f },
6129 { 0x12, 0x99a3092f },
6130 { 0x14, 0x99130110 },
6131 { 0x15, 0x0121401f },
6132 { 0x18, 0x01a19c20 },
6139 { 0x14, 0x99130110 },
6140 { 0x18, 0x01a19c20 },
6141 { 0x19, 0x99a3092f },
6142 { 0x21, 0x0121401f },
6149 { 0x12, 0x99a3092f },
6150 { 0x14, 0x99130110 },
6151 { 0x18, 0x01a19c20 },
6152 { 0x21, 0x0121401f },
6158 .v.func = alc269_fixup_mic2_mute,
6162 .v.func = alc_fixup_inv_dmic_0x12,
6167 { 0x19, 0x23a11040 },
6168 { 0x1b, 0x2121103f },
6176 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6180 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6219 SND_PCI_QUIRK(0x1043, 0x8330,
"ASUS Eeepc P703 P900A",
6275 static void alc269_fill_coef(
struct hda_codec *codec)
6283 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
6284 alc_write_coef_idx(codec, 0xf, 0x960b);
6285 alc_write_coef_idx(codec, 0
xe, 0x8817);
6288 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
6289 alc_write_coef_idx(codec, 0xf, 0x960b);
6290 alc_write_coef_idx(codec, 0
xe, 0x8814);
6293 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
6294 val = alc_read_coef_idx(codec, 0x04);
6296 alc_write_coef_idx(codec, 0x04, val | (1<<11));
6299 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
6300 val = alc_read_coef_idx(codec, 0xd);
6301 if ((val & 0x0c00) >> 10 != 0x1) {
6303 alc_write_coef_idx(codec, 0xd, val | (1<<10));
6305 val = alc_read_coef_idx(codec, 0x17);
6306 if ((val & 0x01c0) >> 6 != 0x4) {
6308 alc_write_coef_idx(codec, 0x17, val | (1<<7));
6312 val = alc_read_coef_idx(codec, 0xd);
6313 alc_write_coef_idx(codec, 0xd, val | (1<<14));
6315 val = alc_read_coef_idx(codec, 0x4);
6316 alc_write_coef_idx(codec, 0x4, val | (1<<11));
6321 static int patch_alc269(
struct hda_codec *codec)
6326 err = alc_alloc_spec(codec, 0x0b);
6333 alc269_fixup_tbl, alc269_fixups);
6336 alc_auto_parse_customize_define(codec);
6340 switch (alc_get_coef0(codec) & 0x00f0) {
6342 if (codec->
bus->pci->subsystem_vendor == 0x1025 &&
6343 spec->
cdefine.platform_type == 1)
6344 err = alc_codec_rename(codec,
"ALC271X");
6348 if (codec->
bus->pci->subsystem_vendor == 0x17aa &&
6349 codec->
bus->pci->subsystem_device == 0x21f3)
6350 err = alc_codec_rename(codec,
"ALC3202");
6357 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6362 alc269_fill_coef(codec);
6366 err = alc269_parse_auto_config(codec);
6379 codec->
patch_ops.resume = alc269_resume;
6381 spec->
shutup = alc269_shutup;
6396 static int alc861_parse_auto_config(
struct hda_codec *codec)
6398 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
6399 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
6400 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
6412 static void alc861_fixup_asus_amp_vref_0f(
struct hda_codec *codec,
6413 const struct alc_fixup *fix,
int action)
6425 snd_hda_set_pin_ctl(codec, 0x0f, val);
6430 static void alc_fixup_no_jack_detect(
struct hda_codec *codec,
6431 const struct alc_fixup *fix,
int action)
6437 static const struct alc_fixup alc861_fixups[] = {
6441 { 0x0b, 0x0221101f },
6442 { 0x0f, 0x90170310 },
6448 .v.func = alc861_fixup_asus_amp_vref_0f,
6452 .v.func = alc_fixup_no_jack_detect,
6456 .v.func = alc861_fixup_asus_amp_vref_0f,
6462 static const struct snd_pci_quirk alc861_fixup_tbl[] = {
6474 static int patch_alc861(
struct hda_codec *codec)
6479 err = alc_alloc_spec(codec, 0x15);
6489 err = alc861_parse_auto_config(codec);
6502 spec->power_hook = alc_power_eapd;
6521 static int alc861vd_parse_auto_config(
struct hda_codec *codec)
6523 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
6524 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
6525 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
6534 static void alc861vd_fixup_dallas(
struct hda_codec *codec,
6535 const struct alc_fixup *fix,
int action)
6543 static const struct alc_fixup alc861vd_fixups[] = {
6546 .v.verbs = (
const struct hda_verb[]) {
6556 .v.func = alc861vd_fixup_dallas,
6560 static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
6569 static int patch_alc861vd(
struct hda_codec *codec)
6574 err = alc_alloc_spec(codec, 0x0b);
6584 err = alc861vd_parse_auto_config(codec);
6597 spec->
shutup = alc_eapd_shutup;
6624 static int alc662_parse_auto_config(
struct hda_codec *codec)
6626 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
6627 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
6628 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
6633 ssids = alc663_ssids;
6635 ssids = alc662_ssids;
6636 return alc_parse_auto_config(codec, alc662_ignore, ssids);
6639 static void alc272_fixup_mario(
struct hda_codec *codec,
6640 const struct alc_fixup *fix,
int action)
6650 "hda_codec: failed to override amp caps for NID 0x2\n");
6673 static const struct alc_fixup alc662_fixups[] = {
6677 { 0x15, 0x99130112 },
6684 { 0x17, 0x99130112 },
6690 .v.func = alc272_fixup_mario,
6694 .v.verbs = (
const struct hda_verb[]) {
6701 .v.func = alc_fixup_sku_ignore,
6706 { 0x14, 0x0221201f },
6715 { 0x14, 0x99130110 },
6716 { 0x18, 0x01a19c20 },
6717 { 0x19, 0x99a3092f },
6718 { 0x21, 0x0121401f },
6727 { 0x14, 0x99130110 },
6728 { 0x18, 0x01a19820 },
6729 { 0x19, 0x99a3092f },
6730 { 0x1b, 0x0121401f },
6739 { 0x14, 0x99130110 },
6740 { 0x15, 0x0121441f },
6741 { 0x18, 0x01a19840 },
6742 { 0x19, 0x99a3094f },
6743 { 0x21, 0x01211420 },
6752 { 0x14, 0x99130110 },
6753 { 0x16, 0x99130111 },
6754 { 0x18, 0x01a19840 },
6755 { 0x19, 0x99a3094f },
6756 { 0x21, 0x0121441f },
6765 { 0x14, 0x99130110 },
6766 { 0x15, 0x0121441f },
6767 { 0x16, 0x99130111 },
6768 { 0x18, 0x01a19840 },
6769 { 0x19, 0x99a3094f },
6778 { 0x14, 0x99130110 },
6779 { 0x15, 0x01211420 },
6780 { 0x18, 0x01a19840 },
6781 { 0x19, 0x99a3094f },
6782 { 0x1b, 0x0121441f },
6791 { 0x14, 0x99130110 },
6792 { 0x17, 0x99130111 },
6793 { 0x18, 0x01a19840 },
6794 { 0x19, 0x99a3094f },
6795 { 0x1b, 0x01214020 },
6796 { 0x21, 0x0121401f },
6805 { 0x14, 0x99130110 },
6806 { 0x12, 0x99a30970 },
6807 { 0x15, 0x01214020 },
6808 { 0x17, 0x99130111 },
6809 { 0x18, 0x01a19840 },
6810 { 0x21, 0x0121401f },
6818 .v.func = alc_fixup_no_jack_detect,
6823 { 0x1b, 0x02214020 },
6829 .v.func = alc_fixup_inv_dmic_0x12,
6833 static const struct snd_pci_quirk alc662_fixup_tbl[] = {
6922 static void alc662_fill_coef(
struct hda_codec *codec)
6926 coef = alc_get_coef0(codec);
6930 if ((coef & 0x00f0) == 0x0030) {
6931 val = alc_read_coef_idx(codec, 0x4);
6932 alc_write_coef_idx(codec, 0x4, val & ~(1<<10));
6942 val = alc_read_coef_idx(codec, 0xd);
6943 alc_write_coef_idx(codec, 0xd, val | (1<<14));
6950 static int patch_alc662(
struct hda_codec *codec)
6955 err = alc_alloc_spec(codec, 0x0b);
6964 alc_fix_pll_init(codec, 0x20, 0x04, 15);
6967 alc662_fill_coef(codec);
6970 alc662_fixup_tbl, alc662_fixups);
6973 alc_auto_parse_customize_define(codec);
6975 if ((alc_get_coef0(codec) & (1 << 14)) &&
6976 codec->
bus->pci->subsystem_vendor == 0x1025 &&
6977 spec->
cdefine.platform_type == 1) {
6978 if (alc_codec_rename(codec,
"ALC272X") < 0)
6983 err = alc662_parse_auto_config(codec);
7007 spec->
shutup = alc_eapd_shutup;
7022 static int alc680_parse_auto_config(
struct hda_codec *codec)
7024 return alc_parse_auto_config(codec,
NULL,
NULL);
7029 static int patch_alc680(
struct hda_codec *codec)
7034 err = alc_alloc_spec(codec, 0);
7039 err = alc680_parse_auto_config(codec);
7054 { .id = 0x10ec0221, .name =
"ALC221", .patch = patch_alc269 },
7055 { .id = 0x10ec0260, .name =
"ALC260", .patch = patch_alc260 },
7056 { .id = 0x10ec0262, .name =
"ALC262", .patch = patch_alc262 },
7057 { .id = 0x10ec0267, .name =
"ALC267", .patch = patch_alc268 },
7058 { .id = 0x10ec0268, .name =
"ALC268", .patch = patch_alc268 },
7059 { .id = 0x10ec0269, .name =
"ALC269", .patch = patch_alc269 },
7060 { .id = 0x10ec0270, .name =
"ALC270", .patch = patch_alc269 },
7061 { .id = 0x10ec0272, .name =
"ALC272", .patch = patch_alc662 },
7062 { .id = 0x10ec0275, .name =
"ALC275", .patch = patch_alc269 },
7063 { .id = 0x10ec0276, .name =
"ALC276", .patch = patch_alc269 },
7064 { .id = 0x10ec0280, .name =
"ALC280", .patch = patch_alc269 },
7065 { .id = 0x10ec0282, .name =
"ALC282", .patch = patch_alc269 },
7066 { .id = 0x10ec0283, .name =
"ALC283", .patch = patch_alc269 },
7067 { .id = 0x10ec0290, .name =
"ALC290", .patch = patch_alc269 },
7068 { .id = 0x10ec0292, .name =
"ALC292", .patch = patch_alc269 },
7069 { .id = 0x10ec0861, .rev = 0x100340, .name =
"ALC660",
7070 .patch = patch_alc861 },
7071 { .id = 0x10ec0660, .name =
"ALC660-VD", .patch = patch_alc861vd },
7072 { .id = 0x10ec0861, .name =
"ALC861", .patch = patch_alc861 },
7073 { .id = 0x10ec0862, .name =
"ALC861-VD", .patch = patch_alc861vd },
7074 { .id = 0x10ec0662, .rev = 0x100002, .name =
"ALC662 rev2",
7075 .patch = patch_alc882 },
7076 { .id = 0x10ec0662, .rev = 0x100101, .name =
"ALC662 rev1",
7077 .patch = patch_alc662 },
7078 { .id = 0x10ec0662, .rev = 0x100300, .name =
"ALC662 rev3",
7079 .patch = patch_alc662 },
7080 { .id = 0x10ec0663, .name =
"ALC663", .patch = patch_alc662 },
7081 { .id = 0x10ec0665, .name =
"ALC665", .patch = patch_alc662 },
7082 { .id = 0x10ec0668, .name =
"ALC668", .patch = patch_alc662 },
7083 { .id = 0x10ec0670, .name =
"ALC670", .patch = patch_alc662 },
7084 { .id = 0x10ec0680, .name =
"ALC680", .patch = patch_alc680 },
7085 { .id = 0x10ec0880, .name =
"ALC880", .patch = patch_alc880 },
7086 { .id = 0x10ec0882, .name =
"ALC882", .patch = patch_alc882 },
7087 { .id = 0x10ec0883, .name =
"ALC883", .patch = patch_alc882 },
7088 { .id = 0x10ec0885, .rev = 0x100101, .name =
"ALC889A",
7089 .patch = patch_alc882 },
7090 { .id = 0x10ec0885, .rev = 0x100103, .name =
"ALC889A",
7091 .patch = patch_alc882 },
7092 { .id = 0x10ec0885, .name =
"ALC885", .patch = patch_alc882 },
7093 { .id = 0x10ec0887, .name =
"ALC887", .patch = patch_alc882 },
7094 { .id = 0x10ec0888, .rev = 0x100101, .name =
"ALC1200",
7095 .patch = patch_alc882 },
7096 { .id = 0x10ec0888, .name =
"ALC888", .patch = patch_alc882 },
7097 { .id = 0x10ec0889, .name =
"ALC889", .patch = patch_alc882 },
7098 { .id = 0x10ec0892, .name =
"ALC892", .patch = patch_alc662 },
7099 { .id = 0x10ec0899, .name =
"ALC898", .patch = patch_alc882 },
7100 { .id = 0x10ec0900, .name =
"ALC1150", .patch = patch_alc882 },
7110 .preset = snd_hda_preset_realtek,
7114 static int __init patch_realtek_init(
void)
7119 static void __exit patch_realtek_exit(
void)