diff options
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r-- | sound/pci/hda/hda_local.h | 77 |
1 files changed, 72 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 5f1dcc59002b..7cee364976ff 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -23,6 +23,16 @@ | |||
23 | #ifndef __SOUND_HDA_LOCAL_H | 23 | #ifndef __SOUND_HDA_LOCAL_H |
24 | #define __SOUND_HDA_LOCAL_H | 24 | #define __SOUND_HDA_LOCAL_H |
25 | 25 | ||
26 | /* We abuse kcontrol_new.subdev field to pass the NID corresponding to | ||
27 | * the given new control. If id.subdev has a bit flag HDA_SUBDEV_NID_FLAG, | ||
28 | * snd_hda_ctl_add() takes the lower-bit subdev value as a valid NID. | ||
29 | * | ||
30 | * Note that the subdevice field is cleared again before the real registration | ||
31 | * in snd_hda_ctl_add(), so that this value won't appear in the outside. | ||
32 | */ | ||
33 | #define HDA_SUBDEV_NID_FLAG (1U << 31) | ||
34 | #define HDA_SUBDEV_AMP_FLAG (1U << 30) | ||
35 | |||
26 | /* | 36 | /* |
27 | * for mixer controls | 37 | * for mixer controls |
28 | */ | 38 | */ |
@@ -33,6 +43,7 @@ | |||
33 | /* mono volume with index (index=0,1,...) (channel=1,2) */ | 43 | /* mono volume with index (index=0,1,...) (channel=1,2) */ |
34 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 44 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
35 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 45 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
46 | .subdevice = HDA_SUBDEV_AMP_FLAG, \ | ||
36 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 47 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
37 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | 48 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
38 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | 49 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
@@ -53,6 +64,7 @@ | |||
53 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ | 64 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ |
54 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 65 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
55 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 66 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
67 | .subdevice = HDA_SUBDEV_AMP_FLAG, \ | ||
56 | .info = snd_hda_mixer_amp_switch_info, \ | 68 | .info = snd_hda_mixer_amp_switch_info, \ |
57 | .get = snd_hda_mixer_amp_switch_get, \ | 69 | .get = snd_hda_mixer_amp_switch_get, \ |
58 | .put = snd_hda_mixer_amp_switch_put, \ | 70 | .put = snd_hda_mixer_amp_switch_put, \ |
@@ -66,6 +78,28 @@ | |||
66 | /* stereo mute switch */ | 78 | /* stereo mute switch */ |
67 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ | 79 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ |
68 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) | 80 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) |
81 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
82 | /* special beep mono mute switch with index (index=0,1,...) (channel=1,2) */ | ||
83 | #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | ||
84 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | ||
85 | .subdevice = HDA_SUBDEV_AMP_FLAG, \ | ||
86 | .info = snd_hda_mixer_amp_switch_info, \ | ||
87 | .get = snd_hda_mixer_amp_switch_get, \ | ||
88 | .put = snd_hda_mixer_amp_switch_put_beep, \ | ||
89 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } | ||
90 | #else | ||
91 | /* no digital beep - just the standard one */ | ||
92 | #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, ch, xidx, dir) \ | ||
93 | HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, ch, xidx, dir) | ||
94 | #endif /* CONFIG_SND_HDA_INPUT_BEEP */ | ||
95 | /* special beep mono mute switch */ | ||
96 | #define HDA_CODEC_MUTE_BEEP_MONO(xname, nid, channel, xindex, direction) \ | ||
97 | HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, 0, nid, channel, xindex, direction) | ||
98 | /* special beep stereo mute switch */ | ||
99 | #define HDA_CODEC_MUTE_BEEP(xname, nid, xindex, direction) \ | ||
100 | HDA_CODEC_MUTE_BEEP_MONO(xname, nid, 3, xindex, direction) | ||
101 | |||
102 | extern const char *snd_hda_pcm_type_name[]; | ||
69 | 103 | ||
70 | int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, | 104 | int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, |
71 | struct snd_ctl_elem_info *uinfo); | 105 | struct snd_ctl_elem_info *uinfo); |
@@ -81,6 +115,10 @@ int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, | |||
81 | struct snd_ctl_elem_value *ucontrol); | 115 | struct snd_ctl_elem_value *ucontrol); |
82 | int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, | 116 | int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, |
83 | struct snd_ctl_elem_value *ucontrol); | 117 | struct snd_ctl_elem_value *ucontrol); |
118 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
119 | int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol, | ||
120 | struct snd_ctl_elem_value *ucontrol); | ||
121 | #endif | ||
84 | /* lowlevel accessor with caching; use carefully */ | 122 | /* lowlevel accessor with caching; use carefully */ |
85 | int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch, | 123 | int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch, |
86 | int direction, int index); | 124 | int direction, int index); |
@@ -424,8 +462,23 @@ u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); | |||
424 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | 462 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, |
425 | unsigned int caps); | 463 | unsigned int caps); |
426 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); | 464 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); |
465 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); | ||
466 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); | ||
427 | 467 | ||
428 | int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); | 468 | /* flags for hda_nid_item */ |
469 | #define HDA_NID_ITEM_AMP (1<<0) | ||
470 | |||
471 | struct hda_nid_item { | ||
472 | struct snd_kcontrol *kctl; | ||
473 | unsigned int index; | ||
474 | hda_nid_t nid; | ||
475 | unsigned short flags; | ||
476 | }; | ||
477 | |||
478 | int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, | ||
479 | struct snd_kcontrol *kctl); | ||
480 | int snd_hda_add_nid(struct hda_codec *codec, struct snd_kcontrol *kctl, | ||
481 | unsigned int index, hda_nid_t nid); | ||
429 | void snd_hda_ctls_clear(struct hda_codec *codec); | 482 | void snd_hda_ctls_clear(struct hda_codec *codec); |
430 | 483 | ||
431 | /* | 484 | /* |
@@ -437,6 +490,15 @@ int snd_hda_create_hwdep(struct hda_codec *codec); | |||
437 | static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } | 490 | static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } |
438 | #endif | 491 | #endif |
439 | 492 | ||
493 | #if defined(CONFIG_SND_HDA_POWER_SAVE) && defined(CONFIG_SND_HDA_HWDEP) | ||
494 | int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec); | ||
495 | #else | ||
496 | static inline int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec) | ||
497 | { | ||
498 | return 0; | ||
499 | } | ||
500 | #endif | ||
501 | |||
440 | #ifdef CONFIG_SND_HDA_RECONFIG | 502 | #ifdef CONFIG_SND_HDA_RECONFIG |
441 | int snd_hda_hwdep_add_sysfs(struct hda_codec *codec); | 503 | int snd_hda_hwdep_add_sysfs(struct hda_codec *codec); |
442 | #else | 504 | #else |
@@ -490,7 +552,8 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
490 | * AMP control callbacks | 552 | * AMP control callbacks |
491 | */ | 553 | */ |
492 | /* retrieve parameters from private_value */ | 554 | /* retrieve parameters from private_value */ |
493 | #define get_amp_nid(kc) ((kc)->private_value & 0xffff) | 555 | #define get_amp_nid_(pv) ((pv) & 0xffff) |
556 | #define get_amp_nid(kc) get_amp_nid_((kc)->private_value) | ||
494 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) | 557 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) |
495 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) | 558 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) |
496 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) | 559 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) |
@@ -516,9 +579,11 @@ struct cea_sad { | |||
516 | * ELD: EDID Like Data | 579 | * ELD: EDID Like Data |
517 | */ | 580 | */ |
518 | struct hdmi_eld { | 581 | struct hdmi_eld { |
582 | bool monitor_present; | ||
583 | bool eld_valid; | ||
519 | int eld_size; | 584 | int eld_size; |
520 | int baseline_len; | 585 | int baseline_len; |
521 | int eld_ver; /* (eld_ver == 0) indicates invalid ELD */ | 586 | int eld_ver; |
522 | int cea_edid_ver; | 587 | int cea_edid_ver; |
523 | char monitor_name[ELD_MAX_MNL + 1]; | 588 | char monitor_name[ELD_MAX_MNL + 1]; |
524 | int manufacture_id; | 589 | int manufacture_id; |
@@ -541,11 +606,13 @@ int snd_hdmi_get_eld(struct hdmi_eld *, struct hda_codec *, hda_nid_t); | |||
541 | void snd_hdmi_show_eld(struct hdmi_eld *eld); | 606 | void snd_hdmi_show_eld(struct hdmi_eld *eld); |
542 | 607 | ||
543 | #ifdef CONFIG_PROC_FS | 608 | #ifdef CONFIG_PROC_FS |
544 | int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld); | 609 | int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld, |
610 | int index); | ||
545 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld); | 611 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld); |
546 | #else | 612 | #else |
547 | static inline int snd_hda_eld_proc_new(struct hda_codec *codec, | 613 | static inline int snd_hda_eld_proc_new(struct hda_codec *codec, |
548 | struct hdmi_eld *eld) | 614 | struct hdmi_eld *eld, |
615 | int index) | ||
549 | { | 616 | { |
550 | return 0; | 617 | return 0; |
551 | } | 618 | } |