Lines Matching refs:follower

3  * Virtual master and follower controls
24 * link master - this contains a list of follower controls that are
41 * link follower - this contains a follower control element
44 * master control. A follower may have either one or two channels.
54 struct snd_kcontrol follower; /* the copy of original control entry */
57 static int follower_update(struct link_follower *follower)
65 uctl->id = follower->follower.id;
66 err = follower->follower.get(&follower->follower, uctl);
69 for (ch = 0; ch < follower->info.count; ch++)
70 follower->vals[ch] = uctl->value.integer.value[ch];
76 /* get the follower ctl info and save the initial values */
77 static int follower_init(struct link_follower *follower)
82 if (follower->info.count) {
84 if (follower->flags & SND_CTL_FOLLOWER_NEED_UPDATE)
85 return follower_update(follower);
92 uinfo->id = follower->follower.id;
93 err = follower->follower.info(&follower->follower, uinfo);
98 follower->info.type = uinfo->type;
99 follower->info.count = uinfo->count;
100 if (follower->info.count > 2 ||
101 (follower->info.type != SNDRV_CTL_ELEM_TYPE_INTEGER &&
102 follower->info.type != SNDRV_CTL_ELEM_TYPE_BOOLEAN)) {
103 pr_err("ALSA: vmaster: invalid follower element\n");
107 follower->info.min_val = uinfo->value.integer.min;
108 follower->info.max_val = uinfo->value.integer.max;
111 return follower_update(follower);
117 struct link_follower *follower;
122 list_for_each_entry(follower, &master->followers, list) {
123 int err = follower_init(follower);
126 master->info = follower->info;
137 static int follower_get_val(struct link_follower *follower,
142 err = follower_init(follower);
145 for (ch = 0; ch < follower->info.count; ch++)
146 ucontrol->value.integer.value[ch] = follower->vals[ch];
150 static int follower_put_val(struct link_follower *follower,
155 err = master_init(follower->master);
159 switch (follower->info.type) {
161 for (ch = 0; ch < follower->info.count; ch++)
163 !!follower->master->val;
166 for (ch = 0; ch < follower->info.count; ch++) {
169 vol += follower->master->val - follower->master->info.max_val;
170 if (vol < follower->info.min_val)
171 vol = follower->info.min_val;
172 else if (vol > follower->info.max_val)
173 vol = follower->info.max_val;
178 return follower->follower.put(&follower->follower, ucontrol);
187 struct link_follower *follower = snd_kcontrol_chip(kcontrol);
188 return follower->follower.info(&follower->follower, uinfo);
194 struct link_follower *follower = snd_kcontrol_chip(kcontrol);
195 return follower_get_val(follower, ucontrol);
201 struct link_follower *follower = snd_kcontrol_chip(kcontrol);
204 err = follower_init(follower);
207 for (ch = 0; ch < follower->info.count; ch++) {
208 if (follower->vals[ch] != ucontrol->value.integer.value[ch]) {
210 follower->vals[ch] = ucontrol->value.integer.value[ch];
215 err = follower_put_val(follower, ucontrol);
225 struct link_follower *follower = snd_kcontrol_chip(kcontrol);
227 return follower->follower.tlv.c(&follower->follower, op_flag, size, tlv);
232 struct link_follower *follower = snd_kcontrol_chip(kcontrol);
233 if (follower->follower.private_free)
234 follower->follower.private_free(&follower->follower);
235 if (follower->master)
236 list_del(&follower->list);
237 kfree(follower);
241 * Add a follower control to the group with the given master control
253 struct snd_kcontrol *follower,
259 srec = kzalloc(struct_size(srec, follower.vd, follower->count),
263 srec->kctl = follower;
264 srec->follower = *follower;
265 memcpy(srec->follower.vd, follower->vd, follower->count * sizeof(*follower->vd));
270 follower->info = follower_info;
271 follower->get = follower_get;
272 follower->put = follower_put;
273 if (follower->vd[0].access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK)
274 follower->tlv.c = follower_tlv_cmd;
275 follower->private_data = srec;
276 follower->private_free = follower_free;
289 * Adds the multiple follower kcontrols with the given names.
295 struct snd_kcontrol *follower;
299 follower = snd_ctl_find_id_mixer(card, *list);
300 if (follower) {
301 err = snd_ctl_add_follower(master, follower);
343 struct link_follower *follower;
349 list_for_each_entry(follower, &master->followers, list) {
351 uval->id = follower->follower.id;
352 follower_get_val(follower, uval);
354 follower_put_val(follower, uval);
387 struct link_follower *follower, *n;
389 /* free all follower links and retore the original follower kctls */
390 list_for_each_entry_safe(follower, n, &master->followers, list) {
391 struct snd_kcontrol *sctl = follower->kctl;
393 memcpy(sctl, &follower->follower, sizeof(*sctl));
394 memcpy(sctl->vd, follower->follower.vd,
397 kfree(follower);
410 * After creating a vmaster element, you can add the follower controls
491 * Forcibly call the put callback of each follower and call the hook function
519 * snd_ctl_apply_vmaster_followers - Apply function to each vmaster follower
524 * Apply the function @func to each follower kctl of the given vmaster kctl.
530 struct snd_kcontrol *follower,
535 struct link_follower *follower;
542 list_for_each_entry(follower, &master->followers, list) {
543 err = func(follower->kctl, &follower->follower, arg);