23 #ifndef __SOUND_HDA_LOCAL_H
24 #define __SOUND_HDA_LOCAL_H
33 #define HDA_SUBDEV_NID_FLAG (1U << 31)
34 #define HDA_SUBDEV_AMP_FLAG (1U << 30)
39 #define HDA_COMPOSE_AMP_VAL_OFS(nid,chs,idx,dir,ofs) \
40 ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19) | ((ofs)<<23))
41 #define HDA_AMP_VAL_MIN_MUTE (1<<29)
42 #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \
43 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, 0)
45 #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, dir, flags) \
46 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
47 .subdevice = HDA_SUBDEV_AMP_FLAG, \
48 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
49 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
50 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \
51 .info = snd_hda_mixer_amp_volume_info, \
52 .get = snd_hda_mixer_amp_volume_get, \
53 .put = snd_hda_mixer_amp_volume_put, \
54 .tlv = { .c = snd_hda_mixer_amp_tlv }, \
55 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, dir) | flags }
57 #define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \
58 HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction, 0)
60 #define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \
61 HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction, 0)
63 #define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \
64 HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction)
66 #define HDA_CODEC_VOLUME_MIN_MUTE(xname, nid, xindex, direction) \
67 HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, 3, xindex, direction, \
70 #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
71 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
72 .subdevice = HDA_SUBDEV_AMP_FLAG, \
73 .info = snd_hda_mixer_amp_switch_info, \
74 .get = snd_hda_mixer_amp_switch_get, \
75 .put = snd_hda_mixer_amp_switch_put, \
76 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
78 #define HDA_CODEC_MUTE_IDX(xname, xcidx, nid, xindex, direction) \
79 HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, 3, xindex, direction)
81 #define HDA_CODEC_MUTE_MONO(xname, nid, channel, xindex, direction) \
82 HDA_CODEC_MUTE_MONO_IDX(xname, 0, nid, channel, xindex, direction)
84 #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \
85 HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction)
86 #ifdef CONFIG_SND_HDA_INPUT_BEEP
88 #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
89 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
90 .subdevice = HDA_SUBDEV_AMP_FLAG, \
91 .info = snd_hda_mixer_amp_switch_info, \
92 .get = snd_hda_mixer_amp_switch_get_beep, \
93 .put = snd_hda_mixer_amp_switch_put_beep, \
94 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
97 #define HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, xcidx, nid, ch, xidx, dir) \
98 HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, ch, xidx, dir)
101 #define HDA_CODEC_MUTE_BEEP_MONO(xname, nid, channel, xindex, direction) \
102 HDA_CODEC_MUTE_BEEP_MONO_IDX(xname, 0, nid, channel, xindex, direction)
104 #define HDA_CODEC_MUTE_BEEP(xname, nid, xindex, direction) \
105 HDA_CODEC_MUTE_BEEP_MONO(xname, nid, 3, xindex, direction)
116 unsigned int size,
unsigned int __user *
tlv);
123 #ifdef CONFIG_SND_HDA_INPUT_BEEP
145 unsigned int *
tlv,
const char *
const *slaves,
146 const char *suffix,
bool init_slave_vol,
148 #define snd_hda_add_vmaster(codec, name, tlv, slaves, suffix) \
149 __snd_hda_add_vmaster(codec, name, tlv, slaves, suffix, true, NULL)
171 bool expose_enum_ctl);
175 #define HDA_AMP_MUTE 0x80
176 #define HDA_AMP_UNMUTE 0x00
177 #define HDA_AMP_VOLMASK 0x7f
180 #define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \
181 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
182 .info = snd_hda_mixer_amp_switch_info, \
183 .get = snd_hda_mixer_bind_switch_get, \
184 .put = snd_hda_mixer_bind_switch_put, \
185 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, indices, direction) }
188 #define HDA_BIND_MUTE(xname,nid,indices,dir) \
189 HDA_BIND_MUTE_MONO(xname,nid,3,indices,dir)
219 unsigned int size,
unsigned int __user *
tlv);
221 #define HDA_BIND_VOL(xname, bindrec) \
222 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
224 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\
225 SNDRV_CTL_ELEM_ACCESS_TLV_READ |\
226 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,\
227 .info = snd_hda_mixer_bind_ctls_info,\
228 .get = snd_hda_mixer_bind_ctls_get,\
229 .put = snd_hda_mixer_bind_ctls_put,\
230 .tlv = { .c = snd_hda_mixer_bind_tlv },\
231 .private_value = (long) (bindrec) }
232 #define HDA_BIND_SW(xname, bindrec) \
233 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,\
235 .info = snd_hda_mixer_bind_ctls_info,\
236 .get = snd_hda_mixer_bind_ctls_get,\
237 .put = snd_hda_mixer_bind_ctls_put,\
238 .private_value = (long) (bindrec) }
251 #define HDA_MAX_NUM_INPUTS 16
266 unsigned int *cur_val);
268 int index,
int *type_index_ret);
300 #define HDA_MAX_OUTS 5
331 unsigned int stream_tag,
342 unsigned int stream_tag,
351 #ifdef CONFIG_SND_HDA_GENERIC
363 #ifdef CONFIG_PROC_FS
369 #define SND_PRINT_BITS_ADVISED_BUFSIZE 16
376 const char *
const *modelnames,
377 const struct snd_pci_quirk *pci_list);
379 int num_configs,
const char *
const *models,
380 const struct snd_pci_quirk *tbl);
388 #define HDA_UNSOL_QUEUE_SIZE 64
401 #define get_defcfg_connect(cfg) \
402 ((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT)
403 #define get_defcfg_association(cfg) \
404 ((cfg & AC_DEFCFG_DEF_ASSOC) >> AC_DEFCFG_ASSOC_SHIFT)
405 #define get_defcfg_location(cfg) \
406 ((cfg & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT)
407 #define get_defcfg_sequence(cfg) \
408 (cfg & AC_DEFCFG_SEQUENCE)
409 #define get_defcfg_device(cfg) \
410 ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT)
411 #define get_defcfg_misc(cfg) \
412 ((cfg & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT)
415 #define AMP_IN_MUTE(idx) (0x7080 | ((idx)<<8))
416 #define AMP_IN_UNMUTE(idx) (0x7000 | ((idx)<<8))
417 #define AMP_OUT_MUTE 0xb080
418 #define AMP_OUT_UNMUTE 0xb000
419 #define AMP_OUT_ZERO 0xb000
421 #define PIN_IN (AC_PINCTL_IN_EN)
422 #define PIN_VREFHIZ (AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ)
423 #define PIN_VREF50 (AC_PINCTL_IN_EN | AC_PINCTL_VREF_50)
424 #define PIN_VREFGRD (AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD)
425 #define PIN_VREF80 (AC_PINCTL_IN_EN | AC_PINCTL_VREF_80)
426 #define PIN_VREF100 (AC_PINCTL_IN_EN | AC_PINCTL_VREF_100)
427 #define PIN_OUT (AC_PINCTL_OUT_EN)
428 #define PIN_HP (AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN)
429 #define PIN_HP_AMP (AC_PINCTL_HP_EN)
476 if (nid < codec->start_nid ||
483 static inline int get_wcaps_type(
unsigned int wcaps)
490 static inline unsigned int get_wcaps_channels(
u32 wcaps)
495 chans = ((chans << 1) | 1) + 1;
508 #define HDA_NID_ITEM_AMP (1<<0)
526 #ifdef CONFIG_SND_HDA_HWDEP
532 #if defined(CONFIG_PM) && defined(CONFIG_SND_HDA_HWDEP)
533 int snd_hda_hwdep_add_power_sysfs(
struct hda_codec *codec);
535 static inline int snd_hda_hwdep_add_power_sysfs(
struct hda_codec *codec)
541 #ifdef CONFIG_SND_HDA_RECONFIG
542 int snd_hda_hwdep_add_sysfs(
struct hda_codec *codec);
544 static inline int snd_hda_hwdep_add_sysfs(
struct hda_codec *codec)
550 #ifdef CONFIG_SND_HDA_RECONFIG
551 const char *snd_hda_get_hint(
struct hda_codec *codec,
const char *
key);
552 int snd_hda_get_bool_hint(
struct hda_codec *codec,
const char *
key);
555 const char *snd_hda_get_hint(
struct hda_codec *codec,
const char *
key)
561 int snd_hda_get_bool_hint(
struct hda_codec *codec,
const char *
key)
592 #define get_amp_nid_(pv) ((pv) & 0xffff)
593 #define get_amp_nid(kc) get_amp_nid_((kc)->private_value)
594 #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3)
595 #define get_amp_direction_(pv) (((pv) >> 18) & 0x1)
596 #define get_amp_direction(kc) get_amp_direction_((kc)->private_value)
597 #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf)
598 #define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f)
599 #define get_amp_min_mute(kc) (((kc)->private_value >> 29) & 0x1)
613 #define ELD_FIXED_BYTES 20
614 #define ELD_MAX_SIZE 256
615 #define ELD_MAX_MNL 16
616 #define ELD_MAX_SAD 16
643 #ifdef CONFIG_PROC_FS
654 #ifdef CONFIG_PROC_FS
659 static inline int snd_hda_eld_proc_new(
struct hda_codec *codec,
665 static inline void snd_hda_eld_proc_free(
struct hda_codec *codec,
671 #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80