diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-07-27 13:02:40 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:58:11 -0400 |
commit | 532d5381793f3c824f8ff68d7067fab8c76bb811 (patch) | |
tree | 41a27e08a905c28576167b711ccc2b06ea234a9f /sound/pci/hda/hda_local.h | |
parent | 2807314d467e7dd929c42050031aabbd28e78f0b (diff) |
[ALSA] hda-codec - Add a generic bind-control helper
Added callbacks for a generic bind-control of mixer elements.
This can be used for creating a mixer element controlling multiple
widgets at the same time. Two macros, HDA_BIND_VOL() and HDA_BIND_SW(),
are introduced for creating bind-volume and bind-switch, respectively.
It taks the mixer element name and struct hda_bind_ctls pointer, which
contains the real control callbacks in ops field and long array for
private_value of each bound widget.
All widgets have to be the same type (i.e. the same amp capability).
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r-- | sound/pci/hda/hda_local.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 12428a67eb2a..fafcffe6fc79 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -102,6 +102,53 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, | |||
102 | int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, | 102 | int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, |
103 | struct snd_ctl_elem_value *ucontrol); | 103 | struct snd_ctl_elem_value *ucontrol); |
104 | 104 | ||
105 | /* more generic bound controls */ | ||
106 | struct hda_ctl_ops { | ||
107 | snd_kcontrol_info_t *info; | ||
108 | snd_kcontrol_get_t *get; | ||
109 | snd_kcontrol_put_t *put; | ||
110 | snd_kcontrol_tlv_rw_t *tlv; | ||
111 | }; | ||
112 | |||
113 | extern struct hda_ctl_ops snd_hda_bind_vol; /* for bind-volume with TLV */ | ||
114 | extern struct hda_ctl_ops snd_hda_bind_sw; /* for bind-switch */ | ||
115 | |||
116 | struct hda_bind_ctls { | ||
117 | struct hda_ctl_ops *ops; | ||
118 | long values[]; | ||
119 | }; | ||
120 | |||
121 | int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol, | ||
122 | struct snd_ctl_elem_info *uinfo); | ||
123 | int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, | ||
124 | struct snd_ctl_elem_value *ucontrol); | ||
125 | int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, | ||
126 | struct snd_ctl_elem_value *ucontrol); | ||
127 | int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag, | ||
128 | unsigned int size, unsigned int __user *tlv); | ||
129 | |||
130 | #define HDA_BIND_VOL(xname, bindrec) \ | ||
131 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
132 | .name = xname, \ | ||
133 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |\ | ||
134 | SNDRV_CTL_ELEM_ACCESS_TLV_READ |\ | ||
135 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,\ | ||
136 | .info = snd_hda_mixer_bind_ctls_info,\ | ||
137 | .get = snd_hda_mixer_bind_ctls_get,\ | ||
138 | .put = snd_hda_mixer_bind_ctls_put,\ | ||
139 | .tlv = { .c = snd_hda_mixer_bind_tlv },\ | ||
140 | .private_value = (long) (bindrec) } | ||
141 | #define HDA_BIND_SW(xname, bindrec) \ | ||
142 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,\ | ||
143 | .name = xname, \ | ||
144 | .info = snd_hda_mixer_bind_ctls_info,\ | ||
145 | .get = snd_hda_mixer_bind_ctls_get,\ | ||
146 | .put = snd_hda_mixer_bind_ctls_put,\ | ||
147 | .private_value = (long) (bindrec) } | ||
148 | |||
149 | /* | ||
150 | * SPDIF I/O | ||
151 | */ | ||
105 | int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid); | 152 | int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid); |
106 | int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); | 153 | int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); |
107 | 154 | ||