Lines Matching refs:kctl

187  * @kctl: the pointer to store new control instance
198 static int snd_ctl_new(struct snd_kcontrol **kctl, unsigned int count,
206 *kctl = kzalloc(struct_size(*kctl, vd, count), GFP_KERNEL);
207 if (!*kctl)
211 (*kctl)->vd[idx].access = access;
212 (*kctl)->vd[idx].owner = file;
214 (*kctl)->count = count;
233 struct snd_kcontrol *kctl;
256 err = snd_ctl_new(&kctl, count, access, NULL);
261 kctl->id.iface = ncontrol->iface;
262 kctl->id.device = ncontrol->device;
263 kctl->id.subdevice = ncontrol->subdevice;
265 strlcpy(kctl->id.name, ncontrol->name, sizeof(kctl->id.name));
266 if (strcmp(ncontrol->name, kctl->id.name) != 0)
268 ncontrol->name, kctl->id.name);
270 kctl->id.index = ncontrol->index;
272 kctl->info = ncontrol->info;
273 kctl->get = ncontrol->get;
274 kctl->put = ncontrol->put;
275 kctl->tlv.p = ncontrol->tlv.p;
277 kctl->private_value = ncontrol->private_value;
278 kctl->private_data = private_data;
280 return kctl;
305 struct snd_kcontrol *kctl;
311 list_for_each_entry(kctl, &card->controls, list) {
312 if (kctl->id.numid < card->last_numid + 1 + count &&
313 kctl->id.numid + kctl->count > card->last_numid + 1) {
314 card->last_numid = kctl->id.numid + kctl->count - 1;
493 struct snd_kcontrol *kctl;
497 kctl = snd_ctl_find_id(card, id);
498 if (kctl == NULL) {
502 ret = snd_ctl_remove(card, kctl);
522 struct snd_kcontrol *kctl;
526 kctl = snd_ctl_find_id(card, id);
527 if (kctl == NULL) {
531 if (!(kctl->vd[0].access & SNDRV_CTL_ELEM_ACCESS_USER)) {
535 for (idx = 0; idx < kctl->count; idx++)
536 if (kctl->vd[idx].owner != NULL && kctl->vd[idx].owner != file) {
540 ret = snd_ctl_remove(card, kctl);
564 struct snd_kcontrol *kctl;
570 kctl = snd_ctl_find_id(card, id);
571 if (kctl == NULL) {
575 index_offset = snd_ctl_get_ioff(kctl, id);
576 vd = &kctl->vd[index_offset];
587 snd_ctl_build_ioff(id, kctl, index_offset);
611 struct snd_kcontrol *kctl;
614 kctl = snd_ctl_find_id(card, src_id);
615 if (kctl == NULL) {
619 kctl->id = *dst_id;
620 kctl->id.numid = card->last_numid + 1;
621 card->last_numid += kctl->count;
642 struct snd_kcontrol *kctl;
646 list_for_each_entry(kctl, &card->controls, list) {
647 if (kctl->id.numid <= numid && kctl->id.numid + kctl->count > numid)
648 return kctl;
670 struct snd_kcontrol *kctl;
676 list_for_each_entry(kctl, &card->controls, list) {
677 if (kctl->id.iface != id->iface)
679 if (kctl->id.device != id->device)
681 if (kctl->id.subdevice != id->subdevice)
683 if (strncmp(kctl->id.name, id->name, sizeof(kctl->id.name)))
685 if (kctl->id.index > id->index)
687 if (kctl->id.index + kctl->count <= id->index)
689 return kctl;
723 struct snd_kcontrol *kctl;
735 list_for_each_entry(kctl, &card->controls, list) {
736 if (offset >= kctl->count) {
737 offset -= kctl->count;
740 for (jidx = offset; jidx < kctl->count; jidx++) {
741 snd_ctl_build_ioff(&id, kctl, jidx);
776 /* Check whether the given kctl info is valid */
961 struct snd_kcontrol *kctl,
972 result = kctl->info(kctl, info);
975 index_offset = snd_ctl_get_ioff(kctl, &info->id);
976 vd = &kctl->vd[index_offset];
977 snd_ctl_build_ioff(&info->id, kctl, index_offset);
998 struct snd_kcontrol *kctl;
1002 kctl = snd_ctl_find_id(card, &info->id);
1003 if (kctl == NULL)
1006 result = __snd_ctl_elem_info(card, kctl, info, ctl);
1035 struct snd_kcontrol *kctl;
1042 kctl = snd_ctl_find_id(card, &control->id);
1043 if (kctl == NULL)
1046 index_offset = snd_ctl_get_ioff(kctl, &control->id);
1047 vd = &kctl->vd[index_offset];
1048 if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_READ) || kctl->get == NULL)
1051 snd_ctl_build_ioff(&control->id, kctl, index_offset);
1057 ret = __snd_ctl_elem_info(card, kctl, &info, NULL);
1064 ret = kctl->get(kctl, control);
1109 struct snd_kcontrol *kctl;
1114 kctl = snd_ctl_find_id(card, &control->id);
1115 if (kctl == NULL)
1118 index_offset = snd_ctl_get_ioff(kctl, &control->id);
1119 vd = &kctl->vd[index_offset];
1120 if (!(vd->access & SNDRV_CTL_ELEM_ACCESS_WRITE) || kctl->put == NULL ||
1125 snd_ctl_build_ioff(&control->id, kctl, index_offset);
1126 result = kctl->put(kctl, control);
1172 struct snd_kcontrol *kctl;
1179 kctl = snd_ctl_find_id(card, &id);
1180 if (kctl == NULL) {
1183 vd = &kctl->vd[snd_ctl_get_ioff(kctl, &id)];
1200 struct snd_kcontrol *kctl;
1207 kctl = snd_ctl_find_id(card, &id);
1208 if (kctl == NULL) {
1211 vd = &kctl->vd[snd_ctl_get_ioff(kctl, &id)];
1300 static int replace_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf,
1303 struct user_element *ue = kctl->private_data;
1327 for (i = 0; i < kctl->count; ++i)
1328 kctl->vd[i].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
1337 for (i = 0; i < kctl->count; ++i) {
1338 snd_ctl_build_ioff(&id, kctl, i);
1345 static int read_user_tlv(struct snd_kcontrol *kctl, unsigned int __user *buf,
1348 struct user_element *ue = kctl->private_data;
1362 static int snd_ctl_elem_user_tlv(struct snd_kcontrol *kctl, int op_flag,
1366 return replace_user_tlv(kctl, buf, size);
1368 return read_user_tlv(kctl, buf, size);
1418 struct snd_kcontrol *kctl;
1483 err = snd_ctl_new(&kctl, count, access, file);
1486 memcpy(&kctl->id, &info->id, sizeof(kctl->id));
1487 kctl->private_data = kzalloc(sizeof(struct user_element) + private_size * count,
1489 if (kctl->private_data == NULL) {
1490 kfree(kctl);
1493 kctl->private_free = snd_ctl_elem_user_free;
1496 ue = (struct user_element *)kctl->private_data;
1505 snd_ctl_free_one(kctl);
1512 kctl->info = snd_ctl_elem_user_enum_info;
1514 kctl->info = snd_ctl_elem_user_info;
1516 kctl->get = snd_ctl_elem_user_get;
1518 kctl->put = snd_ctl_elem_user_put;
1520 kctl->tlv.c = snd_ctl_elem_user_tlv;
1524 err = __snd_ctl_add_replace(card, kctl, CTL_ADD_EXCLUSIVE);
1526 snd_ctl_free_one(kctl);
1529 offset = snd_ctl_get_ioff(kctl, &info->id);
1530 snd_ctl_build_ioff(&info->id, kctl, offset);
1597 struct snd_kcontrol *kctl,
1609 struct snd_kcontrol_volatile *vd = &kctl->vd[snd_ctl_get_ioff(kctl, id)];
1620 if (kctl->tlv.c == NULL)
1628 return kctl->tlv.c(kctl, op_flag, size, buf);
1631 static int read_tlv_buf(struct snd_kcontrol *kctl, struct snd_ctl_elem_id *id,
1634 struct snd_kcontrol_volatile *vd = &kctl->vd[snd_ctl_get_ioff(kctl, id)];
1640 if (kctl->tlv.p == NULL)
1643 len = sizeof(unsigned int) * 2 + kctl->tlv.p[1];
1647 if (copy_to_user(buf, kctl->tlv.p, len))
1660 struct snd_kcontrol *kctl;
1677 kctl = snd_ctl_find_numid(file->card, header.numid);
1678 if (kctl == NULL)
1682 id = kctl->id;
1683 snd_ctl_build_ioff(&id, kctl, header.numid - id.numid);
1684 vd = &kctl->vd[snd_ctl_get_ioff(kctl, &id)];
1687 return call_tlv_handler(file, op_flag, kctl, &id, container,
1691 return read_tlv_buf(kctl, &id, container,
1953 struct snd_ctl_file *kctl;
1958 list_for_each_entry(kctl, &card->ctl_files, list) {
1959 if (kctl->pid == task_pid(current)) {
1960 subdevice = kctl->preferred_subdevice[type];