diff options
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r-- | sound/pci/hda/hda_local.h | 69 |
1 files changed, 64 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 5f1dcc59002b..5778ae882b83 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -23,6 +23,15 @@ | |||
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 | |||
26 | /* | 35 | /* |
27 | * for mixer controls | 36 | * for mixer controls |
28 | */ | 37 | */ |
@@ -33,6 +42,7 @@ | |||
33 | /* mono volume with index (index=0,1,...) (channel=1,2) */ | 42 | /* mono volume with index (index=0,1,...) (channel=1,2) */ |
34 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 43 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
35 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 44 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
45 | .subdevice = HDA_SUBDEV_NID_FLAG | (nid), \ | ||
36 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | 46 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ |
37 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | 47 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ |
38 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | 48 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ |
@@ -53,6 +63,7 @@ | |||
53 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ | 63 | /* mono mute switch with index (index=0,1,...) (channel=1,2) */ |
54 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 64 | #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
55 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 65 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
66 | .subdevice = HDA_SUBDEV_NID_FLAG | (nid), \ | ||
56 | .info = snd_hda_mixer_amp_switch_info, \ | 67 | .info = snd_hda_mixer_amp_switch_info, \ |
57 | .get = snd_hda_mixer_amp_switch_get, \ | 68 | .get = snd_hda_mixer_amp_switch_get, \ |
58 | .put = snd_hda_mixer_amp_switch_put, \ | 69 | .put = snd_hda_mixer_amp_switch_put, \ |
@@ -66,6 +77,28 @@ | |||
66 | /* stereo mute switch */ | 77 | /* stereo mute switch */ |
67 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ | 78 | #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \ |
68 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) | 79 | HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction) |
80 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
81 | /* special beep mono mute switch with index (index=0,1,...) (channel=1,2) */ | ||
82 | #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | ||
83 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | ||
84 | .subdevice = HDA_SUBDEV_NID_FLAG | (nid), \ | ||
85 | .info = snd_hda_mixer_amp_switch_info, \ | ||
86 | .get = snd_hda_mixer_amp_switch_get, \ | ||
87 | .put = snd_hda_mixer_amp_switch_put_beep, \ | ||
88 | .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } | ||
89 | #else | ||
90 | /* no digital beep - just the standard one */ | ||
91 | #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, ch, xidx, dir) \ | ||
92 | HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, ch, xidx, dir) | ||
93 | #endif /* CONFIG_SND_HDA_INPUT_BEEP */ | ||
94 | /* special beep mono mute switch */ | ||
95 | #define HDA_CODEC_MUTE_BEEP_MONO(xname, nid, channel, xindex, direction) \ | ||
96 | HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, 0, nid, channel, xindex, direction) | ||
97 | /* special beep stereo mute switch */ | ||
98 | #define HDA_CODEC_MUTE_BEEP(xname, nid, xindex, direction) \ | ||
99 | HDA_CODEC_MUTE_BEEP_MONO(xname, nid, 3, xindex, direction) | ||
100 | |||
101 | extern const char *snd_hda_pcm_type_name[]; | ||
69 | 102 | ||
70 | int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, | 103 | int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, |
71 | struct snd_ctl_elem_info *uinfo); | 104 | struct snd_ctl_elem_info *uinfo); |
@@ -81,6 +114,10 @@ int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, | |||
81 | struct snd_ctl_elem_value *ucontrol); | 114 | struct snd_ctl_elem_value *ucontrol); |
82 | int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, | 115 | int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, |
83 | struct snd_ctl_elem_value *ucontrol); | 116 | struct snd_ctl_elem_value *ucontrol); |
117 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
118 | int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol, | ||
119 | struct snd_ctl_elem_value *ucontrol); | ||
120 | #endif | ||
84 | /* lowlevel accessor with caching; use carefully */ | 121 | /* lowlevel accessor with caching; use carefully */ |
85 | int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch, | 122 | int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch, |
86 | int direction, int index); | 123 | int direction, int index); |
@@ -424,8 +461,16 @@ 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, | 461 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, |
425 | unsigned int caps); | 462 | unsigned int caps); |
426 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); | 463 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); |
464 | u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); | ||
465 | int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); | ||
427 | 466 | ||
428 | int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); | 467 | struct hda_nid_item { |
468 | struct snd_kcontrol *kctl; | ||
469 | hda_nid_t nid; | ||
470 | }; | ||
471 | |||
472 | int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, | ||
473 | struct snd_kcontrol *kctl); | ||
429 | void snd_hda_ctls_clear(struct hda_codec *codec); | 474 | void snd_hda_ctls_clear(struct hda_codec *codec); |
430 | 475 | ||
431 | /* | 476 | /* |
@@ -437,6 +482,15 @@ int snd_hda_create_hwdep(struct hda_codec *codec); | |||
437 | static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } | 482 | static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } |
438 | #endif | 483 | #endif |
439 | 484 | ||
485 | #if defined(CONFIG_SND_HDA_POWER_SAVE) && defined(CONFIG_SND_HDA_HWDEP) | ||
486 | int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec); | ||
487 | #else | ||
488 | static inline int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec) | ||
489 | { | ||
490 | return 0; | ||
491 | } | ||
492 | #endif | ||
493 | |||
440 | #ifdef CONFIG_SND_HDA_RECONFIG | 494 | #ifdef CONFIG_SND_HDA_RECONFIG |
441 | int snd_hda_hwdep_add_sysfs(struct hda_codec *codec); | 495 | int snd_hda_hwdep_add_sysfs(struct hda_codec *codec); |
442 | #else | 496 | #else |
@@ -490,7 +544,8 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
490 | * AMP control callbacks | 544 | * AMP control callbacks |
491 | */ | 545 | */ |
492 | /* retrieve parameters from private_value */ | 546 | /* retrieve parameters from private_value */ |
493 | #define get_amp_nid(kc) ((kc)->private_value & 0xffff) | 547 | #define get_amp_nid_(pv) ((pv) & 0xffff) |
548 | #define get_amp_nid(kc) get_amp_nid_((kc)->private_value) | ||
494 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) | 549 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) |
495 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) | 550 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) |
496 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) | 551 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) |
@@ -516,9 +571,11 @@ struct cea_sad { | |||
516 | * ELD: EDID Like Data | 571 | * ELD: EDID Like Data |
517 | */ | 572 | */ |
518 | struct hdmi_eld { | 573 | struct hdmi_eld { |
574 | bool monitor_present; | ||
575 | bool eld_valid; | ||
519 | int eld_size; | 576 | int eld_size; |
520 | int baseline_len; | 577 | int baseline_len; |
521 | int eld_ver; /* (eld_ver == 0) indicates invalid ELD */ | 578 | int eld_ver; |
522 | int cea_edid_ver; | 579 | int cea_edid_ver; |
523 | char monitor_name[ELD_MAX_MNL + 1]; | 580 | char monitor_name[ELD_MAX_MNL + 1]; |
524 | int manufacture_id; | 581 | int manufacture_id; |
@@ -541,11 +598,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); | 598 | void snd_hdmi_show_eld(struct hdmi_eld *eld); |
542 | 599 | ||
543 | #ifdef CONFIG_PROC_FS | 600 | #ifdef CONFIG_PROC_FS |
544 | int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld); | 601 | int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld, |
602 | int index); | ||
545 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld); | 603 | void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld); |
546 | #else | 604 | #else |
547 | static inline int snd_hda_eld_proc_new(struct hda_codec *codec, | 605 | static inline int snd_hda_eld_proc_new(struct hda_codec *codec, |
548 | struct hdmi_eld *eld) | 606 | struct hdmi_eld *eld, |
607 | int index) | ||
549 | { | 608 | { |
550 | return 0; | 609 | return 0; |
551 | } | 610 | } |