1048
1076
snd_hda_input_jack_report(codec, mic_nid);
1079
err = snd_hda_input_jack_add(codec, dock_nid,
1080
SND_JACK_MICROPHONE, NULL);
1083
snd_hda_input_jack_report(codec, dock_nid);
1050
1085
#endif /* CONFIG_SND_HDA_INPUT_JACK */
1054
static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1089
static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
1056
struct alc_spec *spec = codec->spec;
1061
spec->jack_present = 0;
1062
for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1063
nid = spec->autocfg.hp_pins[i];
1093
for (i = 0; i < num_pins; i++) {
1094
hda_nid_t nid = pins[i];
1066
1097
snd_hda_input_jack_report(codec, nid);
1067
spec->jack_present |= snd_hda_jack_detect(codec, nid);
1098
present |= snd_hda_jack_detect(codec, nid);
1070
mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1071
/* Toggle internal speakers muting */
1072
for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1073
nid = spec->autocfg.speaker_pins[i];
1103
static void do_automute(struct hda_codec *codec, int num_pins, hda_nid_t *pins,
1104
bool mute, bool hp_out)
1106
struct alc_spec *spec = codec->spec;
1107
unsigned int mute_bits = mute ? HDA_AMP_MUTE : 0;
1108
unsigned int pin_bits = mute ? 0 : (hp_out ? PIN_HP : PIN_OUT);
1111
for (i = 0; i < num_pins; i++) {
1112
hda_nid_t nid = pins[i];
1115
switch (spec->automute_mode) {
1116
case ALC_AUTOMUTE_PIN:
1077
1117
snd_hda_codec_write(codec, nid, 0,
1078
AC_VERB_SET_PIN_WIDGET_CONTROL,
1079
spec->jack_present ? 0 : PIN_OUT);
1118
AC_VERB_SET_PIN_WIDGET_CONTROL,
1121
case ALC_AUTOMUTE_AMP:
1081
1122
snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1082
HDA_AMP_MUTE, mute);
1123
HDA_AMP_MUTE, mute_bits);
1125
case ALC_AUTOMUTE_MIXER:
1126
nid = spec->automute_mixer_nid[i];
1129
snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
1130
HDA_AMP_MUTE, mute_bits);
1131
snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 1,
1132
HDA_AMP_MUTE, mute_bits);
1087
static void alc_automute_pin(struct hda_codec *codec)
1089
alc_automute_speaker(codec, 1);
1138
/* Toggle internal speakers muting */
1139
static void update_speakers(struct hda_codec *codec)
1141
struct alc_spec *spec = codec->spec;
1144
/* Control HP pins/amps depending on master_mute state;
1145
* in general, HP pins/amps control should be enabled in all cases,
1146
* but currently set only for master_mute, just to be safe
1148
do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1149
spec->autocfg.hp_pins, spec->master_mute, true);
1151
if (!spec->automute)
1154
on = spec->jack_present | spec->line_jack_present;
1155
on |= spec->master_mute;
1156
do_automute(codec, ARRAY_SIZE(spec->autocfg.speaker_pins),
1157
spec->autocfg.speaker_pins, on, false);
1159
/* toggle line-out mutes if needed, too */
1160
/* if LO is a copy of either HP or Speaker, don't need to handle it */
1161
if (spec->autocfg.line_out_pins[0] == spec->autocfg.hp_pins[0] ||
1162
spec->autocfg.line_out_pins[0] == spec->autocfg.speaker_pins[0])
1164
if (!spec->automute_lines || !spec->automute)
1167
on = spec->jack_present;
1168
on |= spec->master_mute;
1169
do_automute(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1170
spec->autocfg.line_out_pins, on, false);
1173
static void alc_hp_automute(struct hda_codec *codec)
1175
struct alc_spec *spec = codec->spec;
1177
if (!spec->automute)
1179
spec->jack_present =
1180
detect_jacks(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
1181
spec->autocfg.hp_pins);
1182
update_speakers(codec);
1185
static void alc_line_automute(struct hda_codec *codec)
1187
struct alc_spec *spec = codec->spec;
1189
if (!spec->automute || !spec->detect_line)
1191
spec->line_jack_present =
1192
detect_jacks(codec, ARRAY_SIZE(spec->autocfg.line_out_pins),
1193
spec->autocfg.line_out_pins);
1194
update_speakers(codec);
1092
1197
static int get_connection_index(struct hda_codec *codec, hda_nid_t mux,
1460
static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
1461
struct snd_ctl_elem_info *uinfo)
1463
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1464
struct alc_spec *spec = codec->spec;
1465
static const char * const texts2[] = {
1466
"Disabled", "Enabled"
1468
static const char * const texts3[] = {
1469
"Disabled", "Speaker Only", "Line-Out+Speaker"
1471
const char * const *texts;
1473
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1475
if (spec->automute_hp_lo) {
1476
uinfo->value.enumerated.items = 3;
1479
uinfo->value.enumerated.items = 2;
1482
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1483
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
1484
strcpy(uinfo->value.enumerated.name,
1485
texts[uinfo->value.enumerated.item]);
1489
static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
1490
struct snd_ctl_elem_value *ucontrol)
1492
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1493
struct alc_spec *spec = codec->spec;
1495
if (!spec->automute)
1497
else if (!spec->automute_lines)
1501
ucontrol->value.enumerated.item[0] = val;
1505
static int alc_automute_mode_put(struct snd_kcontrol *kcontrol,
1506
struct snd_ctl_elem_value *ucontrol)
1508
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
1509
struct alc_spec *spec = codec->spec;
1511
switch (ucontrol->value.enumerated.item[0]) {
1513
if (!spec->automute)
1518
if (spec->automute && !spec->automute_lines)
1521
spec->automute_lines = 0;
1524
if (!spec->automute_hp_lo)
1526
if (spec->automute && spec->automute_lines)
1529
spec->automute_lines = 1;
1534
update_speakers(codec);
1538
static const struct snd_kcontrol_new alc_automute_mode_enum = {
1539
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1540
.name = "Auto-Mute Mode",
1541
.info = alc_automute_mode_info,
1542
.get = alc_automute_mode_get,
1543
.put = alc_automute_mode_put,
1546
static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec);
1548
static int alc_add_automute_mode_enum(struct hda_codec *codec)
1550
struct alc_spec *spec = codec->spec;
1551
struct snd_kcontrol_new *knew;
1553
knew = alc_kcontrol_new(spec);
1556
*knew = alc_automute_mode_enum;
1557
knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL);
1318
1563
static void alc_init_auto_hp(struct hda_codec *codec)
1320
1565
struct alc_spec *spec = codec->spec;
1321
1566
struct auto_pin_cfg *cfg = &spec->autocfg;
1324
if (!cfg->hp_pins[0]) {
1325
if (cfg->line_out_type != AUTO_PIN_HP_OUT)
1570
if (cfg->hp_pins[0])
1572
if (cfg->line_out_pins[0])
1574
if (cfg->speaker_pins[0])
1576
if (present < 2) /* need two different output types */
1579
spec->automute_hp_lo = 1; /* both HP and LO automute */
1329
if (!cfg->speaker_pins[0]) {
1330
if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT)
1581
if (!cfg->speaker_pins[0] &&
1582
cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
1332
1583
memcpy(cfg->speaker_pins, cfg->line_out_pins,
1333
1584
sizeof(cfg->speaker_pins));
1334
1585
cfg->speaker_outs = cfg->line_outs;
1337
if (!cfg->hp_pins[0]) {
1588
if (!cfg->hp_pins[0] &&
1589
cfg->line_out_type == AUTO_PIN_HP_OUT) {
1338
1590
memcpy(cfg->hp_pins, cfg->line_out_pins,
1339
1591
sizeof(cfg->hp_pins));
1340
1592
cfg->hp_outs = cfg->line_outs;
1343
1595
for (i = 0; i < cfg->hp_outs; i++) {
1596
hda_nid_t nid = cfg->hp_pins[i];
1597
if (!is_jack_detectable(codec, nid))
1344
1599
snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1346
snd_hda_codec_write_cache(codec, cfg->hp_pins[i], 0,
1601
snd_hda_codec_write_cache(codec, nid, 0,
1347
1602
AC_VERB_SET_UNSOLICITED_ENABLE,
1348
1603
AC_USRSP_EN | ALC880_HP_EVENT);
1350
spec->unsol_event = alc_sku_unsol_event;
1605
spec->automute_mode = ALC_AUTOMUTE_PIN;
1607
if (spec->automute && cfg->line_out_pins[0] &&
1608
cfg->speaker_pins[0] &&
1609
cfg->line_out_pins[0] != cfg->hp_pins[0] &&
1610
cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
1611
for (i = 0; i < cfg->line_outs; i++) {
1612
hda_nid_t nid = cfg->line_out_pins[i];
1613
if (!is_jack_detectable(codec, nid))
1615
snd_printdd("realtek: Enable Line-Out auto-muting "
1616
"on NID 0x%x\n", nid);
1617
snd_hda_codec_write_cache(codec, nid, 0,
1618
AC_VERB_SET_UNSOLICITED_ENABLE,
1619
AC_USRSP_EN | ALC880_FRONT_EVENT);
1620
spec->detect_line = 1;
1622
spec->automute_lines = spec->detect_line;
1625
if (spec->automute) {
1626
/* create a control for automute mode */
1627
alc_add_automute_mode_enum(codec);
1628
spec->unsol_event = alc_sku_unsol_event;
1353
1632
static void alc_init_auto_mic(struct hda_codec *codec)
1355
1634
struct alc_spec *spec = codec->spec;
1356
1635
struct auto_pin_cfg *cfg = &spec->autocfg;
1357
hda_nid_t fixed, ext;
1636
hda_nid_t fixed, ext, dock;
1360
/* there must be only two mic inputs exclusively */
1361
for (i = 0; i < cfg->num_inputs; i++)
1362
if (cfg->inputs[i].type >= AUTO_PIN_LINE_IN)
1639
fixed = ext = dock = 0;
1366
1640
for (i = 0; i < cfg->num_inputs; i++) {
1367
1641
hda_nid_t nid = cfg->inputs[i].pin;
1368
1642
unsigned int defcfg;
3582
3884
/* 2,4,6 channel modes */
3583
static struct hda_verb alc880_lg_ch2_init[] = {
3885
static const struct hda_verb alc880_lg_ch2_init[] = {
3584
3886
/* set line-in and mic-in to input */
3585
3887
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
3586
3888
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3590
static struct hda_verb alc880_lg_ch4_init[] = {
3892
static const struct hda_verb alc880_lg_ch4_init[] = {
3591
3893
/* set line-in to out and mic-in to input */
3592
3894
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3593
3895
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
3597
static struct hda_verb alc880_lg_ch6_init[] = {
3899
static const struct hda_verb alc880_lg_ch6_init[] = {
3598
3900
/* set line-in and mic-in to output */
3599
3901
{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3600
3902
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
3604
static struct hda_channel_mode alc880_lg_ch_modes[3] = {
3906
static const struct hda_channel_mode alc880_lg_ch_modes[3] = {
3605
3907
{ 2, alc880_lg_ch2_init },
3606
3908
{ 4, alc880_lg_ch4_init },
3607
3909
{ 6, alc880_lg_ch6_init },
3610
static struct snd_kcontrol_new alc880_lg_mixer[] = {
3912
static const struct snd_kcontrol_new alc880_lg_mixer[] = {
3611
3913
HDA_CODEC_VOLUME("Front Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
3612
3914
HDA_BIND_MUTE("Front Playback Switch", 0x0f, 2, HDA_INPUT),
3613
3915
HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
6037
static struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6345
static const struct hda_verb alc260_hp_3013_unsol_verbs[] = {
6038
6346
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
6042
static void alc260_hp_3013_automute(struct hda_codec *codec)
6350
static void alc260_hp_3012_setup(struct hda_codec *codec)
6044
6352
struct alc_spec *spec = codec->spec;
6046
spec->jack_present = snd_hda_jack_detect(codec, 0x15);
6047
alc260_hp_master_update(codec, 0x15, 0x10, 0x11);
6050
static void alc260_hp_3013_unsol_event(struct hda_codec *codec,
6053
if ((res >> 26) == ALC880_HP_EVENT)
6054
alc260_hp_3013_automute(codec);
6057
static void alc260_hp_3012_automute(struct hda_codec *codec)
6059
unsigned int bits = snd_hda_jack_detect(codec, 0x10) ? 0 : PIN_OUT;
6061
snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6063
snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6065
snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6069
static void alc260_hp_3012_unsol_event(struct hda_codec *codec,
6072
if ((res >> 26) == ALC880_HP_EVENT)
6073
alc260_hp_3012_automute(codec);
6354
spec->autocfg.hp_pins[0] = 0x10;
6355
spec->autocfg.speaker_pins[0] = 0x0f;
6356
spec->autocfg.speaker_pins[1] = 0x11;
6357
spec->autocfg.speaker_pins[2] = 0x15;
6359
spec->automute_mode = ALC_AUTOMUTE_PIN;
6076
6362
/* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12,
6077
6363
* HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10.
6079
static struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6365
static const struct snd_kcontrol_new alc260_fujitsu_mixer[] = {
6080
6366
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT),
6081
6367
HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT),
6082
6368
ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT),
8867
static struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
8868
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8869
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8870
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8871
HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8872
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8873
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8874
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8875
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8876
HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8877
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8881
static struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
8882
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8883
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
8884
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
8885
HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
8886
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
8887
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
8888
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
8889
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
8890
HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
8891
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
8895
static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
9167
static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
9168
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9169
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9170
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9171
HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9172
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9173
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9174
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9175
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9176
HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9177
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9181
static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
9182
HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9183
HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
9184
HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
9185
HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
9186
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
9187
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
9188
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
9189
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
9190
HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
9191
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
9195
static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
8896
9196
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
8897
9197
HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
8898
9198
HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9473
static struct hda_channel_mode alc888_3st_hp_modes[3] = {
9779
static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
9474
9780
{ 2, alc888_3st_hp_2ch_init },
9475
9781
{ 4, alc888_3st_hp_4ch_init },
9476
9782
{ 6, alc888_3st_hp_6ch_init },
9479
/* toggle front-jack and RCA according to the hp-jack state */
9480
static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
9482
unsigned int present = snd_hda_jack_detect(codec, 0x1b);
9484
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
9485
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9486
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9487
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9490
/* toggle RCA according to the front-jack state */
9491
static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
9493
unsigned int present = snd_hda_jack_detect(codec, 0x14);
9495
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
9496
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9499
static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
9502
if ((res >> 26) == ALC880_HP_EVENT)
9503
alc888_lenovo_ms7195_front_automute(codec);
9504
if ((res >> 26) == ALC880_FRONT_EVENT)
9505
alc888_lenovo_ms7195_rca_automute(codec);
9785
static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
9787
struct alc_spec *spec = codec->spec;
9789
spec->autocfg.hp_pins[0] = 0x1b;
9790
spec->autocfg.line_out_pins[0] = 0x14;
9791
spec->autocfg.speaker_pins[0] = 0x15;
9793
spec->automute_mode = ALC_AUTOMUTE_AMP;
9508
9796
/* toggle speaker-output according to the hp-jack state */
11165
11467
/* update HP, line and mono-out pins according to the master switch */
11166
static void alc262_hp_master_update(struct hda_codec *codec)
11168
struct alc_spec *spec = codec->spec;
11169
int val = spec->master_sw;
11171
/* HP & line-out */
11172
snd_hda_codec_write_cache(codec, 0x1b, 0,
11173
AC_VERB_SET_PIN_WIDGET_CONTROL,
11175
snd_hda_codec_write_cache(codec, 0x15, 0,
11176
AC_VERB_SET_PIN_WIDGET_CONTROL,
11178
/* mono (speaker) depending on the HP jack sense */
11179
val = val && !spec->jack_present;
11180
snd_hda_codec_write_cache(codec, 0x16, 0,
11181
AC_VERB_SET_PIN_WIDGET_CONTROL,
11182
val ? PIN_OUT : 0);
11185
static void alc262_hp_bpc_automute(struct hda_codec *codec)
11187
struct alc_spec *spec = codec->spec;
11189
spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11190
alc262_hp_master_update(codec);
11193
static void alc262_hp_bpc_unsol_event(struct hda_codec *codec, unsigned int res)
11195
if ((res >> 26) != ALC880_HP_EVENT)
11197
alc262_hp_bpc_automute(codec);
11200
static void alc262_hp_wildwest_automute(struct hda_codec *codec)
11202
struct alc_spec *spec = codec->spec;
11204
spec->jack_present = snd_hda_jack_detect(codec, 0x15);
11205
alc262_hp_master_update(codec);
11208
static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
11211
if ((res >> 26) != ALC880_HP_EVENT)
11213
alc262_hp_wildwest_automute(codec);
11468
#define alc262_hp_master_update alc260_hp_master_update
11470
static void alc262_hp_bpc_setup(struct hda_codec *codec)
11472
struct alc_spec *spec = codec->spec;
11474
spec->autocfg.hp_pins[0] = 0x1b;
11475
spec->autocfg.speaker_pins[0] = 0x16;
11476
spec->automute = 1;
11477
spec->automute_mode = ALC_AUTOMUTE_PIN;
11480
static void alc262_hp_wildwest_setup(struct hda_codec *codec)
11482
struct alc_spec *spec = codec->spec;
11484
spec->autocfg.hp_pins[0] = 0x15;
11485
spec->autocfg.speaker_pins[0] = 0x16;
11486
spec->automute = 1;
11487
spec->automute_mode = ALC_AUTOMUTE_PIN;
11216
11490
#define alc262_hp_master_sw_get alc260_hp_master_sw_get
11218
static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
11219
struct snd_ctl_elem_value *ucontrol)
11221
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11222
struct alc_spec *spec = codec->spec;
11223
int val = !!*ucontrol->value.integer.value;
11225
if (val == spec->master_sw)
11227
spec->master_sw = val;
11228
alc262_hp_master_update(codec);
11491
#define alc262_hp_master_sw_put alc260_hp_master_sw_put
11232
11493
#define ALC262_HP_MASTER_SWITCH \
11777
/* mute/unmute internal speaker according to the hp jacks and mute state */
11778
static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
11997
static void alc262_fujitsu_setup(struct hda_codec *codec)
11780
11999
struct alc_spec *spec = codec->spec;
11783
if (force || !spec->sense_updated) {
11784
spec->jack_present = snd_hda_jack_detect(codec, 0x14) ||
11785
snd_hda_jack_detect(codec, 0x1b);
11786
spec->sense_updated = 1;
11788
/* unmute internal speaker only if both HPs are unplugged and
11789
* master switch is on
11791
if (spec->jack_present)
11792
mute = HDA_AMP_MUTE;
11794
mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
11795
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11796
HDA_AMP_MUTE, mute);
11799
/* unsolicited event for HP jack sensing */
11800
static void alc262_fujitsu_unsol_event(struct hda_codec *codec,
11803
if ((res >> 26) != ALC_HP_EVENT)
11805
alc262_fujitsu_automute(codec, 1);
11808
static void alc262_fujitsu_init_hook(struct hda_codec *codec)
11810
alc262_fujitsu_automute(codec, 1);
12001
spec->autocfg.hp_pins[0] = 0x14;
12002
spec->autocfg.hp_pins[1] = 0x1b;
12003
spec->autocfg.speaker_pins[0] = 0x15;
12004
spec->automute = 1;
12005
spec->automute_mode = ALC_AUTOMUTE_AMP;
11813
12008
/* bind volumes of both NID 0x0c and 0x0d */
11814
static struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
12009
static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
11815
12010
.ops = &snd_hda_bind_vol,
11817
12012
HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
11823
/* mute/unmute internal speaker according to the hp jack and mute state */
11824
static void alc262_lenovo_3000_automute(struct hda_codec *codec, int force)
11826
struct alc_spec *spec = codec->spec;
11829
if (force || !spec->sense_updated) {
11830
spec->jack_present = snd_hda_jack_detect(codec, 0x1b);
11831
spec->sense_updated = 1;
11833
if (spec->jack_present) {
11834
/* mute internal speaker */
11835
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11836
HDA_AMP_MUTE, HDA_AMP_MUTE);
11837
snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11838
HDA_AMP_MUTE, HDA_AMP_MUTE);
11840
/* unmute internal speaker if necessary */
11841
mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
11842
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11843
HDA_AMP_MUTE, mute);
11844
snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
11845
HDA_AMP_MUTE, mute);
11849
/* unsolicited event for HP jack sensing */
11850
static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec,
11853
if ((res >> 26) != ALC_HP_EVENT)
11855
alc262_lenovo_3000_automute(codec, 1);
11858
static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid,
11859
int dir, int idx, long *valp)
11863
for (i = 0; i < 2; i++, valp++)
11864
change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx,
11866
*valp ? 0 : HDA_AMP_MUTE);
11870
/* bind hp and internal speaker mute (with plug check) */
11871
static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
11872
struct snd_ctl_elem_value *ucontrol)
11874
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11875
long *valp = ucontrol->value.integer.value;
11878
change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
11879
change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11881
alc262_fujitsu_automute(codec, 0);
11885
static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
12018
static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
11886
12019
HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11888
12021
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11889
12022
.name = "Master Playback Switch",
11890
.subdevice = HDA_SUBDEV_AMP_FLAG,
11891
.info = snd_hda_mixer_amp_switch_info,
11892
.get = snd_hda_mixer_amp_switch_get,
11893
.put = alc262_fujitsu_master_sw_put,
11894
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
12023
.subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
12024
.info = snd_ctl_boolean_mono_info,
12025
.get = alc262_hp_master_sw_get,
12026
.put = alc262_hp_master_sw_put,
11897
12029
.iface = NID_MAPPING,
11909
12041
{ } /* end */
11912
/* bind hp and internal speaker mute (with plug check) */
11913
static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol,
11914
struct snd_ctl_elem_value *ucontrol)
12044
static void alc262_lenovo_3000_setup(struct hda_codec *codec)
11916
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
11917
long *valp = ucontrol->value.integer.value;
12046
struct alc_spec *spec = codec->spec;
11920
change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp);
11922
alc262_lenovo_3000_automute(codec, 0);
12048
spec->autocfg.hp_pins[0] = 0x1b;
12049
spec->autocfg.speaker_pins[0] = 0x14;
12050
spec->autocfg.speaker_pins[1] = 0x16;
12051
spec->automute = 1;
12052
spec->automute_mode = ALC_AUTOMUTE_AMP;
11926
static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
12055
static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
11927
12056
HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
11929
12058
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
11930
12059
.name = "Master Playback Switch",
11931
.subdevice = HDA_SUBDEV_AMP_FLAG,
11932
.info = snd_hda_mixer_amp_switch_info,
11933
.get = snd_hda_mixer_amp_switch_get,
11934
.put = alc262_lenovo_3000_master_sw_put,
11935
.private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT),
12060
.subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
12061
.info = snd_ctl_boolean_mono_info,
12062
.get = alc262_hp_master_sw_get,
12063
.put = alc262_hp_master_sw_put,
11937
12065
HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
11938
12066
HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
13109
/* mute/unmute internal speaker according to the hp jack and mute state */
13110
static void alc268_acer_automute(struct hda_codec *codec, int force)
13255
static void alc268_acer_setup(struct hda_codec *codec)
13112
13257
struct alc_spec *spec = codec->spec;
13115
if (force || !spec->sense_updated) {
13116
spec->jack_present = snd_hda_jack_detect(codec, 0x14);
13117
spec->sense_updated = 1;
13119
if (spec->jack_present)
13120
mute = HDA_AMP_MUTE; /* mute internal speaker */
13121
else /* unmute internal speaker if necessary */
13122
mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
13123
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
13124
HDA_AMP_MUTE, mute);
13128
/* bind hp and internal speaker mute (with plug check) */
13129
static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol,
13130
struct snd_ctl_elem_value *ucontrol)
13132
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
13133
long *valp = ucontrol->value.integer.value;
13136
change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp);
13138
alc268_acer_automute(codec, 0);
13142
static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13259
spec->autocfg.hp_pins[0] = 0x14;
13260
spec->autocfg.speaker_pins[0] = 0x15;
13261
spec->automute = 1;
13262
spec->automute_mode = ALC_AUTOMUTE_AMP;
13265
#define alc268_acer_master_sw_get alc262_hp_master_sw_get
13266
#define alc268_acer_master_sw_put alc262_hp_master_sw_put
13268
static const struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {
13143
13269
/* output mixer control */
13144
13270
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13146
13272
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13147
13273
.name = "Master Playback Switch",
13148
.subdevice = HDA_SUBDEV_AMP_FLAG,
13149
.info = snd_hda_mixer_amp_switch_info,
13150
.get = snd_hda_mixer_amp_switch_get,
13274
.subdevice = HDA_SUBDEV_NID_FLAG | 0x15,
13275
.info = snd_ctl_boolean_mono_info,
13276
.get = alc268_acer_master_sw_get,
13151
13277
.put = alc268_acer_master_sw_put,
13152
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13154
13279
HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT),
13158
static struct snd_kcontrol_new alc268_acer_mixer[] = {
13283
static const struct snd_kcontrol_new alc268_acer_mixer[] = {
13159
13284
/* output mixer control */
13160
13285
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13162
13287
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13163
13288
.name = "Master Playback Switch",
13164
.subdevice = HDA_SUBDEV_AMP_FLAG,
13165
.info = snd_hda_mixer_amp_switch_info,
13166
.get = snd_hda_mixer_amp_switch_get,
13289
.subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13290
.info = snd_ctl_boolean_mono_info,
13291
.get = alc268_acer_master_sw_get,
13167
13292
.put = alc268_acer_master_sw_put,
13168
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13170
13294
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13171
13295
HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
13176
static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13300
static const struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {
13177
13301
/* output mixer control */
13178
13302
HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol),
13180
13304
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
13181
13305
.name = "Master Playback Switch",
13182
.subdevice = HDA_SUBDEV_AMP_FLAG,
13183
.info = snd_hda_mixer_amp_switch_info,
13184
.get = snd_hda_mixer_amp_switch_get,
13306
.subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
13307
.info = snd_ctl_boolean_mono_info,
13308
.get = alc268_acer_master_sw_get,
13185
13309
.put = alc268_acer_master_sw_put,
13186
.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),
13188
13311
HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
13189
13312
HDA_CODEC_VOLUME("Line In Boost Volume", 0x1a, 0, HDA_INPUT),
13193
static struct hda_verb alc268_acer_aspire_one_verbs[] = {
13316
static const struct hda_verb alc268_acer_aspire_one_verbs[] = {
13194
13317
{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
13195
13318
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
13196
13319
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
13214
13337
/* unsolicited event for HP jack sensing */
13215
#define alc268_toshiba_unsol_event alc262_hippo_unsol_event
13216
13338
#define alc268_toshiba_setup alc262_hippo_setup
13217
#define alc268_toshiba_automute alc262_hippo_automute
13219
static void alc268_acer_unsol_event(struct hda_codec *codec,
13222
if ((res >> 26) != ALC880_HP_EVENT)
13224
alc268_acer_automute(codec, 1);
13227
static void alc268_acer_init_hook(struct hda_codec *codec)
13229
alc268_acer_automute(codec, 1);
13232
/* toggle speaker-output according to the hp-jack state */
13233
static void alc268_aspire_one_speaker_automute(struct hda_codec *codec)
13235
unsigned int present;
13236
unsigned char bits;
13238
present = snd_hda_jack_detect(codec, 0x15);
13239
bits = present ? HDA_AMP_MUTE : 0;
13240
snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0,
13241
HDA_AMP_MUTE, bits);
13242
snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1,
13243
HDA_AMP_MUTE, bits);
13246
static void alc268_acer_lc_unsol_event(struct hda_codec *codec,
13249
switch (res >> 26) {
13250
case ALC880_HP_EVENT:
13251
alc268_aspire_one_speaker_automute(codec);
13253
case ALC880_MIC_EVENT:
13254
alc_mic_automute(codec);
13259
13340
static void alc268_acer_lc_setup(struct hda_codec *codec)
13261
13342
struct alc_spec *spec = codec->spec;
13343
spec->autocfg.hp_pins[0] = 0x15;
13344
spec->autocfg.speaker_pins[0] = 0x14;
13345
spec->automute = 1;
13346
spec->automute_mode = ALC_AUTOMUTE_AMP;
13262
13347
spec->ext_mic.pin = 0x18;
13263
13348
spec->ext_mic.mux_idx = 0;
13264
13349
spec->int_mic.pin = 0x12;
14267
14354
/* toggle speaker-output according to the hp-jack state */
14268
14355
static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec)
14270
unsigned int present;
14271
unsigned char bits;
14273
present = snd_hda_jack_detect(codec, 0x15);
14274
bits = present ? HDA_AMP_MUTE : 0;
14275
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14276
HDA_AMP_MUTE, bits);
14277
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14278
HDA_AMP_MUTE, bits);
14280
snd_hda_codec_write(codec, 0x20, 0,
14281
AC_VERB_SET_COEF_INDEX, 0x0c);
14282
snd_hda_codec_write(codec, 0x20, 0,
14283
AC_VERB_SET_PROC_COEF, 0x680);
14285
snd_hda_codec_write(codec, 0x20, 0,
14286
AC_VERB_SET_COEF_INDEX, 0x0c);
14287
snd_hda_codec_write(codec, 0x20, 0,
14288
AC_VERB_SET_PROC_COEF, 0x480);
14291
/* toggle speaker-output according to the hp-jacks state */
14292
static void alc269_lifebook_speaker_automute(struct hda_codec *codec)
14294
unsigned int present;
14295
unsigned char bits;
14297
/* Check laptop headphone socket */
14298
present = snd_hda_jack_detect(codec, 0x15);
14300
/* Check port replicator headphone socket */
14301
present |= snd_hda_jack_detect(codec, 0x1a);
14303
bits = present ? HDA_AMP_MUTE : 0;
14304
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
14305
HDA_AMP_MUTE, bits);
14306
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
14307
HDA_AMP_MUTE, bits);
14309
snd_hda_codec_write(codec, 0x20, 0,
14310
AC_VERB_SET_COEF_INDEX, 0x0c);
14311
snd_hda_codec_write(codec, 0x20, 0,
14312
AC_VERB_SET_PROC_COEF, 0x680);
14314
snd_hda_codec_write(codec, 0x20, 0,
14315
AC_VERB_SET_COEF_INDEX, 0x0c);
14316
snd_hda_codec_write(codec, 0x20, 0,
14317
AC_VERB_SET_PROC_COEF, 0x480);
14357
alc_hp_automute(codec);
14359
snd_hda_codec_write(codec, 0x20, 0,
14360
AC_VERB_SET_COEF_INDEX, 0x0c);
14361
snd_hda_codec_write(codec, 0x20, 0,
14362
AC_VERB_SET_PROC_COEF, 0x680);
14364
snd_hda_codec_write(codec, 0x20, 0,
14365
AC_VERB_SET_COEF_INDEX, 0x0c);
14366
snd_hda_codec_write(codec, 0x20, 0,
14367
AC_VERB_SET_PROC_COEF, 0x480);
14370
#define alc269_lifebook_speaker_automute \
14371
alc269_quanta_fl1_speaker_automute
14320
14373
static void alc269_lifebook_mic_autoswitch(struct hda_codec *codec)
15377
15416
{ } /* end */
15380
static struct hda_channel_mode alc861_threestack_modes[2] = {
15419
static const struct hda_channel_mode alc861_threestack_modes[2] = {
15381
15420
{ 2, alc861_threestack_ch2_init },
15382
15421
{ 6, alc861_threestack_ch6_init },
15384
15423
/* Set mic1 as input and unmute the mixer */
15385
static struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15424
static const struct hda_verb alc861_uniwill_m31_ch2_init[] = {
15386
15425
{ 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
15387
15426
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/
15388
15427
{ } /* end */
15390
15429
/* Set mic1 as output and mute mixer */
15391
static struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15430
static const struct hda_verb alc861_uniwill_m31_ch4_init[] = {
15392
15431
{ 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 },
15393
15432
{ 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/
15394
15433
{ } /* end */
15397
static struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15436
static const struct hda_channel_mode alc861_uniwill_m31_modes[2] = {
15398
15437
{ 2, alc861_uniwill_m31_ch2_init },
15399
15438
{ 4, alc861_uniwill_m31_ch4_init },
15402
15441
/* Set mic1 and line-in as input and unmute the mixer */
15403
static struct hda_verb alc861_asus_ch2_init[] = {
15442
static const struct hda_verb alc861_asus_ch2_init[] = {
15404
15443
/* set pin widget 1Ah (line in) for input */
15405
15444
{ 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 },
15406
15445
/* set pin widget 18h (mic1/2) for input, for mic also enable
17938
17996
{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17939
17997
{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
18002
static const struct hda_verb alc662_eapd_init_verbs[] = {
17941
18003
/* always trun on EAPD */
17942
18004
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
17943
18005
{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
17948
static struct hda_verb alc663_init_verbs[] = {
17949
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17950
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17951
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17952
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17953
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17954
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17958
static struct hda_verb alc272_init_verbs[] = {
17959
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17960
{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
17961
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17962
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17963
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17964
{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
17965
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
17966
{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
17970
static struct hda_verb alc662_sue_init_verbs[] = {
18009
static const struct hda_verb alc662_sue_init_verbs[] = {
17971
18010
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
17972
18011
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
17976
static struct hda_verb alc662_eeepc_sue_init_verbs[] = {
18015
static const struct hda_verb alc662_eeepc_sue_init_verbs[] = {
17977
18016
{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
17978
18017
{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17982
18021
/* Set Unsolicited Event*/
17983
static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
18022
static const struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {
17984
18023
{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
17985
18024
{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
17989
static struct hda_verb alc663_m51va_init_verbs[] = {
18028
static const struct hda_verb alc663_m51va_init_verbs[] = {
17990
18029
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17991
18030
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
17992
18031
{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
18170
static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18209
static const struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
18171
18210
HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
18172
18211
HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
18173
18212
{ } /* end */
18176
static struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18215
static const struct snd_kcontrol_new alc272_auto_capture_mixer[] = {
18177
18216
HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
18178
18217
HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
18179
18218
{ } /* end */
18182
static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
18184
unsigned int present;
18185
unsigned char bits;
18187
present = snd_hda_jack_detect(codec, 0x14);
18188
bits = present ? HDA_AMP_MUTE : 0;
18190
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18191
HDA_AMP_MUTE, bits);
18194
static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
18196
unsigned int present;
18197
unsigned char bits;
18199
present = snd_hda_jack_detect(codec, 0x1b);
18200
bits = present ? HDA_AMP_MUTE : 0;
18202
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18203
HDA_AMP_MUTE, bits);
18204
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18205
HDA_AMP_MUTE, bits);
18208
static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
18211
if ((res >> 26) == ALC880_HP_EVENT)
18212
alc662_lenovo_101e_all_automute(codec);
18213
if ((res >> 26) == ALC880_FRONT_EVENT)
18214
alc662_lenovo_101e_ispeaker_automute(codec);
18217
/* unsolicited event for HP jack sensing */
18218
static void alc662_eeepc_unsol_event(struct hda_codec *codec,
18221
if ((res >> 26) == ALC880_MIC_EVENT)
18222
alc_mic_automute(codec);
18224
alc262_hippo_unsol_event(codec, res);
18221
static void alc662_lenovo_101e_setup(struct hda_codec *codec)
18223
struct alc_spec *spec = codec->spec;
18225
spec->autocfg.hp_pins[0] = 0x1b;
18226
spec->autocfg.line_out_pins[0] = 0x14;
18227
spec->autocfg.speaker_pins[0] = 0x15;
18228
spec->automute = 1;
18229
spec->detect_line = 1;
18230
spec->automute_lines = 1;
18231
spec->automute_mode = ALC_AUTOMUTE_AMP;
18227
18234
static void alc662_eeepc_setup(struct hda_codec *codec)
18236
18243
spec->auto_mic = 1;
18239
static void alc662_eeepc_inithook(struct hda_codec *codec)
18241
alc262_hippo_automute(codec);
18242
alc_mic_automute(codec);
18245
18246
static void alc662_eeepc_ep20_setup(struct hda_codec *codec)
18247
18248
struct alc_spec *spec = codec->spec;
18249
18250
spec->autocfg.hp_pins[0] = 0x14;
18250
18251
spec->autocfg.speaker_pins[0] = 0x1b;
18253
#define alc662_eeepc_ep20_inithook alc262_hippo_master_update
18255
static void alc663_m51va_speaker_automute(struct hda_codec *codec)
18257
unsigned int present;
18258
unsigned char bits;
18260
present = snd_hda_jack_detect(codec, 0x21);
18261
bits = present ? HDA_AMP_MUTE : 0;
18262
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18263
HDA_AMP_MUTE, bits);
18264
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18265
HDA_AMP_MUTE, bits);
18268
static void alc663_21jd_two_speaker_automute(struct hda_codec *codec)
18270
unsigned int present;
18271
unsigned char bits;
18273
present = snd_hda_jack_detect(codec, 0x21);
18274
bits = present ? HDA_AMP_MUTE : 0;
18275
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18276
HDA_AMP_MUTE, bits);
18277
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18278
HDA_AMP_MUTE, bits);
18279
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18280
HDA_AMP_MUTE, bits);
18281
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18282
HDA_AMP_MUTE, bits);
18285
static void alc663_15jd_two_speaker_automute(struct hda_codec *codec)
18287
unsigned int present;
18288
unsigned char bits;
18290
present = snd_hda_jack_detect(codec, 0x15);
18291
bits = present ? HDA_AMP_MUTE : 0;
18292
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18293
HDA_AMP_MUTE, bits);
18294
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18295
HDA_AMP_MUTE, bits);
18296
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0,
18297
HDA_AMP_MUTE, bits);
18298
snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1,
18299
HDA_AMP_MUTE, bits);
18302
static void alc662_f5z_speaker_automute(struct hda_codec *codec)
18304
unsigned int present;
18305
unsigned char bits;
18307
present = snd_hda_jack_detect(codec, 0x1b);
18308
bits = present ? 0 : PIN_OUT;
18309
snd_hda_codec_write(codec, 0x14, 0,
18310
AC_VERB_SET_PIN_WIDGET_CONTROL, bits);
18313
static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec)
18315
unsigned int present1, present2;
18317
present1 = snd_hda_jack_detect(codec, 0x21);
18318
present2 = snd_hda_jack_detect(codec, 0x15);
18320
if (present1 || present2) {
18321
snd_hda_codec_write_cache(codec, 0x14, 0,
18322
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18324
snd_hda_codec_write_cache(codec, 0x14, 0,
18325
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18329
static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec)
18331
unsigned int present1, present2;
18333
present1 = snd_hda_jack_detect(codec, 0x1b);
18334
present2 = snd_hda_jack_detect(codec, 0x15);
18336
if (present1 || present2) {
18337
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18338
HDA_AMP_MUTE, HDA_AMP_MUTE);
18339
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18340
HDA_AMP_MUTE, HDA_AMP_MUTE);
18342
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0,
18344
snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1,
18349
static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec)
18351
unsigned int present1, present2;
18353
present1 = snd_hda_codec_read(codec, 0x1b, 0,
18354
AC_VERB_GET_PIN_SENSE, 0)
18355
& AC_PINSENSE_PRESENCE;
18356
present2 = snd_hda_codec_read(codec, 0x21, 0,
18357
AC_VERB_GET_PIN_SENSE, 0)
18358
& AC_PINSENSE_PRESENCE;
18360
if (present1 || present2) {
18361
snd_hda_codec_write_cache(codec, 0x14, 0,
18362
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18363
snd_hda_codec_write_cache(codec, 0x17, 0,
18364
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18366
snd_hda_codec_write_cache(codec, 0x14, 0,
18367
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18368
snd_hda_codec_write_cache(codec, 0x17, 0,
18369
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18373
static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec)
18375
unsigned int present1, present2;
18377
present1 = snd_hda_codec_read(codec, 0x21, 0,
18378
AC_VERB_GET_PIN_SENSE, 0)
18379
& AC_PINSENSE_PRESENCE;
18380
present2 = snd_hda_codec_read(codec, 0x15, 0,
18381
AC_VERB_GET_PIN_SENSE, 0)
18382
& AC_PINSENSE_PRESENCE;
18384
if (present1 || present2) {
18385
snd_hda_codec_write_cache(codec, 0x14, 0,
18386
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18387
snd_hda_codec_write_cache(codec, 0x17, 0,
18388
AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
18390
snd_hda_codec_write_cache(codec, 0x14, 0,
18391
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18392
snd_hda_codec_write_cache(codec, 0x17, 0,
18393
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
18397
static void alc663_m51va_unsol_event(struct hda_codec *codec,
18400
switch (res >> 26) {
18401
case ALC880_HP_EVENT:
18402
alc663_m51va_speaker_automute(codec);
18404
case ALC880_MIC_EVENT:
18405
alc_mic_automute(codec);
18252
spec->automute = 1;
18253
spec->automute_mode = ALC_AUTOMUTE_AMP;
18410
18256
static void alc663_m51va_setup(struct hda_codec *codec)
18412
18258
struct alc_spec *spec = codec->spec;
18259
spec->autocfg.hp_pins[0] = 0x21;
18260
spec->autocfg.speaker_pins[0] = 0x14;
18261
spec->automute_mixer_nid[0] = 0x0c;
18262
spec->automute = 1;
18263
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18413
18264
spec->ext_mic.pin = 0x18;
18414
18265
spec->ext_mic.mux_idx = 0;
18415
18266
spec->int_mic.pin = 0x12;
18436
18284
spec->auto_mic = 1;
18439
#define alc663_mode1_inithook alc663_m51va_inithook
18441
18287
/* ***************** Mode2 ******************************/
18442
static void alc662_mode2_unsol_event(struct hda_codec *codec,
18445
switch (res >> 26) {
18446
case ALC880_HP_EVENT:
18447
alc662_f5z_speaker_automute(codec);
18449
case ALC880_MIC_EVENT:
18450
alc_mic_automute(codec);
18455
#define alc662_mode2_setup alc663_mode1_setup
18457
static void alc662_mode2_inithook(struct hda_codec *codec)
18459
alc662_f5z_speaker_automute(codec);
18460
alc_mic_automute(codec);
18288
static void alc662_mode2_setup(struct hda_codec *codec)
18290
struct alc_spec *spec = codec->spec;
18291
spec->autocfg.hp_pins[0] = 0x1b;
18292
spec->autocfg.speaker_pins[0] = 0x14;
18293
spec->automute = 1;
18294
spec->automute_mode = ALC_AUTOMUTE_PIN;
18295
spec->ext_mic.pin = 0x18;
18296
spec->ext_mic.mux_idx = 0;
18297
spec->int_mic.pin = 0x19;
18298
spec->int_mic.mux_idx = 1;
18299
spec->auto_mic = 1;
18462
18302
/* ***************** Mode3 ******************************/
18463
static void alc663_mode3_unsol_event(struct hda_codec *codec,
18466
switch (res >> 26) {
18467
case ALC880_HP_EVENT:
18468
alc663_two_hp_m1_speaker_automute(codec);
18470
case ALC880_MIC_EVENT:
18471
alc_mic_automute(codec);
18476
#define alc663_mode3_setup alc663_mode1_setup
18478
static void alc663_mode3_inithook(struct hda_codec *codec)
18480
alc663_two_hp_m1_speaker_automute(codec);
18481
alc_mic_automute(codec);
18303
static void alc663_mode3_setup(struct hda_codec *codec)
18305
struct alc_spec *spec = codec->spec;
18306
spec->autocfg.hp_pins[0] = 0x21;
18307
spec->autocfg.hp_pins[0] = 0x15;
18308
spec->autocfg.speaker_pins[0] = 0x14;
18309
spec->automute = 1;
18310
spec->automute_mode = ALC_AUTOMUTE_PIN;
18311
spec->ext_mic.pin = 0x18;
18312
spec->ext_mic.mux_idx = 0;
18313
spec->int_mic.pin = 0x19;
18314
spec->int_mic.mux_idx = 1;
18315
spec->auto_mic = 1;
18483
18318
/* ***************** Mode4 ******************************/
18484
static void alc663_mode4_unsol_event(struct hda_codec *codec,
18487
switch (res >> 26) {
18488
case ALC880_HP_EVENT:
18489
alc663_21jd_two_speaker_automute(codec);
18491
case ALC880_MIC_EVENT:
18492
alc_mic_automute(codec);
18497
#define alc663_mode4_setup alc663_mode1_setup
18499
static void alc663_mode4_inithook(struct hda_codec *codec)
18501
alc663_21jd_two_speaker_automute(codec);
18502
alc_mic_automute(codec);
18319
static void alc663_mode4_setup(struct hda_codec *codec)
18321
struct alc_spec *spec = codec->spec;
18322
spec->autocfg.hp_pins[0] = 0x21;
18323
spec->autocfg.speaker_pins[0] = 0x14;
18324
spec->autocfg.speaker_pins[1] = 0x16;
18325
spec->automute_mixer_nid[0] = 0x0c;
18326
spec->automute_mixer_nid[1] = 0x0e;
18327
spec->automute = 1;
18328
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18329
spec->ext_mic.pin = 0x18;
18330
spec->ext_mic.mux_idx = 0;
18331
spec->int_mic.pin = 0x19;
18332
spec->int_mic.mux_idx = 1;
18333
spec->auto_mic = 1;
18504
18336
/* ***************** Mode5 ******************************/
18505
static void alc663_mode5_unsol_event(struct hda_codec *codec,
18508
switch (res >> 26) {
18509
case ALC880_HP_EVENT:
18510
alc663_15jd_two_speaker_automute(codec);
18512
case ALC880_MIC_EVENT:
18513
alc_mic_automute(codec);
18518
#define alc663_mode5_setup alc663_mode1_setup
18520
static void alc663_mode5_inithook(struct hda_codec *codec)
18522
alc663_15jd_two_speaker_automute(codec);
18523
alc_mic_automute(codec);
18337
static void alc663_mode5_setup(struct hda_codec *codec)
18339
struct alc_spec *spec = codec->spec;
18340
spec->autocfg.hp_pins[0] = 0x15;
18341
spec->autocfg.speaker_pins[0] = 0x14;
18342
spec->autocfg.speaker_pins[1] = 0x16;
18343
spec->automute_mixer_nid[0] = 0x0c;
18344
spec->automute_mixer_nid[1] = 0x0e;
18345
spec->automute = 1;
18346
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18347
spec->ext_mic.pin = 0x18;
18348
spec->ext_mic.mux_idx = 0;
18349
spec->int_mic.pin = 0x19;
18350
spec->int_mic.mux_idx = 1;
18351
spec->auto_mic = 1;
18525
18354
/* ***************** Mode6 ******************************/
18526
static void alc663_mode6_unsol_event(struct hda_codec *codec,
18529
switch (res >> 26) {
18530
case ALC880_HP_EVENT:
18531
alc663_two_hp_m2_speaker_automute(codec);
18533
case ALC880_MIC_EVENT:
18534
alc_mic_automute(codec);
18539
#define alc663_mode6_setup alc663_mode1_setup
18541
static void alc663_mode6_inithook(struct hda_codec *codec)
18543
alc663_two_hp_m2_speaker_automute(codec);
18544
alc_mic_automute(codec);
18355
static void alc663_mode6_setup(struct hda_codec *codec)
18357
struct alc_spec *spec = codec->spec;
18358
spec->autocfg.hp_pins[0] = 0x1b;
18359
spec->autocfg.hp_pins[0] = 0x15;
18360
spec->autocfg.speaker_pins[0] = 0x14;
18361
spec->automute_mixer_nid[0] = 0x0c;
18362
spec->automute = 1;
18363
spec->automute_mode = ALC_AUTOMUTE_MIXER;
18364
spec->ext_mic.pin = 0x18;
18365
spec->ext_mic.mux_idx = 0;
18366
spec->int_mic.pin = 0x19;
18367
spec->int_mic.mux_idx = 1;
18368
spec->auto_mic = 1;
18547
18371
/* ***************** Mode7 ******************************/
18548
static void alc663_mode7_unsol_event(struct hda_codec *codec,
18551
switch (res >> 26) {
18552
case ALC880_HP_EVENT:
18553
alc663_two_hp_m7_speaker_automute(codec);
18555
case ALC880_MIC_EVENT:
18556
alc_mic_automute(codec);
18561
#define alc663_mode7_setup alc663_mode1_setup
18563
static void alc663_mode7_inithook(struct hda_codec *codec)
18565
alc663_two_hp_m7_speaker_automute(codec);
18566
alc_mic_automute(codec);
18372
static void alc663_mode7_setup(struct hda_codec *codec)
18374
struct alc_spec *spec = codec->spec;
18375
spec->autocfg.hp_pins[0] = 0x1b;
18376
spec->autocfg.hp_pins[0] = 0x21;
18377
spec->autocfg.speaker_pins[0] = 0x14;
18378
spec->autocfg.speaker_pins[0] = 0x17;
18379
spec->automute = 1;
18380
spec->automute_mode = ALC_AUTOMUTE_PIN;
18381
spec->ext_mic.pin = 0x18;
18382
spec->ext_mic.mux_idx = 0;
18383
spec->int_mic.pin = 0x19;
18384
spec->int_mic.mux_idx = 1;
18385
spec->auto_mic = 1;
18569
18388
/* ***************** Mode8 ******************************/
18570
static void alc663_mode8_unsol_event(struct hda_codec *codec,
18573
switch (res >> 26) {
18574
case ALC880_HP_EVENT:
18575
alc663_two_hp_m8_speaker_automute(codec);
18577
case ALC880_MIC_EVENT:
18578
alc_mic_automute(codec);
18583
#define alc663_mode8_setup alc663_m51va_setup
18585
static void alc663_mode8_inithook(struct hda_codec *codec)
18587
alc663_two_hp_m8_speaker_automute(codec);
18588
alc_mic_automute(codec);
18591
static void alc663_g71v_hp_automute(struct hda_codec *codec)
18593
unsigned int present;
18594
unsigned char bits;
18596
present = snd_hda_jack_detect(codec, 0x21);
18597
bits = present ? HDA_AMP_MUTE : 0;
18598
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
18599
HDA_AMP_MUTE, bits);
18600
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18601
HDA_AMP_MUTE, bits);
18604
static void alc663_g71v_front_automute(struct hda_codec *codec)
18606
unsigned int present;
18607
unsigned char bits;
18609
present = snd_hda_jack_detect(codec, 0x15);
18610
bits = present ? HDA_AMP_MUTE : 0;
18611
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
18612
HDA_AMP_MUTE, bits);
18615
static void alc663_g71v_unsol_event(struct hda_codec *codec,
18618
switch (res >> 26) {
18619
case ALC880_HP_EVENT:
18620
alc663_g71v_hp_automute(codec);
18622
case ALC880_FRONT_EVENT:
18623
alc663_g71v_front_automute(codec);
18625
case ALC880_MIC_EVENT:
18626
alc_mic_automute(codec);
18631
#define alc663_g71v_setup alc663_m51va_setup
18633
static void alc663_g71v_inithook(struct hda_codec *codec)
18635
alc663_g71v_front_automute(codec);
18636
alc663_g71v_hp_automute(codec);
18637
alc_mic_automute(codec);
18640
static void alc663_g50v_unsol_event(struct hda_codec *codec,
18643
switch (res >> 26) {
18644
case ALC880_HP_EVENT:
18645
alc663_m51va_speaker_automute(codec);
18647
case ALC880_MIC_EVENT:
18648
alc_mic_automute(codec);
18389
static void alc663_mode8_setup(struct hda_codec *codec)
18391
struct alc_spec *spec = codec->spec;
18392
spec->autocfg.hp_pins[0] = 0x21;
18393
spec->autocfg.hp_pins[1] = 0x15;
18394
spec->autocfg.speaker_pins[0] = 0x14;
18395
spec->autocfg.speaker_pins[0] = 0x17;
18396
spec->automute = 1;
18397
spec->automute_mode = ALC_AUTOMUTE_PIN;
18398
spec->ext_mic.pin = 0x18;
18399
spec->ext_mic.mux_idx = 0;
18400
spec->int_mic.pin = 0x12;
18401
spec->int_mic.mux_idx = 9;
18402
spec->auto_mic = 1;
18405
static void alc663_g71v_setup(struct hda_codec *codec)
18407
struct alc_spec *spec = codec->spec;
18408
spec->autocfg.hp_pins[0] = 0x21;
18409
spec->autocfg.line_out_pins[0] = 0x15;
18410
spec->autocfg.speaker_pins[0] = 0x14;
18411
spec->automute = 1;
18412
spec->automute_mode = ALC_AUTOMUTE_AMP;
18413
spec->detect_line = 1;
18414
spec->automute_lines = 1;
18415
spec->ext_mic.pin = 0x18;
18416
spec->ext_mic.mux_idx = 0;
18417
spec->int_mic.pin = 0x12;
18418
spec->int_mic.mux_idx = 9;
18419
spec->auto_mic = 1;
18653
18422
#define alc663_g50v_setup alc663_m51va_setup
18655
static void alc663_g50v_inithook(struct hda_codec *codec)
18657
alc663_m51va_speaker_automute(codec);
18658
alc_mic_automute(codec);
18661
static struct snd_kcontrol_new alc662_ecs_mixer[] = {
18424
static const struct snd_kcontrol_new alc662_ecs_mixer[] = {
18662
18425
HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
18663
18426
ALC262_HIPPO_MASTER_SWITCH,
18860
18623
[ALC662_LENOVO_101E] = {
18861
18624
.mixers = { alc662_lenovo_101e_mixer },
18862
.init_verbs = { alc662_init_verbs, alc662_sue_init_verbs },
18625
.init_verbs = { alc662_init_verbs,
18626
alc662_eapd_init_verbs,
18627
alc662_sue_init_verbs },
18863
18628
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18864
18629
.dac_nids = alc662_dac_nids,
18865
18630
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18866
18631
.channel_mode = alc662_3ST_2ch_modes,
18867
18632
.input_mux = &alc662_lenovo_101e_capture_source,
18868
.unsol_event = alc662_lenovo_101e_unsol_event,
18869
.init_hook = alc662_lenovo_101e_all_automute,
18633
.unsol_event = alc_sku_unsol_event,
18634
.setup = alc662_lenovo_101e_setup,
18635
.init_hook = alc_inithook,
18871
18637
[ALC662_ASUS_EEEPC_P701] = {
18872
18638
.mixers = { alc662_eeepc_p701_mixer },
18873
18639
.init_verbs = { alc662_init_verbs,
18640
alc662_eapd_init_verbs,
18874
18641
alc662_eeepc_sue_init_verbs },
18875
18642
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18876
18643
.dac_nids = alc662_dac_nids,
18877
18644
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18878
18645
.channel_mode = alc662_3ST_2ch_modes,
18879
.unsol_event = alc662_eeepc_unsol_event,
18646
.unsol_event = alc_sku_unsol_event,
18880
18647
.setup = alc662_eeepc_setup,
18881
.init_hook = alc662_eeepc_inithook,
18648
.init_hook = alc_inithook,
18883
18650
[ALC662_ASUS_EEEPC_EP20] = {
18884
18651
.mixers = { alc662_eeepc_ep20_mixer,
18885
18652
alc662_chmode_mixer },
18886
18653
.init_verbs = { alc662_init_verbs,
18654
alc662_eapd_init_verbs,
18887
18655
alc662_eeepc_ep20_sue_init_verbs },
18888
18656
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18889
18657
.dac_nids = alc662_dac_nids,
18890
18658
.num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18891
18659
.channel_mode = alc662_3ST_6ch_modes,
18892
18660
.input_mux = &alc662_lenovo_101e_capture_source,
18893
.unsol_event = alc662_eeepc_unsol_event,
18661
.unsol_event = alc_sku_unsol_event,
18894
18662
.setup = alc662_eeepc_ep20_setup,
18895
.init_hook = alc662_eeepc_ep20_inithook,
18663
.init_hook = alc_inithook,
18897
18665
[ALC662_ECS] = {
18898
18666
.mixers = { alc662_ecs_mixer },
18899
18667
.init_verbs = { alc662_init_verbs,
18668
alc662_eapd_init_verbs,
18900
18669
alc662_ecs_init_verbs },
18901
18670
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18902
18671
.dac_nids = alc662_dac_nids,
18903
18672
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18904
18673
.channel_mode = alc662_3ST_2ch_modes,
18905
.unsol_event = alc662_eeepc_unsol_event,
18674
.unsol_event = alc_sku_unsol_event,
18906
18675
.setup = alc662_eeepc_setup,
18907
.init_hook = alc662_eeepc_inithook,
18676
.init_hook = alc_inithook,
18909
18678
[ALC663_ASUS_M51VA] = {
18910
18679
.mixers = { alc663_m51va_mixer },
18911
.init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18680
.init_verbs = { alc662_init_verbs,
18681
alc662_eapd_init_verbs,
18682
alc663_m51va_init_verbs },
18912
18683
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18913
18684
.dac_nids = alc662_dac_nids,
18914
18685
.dig_out_nid = ALC662_DIGOUT_NID,
18915
18686
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18916
18687
.channel_mode = alc662_3ST_2ch_modes,
18917
.unsol_event = alc663_m51va_unsol_event,
18688
.unsol_event = alc_sku_unsol_event,
18918
18689
.setup = alc663_m51va_setup,
18919
.init_hook = alc663_m51va_inithook,
18690
.init_hook = alc_inithook,
18921
18692
[ALC663_ASUS_G71V] = {
18922
18693
.mixers = { alc663_g71v_mixer },
18923
.init_verbs = { alc662_init_verbs, alc663_g71v_init_verbs },
18694
.init_verbs = { alc662_init_verbs,
18695
alc662_eapd_init_verbs,
18696
alc663_g71v_init_verbs },
18924
18697
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18925
18698
.dac_nids = alc662_dac_nids,
18926
18699
.dig_out_nid = ALC662_DIGOUT_NID,
18927
18700
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18928
18701
.channel_mode = alc662_3ST_2ch_modes,
18929
.unsol_event = alc663_g71v_unsol_event,
18702
.unsol_event = alc_sku_unsol_event,
18930
18703
.setup = alc663_g71v_setup,
18931
.init_hook = alc663_g71v_inithook,
18704
.init_hook = alc_inithook,
18933
18706
[ALC663_ASUS_H13] = {
18934
18707
.mixers = { alc663_m51va_mixer },
18935
.init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs },
18708
.init_verbs = { alc662_init_verbs,
18709
alc662_eapd_init_verbs,
18710
alc663_m51va_init_verbs },
18936
18711
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18937
18712
.dac_nids = alc662_dac_nids,
18938
18713
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18939
18714
.channel_mode = alc662_3ST_2ch_modes,
18940
.unsol_event = alc663_m51va_unsol_event,
18941
.init_hook = alc663_m51va_inithook,
18715
.setup = alc663_m51va_setup,
18716
.unsol_event = alc_sku_unsol_event,
18717
.init_hook = alc_inithook,
18943
18719
[ALC663_ASUS_G50V] = {
18944
18720
.mixers = { alc663_g50v_mixer },
18945
.init_verbs = { alc662_init_verbs, alc663_g50v_init_verbs },
18721
.init_verbs = { alc662_init_verbs,
18722
alc662_eapd_init_verbs,
18723
alc663_g50v_init_verbs },
18946
18724
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18947
18725
.dac_nids = alc662_dac_nids,
18948
18726
.dig_out_nid = ALC662_DIGOUT_NID,
18949
18727
.num_channel_mode = ARRAY_SIZE(alc662_3ST_6ch_modes),
18950
18728
.channel_mode = alc662_3ST_6ch_modes,
18951
18729
.input_mux = &alc663_capture_source,
18952
.unsol_event = alc663_g50v_unsol_event,
18730
.unsol_event = alc_sku_unsol_event,
18953
18731
.setup = alc663_g50v_setup,
18954
.init_hook = alc663_g50v_inithook,
18732
.init_hook = alc_inithook,
18956
18734
[ALC663_ASUS_MODE1] = {
18957
18735
.mixers = { alc663_m51va_mixer },
18958
18736
.cap_mixer = alc662_auto_capture_mixer,
18959
18737
.init_verbs = { alc662_init_verbs,
18738
alc662_eapd_init_verbs,
18960
18739
alc663_21jd_amic_init_verbs },
18961
18740
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18962
18741
.hp_nid = 0x03,
18964
18743
.dig_out_nid = ALC662_DIGOUT_NID,
18965
18744
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18966
18745
.channel_mode = alc662_3ST_2ch_modes,
18967
.unsol_event = alc663_mode1_unsol_event,
18746
.unsol_event = alc_sku_unsol_event,
18968
18747
.setup = alc663_mode1_setup,
18969
.init_hook = alc663_mode1_inithook,
18748
.init_hook = alc_inithook,
18971
18750
[ALC662_ASUS_MODE2] = {
18972
18751
.mixers = { alc662_1bjd_mixer },
18973
18752
.cap_mixer = alc662_auto_capture_mixer,
18974
18753
.init_verbs = { alc662_init_verbs,
18754
alc662_eapd_init_verbs,
18975
18755
alc662_1bjd_amic_init_verbs },
18976
18756
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18977
18757
.dac_nids = alc662_dac_nids,
18978
18758
.dig_out_nid = ALC662_DIGOUT_NID,
18979
18759
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
18980
18760
.channel_mode = alc662_3ST_2ch_modes,
18981
.unsol_event = alc662_mode2_unsol_event,
18761
.unsol_event = alc_sku_unsol_event,
18982
18762
.setup = alc662_mode2_setup,
18983
.init_hook = alc662_mode2_inithook,
18763
.init_hook = alc_inithook,
18985
18765
[ALC663_ASUS_MODE3] = {
18986
18766
.mixers = { alc663_two_hp_m1_mixer },
18987
18767
.cap_mixer = alc662_auto_capture_mixer,
18988
18768
.init_verbs = { alc662_init_verbs,
18769
alc662_eapd_init_verbs,
18989
18770
alc663_two_hp_amic_m1_init_verbs },
18990
18771
.num_dacs = ARRAY_SIZE(alc662_dac_nids),
18991
18772
.hp_nid = 0x03,
19068
18854
.dig_out_nid = ALC662_DIGOUT_NID,
19069
18855
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19070
18856
.channel_mode = alc662_3ST_2ch_modes,
19071
.unsol_event = alc663_mode8_unsol_event,
18857
.unsol_event = alc_sku_unsol_event,
19072
18858
.setup = alc663_mode8_setup,
19073
.init_hook = alc663_mode8_inithook,
18859
.init_hook = alc_inithook,
19075
18861
[ALC272_DELL] = {
19076
18862
.mixers = { alc663_m51va_mixer },
19077
18863
.cap_mixer = alc272_auto_capture_mixer,
19078
.init_verbs = { alc662_init_verbs, alc272_dell_init_verbs },
18864
.init_verbs = { alc662_init_verbs,
18865
alc662_eapd_init_verbs,
18866
alc272_dell_init_verbs },
19079
18867
.num_dacs = ARRAY_SIZE(alc272_dac_nids),
19080
.dac_nids = alc662_dac_nids,
18868
.dac_nids = alc272_dac_nids,
19081
18869
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19082
18870
.adc_nids = alc272_adc_nids,
19083
18871
.num_adc_nids = ARRAY_SIZE(alc272_adc_nids),
19084
18872
.capsrc_nids = alc272_capsrc_nids,
19085
18873
.channel_mode = alc662_3ST_2ch_modes,
19086
.unsol_event = alc663_m51va_unsol_event,
18874
.unsol_event = alc_sku_unsol_event,
19087
18875
.setup = alc663_m51va_setup,
19088
.init_hook = alc663_m51va_inithook,
18876
.init_hook = alc_inithook,
19090
18878
[ALC272_DELL_ZM1] = {
19091
18879
.mixers = { alc663_m51va_mixer },
19092
18880
.cap_mixer = alc662_auto_capture_mixer,
19093
.init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs },
18881
.init_verbs = { alc662_init_verbs,
18882
alc662_eapd_init_verbs,
18883
alc272_dell_zm1_init_verbs },
19094
18884
.num_dacs = ARRAY_SIZE(alc272_dac_nids),
19095
.dac_nids = alc662_dac_nids,
18885
.dac_nids = alc272_dac_nids,
19096
18886
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19097
18887
.adc_nids = alc662_adc_nids,
19098
18888
.num_adc_nids = 1,
19099
18889
.capsrc_nids = alc662_capsrc_nids,
19100
18890
.channel_mode = alc662_3ST_2ch_modes,
19101
.unsol_event = alc663_m51va_unsol_event,
18891
.unsol_event = alc_sku_unsol_event,
19102
18892
.setup = alc663_m51va_setup,
19103
.init_hook = alc663_m51va_inithook,
18893
.init_hook = alc_inithook,
19105
18895
[ALC272_SAMSUNG_NC10] = {
19106
18896
.mixers = { alc272_nc10_mixer },
19107
18897
.init_verbs = { alc662_init_verbs,
18898
alc662_eapd_init_verbs,
19108
18899
alc663_21jd_amic_init_verbs },
19109
18900
.num_dacs = ARRAY_SIZE(alc272_dac_nids),
19110
18901
.dac_nids = alc272_dac_nids,
19111
18902
.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
19112
18903
.channel_mode = alc662_3ST_2ch_modes,
19113
18904
/*.input_mux = &alc272_nc10_capture_source,*/
19114
.unsol_event = alc663_mode4_unsol_event,
18905
.unsol_event = alc_sku_unsol_event,
19115
18906
.setup = alc663_mode4_setup,
19116
.init_hook = alc663_mode4_inithook,
18907
.init_hook = alc_inithook,
19125
18916
/* convert from MIX nid to DAC */
19126
static inline hda_nid_t alc662_mix_to_dac(hda_nid_t nid)
19130
else if (nid >= 0x0c && nid <= 0x0e)
19131
return nid - 0x0c + 0x02;
19132
else if (nid == 0x26) /* ALC887-VD has this DAC too */
18917
static hda_nid_t alc_auto_mix_to_dac(struct hda_codec *codec, hda_nid_t nid)
18922
num = snd_hda_get_connections(codec, nid, list, ARRAY_SIZE(list));
18923
for (i = 0; i < num; i++) {
18924
if (get_wcaps_type(get_wcaps(codec, list[i])) == AC_WID_AUD_OUT)
18930
/* go down to the selector widget before the mixer */
18931
static hda_nid_t alc_go_down_to_selector(struct hda_codec *codec, hda_nid_t pin)
18934
int num = snd_hda_get_connections(codec, pin, srcs,
18937
get_wcaps_type(get_wcaps(codec, srcs[0])) != AC_WID_AUD_SEL)
19138
18942
/* get MIX nid connected to the given pin targeted to DAC */
19139
static hda_nid_t alc662_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
18943
static hda_nid_t alc_auto_dac_to_mix(struct hda_codec *codec, hda_nid_t pin,
19140
18944
hda_nid_t dac)
19142
18946
hda_nid_t mix[5];
18949
pin = alc_go_down_to_selector(codec, pin);
19145
18950
num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
19146
18951
for (i = 0; i < num; i++) {
19147
if (alc662_mix_to_dac(mix[i]) == dac)
18952
if (alc_auto_mix_to_dac(codec, mix[i]) == dac)
19148
18953
return mix[i];
18958
/* select the connection from pin to DAC if needed */
18959
static int alc_auto_select_dac(struct hda_codec *codec, hda_nid_t pin,
18965
pin = alc_go_down_to_selector(codec, pin);
18966
num = snd_hda_get_connections(codec, pin, mix, ARRAY_SIZE(mix));
18969
for (i = 0; i < num; i++) {
18970
if (alc_auto_mix_to_dac(codec, mix[i]) == dac) {
18971
snd_hda_codec_update_cache(codec, pin, 0,
18972
AC_VERB_SET_CONNECT_SEL, i);
19153
18979
/* look for an empty DAC slot */
19154
static hda_nid_t alc662_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
18980
static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
19156
18982
struct alc_spec *spec = codec->spec;
19157
18983
hda_nid_t srcs[5];
19158
18984
int i, j, num;
18986
pin = alc_go_down_to_selector(codec, pin);
19160
18987
num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
19163
18988
for (i = 0; i < num; i++) {
19164
hda_nid_t nid = alc662_mix_to_dac(srcs[i]);
18989
hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
19167
18992
for (j = 0; j < spec->multiout.num_dacs; j++)
19375
19215
#define alc662_auto_init_input_src alc882_auto_init_input_src
19220
static int alc_auto_fill_multi_ios(struct hda_codec *codec,
19221
unsigned int location)
19223
struct alc_spec *spec = codec->spec;
19224
struct auto_pin_cfg *cfg = &spec->autocfg;
19225
int type, i, num_pins = 0;
19227
for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) {
19228
for (i = 0; i < cfg->num_inputs; i++) {
19229
hda_nid_t nid = cfg->inputs[i].pin;
19231
unsigned int defcfg, caps;
19232
if (cfg->inputs[i].type != type)
19234
defcfg = snd_hda_codec_get_pincfg(codec, nid);
19235
if (get_defcfg_connect(defcfg) != AC_JACK_PORT_COMPLEX)
19237
if (location && get_defcfg_location(defcfg) != location)
19239
caps = snd_hda_query_pin_caps(codec, nid);
19240
if (!(caps & AC_PINCAP_OUT))
19242
dac = alc_auto_look_for_dac(codec, nid);
19245
spec->multi_io[num_pins].pin = nid;
19246
spec->multi_io[num_pins].dac = dac;
19248
spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
19251
spec->multiout.num_dacs = 1;
19257
static int alc_auto_ch_mode_info(struct snd_kcontrol *kcontrol,
19258
struct snd_ctl_elem_info *uinfo)
19260
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19261
struct alc_spec *spec = codec->spec;
19263
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
19265
uinfo->value.enumerated.items = spec->multi_ios + 1;
19266
if (uinfo->value.enumerated.item > spec->multi_ios)
19267
uinfo->value.enumerated.item = spec->multi_ios;
19268
sprintf(uinfo->value.enumerated.name, "%dch",
19269
(uinfo->value.enumerated.item + 1) * 2);
19273
static int alc_auto_ch_mode_get(struct snd_kcontrol *kcontrol,
19274
struct snd_ctl_elem_value *ucontrol)
19276
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19277
struct alc_spec *spec = codec->spec;
19278
ucontrol->value.enumerated.item[0] = (spec->ext_channel_count - 1) / 2;
19282
static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output)
19284
struct alc_spec *spec = codec->spec;
19285
hda_nid_t nid = spec->multi_io[idx].pin;
19287
if (!spec->multi_io[idx].ctl_in)
19288
spec->multi_io[idx].ctl_in =
19289
snd_hda_codec_read(codec, nid, 0,
19290
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
19292
snd_hda_codec_update_cache(codec, nid, 0,
19293
AC_VERB_SET_PIN_WIDGET_CONTROL,
19295
if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19296
snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19298
alc_auto_select_dac(codec, nid, spec->multi_io[idx].dac);
19300
if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)
19301
snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
19302
HDA_AMP_MUTE, HDA_AMP_MUTE);
19303
snd_hda_codec_update_cache(codec, nid, 0,
19304
AC_VERB_SET_PIN_WIDGET_CONTROL,
19305
spec->multi_io[idx].ctl_in);
19310
static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
19311
struct snd_ctl_elem_value *ucontrol)
19313
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
19314
struct alc_spec *spec = codec->spec;
19317
ch = ucontrol->value.enumerated.item[0];
19318
if (ch < 0 || ch > spec->multi_ios)
19320
if (ch == (spec->ext_channel_count - 1) / 2)
19322
spec->ext_channel_count = (ch + 1) * 2;
19323
for (i = 0; i < spec->multi_ios; i++)
19324
alc_set_multi_io(codec, i, i < ch);
19325
spec->multiout.max_channels = spec->ext_channel_count;
19329
static const struct snd_kcontrol_new alc_auto_channel_mode_enum = {
19330
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
19331
.name = "Channel Mode",
19332
.info = alc_auto_ch_mode_info,
19333
.get = alc_auto_ch_mode_get,
19334
.put = alc_auto_ch_mode_put,
19337
static int alc_auto_add_multi_channel_mode(struct hda_codec *codec)
19339
struct alc_spec *spec = codec->spec;
19340
struct auto_pin_cfg *cfg = &spec->autocfg;
19341
unsigned int location, defcfg;
19344
if (cfg->line_outs != 1 ||
19345
cfg->line_out_type != AUTO_PIN_LINE_OUT)
19348
defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]);
19349
location = get_defcfg_location(defcfg);
19351
num_pins = alc_auto_fill_multi_ios(codec, location);
19352
if (num_pins > 0) {
19353
struct snd_kcontrol_new *knew;
19355
knew = alc_kcontrol_new(spec);
19358
*knew = alc_auto_channel_mode_enum;
19359
knew->name = kstrdup("Channel Mode", GFP_KERNEL);
19363
spec->multi_ios = num_pins;
19364
spec->ext_channel_count = 2;
19365
spec->multiout.num_dacs = num_pins + 1;
19377
19370
static int alc662_parse_auto_config(struct hda_codec *codec)
19379
19372
struct alc_spec *spec = codec->spec;
19381
static hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19374
static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
19383
19376
err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,
19384
19377
alc662_ignore);