aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-07 04:08:02 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:43:49 -0500
commitd4156930b21e9317a560c9e1fc1d544935a9f6f3 (patch)
tree3bc5a2b53bc7706e43ce854f496e0e041e2dafa0 /sound/pci/hda/hda_generic.c
parentee79c69ac726269591e2855d5a8d2be02920678d (diff)
ALSA: hda - Drop unneeded pin argument from set_output_and_unmute()
Just a minor refactoring. 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.c41
1 files changed, 13 insertions, 28 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 1a1e8e228d7e..bebc3f4a47ba 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -3753,16 +3753,18 @@ EXPORT_SYMBOL_HDA(snd_hda_gen_build_pcms);
3753 * Standard auto-parser initializations 3753 * Standard auto-parser initializations
3754 */ 3754 */
3755 3755
3756/* configure the path from the given dac to the pin as the proper output */ 3756/* configure the given path as a proper output */
3757static void set_output_and_unmute(struct hda_codec *codec, hda_nid_t pin, 3757static void set_output_and_unmute(struct hda_codec *codec,
3758 int pin_type, int path_idx) 3758 int pin_type, int path_idx)
3759{ 3759{
3760 struct nid_path *path; 3760 struct nid_path *path;
3761 hda_nid_t pin;
3761 3762
3762 snd_hda_set_pin_ctl_cache(codec, pin, pin_type);
3763 path = snd_hda_get_path_from_idx(codec, path_idx); 3763 path = snd_hda_get_path_from_idx(codec, path_idx);
3764 if (!path) 3764 if (!path || !path->depth)
3765 return; 3765 return;
3766 pin = path->path[path->depth - 1];
3767 snd_hda_set_pin_ctl_cache(codec, pin, pin_type);
3766 snd_hda_activate_path(codec, path, path->active, true); 3768 snd_hda_activate_path(codec, path, path->active, true);
3767 set_pin_eapd(codec, pin, path->active); 3769 set_pin_eapd(codec, pin, path->active);
3768} 3770}
@@ -3771,7 +3773,6 @@ static void set_output_and_unmute(struct hda_codec *codec, hda_nid_t pin,
3771static void init_multi_out(struct hda_codec *codec) 3773static void init_multi_out(struct hda_codec *codec)
3772{ 3774{
3773 struct hda_gen_spec *spec = codec->spec; 3775 struct hda_gen_spec *spec = codec->spec;
3774 hda_nid_t nid;
3775 int pin_type; 3776 int pin_type;
3776 int i; 3777 int i;
3777 3778
@@ -3780,27 +3781,18 @@ static void init_multi_out(struct hda_codec *codec)
3780 else 3781 else
3781 pin_type = PIN_OUT; 3782 pin_type = PIN_OUT;
3782 3783
3783 for (i = 0; i < spec->autocfg.line_outs; i++) { 3784 for (i = 0; i < spec->autocfg.line_outs; i++)
3784 nid = spec->autocfg.line_out_pins[i]; 3785 set_output_and_unmute(codec, pin_type, spec->out_paths[i]);
3785 if (nid)
3786 set_output_and_unmute(codec, nid, pin_type,
3787 spec->out_paths[i]);
3788 }
3789} 3786}
3790 3787
3791 3788
3792static void __init_extra_out(struct hda_codec *codec, int num_outs, 3789static void __init_extra_out(struct hda_codec *codec, int num_outs,
3793 hda_nid_t *pins, int *paths, int type) 3790 int *paths, int type)
3794{ 3791{
3795 int i; 3792 int i;
3796 hda_nid_t pin;
3797 3793
3798 for (i = 0; i < num_outs; i++) { 3794 for (i = 0; i < num_outs; i++)
3799 pin = pins[i]; 3795 set_output_and_unmute(codec, type, paths[i]);
3800 if (!pin)
3801 break;
3802 set_output_and_unmute(codec, pin, type, paths[i]);
3803 }
3804} 3796}
3805 3797
3806/* initialize hp and speaker paths */ 3798/* initialize hp and speaker paths */
@@ -3810,11 +3802,9 @@ static void init_extra_out(struct hda_codec *codec)
3810 3802
3811 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT) 3803 if (spec->autocfg.line_out_type != AUTO_PIN_HP_OUT)
3812 __init_extra_out(codec, spec->autocfg.hp_outs, 3804 __init_extra_out(codec, spec->autocfg.hp_outs,
3813 spec->autocfg.hp_pins,
3814 spec->hp_paths, PIN_HP); 3805 spec->hp_paths, PIN_HP);
3815 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT) 3806 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT)
3816 __init_extra_out(codec, spec->autocfg.speaker_outs, 3807 __init_extra_out(codec, spec->autocfg.speaker_outs,
3817 spec->autocfg.speaker_pins,
3818 spec->speaker_paths, PIN_OUT); 3808 spec->speaker_paths, PIN_OUT);
3819} 3809}
3820 3810
@@ -3911,13 +3901,8 @@ static void init_digital(struct hda_codec *codec)
3911 int i; 3901 int i;
3912 hda_nid_t pin; 3902 hda_nid_t pin;
3913 3903
3914 for (i = 0; i < spec->autocfg.dig_outs; i++) { 3904 for (i = 0; i < spec->autocfg.dig_outs; i++)
3915 pin = spec->autocfg.dig_out_pins[i]; 3905 set_output_and_unmute(codec, PIN_OUT, spec->digout_paths[i]);
3916 if (!pin)
3917 continue;
3918 set_output_and_unmute(codec, pin, PIN_OUT,
3919 spec->digout_paths[i]);
3920 }
3921 pin = spec->autocfg.dig_in_pin; 3906 pin = spec->autocfg.dig_in_pin;
3922 if (pin) { 3907 if (pin) {
3923 struct nid_path *path; 3908 struct nid_path *path;