aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_local.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r--sound/pci/hda/hda_local.h51
1 files changed, 40 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 28ab4aead48f..46bbefe2e4a9 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -38,10 +38,11 @@
38 */ 38 */
39#define HDA_COMPOSE_AMP_VAL_OFS(nid,chs,idx,dir,ofs) \ 39#define HDA_COMPOSE_AMP_VAL_OFS(nid,chs,idx,dir,ofs) \
40 ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19) | ((ofs)<<23)) 40 ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19) | ((ofs)<<23))
41#define HDA_AMP_VAL_MIN_MUTE (1<<29)
41#define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \ 42#define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \
42 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, 0) 43 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, 0)
43/* mono volume with index (index=0,1,...) (channel=1,2) */ 44/* mono volume with index (index=0,1,...) (channel=1,2) */
44#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ 45#define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, dir, flags) \
45 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ 46 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
46 .subdevice = HDA_SUBDEV_AMP_FLAG, \ 47 .subdevice = HDA_SUBDEV_AMP_FLAG, \
47 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ 48 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
@@ -51,16 +52,20 @@
51 .get = snd_hda_mixer_amp_volume_get, \ 52 .get = snd_hda_mixer_amp_volume_get, \
52 .put = snd_hda_mixer_amp_volume_put, \ 53 .put = snd_hda_mixer_amp_volume_put, \
53 .tlv = { .c = snd_hda_mixer_amp_tlv }, \ 54 .tlv = { .c = snd_hda_mixer_amp_tlv }, \
54 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } 55 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, dir) | flags }
55/* stereo volume with index */ 56/* stereo volume with index */
56#define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \ 57#define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \
57 HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction) 58 HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction, 0)
58/* mono volume */ 59/* mono volume */
59#define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \ 60#define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \
60 HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction) 61 HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction, 0)
61/* stereo volume */ 62/* stereo volume */
62#define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \ 63#define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \
63 HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction) 64 HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction)
65/* stereo volume with min=mute */
66#define HDA_CODEC_VOLUME_MIN_MUTE(xname, nid, xindex, direction) \
67 HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, 3, xindex, direction, \
68 HDA_AMP_VAL_MIN_MUTE)
64/* mono mute switch with index (index=0,1,...) (channel=1,2) */ 69/* mono mute switch with index (index=0,1,...) (channel=1,2) */
65#define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ 70#define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
66 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ 71 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
@@ -215,7 +220,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid);
215 */ 220 */
216#define HDA_MAX_NUM_INPUTS 16 221#define HDA_MAX_NUM_INPUTS 16
217struct hda_input_mux_item { 222struct hda_input_mux_item {
218 const char *label; 223 char label[32];
219 unsigned int index; 224 unsigned int index;
220}; 225};
221struct hda_input_mux { 226struct hda_input_mux {
@@ -366,9 +371,7 @@ struct hda_bus_unsolicited {
366 371
367enum { 372enum {
368 AUTO_PIN_MIC, 373 AUTO_PIN_MIC,
369 AUTO_PIN_FRONT_MIC, 374 AUTO_PIN_LINE_IN,
370 AUTO_PIN_LINE,
371 AUTO_PIN_FRONT_LINE,
372 AUTO_PIN_CD, 375 AUTO_PIN_CD,
373 AUTO_PIN_AUX, 376 AUTO_PIN_AUX,
374 AUTO_PIN_LAST 377 AUTO_PIN_LAST
@@ -380,9 +383,33 @@ enum {
380 AUTO_PIN_HP_OUT 383 AUTO_PIN_HP_OUT
381}; 384};
382 385
383extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST];
384
385#define AUTO_CFG_MAX_OUTS 5 386#define AUTO_CFG_MAX_OUTS 5
387#define AUTO_CFG_MAX_INS 8
388
389struct auto_pin_cfg_item {
390 hda_nid_t pin;
391 int type;
392};
393
394struct auto_pin_cfg;
395const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin,
396 int check_location);
397const char *hda_get_autocfg_input_label(struct hda_codec *codec,
398 const struct auto_pin_cfg *cfg,
399 int input);
400int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label,
401 int index, int *type_index_ret);
402
403enum {
404 INPUT_PIN_ATTR_UNUSED, /* pin not connected */
405 INPUT_PIN_ATTR_INT, /* internal mic/line-in */
406 INPUT_PIN_ATTR_DOCK, /* docking mic/line-in */
407 INPUT_PIN_ATTR_NORMAL, /* mic/line-in jack */
408 INPUT_PIN_ATTR_FRONT, /* mic/line-in jack in front */
409 INPUT_PIN_ATTR_REAR, /* mic/line-in jack in rear */
410};
411
412int snd_hda_get_input_pin_attr(unsigned int def_conf);
386 413
387struct auto_pin_cfg { 414struct auto_pin_cfg {
388 int line_outs; 415 int line_outs;
@@ -393,7 +420,8 @@ struct auto_pin_cfg {
393 int hp_outs; 420 int hp_outs;
394 int line_out_type; /* AUTO_PIN_XXX_OUT */ 421 int line_out_type; /* AUTO_PIN_XXX_OUT */
395 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; 422 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS];
396 hda_nid_t input_pins[AUTO_PIN_LAST]; 423 int num_inputs;
424 struct auto_pin_cfg_item inputs[AUTO_CFG_MAX_INS];
397 int dig_outs; 425 int dig_outs;
398 hda_nid_t dig_out_pins[2]; 426 hda_nid_t dig_out_pins[2];
399 hda_nid_t dig_in_pin; 427 hda_nid_t dig_in_pin;
@@ -558,6 +586,7 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
558#define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) 586#define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1)
559#define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) 587#define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf)
560#define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f) 588#define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f)
589#define get_amp_min_mute(kc) (((kc)->private_value >> 29) & 0x1)
561 590
562/* 591/*
563 * CEA Short Audio Descriptor data 592 * CEA Short Audio Descriptor data