Lines Matching refs:follower

54 	struct snd_kcontrol follower; /* the copy of original control entry */  member
57 static int follower_update(struct link_follower *follower) in follower_update() argument
65 uctl->id = follower->follower.id; in follower_update()
66 err = follower->follower.get(&follower->follower, uctl); in follower_update()
69 for (ch = 0; ch < follower->info.count; ch++) in follower_update()
70 follower->vals[ch] = uctl->value.integer.value[ch]; in follower_update()
77 static int follower_init(struct link_follower *follower) in follower_init() argument
82 if (follower->info.count) { in follower_init()
84 if (follower->flags & SND_CTL_FOLLOWER_NEED_UPDATE) in follower_init()
85 return follower_update(follower); in follower_init()
92 uinfo->id = follower->follower.id; in follower_init()
93 err = follower->follower.info(&follower->follower, uinfo); in follower_init()
98 follower->info.type = uinfo->type; in follower_init()
99 follower->info.count = uinfo->count; in follower_init()
100 if (follower->info.count > 2 || in follower_init()
101 (follower->info.type != SNDRV_CTL_ELEM_TYPE_INTEGER && in follower_init()
102 follower->info.type != SNDRV_CTL_ELEM_TYPE_BOOLEAN)) { in follower_init()
107 follower->info.min_val = uinfo->value.integer.min; in follower_init()
108 follower->info.max_val = uinfo->value.integer.max; in follower_init()
111 return follower_update(follower); in follower_init()
117 struct link_follower *follower; in master_init() local
122 list_for_each_entry(follower, &master->followers, list) { in master_init()
123 int err = follower_init(follower); in master_init()
126 master->info = follower->info; in master_init()
137 static int follower_get_val(struct link_follower *follower, in follower_get_val() argument
142 err = follower_init(follower); in follower_get_val()
145 for (ch = 0; ch < follower->info.count; ch++) in follower_get_val()
146 ucontrol->value.integer.value[ch] = follower->vals[ch]; in follower_get_val()
150 static int follower_put_val(struct link_follower *follower, in follower_put_val() argument
155 err = master_init(follower->master); in follower_put_val()
159 switch (follower->info.type) { in follower_put_val()
161 for (ch = 0; ch < follower->info.count; ch++) in follower_put_val()
163 !!follower->master->val; in follower_put_val()
166 for (ch = 0; ch < follower->info.count; ch++) { in follower_put_val()
169 vol += follower->master->val - follower->master->info.max_val; in follower_put_val()
170 if (vol < follower->info.min_val) in follower_put_val()
171 vol = follower->info.min_val; in follower_put_val()
172 else if (vol > follower->info.max_val) in follower_put_val()
173 vol = follower->info.max_val; in follower_put_val()
178 return follower->follower.put(&follower->follower, ucontrol); in follower_put_val()
187 struct link_follower *follower = snd_kcontrol_chip(kcontrol); in follower_info() local
188 return follower->follower.info(&follower->follower, uinfo); in follower_info()
194 struct link_follower *follower = snd_kcontrol_chip(kcontrol); in follower_get() local
195 return follower_get_val(follower, ucontrol); in follower_get()
201 struct link_follower *follower = snd_kcontrol_chip(kcontrol); in follower_put() local
204 err = follower_init(follower); in follower_put()
207 for (ch = 0; ch < follower->info.count; ch++) { in follower_put()
208 if (follower->vals[ch] != ucontrol->value.integer.value[ch]) { in follower_put()
210 follower->vals[ch] = ucontrol->value.integer.value[ch]; in follower_put()
215 err = follower_put_val(follower, ucontrol); in follower_put()
225 struct link_follower *follower = snd_kcontrol_chip(kcontrol); in follower_tlv_cmd() local
227 return follower->follower.tlv.c(&follower->follower, op_flag, size, tlv); in follower_tlv_cmd()
232 struct link_follower *follower = snd_kcontrol_chip(kcontrol); in follower_free() local
233 if (follower->follower.private_free) in follower_free()
234 follower->follower.private_free(&follower->follower); in follower_free()
235 if (follower->master) in follower_free()
236 list_del(&follower->list); in follower_free()
237 kfree(follower); in follower_free()
253 struct snd_kcontrol *follower, in _snd_ctl_add_follower() argument
259 srec = kzalloc(struct_size(srec, follower.vd, follower->count), in _snd_ctl_add_follower()
263 srec->kctl = follower; in _snd_ctl_add_follower()
264 srec->follower = *follower; in _snd_ctl_add_follower()
265 memcpy(srec->follower.vd, follower->vd, follower->count * sizeof(*follower->vd)); in _snd_ctl_add_follower()
270 follower->info = follower_info; in _snd_ctl_add_follower()
271 follower->get = follower_get; in _snd_ctl_add_follower()
272 follower->put = follower_put; in _snd_ctl_add_follower()
273 if (follower->vd[0].access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) in _snd_ctl_add_follower()
274 follower->tlv.c = follower_tlv_cmd; in _snd_ctl_add_follower()
275 follower->private_data = srec; in _snd_ctl_add_follower()
276 follower->private_free = follower_free; in _snd_ctl_add_follower()
315 struct link_follower *follower; in sync_followers() local
321 list_for_each_entry(follower, &master->followers, list) { in sync_followers()
323 uval->id = follower->follower.id; in sync_followers()
324 follower_get_val(follower, uval); in sync_followers()
326 follower_put_val(follower, uval); in sync_followers()
359 struct link_follower *follower, *n; in master_free() local
362 list_for_each_entry_safe(follower, n, &master->followers, list) { in master_free()
363 struct snd_kcontrol *sctl = follower->kctl; in master_free()
365 memcpy(sctl, &follower->follower, sizeof(*sctl)); in master_free()
366 memcpy(sctl->vd, follower->follower.vd, in master_free()
369 kfree(follower); in master_free()
501 struct snd_kcontrol *follower, in snd_ctl_apply_vmaster_followers() argument
506 struct link_follower *follower; in snd_ctl_apply_vmaster_followers() local
513 list_for_each_entry(follower, &master->followers, list) { in snd_ctl_apply_vmaster_followers()
514 err = func(follower->kctl, &follower->follower, arg); in snd_ctl_apply_vmaster_followers()