Lines Matching full:master
3 * Virtual master and follower controls
24 * link master - this contains a list of follower controls that are
28 * The master control is so far only mono volume/switch for simplicity.
34 int val; /* the master value */
44 * master control. A follower may have either one or two channels.
49 struct link_master *master; member
108 /* initialize master volume */
109 static int master_init(struct link_master *master) in master_init() argument
113 if (master->info.count) in master_init()
116 list_for_each_entry(follower, &master->followers, list) { in master_init()
120 master->info = follower->info; in master_init()
121 master->info.count = 1; /* always mono */ in master_init()
123 master->val = master->info.max_val; in master_init()
124 if (master->hook) in master_init()
125 master->hook(master->hook_private_data, master->val); in master_init()
149 err = master_init(follower->master); in follower_put_val()
157 !!follower->master->val; in follower_put_val()
161 /* max master volume is supposed to be 0 dB */ in follower_put_val()
163 vol += follower->master->val - follower->master->info.max_val; in follower_put_val()
235 if (follower->master) in follower_free()
241 * Add a follower control to the group with the given master control
250 * - master can only attenuate the volume, no gain
252 int _snd_ctl_add_follower(struct snd_kcontrol *master, in _snd_ctl_add_follower() argument
256 struct link_master *master_link = snd_kcontrol_chip(master); in _snd_ctl_add_follower()
266 srec->master = master_link; in _snd_ctl_add_follower()
286 * @master: the target vmaster kcontrol object
292 int snd_ctl_add_followers(struct snd_card *card, struct snd_kcontrol *master, in snd_ctl_add_followers() argument
301 err = snd_ctl_add_follower(master, follower); in snd_ctl_add_followers()
312 * ctl callbacks for master controls
317 struct link_master *master = snd_kcontrol_chip(kcontrol); in master_info() local
320 ret = master_init(master); in master_info()
323 uinfo->type = master->info.type; in master_info()
324 uinfo->count = master->info.count; in master_info()
325 uinfo->value.integer.min = master->info.min_val; in master_info()
326 uinfo->value.integer.max = master->info.max_val; in master_info()
333 struct link_master *master = snd_kcontrol_chip(kcontrol); in master_get() local
334 int err = master_init(master); in master_get()
337 ucontrol->value.integer.value[0] = master->val; in master_get()
341 static int sync_followers(struct link_master *master, int old_val, int new_val) in sync_followers() argument
349 list_for_each_entry(follower, &master->followers, list) { in sync_followers()
350 master->val = old_val; in sync_followers()
353 master->val = new_val; in sync_followers()
362 struct link_master *master = snd_kcontrol_chip(kcontrol); in master_put() local
366 err = master_init(master); in master_put()
370 old_val = master->val; in master_put()
374 if (new_val < master->info.min_val || new_val > master->info.max_val) in master_put()
377 err = sync_followers(master, old_val, new_val); in master_put()
380 if (master->hook && !first_init) in master_put()
381 master->hook(master->hook_private_data, master->val); in master_put()
387 struct link_master *master = snd_kcontrol_chip(kcontrol); in master_free() local
391 list_for_each_entry_safe(follower, n, &master->followers, list) { in master_free()
400 kfree(master); in master_free()
405 * snd_ctl_make_virtual_master - Create a virtual master control
409 * Creates a virtual master control with the given name string.
415 * for dB scale of the master control. It should be a single element
424 struct link_master *master; in snd_ctl_make_virtual_master() local
433 master = kzalloc(sizeof(*master), GFP_KERNEL); in snd_ctl_make_virtual_master()
434 if (!master) in snd_ctl_make_virtual_master()
436 INIT_LIST_HEAD(&master->followers); in snd_ctl_make_virtual_master()
438 kctl = snd_ctl_new1(&knew, master); in snd_ctl_make_virtual_master()
440 kfree(master); in snd_ctl_make_virtual_master()
456 memcpy(master->tlv, tlv, sizeof(master->tlv)); in snd_ctl_make_virtual_master()
457 kctl->tlv.p = master->tlv; in snd_ctl_make_virtual_master()
480 struct link_master *master = snd_kcontrol_chip(kcontrol); in snd_ctl_add_vmaster_hook() local
481 master->hook = hook; in snd_ctl_add_vmaster_hook()
482 master->hook_private_data = private_data; in snd_ctl_add_vmaster_hook()
498 struct link_master *master; in snd_ctl_sync_vmaster() local
503 master = snd_kcontrol_chip(kcontrol); in snd_ctl_sync_vmaster()
505 int err = master_init(master); in snd_ctl_sync_vmaster()
509 err = sync_followers(master, master->val, master->val); in snd_ctl_sync_vmaster()
514 if (master->hook && !first_init) in snd_ctl_sync_vmaster()
515 master->hook(master->hook_private_data, master->val); in snd_ctl_sync_vmaster()
535 struct link_master *master; in snd_ctl_apply_vmaster_followers() local
539 master = snd_kcontrol_chip(kctl); in snd_ctl_apply_vmaster_followers()
540 err = master_init(master); in snd_ctl_apply_vmaster_followers()
543 list_for_each_entry(follower, &master->followers, list) { in snd_ctl_apply_vmaster_followers()