diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 13:13:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 13:13:38 -0400 |
commit | fc8a327db6c46de783b1a4276d846841b9abc24c (patch) | |
tree | bee512c142cccea93511debd98ef954581693727 /sound/pci/hda/patch_conexant.c | |
parent | 92d15c2ccbb3e31a3fc71ad28fdb55e1319383c0 (diff) | |
parent | 24837e6f249a2c83667552e6871c1543b4a6b934 (diff) |
Merge branch 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa: (264 commits)
[ALSA] version 1.0.15
[ALSA] Fix thinko in cs4231 mce down check
[ALSA] sun-cs4231: improved waiting after MCE down
[ALSA] sun-cs4231: use cs4231-regs.h
[ALSA] This simplifies and fixes waiting loops of the mce_down()
[ALSA] This patch adds support for a wavetable chip on
[ALSA] This patch removes open_mutex from the ad1848-lib as
[ALSA] fix bootup crash in snd_gus_interrupt()
[ALSA] hda-codec - Fix SKU ID function for realtek codecs
[ALSA] Support ASUS P701 eeepc [0x1043 0x82a1] support
[ALSA] hda-codec - Add array terminator for dmic in STAC codec
[ALSA] hdsp - Fix zero division
[ALSA] usb-audio - Fix double comment
[ALSA] hda-codec - Fix STAC922x volume knob control
[ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz
[ALSA] hda-codec - Fix for Fujitsu Lifebook C1410
[ALSA] mpu-401: remove MPU401_INFO_UART_ONLY flag
[ALSA] mpu-401: do not require an ACK byte for the ENTER_UART command
[ALSA] via82xx - Add DXS quirk for Shuttle AK31v2
[ALSA] hda-codec - Fix input_mux numbers for vaio stac92xx
...
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 156 |
1 files changed, 48 insertions, 108 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 4d8e8af5c819..080e3001d9c5 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -311,23 +311,6 @@ static void conexant_free(struct hda_codec *codec) | |||
311 | kfree(codec->spec); | 311 | kfree(codec->spec); |
312 | } | 312 | } |
313 | 313 | ||
314 | #ifdef CONFIG_PM | ||
315 | static int conexant_resume(struct hda_codec *codec) | ||
316 | { | ||
317 | struct conexant_spec *spec = codec->spec; | ||
318 | int i; | ||
319 | |||
320 | codec->patch_ops.init(codec); | ||
321 | for (i = 0; i < spec->num_mixers; i++) | ||
322 | snd_hda_resume_ctls(codec, spec->mixers[i]); | ||
323 | if (spec->multiout.dig_out_nid) | ||
324 | snd_hda_resume_spdif_out(codec); | ||
325 | if (spec->dig_in_nid) | ||
326 | snd_hda_resume_spdif_in(codec); | ||
327 | return 0; | ||
328 | } | ||
329 | #endif | ||
330 | |||
331 | static int conexant_build_controls(struct hda_codec *codec) | 314 | static int conexant_build_controls(struct hda_codec *codec) |
332 | { | 315 | { |
333 | struct conexant_spec *spec = codec->spec; | 316 | struct conexant_spec *spec = codec->spec; |
@@ -358,9 +341,6 @@ static struct hda_codec_ops conexant_patch_ops = { | |||
358 | .build_pcms = conexant_build_pcms, | 341 | .build_pcms = conexant_build_pcms, |
359 | .init = conexant_init, | 342 | .init = conexant_init, |
360 | .free = conexant_free, | 343 | .free = conexant_free, |
361 | #ifdef CONFIG_PM | ||
362 | .resume = conexant_resume, | ||
363 | #endif | ||
364 | }; | 344 | }; |
365 | 345 | ||
366 | /* | 346 | /* |
@@ -368,15 +348,7 @@ static struct hda_codec_ops conexant_patch_ops = { | |||
368 | * the private value = nid | (invert << 8) | 348 | * the private value = nid | (invert << 8) |
369 | */ | 349 | */ |
370 | 350 | ||
371 | static int cxt_eapd_info(struct snd_kcontrol *kcontrol, | 351 | #define cxt_eapd_info snd_ctl_boolean_mono_info |
372 | struct snd_ctl_elem_info *uinfo) | ||
373 | { | ||
374 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
375 | uinfo->count = 1; | ||
376 | uinfo->value.integer.min = 0; | ||
377 | uinfo->value.integer.max = 1; | ||
378 | return 0; | ||
379 | } | ||
380 | 352 | ||
381 | static int cxt_eapd_get(struct snd_kcontrol *kcontrol, | 353 | static int cxt_eapd_get(struct snd_kcontrol *kcontrol, |
382 | struct snd_ctl_elem_value *ucontrol) | 354 | struct snd_ctl_elem_value *ucontrol) |
@@ -404,13 +376,13 @@ static int cxt_eapd_put(struct snd_kcontrol *kcontrol, | |||
404 | eapd = ucontrol->value.integer.value[0]; | 376 | eapd = ucontrol->value.integer.value[0]; |
405 | if (invert) | 377 | if (invert) |
406 | eapd = !eapd; | 378 | eapd = !eapd; |
407 | if (eapd == spec->cur_eapd && !codec->in_resume) | 379 | if (eapd == spec->cur_eapd) |
408 | return 0; | 380 | return 0; |
409 | 381 | ||
410 | spec->cur_eapd = eapd; | 382 | spec->cur_eapd = eapd; |
411 | snd_hda_codec_write(codec, nid, | 383 | snd_hda_codec_write_cache(codec, nid, |
412 | 0, AC_VERB_SET_EAPD_BTLENABLE, | 384 | 0, AC_VERB_SET_EAPD_BTLENABLE, |
413 | eapd ? 0x02 : 0x00); | 385 | eapd ? 0x02 : 0x00); |
414 | return 1; | 386 | return 1; |
415 | } | 387 | } |
416 | 388 | ||
@@ -500,34 +472,25 @@ static int cxt5045_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
500 | /* toggle internal speakers mute depending of presence of | 472 | /* toggle internal speakers mute depending of presence of |
501 | * the headphone jack | 473 | * the headphone jack |
502 | */ | 474 | */ |
503 | bits = (!spec->hp_present && spec->cur_eapd) ? 0 : 0x80; | 475 | bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE; |
504 | snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, 0x80, bits); | 476 | snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0, |
505 | snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, 0x80, bits); | 477 | HDA_AMP_MUTE, bits); |
506 | 478 | ||
507 | bits = spec->cur_eapd ? 0 : 0x80; | 479 | bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE; |
508 | snd_hda_codec_amp_update(codec, 0x11, 0, HDA_OUTPUT, 0, 0x80, bits); | 480 | snd_hda_codec_amp_stereo(codec, 0x11, HDA_OUTPUT, 0, |
509 | snd_hda_codec_amp_update(codec, 0x11, 1, HDA_OUTPUT, 0, 0x80, bits); | 481 | HDA_AMP_MUTE, bits); |
510 | return 1; | 482 | return 1; |
511 | } | 483 | } |
512 | 484 | ||
513 | /* bind volumes of both NID 0x10 and 0x11 */ | 485 | /* bind volumes of both NID 0x10 and 0x11 */ |
514 | static int cxt5045_hp_master_vol_put(struct snd_kcontrol *kcontrol, | 486 | static struct hda_bind_ctls cxt5045_hp_bind_master_vol = { |
515 | struct snd_ctl_elem_value *ucontrol) | 487 | .ops = &snd_hda_bind_vol, |
516 | { | 488 | .values = { |
517 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 489 | HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT), |
518 | long *valp = ucontrol->value.integer.value; | 490 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), |
519 | int change; | 491 | 0 |
520 | 492 | }, | |
521 | change = snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, | 493 | }; |
522 | 0x7f, valp[0] & 0x7f); | ||
523 | change |= snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, | ||
524 | 0x7f, valp[1] & 0x7f); | ||
525 | snd_hda_codec_amp_update(codec, 0x11, 0, HDA_OUTPUT, 0, | ||
526 | 0x7f, valp[0] & 0x7f); | ||
527 | snd_hda_codec_amp_update(codec, 0x11, 1, HDA_OUTPUT, 0, | ||
528 | 0x7f, valp[1] & 0x7f); | ||
529 | return change; | ||
530 | } | ||
531 | 494 | ||
532 | /* toggle input of built-in and mic jack appropriately */ | 495 | /* toggle input of built-in and mic jack appropriately */ |
533 | static void cxt5045_hp_automic(struct hda_codec *codec) | 496 | static void cxt5045_hp_automic(struct hda_codec *codec) |
@@ -562,9 +525,9 @@ static void cxt5045_hp_automute(struct hda_codec *codec) | |||
562 | spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, | 525 | spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, |
563 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 526 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
564 | 527 | ||
565 | bits = (spec->hp_present || !spec->cur_eapd) ? 0x80 : 0; | 528 | bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; |
566 | snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, 0x80, bits); | 529 | snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0, |
567 | snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, 0x80, bits); | 530 | HDA_AMP_MUTE, bits); |
568 | } | 531 | } |
569 | 532 | ||
570 | /* unsolicited event for HP jack sensing */ | 533 | /* unsolicited event for HP jack sensing */ |
@@ -595,14 +558,7 @@ static struct snd_kcontrol_new cxt5045_mixers[] = { | |||
595 | HDA_CODEC_MUTE("Int Mic Switch", 0x1a, 0x01, HDA_INPUT), | 558 | HDA_CODEC_MUTE("Int Mic Switch", 0x1a, 0x01, HDA_INPUT), |
596 | HDA_CODEC_VOLUME("Ext Mic Volume", 0x1a, 0x02, HDA_INPUT), | 559 | HDA_CODEC_VOLUME("Ext Mic Volume", 0x1a, 0x02, HDA_INPUT), |
597 | HDA_CODEC_MUTE("Ext Mic Switch", 0x1a, 0x02, HDA_INPUT), | 560 | HDA_CODEC_MUTE("Ext Mic Switch", 0x1a, 0x02, HDA_INPUT), |
598 | { | 561 | HDA_BIND_VOL("Master Playback Volume", &cxt5045_hp_bind_master_vol), |
599 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
600 | .name = "Master Playback Volume", | ||
601 | .info = snd_hda_mixer_amp_volume_info, | ||
602 | .get = snd_hda_mixer_amp_volume_get, | ||
603 | .put = cxt5045_hp_master_vol_put, | ||
604 | .private_value = HDA_COMPOSE_AMP_VAL(0x10, 3, 0, HDA_OUTPUT), | ||
605 | }, | ||
606 | { | 562 | { |
607 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 563 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
608 | .name = "Master Playback Switch", | 564 | .name = "Master Playback Switch", |
@@ -915,33 +871,24 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
915 | /* toggle internal speakers mute depending of presence of | 871 | /* toggle internal speakers mute depending of presence of |
916 | * the headphone jack | 872 | * the headphone jack |
917 | */ | 873 | */ |
918 | bits = (!spec->hp_present && spec->cur_eapd) ? 0 : 0x80; | 874 | bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE; |
919 | snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); | 875 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, |
920 | snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); | 876 | HDA_AMP_MUTE, bits); |
921 | bits = spec->cur_eapd ? 0 : 0x80; | 877 | bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE; |
922 | snd_hda_codec_amp_update(codec, 0x13, 0, HDA_OUTPUT, 0, 0x80, bits); | 878 | snd_hda_codec_amp_stereo(codec, 0x13, HDA_OUTPUT, 0, |
923 | snd_hda_codec_amp_update(codec, 0x13, 1, HDA_OUTPUT, 0, 0x80, bits); | 879 | HDA_AMP_MUTE, bits); |
924 | return 1; | 880 | return 1; |
925 | } | 881 | } |
926 | 882 | ||
927 | /* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */ | 883 | /* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */ |
928 | static int cxt5047_hp_master_vol_put(struct snd_kcontrol *kcontrol, | 884 | static struct hda_bind_ctls cxt5047_bind_master_vol = { |
929 | struct snd_ctl_elem_value *ucontrol) | 885 | .ops = &snd_hda_bind_vol, |
930 | { | 886 | .values = { |
931 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 887 | HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT), |
932 | long *valp = ucontrol->value.integer.value; | 888 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), |
933 | int change; | 889 | 0 |
934 | 890 | }, | |
935 | change = snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, | 891 | }; |
936 | 0x7f, valp[0] & 0x7f); | ||
937 | change |= snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, | ||
938 | 0x7f, valp[1] & 0x7f); | ||
939 | snd_hda_codec_amp_update(codec, 0x13, 0, HDA_OUTPUT, 0, | ||
940 | 0x7f, valp[0] & 0x7f); | ||
941 | snd_hda_codec_amp_update(codec, 0x13, 1, HDA_OUTPUT, 0, | ||
942 | 0x7f, valp[1] & 0x7f); | ||
943 | return change; | ||
944 | } | ||
945 | 892 | ||
946 | /* mute internal speaker if HP is plugged */ | 893 | /* mute internal speaker if HP is plugged */ |
947 | static void cxt5047_hp_automute(struct hda_codec *codec) | 894 | static void cxt5047_hp_automute(struct hda_codec *codec) |
@@ -952,12 +899,12 @@ static void cxt5047_hp_automute(struct hda_codec *codec) | |||
952 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, | 899 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, |
953 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 900 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
954 | 901 | ||
955 | bits = (spec->hp_present || !spec->cur_eapd) ? 0x80 : 0; | 902 | bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; |
956 | snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); | 903 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, |
957 | snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); | 904 | HDA_AMP_MUTE, bits); |
958 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ | 905 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ |
959 | snd_hda_codec_amp_update(codec, 0x1c, 0, HDA_OUTPUT, 0, 0x80, bits); | 906 | snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, |
960 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); | 907 | HDA_AMP_MUTE, bits); |
961 | } | 908 | } |
962 | 909 | ||
963 | /* mute internal speaker if HP is plugged */ | 910 | /* mute internal speaker if HP is plugged */ |
@@ -969,12 +916,12 @@ static void cxt5047_hp2_automute(struct hda_codec *codec) | |||
969 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, | 916 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, |
970 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 917 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
971 | 918 | ||
972 | bits = spec->hp_present ? 0x80 : 0; | 919 | bits = spec->hp_present ? HDA_AMP_MUTE : 0; |
973 | snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); | 920 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, |
974 | snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); | 921 | HDA_AMP_MUTE, bits); |
975 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ | 922 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ |
976 | snd_hda_codec_amp_update(codec, 0x1c, 0, HDA_OUTPUT, 0, 0x80, bits); | 923 | snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, |
977 | snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); | 924 | HDA_AMP_MUTE, bits); |
978 | } | 925 | } |
979 | 926 | ||
980 | /* toggle input of built-in and mic jack appropriately */ | 927 | /* toggle input of built-in and mic jack appropriately */ |
@@ -1063,14 +1010,7 @@ static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { | |||
1063 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), | 1010 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), |
1064 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), | 1011 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), |
1065 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), | 1012 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), |
1066 | { | 1013 | HDA_BIND_VOL("Master Playback Volume", &cxt5047_bind_master_vol), |
1067 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1068 | .name = "Master Playback Volume", | ||
1069 | .info = snd_hda_mixer_amp_volume_info, | ||
1070 | .get = snd_hda_mixer_amp_volume_get, | ||
1071 | .put = cxt5047_hp_master_vol_put, | ||
1072 | .private_value = HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT), | ||
1073 | }, | ||
1074 | { | 1014 | { |
1075 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1015 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1076 | .name = "Master Playback Switch", | 1016 | .name = "Master Playback Switch", |