diff mbox

[4/5] ALSA: hda - add some small convenience functions to auto parser

Message ID 1385030211-11385-5-git-send-email-david.henningsson@canonical.com
State New
Headers show

Commit Message

David Henningsson Nov. 21, 2013, 10:36 a.m. UTC
I never liked that we move our speaker and hp pins to line out
if there are not any line outs; but now that we do,
add some convenience functions to find hp and speaker pins even
if they have been moved.

Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(backported from commit 3cdbe11ae8d2eead564605b0d2193ac470d6b7e8)

Conflicts:

	sound/pci/hda/hda_auto_parser.h
---
 sound/pci/hda/hda_auto_parser.h |   21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
diff mbox

Patch

diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h
index 19251b8..a4558a0 100644
--- a/sound/pci/hda/hda_auto_parser.h
+++ b/sound/pci/hda/hda_auto_parser.h
@@ -171,4 +171,25 @@  static inline void snd_hda_gen_free(struct hda_gen_spec *spec)
 	snd_array_free(&spec->verbs);
 }
 
+static inline int auto_cfg_hp_outs(const struct auto_pin_cfg *cfg)
+{
+	return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
+	       cfg->line_outs : cfg->hp_outs;
+}
+static inline const hda_nid_t *auto_cfg_hp_pins(const struct auto_pin_cfg *cfg)
+{
+	return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
+	       cfg->line_out_pins : cfg->hp_pins;
+}
+static inline int auto_cfg_speaker_outs(const struct auto_pin_cfg *cfg)
+{
+	return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
+	       cfg->line_outs : cfg->speaker_outs;
+}
+static inline const hda_nid_t *auto_cfg_speaker_pins(const struct auto_pin_cfg *cfg)
+{
+	return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
+	       cfg->line_out_pins : cfg->speaker_pins;
+}
+
 #endif /* __SOUND_HDA_AUTO_PARSER_H */