aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-19 08:41:21 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:30:58 -0500
commit9eb413e5e4801753f7851ec6c46528adcc15579f (patch)
treea90a1ca159f712597c2c9ee2fe750d1f66d4a6d9 /sound/pci/hda/hda_generic.c
parent12c93df60ccf926f8798723f97f9f45175fce85b (diff)
ALSA: hda - Move the call of snd_hda_parse_pin_defcfg() from snd_hda_gen_parse_auto_config()
In some cases, we want to manipulate the auto_pin_cfg table before passing to snd_hda_gen_parse_auto_config() (e.g. Realtek SSID check code fiddles with the headphone pin). Also passing ignore_pins just for snd_hda_parse_pin_defcfg() isn't good. In this patch, snd_hda_gen_parse_auto_config() is changed to receive the auto_pin_cfg table to be parsed. The passed auto_pin_cfg table must have been initialized (typically by calling snd_hda_gen_parse_auto_config()) beforehand by the caller. Also together with this change, spec->parse_flags is also removed. Since this was referred only at the place calling snd_hda_parse_pin_defcfg(), no longer needed to be kept in spec. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_generic.c')
-rw-r--r--sound/pci/hda/hda_generic.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 49e968c8140b..e512cab22e91 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -2785,21 +2785,23 @@ static int check_auto_mic_availability(struct hda_codec *codec)
2785} 2785}
2786 2786
2787 2787
2788/* parse the BIOS configuration and set up the hda_gen_spec */ 2788/*
2789/* return 1 if successful, 0 if the proper config is not found, 2789 * Parse the given BIOS configuration and set up the hda_gen_spec
2790 *
2791 * return 1 if successful, 0 if the proper config is not found,
2790 * or a negative error code 2792 * or a negative error code
2791 */ 2793 */
2792int snd_hda_gen_parse_auto_config(struct hda_codec *codec, 2794int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
2793 const hda_nid_t *ignore_nids) 2795 struct auto_pin_cfg *cfg)
2794{ 2796{
2795 struct hda_gen_spec *spec = codec->spec; 2797 struct hda_gen_spec *spec = codec->spec;
2796 struct auto_pin_cfg *cfg = &spec->autocfg;
2797 int err; 2798 int err;
2798 2799
2799 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, 2800 if (cfg != &spec->autocfg) {
2800 spec->parse_flags); 2801 spec->autocfg = *cfg;
2801 if (err < 0) 2802 cfg = &spec->autocfg;
2802 return err; 2803 }
2804
2803 if (!cfg->line_outs) { 2805 if (!cfg->line_outs) {
2804 if (cfg->dig_outs || cfg->dig_in_pin) { 2806 if (cfg->dig_outs || cfg->dig_in_pin) {
2805 spec->multiout.max_channels = 2; 2807 spec->multiout.max_channels = 2;
@@ -3586,7 +3588,11 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
3586 snd_hda_gen_spec_init(spec); 3588 snd_hda_gen_spec_init(spec);
3587 codec->spec = spec; 3589 codec->spec = spec;
3588 3590
3589 err = snd_hda_gen_parse_auto_config(codec, NULL); 3591 err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0);
3592 if (err < 0)
3593 return err;
3594
3595 err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg);
3590 if (err < 0) 3596 if (err < 0)
3591 goto error; 3597 goto error;
3592 3598