0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __SOUND_HDA_AUTO_PARSER_H
0009 #define __SOUND_HDA_AUTO_PARSER_H
0010
0011
0012
0013
0014
0015 enum {
0016 AUTO_PIN_MIC,
0017 AUTO_PIN_LINE_IN,
0018 AUTO_PIN_CD,
0019 AUTO_PIN_AUX,
0020 AUTO_PIN_LAST
0021 };
0022
0023 enum {
0024 AUTO_PIN_LINE_OUT,
0025 AUTO_PIN_SPEAKER_OUT,
0026 AUTO_PIN_HP_OUT
0027 };
0028
0029 #define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS
0030 #define AUTO_CFG_MAX_INS 18
0031
0032 struct auto_pin_cfg_item {
0033 hda_nid_t pin;
0034 int type;
0035 unsigned int is_headset_mic:1;
0036 unsigned int is_headphone_mic:1;
0037 unsigned int has_boost_on_pin:1;
0038 };
0039
0040 struct auto_pin_cfg;
0041 const char *hda_get_autocfg_input_label(struct hda_codec *codec,
0042 const struct auto_pin_cfg *cfg,
0043 int input);
0044 int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
0045 const struct auto_pin_cfg *cfg,
0046 char *label, int maxlen, int *indexp);
0047
0048 enum {
0049 INPUT_PIN_ATTR_UNUSED,
0050 INPUT_PIN_ATTR_INT,
0051 INPUT_PIN_ATTR_DOCK,
0052 INPUT_PIN_ATTR_NORMAL,
0053 INPUT_PIN_ATTR_REAR,
0054 INPUT_PIN_ATTR_FRONT,
0055 INPUT_PIN_ATTR_LAST = INPUT_PIN_ATTR_FRONT,
0056 };
0057
0058 int snd_hda_get_input_pin_attr(unsigned int def_conf);
0059
0060 struct auto_pin_cfg {
0061 int line_outs;
0062
0063 hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
0064 int speaker_outs;
0065 hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
0066 int hp_outs;
0067 int line_out_type;
0068 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
0069 int num_inputs;
0070 struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
0071 int dig_outs;
0072 hda_nid_t dig_out_pins[2];
0073 hda_nid_t dig_in_pin;
0074 hda_nid_t mono_out_pin;
0075 int dig_out_type[2];
0076 int dig_in_type;
0077 };
0078
0079
0080 #define HDA_PINCFG_NO_HP_FIXUP (1 << 0)
0081 #define HDA_PINCFG_NO_LO_FIXUP (1 << 1)
0082 #define HDA_PINCFG_HEADSET_MIC (1 << 2)
0083 #define HDA_PINCFG_HEADPHONE_MIC (1 << 3)
0084
0085 int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
0086 struct auto_pin_cfg *cfg,
0087 const hda_nid_t *ignore_nids,
0088 unsigned int cond_flags);
0089
0090
0091 #define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
0092 snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
0093
0094 static inline int auto_cfg_hp_outs(const struct auto_pin_cfg *cfg)
0095 {
0096 return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
0097 cfg->line_outs : cfg->hp_outs;
0098 }
0099 static inline const hda_nid_t *auto_cfg_hp_pins(const struct auto_pin_cfg *cfg)
0100 {
0101 return (cfg->line_out_type == AUTO_PIN_HP_OUT) ?
0102 cfg->line_out_pins : cfg->hp_pins;
0103 }
0104 static inline int auto_cfg_speaker_outs(const struct auto_pin_cfg *cfg)
0105 {
0106 return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
0107 cfg->line_outs : cfg->speaker_outs;
0108 }
0109 static inline const hda_nid_t *auto_cfg_speaker_pins(const struct auto_pin_cfg *cfg)
0110 {
0111 return (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) ?
0112 cfg->line_out_pins : cfg->speaker_pins;
0113 }
0114
0115 #endif