diff options
author | Takashi Iwai <tiwai@suse.de> | 2012-02-21 05:27:09 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2012-02-21 05:28:51 -0500 |
commit | 164f73ee93131f67a61eaca6a6f6180580c39445 (patch) | |
tree | b61b8a2f3c527646df3dcb9b9ee3b0219e4aca5d /sound/pci/hda/patch_realtek.c | |
parent | 1a97b7f22774b454531f013638b181803fba470f (diff) |
ALSA: hda/realtek - Parse aa-loopback items dynamically
Similarly in patch_via.c, parse the active analog-loopback connections
and create a list dynamically rather than static arrays.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 104 |
1 files changed, 22 insertions, 82 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index c5216b58d218..eba50dff6130 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -200,6 +200,8 @@ struct alc_spec { | |||
200 | hda_nid_t vmaster_nid; | 200 | hda_nid_t vmaster_nid; |
201 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 201 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
202 | struct hda_loopback_check loopback; | 202 | struct hda_loopback_check loopback; |
203 | int num_loopbacks; | ||
204 | struct hda_amp_list loopback_list[8]; | ||
203 | #endif | 205 | #endif |
204 | 206 | ||
205 | /* for PLL fix */ | 207 | /* for PLL fix */ |
@@ -2690,6 +2692,25 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, | |||
2690 | return channel_name[ch]; | 2692 | return channel_name[ch]; |
2691 | } | 2693 | } |
2692 | 2694 | ||
2695 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
2696 | /* add the powersave loopback-list entry */ | ||
2697 | static void add_loopback_list(struct alc_spec *spec, hda_nid_t mix, int idx) | ||
2698 | { | ||
2699 | struct hda_amp_list *list; | ||
2700 | |||
2701 | if (spec->num_loopbacks >= ARRAY_SIZE(spec->loopback_list) - 1) | ||
2702 | return; | ||
2703 | list = spec->loopback_list + spec->num_loopbacks; | ||
2704 | list->nid = mix; | ||
2705 | list->dir = HDA_INPUT; | ||
2706 | list->idx = idx; | ||
2707 | spec->num_loopbacks++; | ||
2708 | spec->loopback.amplist = spec->loopback_list; | ||
2709 | } | ||
2710 | #else | ||
2711 | #define add_loopback_list(spec, mix, idx) /* NOP */ | ||
2712 | #endif | ||
2713 | |||
2693 | /* create input playback/capture controls for the given pin */ | 2714 | /* create input playback/capture controls for the given pin */ |
2694 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | 2715 | static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, |
2695 | const char *ctlname, int ctlidx, | 2716 | const char *ctlname, int ctlidx, |
@@ -2705,6 +2726,7 @@ static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | |||
2705 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); | 2726 | HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT)); |
2706 | if (err < 0) | 2727 | if (err < 0) |
2707 | return err; | 2728 | return err; |
2729 | add_loopback_list(spec, mix_nid, idx); | ||
2708 | return 0; | 2730 | return 0; |
2709 | } | 2731 | } |
2710 | 2732 | ||
@@ -4430,17 +4452,6 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4430 | return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); | 4452 | return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); |
4431 | } | 4453 | } |
4432 | 4454 | ||
4433 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
4434 | static const struct hda_amp_list alc880_loopbacks[] = { | ||
4435 | { 0x0b, HDA_INPUT, 0 }, | ||
4436 | { 0x0b, HDA_INPUT, 1 }, | ||
4437 | { 0x0b, HDA_INPUT, 2 }, | ||
4438 | { 0x0b, HDA_INPUT, 3 }, | ||
4439 | { 0x0b, HDA_INPUT, 4 }, | ||
4440 | { } /* end */ | ||
4441 | }; | ||
4442 | #endif | ||
4443 | |||
4444 | /* | 4455 | /* |
4445 | * ALC880 fix-ups | 4456 | * ALC880 fix-ups |
4446 | */ | 4457 | */ |
@@ -4851,10 +4862,6 @@ static int patch_alc880(struct hda_codec *codec) | |||
4851 | 4862 | ||
4852 | codec->patch_ops = alc_patch_ops; | 4863 | codec->patch_ops = alc_patch_ops; |
4853 | spec->init_hook = alc_auto_init_std; | 4864 | spec->init_hook = alc_auto_init_std; |
4854 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
4855 | if (!spec->loopback.amplist) | ||
4856 | spec->loopback.amplist = alc880_loopbacks; | ||
4857 | #endif | ||
4858 | 4865 | ||
4859 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 4866 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
4860 | 4867 | ||
@@ -4876,17 +4883,6 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
4876 | return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); | 4883 | return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); |
4877 | } | 4884 | } |
4878 | 4885 | ||
4879 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
4880 | static const struct hda_amp_list alc260_loopbacks[] = { | ||
4881 | { 0x07, HDA_INPUT, 0 }, | ||
4882 | { 0x07, HDA_INPUT, 1 }, | ||
4883 | { 0x07, HDA_INPUT, 2 }, | ||
4884 | { 0x07, HDA_INPUT, 3 }, | ||
4885 | { 0x07, HDA_INPUT, 4 }, | ||
4886 | { } /* end */ | ||
4887 | }; | ||
4888 | #endif | ||
4889 | |||
4890 | /* | 4886 | /* |
4891 | * Pin config fixes | 4887 | * Pin config fixes |
4892 | */ | 4888 | */ |
@@ -5032,10 +5028,6 @@ static int patch_alc260(struct hda_codec *codec) | |||
5032 | codec->patch_ops = alc_patch_ops; | 5028 | codec->patch_ops = alc_patch_ops; |
5033 | spec->init_hook = alc_auto_init_std; | 5029 | spec->init_hook = alc_auto_init_std; |
5034 | spec->shutup = alc_eapd_shutup; | 5030 | spec->shutup = alc_eapd_shutup; |
5035 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
5036 | if (!spec->loopback.amplist) | ||
5037 | spec->loopback.amplist = alc260_loopbacks; | ||
5038 | #endif | ||
5039 | 5031 | ||
5040 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5032 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5041 | 5033 | ||
@@ -5058,9 +5050,6 @@ static int patch_alc260(struct hda_codec *codec) | |||
5058 | * In addition, an independent DAC for the multi-playback (not used in this | 5050 | * In addition, an independent DAC for the multi-playback (not used in this |
5059 | * driver yet). | 5051 | * driver yet). |
5060 | */ | 5052 | */ |
5061 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
5062 | #define alc882_loopbacks alc880_loopbacks | ||
5063 | #endif | ||
5064 | 5053 | ||
5065 | /* | 5054 | /* |
5066 | * Pin config fixes | 5055 | * Pin config fixes |
@@ -5507,11 +5496,6 @@ static int patch_alc882(struct hda_codec *codec) | |||
5507 | codec->patch_ops = alc_patch_ops; | 5496 | codec->patch_ops = alc_patch_ops; |
5508 | spec->init_hook = alc_auto_init_std; | 5497 | spec->init_hook = alc_auto_init_std; |
5509 | 5498 | ||
5510 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
5511 | if (!spec->loopback.amplist) | ||
5512 | spec->loopback.amplist = alc882_loopbacks; | ||
5513 | #endif | ||
5514 | |||
5515 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5499 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5516 | 5500 | ||
5517 | return 0; | 5501 | return 0; |
@@ -5608,10 +5592,6 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = { | |||
5608 | }; | 5592 | }; |
5609 | 5593 | ||
5610 | 5594 | ||
5611 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
5612 | #define alc262_loopbacks alc880_loopbacks | ||
5613 | #endif | ||
5614 | |||
5615 | /* | 5595 | /* |
5616 | */ | 5596 | */ |
5617 | static int patch_alc262(struct hda_codec *codec) | 5597 | static int patch_alc262(struct hda_codec *codec) |
@@ -5671,11 +5651,6 @@ static int patch_alc262(struct hda_codec *codec) | |||
5671 | spec->init_hook = alc_auto_init_std; | 5651 | spec->init_hook = alc_auto_init_std; |
5672 | spec->shutup = alc_eapd_shutup; | 5652 | spec->shutup = alc_eapd_shutup; |
5673 | 5653 | ||
5674 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
5675 | if (!spec->loopback.amplist) | ||
5676 | spec->loopback.amplist = alc262_loopbacks; | ||
5677 | #endif | ||
5678 | |||
5679 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 5654 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
5680 | 5655 | ||
5681 | return 0; | 5656 | return 0; |
@@ -5793,10 +5768,6 @@ static int patch_alc268(struct hda_codec *codec) | |||
5793 | /* | 5768 | /* |
5794 | * ALC269 | 5769 | * ALC269 |
5795 | */ | 5770 | */ |
5796 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
5797 | #define alc269_loopbacks alc880_loopbacks | ||
5798 | #endif | ||
5799 | |||
5800 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { | 5771 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
5801 | .substreams = 1, | 5772 | .substreams = 1, |
5802 | .channels_min = 2, | 5773 | .channels_min = 2, |
@@ -6336,8 +6307,6 @@ static int patch_alc269(struct hda_codec *codec) | |||
6336 | spec->shutup = alc269_shutup; | 6307 | spec->shutup = alc269_shutup; |
6337 | 6308 | ||
6338 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 6309 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6339 | if (!spec->loopback.amplist) | ||
6340 | spec->loopback.amplist = alc269_loopbacks; | ||
6341 | if (alc269_mic2_for_mute_led(codec)) | 6310 | if (alc269_mic2_for_mute_led(codec)) |
6342 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; | 6311 | codec->patch_ops.check_power_status = alc269_mic2_mute_check_ps; |
6343 | #endif | 6312 | #endif |
@@ -6362,17 +6331,6 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
6362 | return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); | 6331 | return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); |
6363 | } | 6332 | } |
6364 | 6333 | ||
6365 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
6366 | static const struct hda_amp_list alc861_loopbacks[] = { | ||
6367 | { 0x15, HDA_INPUT, 0 }, | ||
6368 | { 0x15, HDA_INPUT, 1 }, | ||
6369 | { 0x15, HDA_INPUT, 2 }, | ||
6370 | { 0x15, HDA_INPUT, 3 }, | ||
6371 | { } /* end */ | ||
6372 | }; | ||
6373 | #endif | ||
6374 | |||
6375 | |||
6376 | /* Pin config fixes */ | 6334 | /* Pin config fixes */ |
6377 | enum { | 6335 | enum { |
6378 | ALC861_FIXUP_FSC_AMILO_PI1505, | 6336 | ALC861_FIXUP_FSC_AMILO_PI1505, |
@@ -6486,8 +6444,6 @@ static int patch_alc861(struct hda_codec *codec) | |||
6486 | spec->init_hook = alc_auto_init_std; | 6444 | spec->init_hook = alc_auto_init_std; |
6487 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 6445 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
6488 | spec->power_hook = alc_power_eapd; | 6446 | spec->power_hook = alc_power_eapd; |
6489 | if (!spec->loopback.amplist) | ||
6490 | spec->loopback.amplist = alc861_loopbacks; | ||
6491 | #endif | 6447 | #endif |
6492 | 6448 | ||
6493 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 6449 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
@@ -6506,10 +6462,6 @@ static int patch_alc861(struct hda_codec *codec) | |||
6506 | * | 6462 | * |
6507 | * In addition, an independent DAC | 6463 | * In addition, an independent DAC |
6508 | */ | 6464 | */ |
6509 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
6510 | #define alc861vd_loopbacks alc880_loopbacks | ||
6511 | #endif | ||
6512 | |||
6513 | static int alc861vd_parse_auto_config(struct hda_codec *codec) | 6465 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
6514 | { | 6466 | { |
6515 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; | 6467 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
@@ -6610,10 +6562,6 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
6610 | 6562 | ||
6611 | spec->init_hook = alc_auto_init_std; | 6563 | spec->init_hook = alc_auto_init_std; |
6612 | spec->shutup = alc_eapd_shutup; | 6564 | spec->shutup = alc_eapd_shutup; |
6613 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
6614 | if (!spec->loopback.amplist) | ||
6615 | spec->loopback.amplist = alc861vd_loopbacks; | ||
6616 | #endif | ||
6617 | 6565 | ||
6618 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 6566 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
6619 | 6567 | ||
@@ -6635,9 +6583,6 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
6635 | * In addition, an independent DAC for the multi-playback (not used in this | 6583 | * In addition, an independent DAC for the multi-playback (not used in this |
6636 | * driver yet). | 6584 | * driver yet). |
6637 | */ | 6585 | */ |
6638 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
6639 | #define alc662_loopbacks alc880_loopbacks | ||
6640 | #endif | ||
6641 | 6586 | ||
6642 | /* | 6587 | /* |
6643 | * BIOS auto configuration | 6588 | * BIOS auto configuration |
@@ -6999,11 +6944,6 @@ static int patch_alc662(struct hda_codec *codec) | |||
6999 | spec->init_hook = alc_auto_init_std; | 6944 | spec->init_hook = alc_auto_init_std; |
7000 | spec->shutup = alc_eapd_shutup; | 6945 | spec->shutup = alc_eapd_shutup; |
7001 | 6946 | ||
7002 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
7003 | if (!spec->loopback.amplist) | ||
7004 | spec->loopback.amplist = alc662_loopbacks; | ||
7005 | #endif | ||
7006 | |||
7007 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); | 6947 | alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); |
7008 | 6948 | ||
7009 | return 0; | 6949 | return 0; |