Commit 128bc4ba authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Move BIOS pin-parser code to hda_auto_parser.c

Just code shuffles.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 23d30f28
This diff is collapsed.
...@@ -12,6 +12,86 @@ ...@@ -12,6 +12,86 @@
#ifndef __SOUND_HDA_AUTO_PARSER_H #ifndef __SOUND_HDA_AUTO_PARSER_H
#define __SOUND_HDA_AUTO_PARSER_H #define __SOUND_HDA_AUTO_PARSER_H
/*
* Helper for automatic pin configuration
*/
enum {
AUTO_PIN_MIC,
AUTO_PIN_LINE_IN,
AUTO_PIN_CD,
AUTO_PIN_AUX,
AUTO_PIN_LAST
};
enum {
AUTO_PIN_LINE_OUT,
AUTO_PIN_SPEAKER_OUT,
AUTO_PIN_HP_OUT
};
#define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS
#define AUTO_CFG_MAX_INS 8
struct auto_pin_cfg_item {
hda_nid_t pin;
int type;
};
struct auto_pin_cfg;
const char *hda_get_autocfg_input_label(struct hda_codec *codec,
const struct auto_pin_cfg *cfg,
int input);
int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
const struct auto_pin_cfg *cfg,
char *label, int maxlen, int *indexp);
enum {
INPUT_PIN_ATTR_UNUSED, /* pin not connected */
INPUT_PIN_ATTR_INT, /* internal mic/line-in */
INPUT_PIN_ATTR_DOCK, /* docking mic/line-in */
INPUT_PIN_ATTR_NORMAL, /* mic/line-in jack */
INPUT_PIN_ATTR_FRONT, /* mic/line-in jack in front */
INPUT_PIN_ATTR_REAR, /* mic/line-in jack in rear */
};
int snd_hda_get_input_pin_attr(unsigned int def_conf);
struct auto_pin_cfg {
int line_outs;
/* sorted in the order of Front/Surr/CLFE/Side */
hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
int speaker_outs;
hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
int hp_outs;
int line_out_type; /* AUTO_PIN_XXX_OUT */
hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
int num_inputs;
struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
int dig_outs;
hda_nid_t dig_out_pins[2];
hda_nid_t dig_in_pin;
hda_nid_t mono_out_pin;
int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */
int dig_in_type; /* HDA_PCM_TYPE_XXX */
};
/* bit-flags for snd_hda_parse_pin_def_config() behavior */
#define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */
#define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */
int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
struct auto_pin_cfg *cfg,
const hda_nid_t *ignore_nids,
unsigned int cond_flags);
/* older function */
#define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
/*
*/
struct hda_gen_spec { struct hda_gen_spec {
/* fix-up list */ /* fix-up list */
int fixup_id; int fixup_id;
......
This diff is collapsed.
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <sound/jack.h> #include <sound/jack.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
#include "hda_jack.h" #include "hda_jack.h"
bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid) bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#ifndef __SOUND_HDA_JACK_H #ifndef __SOUND_HDA_JACK_H
#define __SOUND_HDA_JACK_H #define __SOUND_HDA_JACK_H
struct auto_pin_cfg;
struct hda_jack_tbl { struct hda_jack_tbl {
hda_nid_t nid; hda_nid_t nid;
unsigned char action; /* event action (0 = none) */ unsigned char action; /* event action (0 = none) */
......
...@@ -262,6 +262,8 @@ int snd_hda_input_mux_put(struct hda_codec *codec, ...@@ -262,6 +262,8 @@ int snd_hda_input_mux_put(struct hda_codec *codec,
const struct hda_input_mux *imux, const struct hda_input_mux *imux,
struct snd_ctl_elem_value *ucontrol, hda_nid_t nid, struct snd_ctl_elem_value *ucontrol, hda_nid_t nid,
unsigned int *cur_val); unsigned int *cur_val);
int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label,
int index, int *type_index_ret);
/* /*
* Channel mode helper * Channel mode helper
...@@ -393,72 +395,7 @@ struct hda_bus_unsolicited { ...@@ -393,72 +395,7 @@ struct hda_bus_unsolicited {
struct hda_bus *bus; struct hda_bus *bus;
}; };
/* /* helper macros to retrieve pin default-config values */
* Helper for automatic pin configuration
*/
enum {
AUTO_PIN_MIC,
AUTO_PIN_LINE_IN,
AUTO_PIN_CD,
AUTO_PIN_AUX,
AUTO_PIN_LAST
};
enum {
AUTO_PIN_LINE_OUT,
AUTO_PIN_SPEAKER_OUT,
AUTO_PIN_HP_OUT
};
#define AUTO_CFG_MAX_OUTS HDA_MAX_OUTS
#define AUTO_CFG_MAX_INS 8
struct auto_pin_cfg_item {
hda_nid_t pin;
int type;
};
struct auto_pin_cfg;
const char *hda_get_autocfg_input_label(struct hda_codec *codec,
const struct auto_pin_cfg *cfg,
int input);
int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
const struct auto_pin_cfg *cfg,
char *label, int maxlen, int *indexp);
int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label,
int index, int *type_index_ret);
enum {
INPUT_PIN_ATTR_UNUSED, /* pin not connected */
INPUT_PIN_ATTR_INT, /* internal mic/line-in */
INPUT_PIN_ATTR_DOCK, /* docking mic/line-in */
INPUT_PIN_ATTR_NORMAL, /* mic/line-in jack */
INPUT_PIN_ATTR_FRONT, /* mic/line-in jack in front */
INPUT_PIN_ATTR_REAR, /* mic/line-in jack in rear */
};
int snd_hda_get_input_pin_attr(unsigned int def_conf);
struct auto_pin_cfg {
int line_outs;
/* sorted in the order of Front/Surr/CLFE/Side */
hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS];
int speaker_outs;
hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS];
int hp_outs;
int line_out_type; /* AUTO_PIN_XXX_OUT */
hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
int num_inputs;
struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
int dig_outs;
hda_nid_t dig_out_pins[2];
hda_nid_t dig_in_pin;
hda_nid_t mono_out_pin;
int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */
int dig_in_type; /* HDA_PCM_TYPE_XXX */
};
#define get_defcfg_connect(cfg) \ #define get_defcfg_connect(cfg) \
((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT) ((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT)
#define get_defcfg_association(cfg) \ #define get_defcfg_association(cfg) \
...@@ -472,19 +409,6 @@ struct auto_pin_cfg { ...@@ -472,19 +409,6 @@ struct auto_pin_cfg {
#define get_defcfg_misc(cfg) \ #define get_defcfg_misc(cfg) \
((cfg & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT) ((cfg & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT)
/* bit-flags for snd_hda_parse_pin_def_config() behavior */
#define HDA_PINCFG_NO_HP_FIXUP (1 << 0) /* no HP-split */
#define HDA_PINCFG_NO_LO_FIXUP (1 << 1) /* don't take other outs as LO */
int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
struct auto_pin_cfg *cfg,
const hda_nid_t *ignore_nids,
unsigned int cond_flags);
/* older function */
#define snd_hda_parse_pin_def_config(codec, cfg, ignore) \
snd_hda_parse_pin_defcfg(codec, cfg, ignore, 0)
/* amp values */ /* amp values */
#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8)) #define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
#define AMP_IN_UNMUTE(idx) (0x7000 | ((idx)<<8)) #define AMP_IN_UNMUTE(idx) (0x7000 | ((idx)<<8))
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <sound/core.h> #include <sound/core.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
#include "hda_beep.h" #include "hda_beep.h"
#include "hda_jack.h" #include "hda_jack.h"
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <sound/core.h> #include <sound/core.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
/* /*
*/ */
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <sound/core.h> #include <sound/core.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
#define WIDGET_CHIP_CTRL 0x15 #define WIDGET_CHIP_CTRL 0x15
#define WIDGET_DSP_CTRL 0x16 #define WIDGET_DSP_CTRL 0x16
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include <sound/core.h> #include <sound/core.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
#include "hda_jack.h" #include "hda_jack.h"
#include <sound/tlv.h> #include <sound/tlv.h>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <sound/core.h> #include <sound/core.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
#define NUM_PINS 11 #define NUM_PINS 11
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <sound/tlv.h> #include <sound/tlv.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
#include "hda_beep.h" #include "hda_beep.h"
#include "hda_jack.h" #include "hda_jack.h"
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include <sound/asoundef.h> #include <sound/asoundef.h>
#include "hda_codec.h" #include "hda_codec.h"
#include "hda_local.h" #include "hda_local.h"
#include "hda_auto_parser.h"
#include "hda_jack.h" #include "hda_jack.h"
/* Pin Widget NID */ /* Pin Widget NID */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment