diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-08-18 18:18:10 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-08-18 18:22:17 -0400 |
commit | fdbc66266c21976027938642f60e0f047149a61a (patch) | |
tree | 8ab89f3709b369f437a4728d0b86887e47874ccf | |
parent | 7570ef18349d4f3a9336397952b05ec3e95ec4b7 (diff) |
ALSA: hda - Fix invalid capture mixers with some ALC268 models
The auto-mic clean-up patches caused regressions on some ALC268 models
that have no proper input_mux but with "Input Source" mixer elements.
Such a combination results in Oops when accessed.
[A reason why set_capture_mixer() isn't used in patch_alc268() is that
ALC268 codec have HDA_OUTPUT direction for capture volumes unlike other
codecs. Thus it needs own definitions of capture elements.]
This patch fixes the issues:
- Add a capture mixer definition without input-source
- Use the new capture mixer appropriately
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 54 |
1 files changed, 23 insertions, 31 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 7ff293458f6f..efb92c83c7a6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -12018,21 +12018,16 @@ static struct hda_verb alc268_volume_init_verbs[] = { | |||
12018 | { } | 12018 | { } |
12019 | }; | 12019 | }; |
12020 | 12020 | ||
12021 | static struct snd_kcontrol_new alc268_capture_nosrc_mixer[] = { | ||
12022 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | ||
12023 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | ||
12024 | { } /* end */ | ||
12025 | }; | ||
12026 | |||
12021 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { | 12027 | static struct snd_kcontrol_new alc268_capture_alt_mixer[] = { |
12022 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), | 12028 | HDA_CODEC_VOLUME("Capture Volume", 0x23, 0x0, HDA_OUTPUT), |
12023 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | 12029 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
12024 | { | 12030 | _DEFINE_CAPSRC(1), |
12025 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
12026 | /* The multiple "Capture Source" controls confuse alsamixer | ||
12027 | * So call somewhat different.. | ||
12028 | */ | ||
12029 | /* .name = "Capture Source", */ | ||
12030 | .name = "Input Source", | ||
12031 | .count = 1, | ||
12032 | .info = alc_mux_enum_info, | ||
12033 | .get = alc_mux_enum_get, | ||
12034 | .put = alc_mux_enum_put, | ||
12035 | }, | ||
12036 | { } /* end */ | 12031 | { } /* end */ |
12037 | }; | 12032 | }; |
12038 | 12033 | ||
@@ -12041,18 +12036,7 @@ static struct snd_kcontrol_new alc268_capture_mixer[] = { | |||
12041 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), | 12036 | HDA_CODEC_MUTE("Capture Switch", 0x23, 0x0, HDA_OUTPUT), |
12042 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), | 12037 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x24, 0x0, HDA_OUTPUT), |
12043 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), | 12038 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x24, 0x0, HDA_OUTPUT), |
12044 | { | 12039 | _DEFINE_CAPSRC(2), |
12045 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
12046 | /* The multiple "Capture Source" controls confuse alsamixer | ||
12047 | * So call somewhat different.. | ||
12048 | */ | ||
12049 | /* .name = "Capture Source", */ | ||
12050 | .name = "Input Source", | ||
12051 | .count = 2, | ||
12052 | .info = alc_mux_enum_info, | ||
12053 | .get = alc_mux_enum_get, | ||
12054 | .put = alc_mux_enum_put, | ||
12055 | }, | ||
12056 | { } /* end */ | 12040 | { } /* end */ |
12057 | }; | 12041 | }; |
12058 | 12042 | ||
@@ -12434,7 +12418,8 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
12434 | 12418 | ||
12435 | static struct alc_config_preset alc268_presets[] = { | 12419 | static struct alc_config_preset alc268_presets[] = { |
12436 | [ALC267_QUANTA_IL1] = { | 12420 | [ALC267_QUANTA_IL1] = { |
12437 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, | 12421 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer, |
12422 | alc268_capture_nosrc_mixer }, | ||
12438 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12423 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12439 | alc267_quanta_il1_verbs }, | 12424 | alc267_quanta_il1_verbs }, |
12440 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12425 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -12444,7 +12429,6 @@ static struct alc_config_preset alc268_presets[] = { | |||
12444 | .hp_nid = 0x03, | 12429 | .hp_nid = 0x03, |
12445 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12430 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12446 | .channel_mode = alc268_modes, | 12431 | .channel_mode = alc268_modes, |
12447 | .input_mux = &alc268_capture_source, | ||
12448 | .unsol_event = alc_sku_unsol_event, | 12432 | .unsol_event = alc_sku_unsol_event, |
12449 | .setup = alc267_quanta_il1_setup, | 12433 | .setup = alc267_quanta_il1_setup, |
12450 | .init_hook = alc_inithook, | 12434 | .init_hook = alc_inithook, |
@@ -12483,7 +12467,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
12483 | .init_hook = alc268_toshiba_automute, | 12467 | .init_hook = alc268_toshiba_automute, |
12484 | }, | 12468 | }, |
12485 | [ALC268_ACER] = { | 12469 | [ALC268_ACER] = { |
12486 | .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer, | 12470 | .mixers = { alc268_acer_mixer, alc268_capture_nosrc_mixer, |
12487 | alc268_beep_mixer }, | 12471 | alc268_beep_mixer }, |
12488 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12472 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12489 | alc268_acer_verbs }, | 12473 | alc268_acer_verbs }, |
@@ -12519,7 +12503,7 @@ static struct alc_config_preset alc268_presets[] = { | |||
12519 | [ALC268_ACER_ASPIRE_ONE] = { | 12503 | [ALC268_ACER_ASPIRE_ONE] = { |
12520 | .mixers = { alc268_acer_aspire_one_mixer, | 12504 | .mixers = { alc268_acer_aspire_one_mixer, |
12521 | alc268_beep_mixer, | 12505 | alc268_beep_mixer, |
12522 | alc268_capture_alt_mixer }, | 12506 | alc268_capture_nosrc_mixer }, |
12523 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12507 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12524 | alc268_acer_aspire_one_verbs }, | 12508 | alc268_acer_aspire_one_verbs }, |
12525 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12509 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -12535,11 +12519,15 @@ static struct alc_config_preset alc268_presets[] = { | |||
12535 | .init_hook = alc268_acer_lc_init_hook, | 12519 | .init_hook = alc268_acer_lc_init_hook, |
12536 | }, | 12520 | }, |
12537 | [ALC268_DELL] = { | 12521 | [ALC268_DELL] = { |
12538 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, | 12522 | .mixers = { alc268_dell_mixer, alc268_beep_mixer, |
12523 | alc268_capture_nosrc_mixer }, | ||
12539 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12524 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
12540 | alc268_dell_verbs }, | 12525 | alc268_dell_verbs }, |
12541 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12526 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
12542 | .dac_nids = alc268_dac_nids, | 12527 | .dac_nids = alc268_dac_nids, |
12528 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
12529 | .adc_nids = alc268_adc_nids_alt, | ||
12530 | .capsrc_nids = alc268_capsrc_nids, | ||
12543 | .hp_nid = 0x02, | 12531 | .hp_nid = 0x02, |
12544 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | 12532 | .num_channel_mode = ARRAY_SIZE(alc268_modes), |
12545 | .channel_mode = alc268_modes, | 12533 | .channel_mode = alc268_modes, |
@@ -12659,10 +12647,14 @@ static int patch_alc268(struct hda_codec *codec) | |||
12659 | 12647 | ||
12660 | /* get type */ | 12648 | /* get type */ |
12661 | wcap = get_wcaps_type(wcap); | 12649 | wcap = get_wcaps_type(wcap); |
12662 | if (wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | 12650 | if (spec->auto_mic || |
12651 | wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { | ||
12663 | spec->adc_nids = alc268_adc_nids_alt; | 12652 | spec->adc_nids = alc268_adc_nids_alt; |
12664 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); | 12653 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); |
12665 | add_mixer(spec, alc268_capture_alt_mixer); | 12654 | if (spec->auto_mic || spec->input_mux->num_items == 1) |
12655 | add_mixer(spec, alc268_capture_nosrc_mixer); | ||
12656 | else | ||
12657 | add_mixer(spec, alc268_capture_alt_mixer); | ||
12666 | } else { | 12658 | } else { |
12667 | spec->adc_nids = alc268_adc_nids; | 12659 | spec->adc_nids = alc268_adc_nids; |
12668 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); | 12660 | spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); |