aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_generic.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-23 11:07:23 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-23 11:07:23 -0500
commit3e367f155f3ba90b761497ab9e0343dc54778469 (patch)
tree3151586f23613c91e63e28b16eb3c9ba94b94804 /sound/pci/hda/hda_generic.c
parente4a395e7819b1e666b2e9da22234059f403dbc11 (diff)
ALSA: hda - Small code refactoring about path re-initialization
Introduce a helper function to do the same thing. 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.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 06e203df4059..921582d4fe05 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -735,6 +735,14 @@ static void set_pin_eapd(struct hda_codec *codec, hda_nid_t pin, bool enable)
735 enable ? 0x02 : 0x00); 735 enable ? 0x02 : 0x00);
736} 736}
737 737
738/* re-initialize the path specified by the given path index */
739static void resume_path_from_idx(struct hda_codec *codec, int path_idx)
740{
741 struct nid_path *path = snd_hda_get_path_from_idx(codec, path_idx);
742 if (path)
743 snd_hda_activate_path(codec, path, path->active, false);
744}
745
738 746
739/* 747/*
740 * Helper functions for creating mixer ctl elements 748 * Helper functions for creating mixer ctl elements
@@ -4684,16 +4692,8 @@ static void init_analog_input(struct hda_codec *codec)
4684 4692
4685 /* init loopback inputs */ 4693 /* init loopback inputs */
4686 if (spec->mixer_nid) { 4694 if (spec->mixer_nid) {
4687 struct nid_path *path; 4695 resume_path_from_idx(codec, spec->loopback_paths[i]);
4688 path = snd_hda_get_path_from_idx(codec, spec->loopback_paths[i]); 4696 resume_path_from_idx(codec, spec->loopback_merge_path);
4689 if (path)
4690 snd_hda_activate_path(codec, path,
4691 path->active, false);
4692 path = snd_hda_get_path_from_idx(codec,
4693 spec->loopback_merge_path);
4694 if (path)
4695 snd_hda_activate_path(codec, path, path->active,
4696 false);
4697 } 4697 }
4698 } 4698 }
4699} 4699}
@@ -4741,11 +4741,8 @@ static void init_digital(struct hda_codec *codec)
4741 set_output_and_unmute(codec, spec->digout_paths[i]); 4741 set_output_and_unmute(codec, spec->digout_paths[i]);
4742 pin = spec->autocfg.dig_in_pin; 4742 pin = spec->autocfg.dig_in_pin;
4743 if (pin) { 4743 if (pin) {
4744 struct nid_path *path;
4745 restore_pin_ctl(codec, pin); 4744 restore_pin_ctl(codec, pin);
4746 path = snd_hda_get_path_from_idx(codec, spec->digin_path); 4745 resume_path_from_idx(codec, spec->digin_path);
4747 if (path)
4748 snd_hda_activate_path(codec, path, path->active, false);
4749 } 4746 }
4750} 4747}
4751 4748