2 * BIOS auto-parser helper functions for HD-audio
4 * Copyright (c) 2012 Takashi Iwai <tiwai@suse.de>
6 * This driver is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
12 #ifndef __SOUND_HDA_AUTO_PARSER_H
13 #define __SOUND_HDA_AUTO_PARSER_H
16 * Helper for automatic pin configuration
33 #define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS
34 #define AUTO_CFG_MAX_INS 8
36 struct auto_pin_cfg_item {
42 const char *hda_get_autocfg_input_label(struct hda_codec *codec,
43 const struct auto_pin_cfg *cfg,
45 int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
46 const struct auto_pin_cfg *cfg,
47 char *label, int maxlen, int *indexp);
50 INPUT_PIN_ATTR_UNUSED, /* pin not connected */
51 INPUT_PIN_ATTR_INT, /* internal mic/line-in */
52 INPUT_PIN_ATTR_DOCK, /* docking mic/line-in */
53 INPUT_PIN_ATTR_NORMAL, /* mic/line-in jack */
54 INPUT_PIN_ATTR_FRONT, /* mic/line-in jack in front */
55 INPUT_PIN_ATTR_REAR, /* mic/line-in jack in rear */
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 */
83 int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
84 struct auto_pin_cfg *cfg,
85 const hda_nid_t *ignore_nids,
86 unsigned int cond_flags);
89 #define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
90 snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
98 const struct hda_fixup *fixup_list;
99 const char *fixup_name;
101 /* additional init verbs */
102 struct snd_array verbs;
107 * Fix-up pin default configurations and add default verbs
115 struct hda_model_fixup {
125 const struct hda_pintbl *pins;
126 const struct hda_verb *verbs;
127 void (*func)(struct hda_codec *codec,
128 const struct hda_fixup *fix,
141 /* fixup action definitions */
143 HDA_FIXUP_ACT_PRE_PROBE,
149 int snd_hda_gen_add_verbs(struct hda_gen_spec *spec,
150 const struct hda_verb *list);
151 void snd_hda_gen_apply_verbs(struct hda_codec *codec);
152 void snd_hda_apply_pincfgs(struct hda_codec *codec,
153 const struct hda_pintbl *cfg);
154 void snd_hda_apply_fixup(struct hda_codec *codec, int action);
155 void snd_hda_pick_fixup(struct hda_codec *codec,
156 const struct hda_model_fixup *models,
157 const struct snd_pci_quirk *quirk,
158 const struct hda_fixup *fixlist);
160 static inline void snd_hda_gen_init(struct hda_gen_spec *spec)
162 snd_array_init(&spec->verbs, sizeof(struct hda_verb *), 8);
165 static inline void snd_hda_gen_free(struct hda_gen_spec *spec)
167 snd_array_free(&spec->verbs);
170 #endif /* __SOUND_HDA_AUTO_PARSER_H */