diff options
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r-- | sound/pci/hda/hda_local.h | 81 |
1 files changed, 64 insertions, 17 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index f51a56f813c..c82d2a72d13 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h @@ -60,12 +60,12 @@ #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) -int snd_hda_mixer_amp_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo); -int snd_hda_mixer_amp_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); -int snd_hda_mixer_amp_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); -int snd_hda_mixer_amp_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo); -int snd_hda_mixer_amp_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); -int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); +int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); +int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); +int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); /* mono switch binding multiple inputs */ #define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \ @@ -78,8 +78,8 @@ int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t /* stereo switch binding multiple inputs */ #define HDA_BIND_MUTE(xname,nid,indices,dir) HDA_BIND_MUTE_MONO(xname,nid,3,indices,dir) -int snd_hda_mixer_bind_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); -int snd_hda_mixer_bind_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol); +int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); +int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid); int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); @@ -87,7 +87,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); /* * input MUX helper */ -#define HDA_MAX_NUM_INPUTS 8 +#define HDA_MAX_NUM_INPUTS 16 struct hda_input_mux_item { const char *label; unsigned int index; @@ -97,12 +97,29 @@ struct hda_input_mux { struct hda_input_mux_item items[HDA_MAX_NUM_INPUTS]; }; -int snd_hda_input_mux_info(const struct hda_input_mux *imux, snd_ctl_elem_info_t *uinfo); +int snd_hda_input_mux_info(const struct hda_input_mux *imux, struct snd_ctl_elem_info *uinfo); int snd_hda_input_mux_put(struct hda_codec *codec, const struct hda_input_mux *imux, - snd_ctl_elem_value_t *ucontrol, hda_nid_t nid, + struct snd_ctl_elem_value *ucontrol, hda_nid_t nid, unsigned int *cur_val); /* + * Channel mode helper + */ +struct hda_channel_mode { + int channels; + const struct hda_verb *sequence; +}; + +int snd_hda_ch_mode_info(struct hda_codec *codec, struct snd_ctl_elem_info *uinfo, + const struct hda_channel_mode *chmode, int num_chmodes); +int snd_hda_ch_mode_get(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol, + const struct hda_channel_mode *chmode, int num_chmodes, + int max_channels); +int snd_hda_ch_mode_put(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol, + const struct hda_channel_mode *chmode, int num_chmodes, + int *max_channelsp); + +/* * Multi-channel / digital-out PCM helper */ @@ -121,11 +138,11 @@ struct hda_multi_out { int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mout); int snd_hda_multi_out_dig_close(struct hda_codec *codec, struct hda_multi_out *mout); int snd_hda_multi_out_analog_open(struct hda_codec *codec, struct hda_multi_out *mout, - snd_pcm_substream_t *substream); + struct snd_pcm_substream *substream); int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_out *mout, unsigned int stream_tag, unsigned int format, - snd_pcm_substream_t *substream); + struct snd_pcm_substream *substream); int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, struct hda_multi_out *mout); /* @@ -153,13 +170,13 @@ struct hda_board_config { }; int snd_hda_check_board_config(struct hda_codec *codec, const struct hda_board_config *tbl); -int snd_hda_add_new_ctls(struct hda_codec *codec, snd_kcontrol_new_t *knew); +int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew); /* * power management */ #ifdef CONFIG_PM -int snd_hda_resume_ctls(struct hda_codec *codec, snd_kcontrol_new_t *knew); +int snd_hda_resume_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew); int snd_hda_resume_spdif_out(struct hda_codec *codec); int snd_hda_resume_spdif_in(struct hda_codec *codec); #endif @@ -194,9 +211,12 @@ enum { AUTO_PIN_LAST }; +extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST]; + struct auto_pin_cfg { int line_outs; - hda_nid_t line_out_pins[4]; /* sorted in the order of Front/Surr/CLFE/Side */ + hda_nid_t line_out_pins[5]; /* sorted in the order of Front/Surr/CLFE/Side */ + hda_nid_t speaker_pin; hda_nid_t hp_pin; hda_nid_t input_pins[AUTO_PIN_LAST]; hda_nid_t dig_out_pin; @@ -209,6 +229,33 @@ struct auto_pin_cfg { #define get_defcfg_sequence(cfg) (cfg & AC_DEFCFG_SEQUENCE) #define get_defcfg_device(cfg) ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT) -int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *cfg); +int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *cfg, + hda_nid_t *ignore_nids); + +/* amp values */ +#define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8)) +#define AMP_IN_UNMUTE(idx) (0x7000 | ((idx)<<8)) +#define AMP_OUT_MUTE 0xb080 +#define AMP_OUT_UNMUTE 0xb000 +#define AMP_OUT_ZERO 0xb000 +/* pinctl values */ +#define PIN_IN 0x20 +#define PIN_VREF80 0x24 +#define PIN_VREF50 0x21 +#define PIN_OUT 0x40 +#define PIN_HP 0xc0 +#define PIN_HP_AMP 0x80 + +/* + * get widget capabilities + */ +static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) +{ + if (nid < codec->start_nid || + nid >= codec->start_nid + codec->num_nodes) + return snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); + return codec->wcaps[nid - codec->start_nid]; +} + #endif /* __SOUND_HDA_LOCAL_H */ |