diff options
| -rw-r--r-- | sound/pci/hda/patch_conexant.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index a5a4b2bddf20..bef214bcdddf 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
| @@ -705,6 +705,17 @@ static struct snd_kcontrol_new cxt5045_test_mixer[] = { | |||
| 705 | .get = conexant_mux_enum_get, | 705 | .get = conexant_mux_enum_get, |
| 706 | .put = conexant_mux_enum_put, | 706 | .put = conexant_mux_enum_put, |
| 707 | }, | 707 | }, |
| 708 | /* Audio input controls */ | ||
| 709 | HDA_CODEC_VOLUME("Input-1 Volume", 0x1a, 0x0, HDA_INPUT), | ||
| 710 | HDA_CODEC_MUTE("Input-1 Switch", 0x1a, 0x0, HDA_INPUT), | ||
| 711 | HDA_CODEC_VOLUME("Input-2 Volume", 0x1a, 0x1, HDA_INPUT), | ||
| 712 | HDA_CODEC_MUTE("Input-2 Switch", 0x1a, 0x1, HDA_INPUT), | ||
| 713 | HDA_CODEC_VOLUME("Input-3 Volume", 0x1a, 0x2, HDA_INPUT), | ||
| 714 | HDA_CODEC_MUTE("Input-3 Switch", 0x1a, 0x2, HDA_INPUT), | ||
| 715 | HDA_CODEC_VOLUME("Input-4 Volume", 0x1a, 0x3, HDA_INPUT), | ||
| 716 | HDA_CODEC_MUTE("Input-4 Switch", 0x1a, 0x3, HDA_INPUT), | ||
| 717 | HDA_CODEC_VOLUME("Input-5 Volume", 0x1a, 0x4, HDA_INPUT), | ||
| 718 | HDA_CODEC_MUTE("Input-5 Switch", 0x1a, 0x4, HDA_INPUT), | ||
| 708 | { } /* end */ | 719 | { } /* end */ |
| 709 | }; | 720 | }; |
| 710 | 721 | ||
| @@ -947,6 +958,23 @@ static void cxt5047_hp_automute(struct hda_codec *codec) | |||
| 947 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); | 958 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); |
| 948 | } | 959 | } |
| 949 | 960 | ||
| 961 | /* mute internal speaker if HP is plugged */ | ||
| 962 | static void cxt5047_hp2_automute(struct hda_codec *codec) | ||
| 963 | { | ||
| 964 | struct conexant_spec *spec = codec->spec; | ||
| 965 | unsigned int bits; | ||
| 966 | |||
| 967 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, | ||
| 968 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
| 969 | |||
| 970 | bits = spec->hp_present ? 0x80 : 0; | ||
| 971 | snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); | ||
| 972 | snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); | ||
| 973 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ | ||
| 974 | snd_hda_codec_amp_update(codec, 0x1c, 0, HDA_OUTPUT, 0, 0x80, bits); | ||
| 975 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); | ||
| 976 | } | ||
| 977 | |||
| 950 | /* toggle input of built-in and mic jack appropriately */ | 978 | /* toggle input of built-in and mic jack appropriately */ |
| 951 | static void cxt5047_hp_automic(struct hda_codec *codec) | 979 | static void cxt5047_hp_automic(struct hda_codec *codec) |
| 952 | { | 980 | { |
| @@ -985,6 +1013,21 @@ static void cxt5047_hp_unsol_event(struct hda_codec *codec, | |||
| 985 | } | 1013 | } |
| 986 | } | 1014 | } |
| 987 | 1015 | ||
| 1016 | /* unsolicited event for HP jack sensing - non-EAPD systems */ | ||
| 1017 | static void cxt5047_hp2_unsol_event(struct hda_codec *codec, | ||
| 1018 | unsigned int res) | ||
| 1019 | { | ||
| 1020 | res >>= 26; | ||
| 1021 | switch (res) { | ||
| 1022 | case CONEXANT_HP_EVENT: | ||
| 1023 | cxt5047_hp2_automute(codec); | ||
| 1024 | break; | ||
| 1025 | case CONEXANT_MIC_EVENT: | ||
| 1026 | cxt5047_hp_automic(codec); | ||
| 1027 | break; | ||
| 1028 | } | ||
| 1029 | } | ||
| 1030 | |||
| 988 | static struct snd_kcontrol_new cxt5047_mixers[] = { | 1031 | static struct snd_kcontrol_new cxt5047_mixers[] = { |
| 989 | HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), | 1032 | HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), |
| 990 | HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), | 1033 | HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), |
| @@ -1300,19 +1343,20 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
| 1300 | spec->channel_mode = cxt5047_modes, | 1343 | spec->channel_mode = cxt5047_modes, |
| 1301 | 1344 | ||
| 1302 | codec->patch_ops = conexant_patch_ops; | 1345 | codec->patch_ops = conexant_patch_ops; |
| 1303 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
| 1304 | 1346 | ||
| 1305 | board_config = snd_hda_check_board_config(codec, CXT5047_MODELS, | 1347 | board_config = snd_hda_check_board_config(codec, CXT5047_MODELS, |
| 1306 | cxt5047_models, | 1348 | cxt5047_models, |
| 1307 | cxt5047_cfg_tbl); | 1349 | cxt5047_cfg_tbl); |
| 1308 | switch (board_config) { | 1350 | switch (board_config) { |
| 1309 | case CXT5047_LAPTOP: | 1351 | case CXT5047_LAPTOP: |
| 1352 | codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event; | ||
| 1310 | break; | 1353 | break; |
| 1311 | case CXT5047_LAPTOP_HP: | 1354 | case CXT5047_LAPTOP_HP: |
| 1312 | spec->input_mux = &cxt5047_hp_capture_source; | 1355 | spec->input_mux = &cxt5047_hp_capture_source; |
| 1313 | spec->num_init_verbs = 2; | 1356 | spec->num_init_verbs = 2; |
| 1314 | spec->init_verbs[1] = cxt5047_hp_init_verbs; | 1357 | spec->init_verbs[1] = cxt5047_hp_init_verbs; |
| 1315 | spec->mixers[0] = cxt5047_hp_mixers; | 1358 | spec->mixers[0] = cxt5047_hp_mixers; |
| 1359 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
| 1316 | codec->patch_ops.init = cxt5047_hp_init; | 1360 | codec->patch_ops.init = cxt5047_hp_init; |
| 1317 | break; | 1361 | break; |
| 1318 | case CXT5047_LAPTOP_EAPD: | 1362 | case CXT5047_LAPTOP_EAPD: |
| @@ -1320,12 +1364,14 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
| 1320 | spec->num_init_verbs = 2; | 1364 | spec->num_init_verbs = 2; |
| 1321 | spec->init_verbs[1] = cxt5047_toshiba_init_verbs; | 1365 | spec->init_verbs[1] = cxt5047_toshiba_init_verbs; |
| 1322 | spec->mixers[0] = cxt5047_toshiba_mixers; | 1366 | spec->mixers[0] = cxt5047_toshiba_mixers; |
| 1367 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
| 1323 | break; | 1368 | break; |
| 1324 | #ifdef CONFIG_SND_DEBUG | 1369 | #ifdef CONFIG_SND_DEBUG |
| 1325 | case CXT5047_TEST: | 1370 | case CXT5047_TEST: |
| 1326 | spec->input_mux = &cxt5047_test_capture_source; | 1371 | spec->input_mux = &cxt5047_test_capture_source; |
| 1327 | spec->mixers[0] = cxt5047_test_mixer; | 1372 | spec->mixers[0] = cxt5047_test_mixer; |
| 1328 | spec->init_verbs[0] = cxt5047_test_init_verbs; | 1373 | spec->init_verbs[0] = cxt5047_test_init_verbs; |
| 1374 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
| 1329 | #endif | 1375 | #endif |
| 1330 | } | 1376 | } |
| 1331 | return 0; | 1377 | return 0; |
