1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * BIOS auto-parser helper functions for HD-audio
8 #ifndef __SOUND_HDA_AUTO_PARSER_H
9 #define __SOUND_HDA_AUTO_PARSER_H
12 * Helper for automatic pin configuration
29 #define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS
30 #define AUTO_CFG_MAX_INS 18
32 struct auto_pin_cfg_item {
35 unsigned int is_headset_mic:1;
36 unsigned int is_headphone_mic:1; /* Mic-only in headphone jack */
37 unsigned int has_boost_on_pin:1;
41 const char *hda_get_autocfg_input_label(struct hda_codec *codec,
42 const struct auto_pin_cfg *cfg,
44 int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
45 const struct auto_pin_cfg *cfg,
46 char *label, int maxlen, int *indexp);
49 INPUT_PIN_ATTR_UNUSED, /* pin not connected */
50 INPUT_PIN_ATTR_INT, /* internal mic/line-in */
51 INPUT_PIN_ATTR_DOCK, /* docking mic/line-in */
52 INPUT_PIN_ATTR_NORMAL, /* mic/line-in jack */
53 INPUT_PIN_ATTR_REAR, /* mic/line-in jack in rear */
54 INPUT_PIN_ATTR_FRONT, /* mic/line-in jack in front */
55 INPUT_PIN_ATTR_LAST = INPUT_PIN_ATTR_FRONT,
58 int snd_hda_get_input_pin_attr(unsigned int def_conf);
62 /* sorted in the order of Front/Surr/CLFE/Side */
63 hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
65 hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
67 int line_out_type; /* AUTO_PIN_XXX_OUT */
68 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
70 struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
72 hda_nid_t dig_out_pins[2];
74 hda_nid_t mono_out_pin;
75 int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */
76 int dig_in_type; /* HDA_PCM_TYPE_XXX */
79 /* bit-flags for snd_hda_parse_pin_def_config() behavior */
80 #define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */
81 #define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */
82 #define HDA_PINCFG_HEADSET_MIC (1 << 2) /* Try to find headset mic; mark seq number as 0xc to trigger */
83 #define HDA_PINCFG_HEADPHONE_MIC (1 << 3) /* Try to find headphone mic; mark seq number as 0xd to trigger */
85 int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
86 struct auto_pin_cfg *cfg,
87 const hda_nid_t *ignore_nids,
88 unsigned int cond_flags);
91 #define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
92 snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
94 static inline int auto_cfg_hp_outs(const struct auto_pin_cfg *cfg)
96 return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
97 cfg->line_outs : cfg->hp_outs;
99 static inline const hda_nid_t *auto_cfg_hp_pins(const struct auto_pin_cfg *cfg)
101 return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
102 cfg->line_out_pins : cfg->hp_pins;
104 static inline int auto_cfg_speaker_outs(const struct auto_pin_cfg *cfg)
106 return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
107 cfg->line_outs : cfg->speaker_outs;
109 static inline const hda_nid_t *auto_cfg_speaker_pins(const struct auto_pin_cfg *cfg)
111 return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
112 cfg->line_out_pins : cfg->speaker_pins;
115 #endif /* __SOUND_HDA_AUTO_PARSER_H */