aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2010-08-04 09:14:38 -0400
committerJiri Kosina <jkosina@suse.cz>2010-08-04 09:14:38 -0400
commitd790d4d583aeaed9fc6f8a9f4d9f8ce6b1c15c7f (patch)
tree854ab394486288d40fa8179cbfaf66e8bdc44b0f /sound/pci
parent73b2c7165b76b20eb1290e7efebc33cfd21db1ca (diff)
parent3a09b1be53d23df780a0cd0e4087a05e2ca4a00c (diff)
Merge branch 'master' into for-next
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/asihpi/hpi6205.c22
-rw-r--r--sound/pci/hda/hda_codec.c27
-rw-r--r--sound/pci/hda/hda_codec.h5
-rw-r--r--sound/pci/hda/patch_hdmi.c13
-rw-r--r--sound/pci/hda/patch_nvhdmi.c3
-rw-r--r--sound/pci/hda/patch_realtek.c96
6 files changed, 119 insertions, 47 deletions
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index e89991ea3543..3b4413448226 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -941,11 +941,11 @@ static void outstream_host_buffer_free(struct hpi_adapter_obj *pao,
941 941
942} 942}
943 943
944static long outstream_get_space_available(struct hpi_hostbuffer_status 944static u32 outstream_get_space_available(struct hpi_hostbuffer_status
945 *status) 945 *status)
946{ 946{
947 return status->size_in_bytes - ((long)(status->host_index) - 947 return status->size_in_bytes - (status->host_index -
948 (long)(status->dSP_index)); 948 status->dSP_index);
949} 949}
950 950
951static void outstream_write(struct hpi_adapter_obj *pao, 951static void outstream_write(struct hpi_adapter_obj *pao,
@@ -954,7 +954,7 @@ static void outstream_write(struct hpi_adapter_obj *pao,
954 struct hpi_hw_obj *phw = pao->priv; 954 struct hpi_hw_obj *phw = pao->priv;
955 struct bus_master_interface *interface = phw->p_interface_buffer; 955 struct bus_master_interface *interface = phw->p_interface_buffer;
956 struct hpi_hostbuffer_status *status; 956 struct hpi_hostbuffer_status *status;
957 long space_available; 957 u32 space_available;
958 958
959 if (!phw->outstream_host_buffer_size[phm->obj_index]) { 959 if (!phw->outstream_host_buffer_size[phm->obj_index]) {
960 /* there is no BBM buffer, write via message */ 960 /* there is no BBM buffer, write via message */
@@ -1007,7 +1007,7 @@ static void outstream_write(struct hpi_adapter_obj *pao,
1007 } 1007 }
1008 1008
1009 space_available = outstream_get_space_available(status); 1009 space_available = outstream_get_space_available(status);
1010 if (space_available < (long)phm->u.d.u.data.data_size) { 1010 if (space_available < phm->u.d.u.data.data_size) {
1011 phr->error = HPI_ERROR_INVALID_DATASIZE; 1011 phr->error = HPI_ERROR_INVALID_DATASIZE;
1012 return; 1012 return;
1013 } 1013 }
@@ -1018,7 +1018,7 @@ static void outstream_write(struct hpi_adapter_obj *pao,
1018 && hpios_locked_mem_valid(&phw->outstream_host_buffers[phm-> 1018 && hpios_locked_mem_valid(&phw->outstream_host_buffers[phm->
1019 obj_index])) { 1019 obj_index])) {
1020 u8 *p_bbm_data; 1020 u8 *p_bbm_data;
1021 long l_first_write; 1021 u32 l_first_write;
1022 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data; 1022 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data;
1023 1023
1024 if (hpios_locked_mem_get_virt_addr(&phw-> 1024 if (hpios_locked_mem_get_virt_addr(&phw->
@@ -1248,9 +1248,9 @@ static void instream_start(struct hpi_adapter_obj *pao,
1248 hw_message(pao, phm, phr); 1248 hw_message(pao, phm, phr);
1249} 1249}
1250 1250
1251static long instream_get_bytes_available(struct hpi_hostbuffer_status *status) 1251static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status)
1252{ 1252{
1253 return (long)(status->dSP_index) - (long)(status->host_index); 1253 return status->dSP_index - status->host_index;
1254} 1254}
1255 1255
1256static void instream_read(struct hpi_adapter_obj *pao, 1256static void instream_read(struct hpi_adapter_obj *pao,
@@ -1259,9 +1259,9 @@ static void instream_read(struct hpi_adapter_obj *pao,
1259 struct hpi_hw_obj *phw = pao->priv; 1259 struct hpi_hw_obj *phw = pao->priv;
1260 struct bus_master_interface *interface = phw->p_interface_buffer; 1260 struct bus_master_interface *interface = phw->p_interface_buffer;
1261 struct hpi_hostbuffer_status *status; 1261 struct hpi_hostbuffer_status *status;
1262 long data_available; 1262 u32 data_available;
1263 u8 *p_bbm_data; 1263 u8 *p_bbm_data;
1264 long l_first_read; 1264 u32 l_first_read;
1265 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data; 1265 u8 *p_app_data = (u8 *)phm->u.d.u.data.pb_data;
1266 1266
1267 if (!phw->instream_host_buffer_size[phm->obj_index]) { 1267 if (!phw->instream_host_buffer_size[phm->obj_index]) {
@@ -1272,7 +1272,7 @@ static void instream_read(struct hpi_adapter_obj *pao,
1272 1272
1273 status = &interface->instream_host_buffer_status[phm->obj_index]; 1273 status = &interface->instream_host_buffer_status[phm->obj_index];
1274 data_available = instream_get_bytes_available(status); 1274 data_available = instream_get_bytes_available(status);
1275 if (data_available < (long)phm->u.d.u.data.data_size) { 1275 if (data_available < phm->u.d.u.data.data_size) {
1276 phr->error = HPI_ERROR_INVALID_DATASIZE; 1276 phr->error = HPI_ERROR_INVALID_DATASIZE;
1277 return; 1277 return;
1278 } 1278 }
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index a3d638c8c1fd..ba2098d20ccc 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -784,6 +784,9 @@ static int read_pin_defaults(struct hda_codec *codec)
784 pin->nid = nid; 784 pin->nid = nid;
785 pin->cfg = snd_hda_codec_read(codec, nid, 0, 785 pin->cfg = snd_hda_codec_read(codec, nid, 0,
786 AC_VERB_GET_CONFIG_DEFAULT, 0); 786 AC_VERB_GET_CONFIG_DEFAULT, 0);
787 pin->ctrl = snd_hda_codec_read(codec, nid, 0,
788 AC_VERB_GET_PIN_WIDGET_CONTROL,
789 0);
787 } 790 }
788 return 0; 791 return 0;
789} 792}
@@ -912,15 +915,38 @@ static void restore_pincfgs(struct hda_codec *codec)
912void snd_hda_shutup_pins(struct hda_codec *codec) 915void snd_hda_shutup_pins(struct hda_codec *codec)
913{ 916{
914 int i; 917 int i;
918 /* don't shut up pins when unloading the driver; otherwise it breaks
919 * the default pin setup at the next load of the driver
920 */
921 if (codec->bus->shutdown)
922 return;
915 for (i = 0; i < codec->init_pins.used; i++) { 923 for (i = 0; i < codec->init_pins.used; i++) {
916 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); 924 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
917 /* use read here for syncing after issuing each verb */ 925 /* use read here for syncing after issuing each verb */
918 snd_hda_codec_read(codec, pin->nid, 0, 926 snd_hda_codec_read(codec, pin->nid, 0,
919 AC_VERB_SET_PIN_WIDGET_CONTROL, 0); 927 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
920 } 928 }
929 codec->pins_shutup = 1;
921} 930}
922EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); 931EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
923 932
933/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
934static void restore_shutup_pins(struct hda_codec *codec)
935{
936 int i;
937 if (!codec->pins_shutup)
938 return;
939 if (codec->bus->shutdown)
940 return;
941 for (i = 0; i < codec->init_pins.used; i++) {
942 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
943 snd_hda_codec_write(codec, pin->nid, 0,
944 AC_VERB_SET_PIN_WIDGET_CONTROL,
945 pin->ctrl);
946 }
947 codec->pins_shutup = 0;
948}
949
924static void init_hda_cache(struct hda_cache_rec *cache, 950static void init_hda_cache(struct hda_cache_rec *cache,
925 unsigned int record_size); 951 unsigned int record_size);
926static void free_hda_cache(struct hda_cache_rec *cache); 952static void free_hda_cache(struct hda_cache_rec *cache);
@@ -2907,6 +2933,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
2907 codec->afg ? codec->afg : codec->mfg, 2933 codec->afg ? codec->afg : codec->mfg,
2908 AC_PWRST_D0); 2934 AC_PWRST_D0);
2909 restore_pincfgs(codec); /* restore all current pin configs */ 2935 restore_pincfgs(codec); /* restore all current pin configs */
2936 restore_shutup_pins(codec);
2910 hda_exec_init_verbs(codec); 2937 hda_exec_init_verbs(codec);
2911 if (codec->patch_ops.resume) 2938 if (codec->patch_ops.resume)
2912 codec->patch_ops.resume(codec); 2939 codec->patch_ops.resume(codec);
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 49e939e7e5cd..5991d14e1ec0 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -821,6 +821,7 @@ struct hda_codec {
821 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 821 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
822 * (e.g. Conexant codecs) 822 * (e.g. Conexant codecs)
823 */ 823 */
824 unsigned int pins_shutup:1; /* pins are shut up */
824 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */ 825 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
825#ifdef CONFIG_SND_HDA_POWER_SAVE 826#ifdef CONFIG_SND_HDA_POWER_SAVE
826 unsigned int power_on :1; /* current (global) power-state */ 827 unsigned int power_on :1; /* current (global) power-state */
@@ -897,7 +898,9 @@ void snd_hda_codec_resume_cache(struct hda_codec *codec);
897/* the struct for codec->pin_configs */ 898/* the struct for codec->pin_configs */
898struct hda_pincfg { 899struct hda_pincfg {
899 hda_nid_t nid; 900 hda_nid_t nid;
900 unsigned int cfg; 901 unsigned char ctrl; /* current pin control value */
902 unsigned char pad; /* reserved */
903 unsigned int cfg; /* default configuration */
901}; 904};
902 905
903unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid); 906unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid);
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 86067ee78632..2fc53961054e 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -52,6 +52,10 @@ struct hdmi_spec {
52 */ 52 */
53 struct hda_multi_out multiout; 53 struct hda_multi_out multiout;
54 unsigned int codec_type; 54 unsigned int codec_type;
55
56 /* misc flags */
57 /* PD bit indicates only the update, not the current state */
58 unsigned int old_pin_detect:1;
55}; 59};
56 60
57 61
@@ -616,6 +620,9 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec, hda_nid_t nid,
616 * Unsolicited events 620 * Unsolicited events
617 */ 621 */
618 622
623static void hdmi_present_sense(struct hda_codec *codec, hda_nid_t pin_nid,
624 struct hdmi_eld *eld);
625
619static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) 626static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
620{ 627{
621 struct hdmi_spec *spec = codec->spec; 628 struct hdmi_spec *spec = codec->spec;
@@ -632,6 +639,12 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
632 if (index < 0) 639 if (index < 0)
633 return; 640 return;
634 641
642 if (spec->old_pin_detect) {
643 if (pind)
644 hdmi_present_sense(codec, tag, &spec->sink_eld[index]);
645 pind = spec->sink_eld[index].monitor_present;
646 }
647
635 spec->sink_eld[index].monitor_present = pind; 648 spec->sink_eld[index].monitor_present = pind;
636 spec->sink_eld[index].eld_valid = eldv; 649 spec->sink_eld[index].eld_valid = eldv;
637 650
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c
index 3c10c0b149f4..b0652acee9b2 100644
--- a/sound/pci/hda/patch_nvhdmi.c
+++ b/sound/pci/hda/patch_nvhdmi.c
@@ -478,6 +478,7 @@ static int patch_nvhdmi_8ch_89(struct hda_codec *codec)
478 478
479 codec->spec = spec; 479 codec->spec = spec;
480 spec->codec_type = HDA_CODEC_NVIDIA_MCP89; 480 spec->codec_type = HDA_CODEC_NVIDIA_MCP89;
481 spec->old_pin_detect = 1;
481 482
482 if (hdmi_parse_codec(codec) < 0) { 483 if (hdmi_parse_codec(codec) < 0) {
483 codec->spec = NULL; 484 codec->spec = NULL;
@@ -508,6 +509,7 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
508 spec->multiout.max_channels = 8; 509 spec->multiout.max_channels = 8;
509 spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; 510 spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x;
510 spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; 511 spec->codec_type = HDA_CODEC_NVIDIA_MCP7X;
512 spec->old_pin_detect = 1;
511 513
512 codec->patch_ops = nvhdmi_patch_ops_8ch_7x; 514 codec->patch_ops = nvhdmi_patch_ops_8ch_7x;
513 515
@@ -528,6 +530,7 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec)
528 spec->multiout.max_channels = 2; 530 spec->multiout.max_channels = 2;
529 spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x; 531 spec->multiout.dig_out_nid = nvhdmi_master_con_nid_7x;
530 spec->codec_type = HDA_CODEC_NVIDIA_MCP7X; 532 spec->codec_type = HDA_CODEC_NVIDIA_MCP7X;
533 spec->old_pin_detect = 1;
531 534
532 codec->patch_ops = nvhdmi_patch_ops_2ch; 535 codec->patch_ops = nvhdmi_patch_ops_2ch;
533 536
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fc767b6b4785..596ea2f12cf6 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1267,6 +1267,8 @@ static int alc_auto_parse_customize_define(struct hda_codec *codec)
1267 unsigned nid = 0; 1267 unsigned nid = 0;
1268 struct alc_spec *spec = codec->spec; 1268 struct alc_spec *spec = codec->spec;
1269 1269
1270 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
1271
1270 ass = codec->subsystem_id & 0xffff; 1272 ass = codec->subsystem_id & 0xffff;
1271 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) 1273 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
1272 goto do_sku; 1274 goto do_sku;
@@ -2547,7 +2549,7 @@ static struct snd_kcontrol_new alc_beep_mixer[] = {
2547static int alc_build_controls(struct hda_codec *codec) 2549static int alc_build_controls(struct hda_codec *codec)
2548{ 2550{
2549 struct alc_spec *spec = codec->spec; 2551 struct alc_spec *spec = codec->spec;
2550 struct snd_kcontrol *kctl; 2552 struct snd_kcontrol *kctl = NULL;
2551 struct snd_kcontrol_new *knew; 2553 struct snd_kcontrol_new *knew;
2552 int i, j, err; 2554 int i, j, err;
2553 unsigned int u; 2555 unsigned int u;
@@ -2619,16 +2621,18 @@ static int alc_build_controls(struct hda_codec *codec)
2619 } 2621 }
2620 2622
2621 /* assign Capture Source enums to NID */ 2623 /* assign Capture Source enums to NID */
2622 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); 2624 if (spec->capsrc_nids || spec->adc_nids) {
2623 if (!kctl) 2625 kctl = snd_hda_find_mixer_ctl(codec, "Capture Source");
2624 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 2626 if (!kctl)
2625 for (i = 0; kctl && i < kctl->count; i++) { 2627 kctl = snd_hda_find_mixer_ctl(codec, "Input Source");
2626 hda_nid_t *nids = spec->capsrc_nids; 2628 for (i = 0; kctl && i < kctl->count; i++) {
2627 if (!nids) 2629 hda_nid_t *nids = spec->capsrc_nids;
2628 nids = spec->adc_nids; 2630 if (!nids)
2629 err = snd_hda_add_nid(codec, kctl, i, nids[i]); 2631 nids = spec->adc_nids;
2630 if (err < 0) 2632 err = snd_hda_add_nid(codec, kctl, i, nids[i]);
2631 return err; 2633 if (err < 0)
2634 return err;
2635 }
2632 } 2636 }
2633 if (spec->cap_mixer) { 2637 if (spec->cap_mixer) {
2634 const char *kname = kctl ? kctl->id.name : NULL; 2638 const char *kname = kctl ? kctl->id.name : NULL;
@@ -5176,8 +5180,24 @@ static void fillup_priv_adc_nids(struct hda_codec *codec, hda_nid_t *nids,
5176#ifdef CONFIG_SND_HDA_INPUT_BEEP 5180#ifdef CONFIG_SND_HDA_INPUT_BEEP
5177#define set_beep_amp(spec, nid, idx, dir) \ 5181#define set_beep_amp(spec, nid, idx, dir) \
5178 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) 5182 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir))
5183
5184static struct snd_pci_quirk beep_white_list[] = {
5185 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
5186 {}
5187};
5188
5189static inline int has_cdefine_beep(struct hda_codec *codec)
5190{
5191 struct alc_spec *spec = codec->spec;
5192 const struct snd_pci_quirk *q;
5193 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list);
5194 if (q)
5195 return q->value;
5196 return spec->cdefine.enable_pcbeep;
5197}
5179#else 5198#else
5180#define set_beep_amp(spec, nid, idx, dir) /* NOP */ 5199#define set_beep_amp(spec, nid, idx, dir) /* NOP */
5200#define has_cdefine_beep(codec) 0
5181#endif 5201#endif
5182 5202
5183/* 5203/*
@@ -6948,7 +6968,7 @@ static struct hda_input_mux mb5_capture_source = {
6948 .num_items = 3, 6968 .num_items = 3,
6949 .items = { 6969 .items = {
6950 { "Mic", 0x1 }, 6970 { "Mic", 0x1 },
6951 { "Line", 0x2 }, 6971 { "Line", 0x7 },
6952 { "CD", 0x4 }, 6972 { "CD", 0x4 },
6953 }, 6973 },
6954}; 6974};
@@ -7469,8 +7489,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7469 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7489 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7470 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7490 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7471 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), 7491 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7472 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7492 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT),
7473 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7493 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT),
7474 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7494 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
7475 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 7495 HDA_CODEC_MUTE ("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
7476 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), 7496 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT),
@@ -7853,10 +7873,9 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7853 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 7873 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
7854 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7874 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
7855 7875
7856 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7876 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0x1)},
7857 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 7877 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x7)},
7858 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 7878 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0x4)},
7859 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
7860 { } 7879 { }
7861}; 7880};
7862 7881
@@ -9485,6 +9504,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
9485 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24), 9504 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
9486 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), 9505 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
9487 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), 9506 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
9507 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
9488 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2, 9508 /* FIXME: HP jack sense seems not working for MBP 5,1 or 5,2,
9489 * so apparently no perfect solution yet 9509 * so apparently no perfect solution yet
9490 */ 9510 */
@@ -10562,10 +10582,12 @@ static int patch_alc882(struct hda_codec *codec)
10562 } 10582 }
10563 } 10583 }
10564 10584
10565 err = snd_hda_attach_beep_device(codec, 0x1); 10585 if (has_cdefine_beep(codec)) {
10566 if (err < 0) { 10586 err = snd_hda_attach_beep_device(codec, 0x1);
10567 alc_free(codec); 10587 if (err < 0) {
10568 return err; 10588 alc_free(codec);
10589 return err;
10590 }
10569 } 10591 }
10570 10592
10571 if (board_config != ALC882_AUTO) 10593 if (board_config != ALC882_AUTO)
@@ -10615,7 +10637,7 @@ static int patch_alc882(struct hda_codec *codec)
10615 10637
10616 set_capture_mixer(codec); 10638 set_capture_mixer(codec);
10617 10639
10618 if (spec->cdefine.enable_pcbeep) 10640 if (has_cdefine_beep(codec))
10619 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 10641 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10620 10642
10621 if (board_config == ALC882_AUTO) 10643 if (board_config == ALC882_AUTO)
@@ -12431,7 +12453,7 @@ static int patch_alc262(struct hda_codec *codec)
12431 } 12453 }
12432 } 12454 }
12433 12455
12434 if (!spec->no_analog) { 12456 if (!spec->no_analog && has_cdefine_beep(codec)) {
12435 err = snd_hda_attach_beep_device(codec, 0x1); 12457 err = snd_hda_attach_beep_device(codec, 0x1);
12436 if (err < 0) { 12458 if (err < 0) {
12437 alc_free(codec); 12459 alc_free(codec);
@@ -12482,7 +12504,7 @@ static int patch_alc262(struct hda_codec *codec)
12482 } 12504 }
12483 if (!spec->cap_mixer && !spec->no_analog) 12505 if (!spec->cap_mixer && !spec->no_analog)
12484 set_capture_mixer(codec); 12506 set_capture_mixer(codec);
12485 if (!spec->no_analog && spec->cdefine.enable_pcbeep) 12507 if (!spec->no_analog && has_cdefine_beep(codec))
12486 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 12508 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
12487 12509
12488 spec->vmaster_nid = 0x0c; 12510 spec->vmaster_nid = 0x0c;
@@ -14454,10 +14476,12 @@ static int patch_alc269(struct hda_codec *codec)
14454 } 14476 }
14455 } 14477 }
14456 14478
14457 err = snd_hda_attach_beep_device(codec, 0x1); 14479 if (has_cdefine_beep(codec)) {
14458 if (err < 0) { 14480 err = snd_hda_attach_beep_device(codec, 0x1);
14459 alc_free(codec); 14481 if (err < 0) {
14460 return err; 14482 alc_free(codec);
14483 return err;
14484 }
14461 } 14485 }
14462 14486
14463 if (board_config != ALC269_AUTO) 14487 if (board_config != ALC269_AUTO)
@@ -14490,7 +14514,7 @@ static int patch_alc269(struct hda_codec *codec)
14490 14514
14491 if (!spec->cap_mixer) 14515 if (!spec->cap_mixer)
14492 set_capture_mixer(codec); 14516 set_capture_mixer(codec);
14493 if (spec->cdefine.enable_pcbeep) 14517 if (has_cdefine_beep(codec))
14494 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 14518 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
14495 14519
14496 if (board_config == ALC269_AUTO) 14520 if (board_config == ALC269_AUTO)
@@ -18687,10 +18711,12 @@ static int patch_alc662(struct hda_codec *codec)
18687 } 18711 }
18688 } 18712 }
18689 18713
18690 err = snd_hda_attach_beep_device(codec, 0x1); 18714 if (has_cdefine_beep(codec)) {
18691 if (err < 0) { 18715 err = snd_hda_attach_beep_device(codec, 0x1);
18692 alc_free(codec); 18716 if (err < 0) {
18693 return err; 18717 alc_free(codec);
18718 return err;
18719 }
18694 } 18720 }
18695 18721
18696 if (board_config != ALC662_AUTO) 18722 if (board_config != ALC662_AUTO)
@@ -18712,7 +18738,7 @@ static int patch_alc662(struct hda_codec *codec)
18712 if (!spec->cap_mixer) 18738 if (!spec->cap_mixer)
18713 set_capture_mixer(codec); 18739 set_capture_mixer(codec);
18714 18740
18715 if (spec->cdefine.enable_pcbeep) { 18741 if (has_cdefine_beep(codec)) {
18716 switch (codec->vendor_id) { 18742 switch (codec->vendor_id) {
18717 case 0x10ec0662: 18743 case 0x10ec0662:
18718 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 18744 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);