Lines Matching refs:ctrl
40 struct v4l2_ctrl *ctrl; member
1036 static bool type_is_int(const struct v4l2_ctrl *ctrl) in type_is_int() argument
1038 switch (ctrl->type) { in type_is_int()
1048 static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl, u32 changes) in fill_event() argument
1052 ev->id = ctrl->id; in fill_event()
1053 ev->u.ctrl.changes = changes; in fill_event()
1054 ev->u.ctrl.type = ctrl->type; in fill_event()
1055 ev->u.ctrl.flags = ctrl->flags; in fill_event()
1056 if (ctrl->type == V4L2_CTRL_TYPE_STRING) in fill_event()
1057 ev->u.ctrl.value64 = 0; in fill_event()
1059 ev->u.ctrl.value64 = ctrl->cur.val64; in fill_event()
1060 ev->u.ctrl.minimum = ctrl->minimum; in fill_event()
1061 ev->u.ctrl.maximum = ctrl->maximum; in fill_event()
1062 if (ctrl->type == V4L2_CTRL_TYPE_MENU in fill_event()
1063 || ctrl->type == V4L2_CTRL_TYPE_INTEGER_MENU) in fill_event()
1064 ev->u.ctrl.step = 1; in fill_event()
1066 ev->u.ctrl.step = ctrl->step; in fill_event()
1067 ev->u.ctrl.default_value = ctrl->default_value; in fill_event()
1070 static void send_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 changes) in send_event() argument
1075 if (list_empty(&ctrl->ev_subs)) in send_event()
1077 fill_event(&ev, ctrl, changes); in send_event()
1079 list_for_each_entry(sev, &ctrl->ev_subs, node) in send_event()
1087 struct v4l2_ctrl *ctrl) in cur_to_user() argument
1091 switch (ctrl->type) { in cur_to_user()
1093 len = strlen(ctrl->cur.string); in cur_to_user()
1098 return copy_to_user(c->string, ctrl->cur.string, in cur_to_user()
1101 c->value64 = ctrl->cur.val64; in cur_to_user()
1104 c->value = ctrl->cur.val; in cur_to_user()
1112 struct v4l2_ctrl *ctrl) in user_to_new() argument
1117 ctrl->is_new = 1; in user_to_new()
1118 switch (ctrl->type) { in user_to_new()
1120 ctrl->val64 = c->value64; in user_to_new()
1126 if (size > ctrl->maximum + 1) in user_to_new()
1127 size = ctrl->maximum + 1; in user_to_new()
1128 ret = copy_from_user(ctrl->string, c->string, size); in user_to_new()
1130 char last = ctrl->string[size - 1]; in user_to_new()
1132 ctrl->string[size - 1] = 0; in user_to_new()
1135 if (strlen(ctrl->string) == ctrl->maximum && last) in user_to_new()
1140 ctrl->val = c->value; in user_to_new()
1148 struct v4l2_ctrl *ctrl) in new_to_user() argument
1152 switch (ctrl->type) { in new_to_user()
1154 len = strlen(ctrl->string); in new_to_user()
1156 c->size = ctrl->maximum + 1; in new_to_user()
1159 return copy_to_user(c->string, ctrl->string, in new_to_user()
1162 c->value64 = ctrl->val64; in new_to_user()
1165 c->value = ctrl->val; in new_to_user()
1172 static void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 ch_flags) in new_to_cur() argument
1176 if (ctrl == NULL) in new_to_cur()
1178 switch (ctrl->type) { in new_to_cur()
1184 changed = strcmp(ctrl->string, ctrl->cur.string); in new_to_cur()
1185 strcpy(ctrl->cur.string, ctrl->string); in new_to_cur()
1188 changed = ctrl->val64 != ctrl->cur.val64; in new_to_cur()
1189 ctrl->cur.val64 = ctrl->val64; in new_to_cur()
1192 changed = ctrl->val != ctrl->cur.val; in new_to_cur()
1193 ctrl->cur.val = ctrl->val; in new_to_cur()
1198 ctrl->flags &= in new_to_cur()
1200 if (!is_cur_manual(ctrl->cluster[0])) { in new_to_cur()
1201 ctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; in new_to_cur()
1202 if (ctrl->cluster[0]->has_volatiles) in new_to_cur()
1203 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; in new_to_cur()
1210 if (!ctrl->is_new) in new_to_cur()
1212 send_event(fh, ctrl, in new_to_cur()
1214 if (ctrl->call_notify && changed && ctrl->handler->notify) in new_to_cur()
1215 ctrl->handler->notify(ctrl, ctrl->handler->notify_priv); in new_to_cur()
1220 static void cur_to_new(struct v4l2_ctrl *ctrl) in cur_to_new() argument
1222 if (ctrl == NULL) in cur_to_new()
1224 switch (ctrl->type) { in cur_to_new()
1227 strcpy(ctrl->string, ctrl->cur.string); in cur_to_new()
1230 ctrl->val64 = ctrl->cur.val64; in cur_to_new()
1233 ctrl->val = ctrl->cur.val; in cur_to_new()
1246 struct v4l2_ctrl *ctrl = master->cluster[i]; in cluster_changed() local
1248 if (ctrl == NULL) in cluster_changed()
1250 switch (ctrl->type) { in cluster_changed()
1256 diff = strcmp(ctrl->string, ctrl->cur.string); in cluster_changed()
1259 diff = ctrl->val64 != ctrl->cur.val64; in cluster_changed()
1262 diff = ctrl->val != ctrl->cur.val; in cluster_changed()
1305 static int validate_new(const struct v4l2_ctrl *ctrl, in validate_new() argument
1312 switch (ctrl->type) { in validate_new()
1315 val = c->value + ctrl->step / 2; in validate_new()
1316 val = clamp(val, ctrl->minimum, ctrl->maximum); in validate_new()
1317 offset = val - ctrl->minimum; in validate_new()
1318 offset = ctrl->step * (offset / ctrl->step); in validate_new()
1319 c->value = ctrl->minimum + offset; in validate_new()
1328 if (c->value < ctrl->minimum || c->value > ctrl->maximum) in validate_new()
1330 if (ctrl->menu_skip_mask & (1 << c->value)) in validate_new()
1332 if (ctrl->type == V4L2_CTRL_TYPE_MENU && in validate_new()
1333 ctrl->qmenu[c->value][0] == '\0') in validate_new()
1338 c->value &= ctrl->maximum; in validate_new()
1351 if (len < ctrl->minimum) in validate_new()
1353 if ((len - ctrl->minimum) % ctrl->step) in validate_new()
1364 return list_entry(node, struct v4l2_ctrl_ref, node)->ctrl->id; in node2id()
1397 struct v4l2_ctrl *ctrl, *next_ctrl; in v4l2_ctrl_handler_free() local
1410 list_for_each_entry_safe(ctrl, next_ctrl, &hdl->ctrls, node) { in v4l2_ctrl_handler_free()
1411 list_del(&ctrl->node); in v4l2_ctrl_handler_free()
1412 list_for_each_entry_safe(sev, next_sev, &ctrl->ev_subs, node) in v4l2_ctrl_handler_free()
1414 kfree(ctrl); in v4l2_ctrl_handler_free()
1439 if (V4L2_CTRL_ID2CLASS(ref->ctrl->id) == V4L2_CTRL_CLASS_USER && in find_private_ref()
1440 V4L2_CTRL_DRIVER_PRIV(ref->ctrl->id)) { in find_private_ref()
1441 if (!type_is_int(ref->ctrl)) in find_private_ref()
1465 if (hdl->cached && hdl->cached->ctrl->id == id) in find_ref()
1470 while (ref && ref->ctrl->id != id) in find_ref()
1497 return ref ? ref->ctrl : NULL; in v4l2_ctrl_find()
1503 struct v4l2_ctrl *ctrl) in handler_new_ref() argument
1507 u32 id = ctrl->id; in handler_new_ref()
1522 new_ref->ctrl = ctrl; in handler_new_ref()
1523 if (ctrl->handler == hdl) { in handler_new_ref()
1528 ctrl->cluster = &new_ref->ctrl; in handler_new_ref()
1529 ctrl->ncontrols = 1; in handler_new_ref()
1547 if (ref->ctrl->id < id) in handler_new_ref()
1550 if (ref->ctrl->id == id) { in handler_new_ref()
1576 struct v4l2_ctrl *ctrl; in v4l2_ctrl_new() local
1607 ctrl = kzalloc(sizeof(*ctrl) + sz_extra, GFP_KERNEL); in v4l2_ctrl_new()
1608 if (ctrl == NULL) { in v4l2_ctrl_new()
1613 INIT_LIST_HEAD(&ctrl->node); in v4l2_ctrl_new()
1614 INIT_LIST_HEAD(&ctrl->ev_subs); in v4l2_ctrl_new()
1615 ctrl->handler = hdl; in v4l2_ctrl_new()
1616 ctrl->ops = ops; in v4l2_ctrl_new()
1617 ctrl->id = id; in v4l2_ctrl_new()
1618 ctrl->name = name; in v4l2_ctrl_new()
1619 ctrl->type = type; in v4l2_ctrl_new()
1620 ctrl->flags = flags; in v4l2_ctrl_new()
1621 ctrl->minimum = min; in v4l2_ctrl_new()
1622 ctrl->maximum = max; in v4l2_ctrl_new()
1623 ctrl->step = step; in v4l2_ctrl_new()
1625 ctrl->qmenu = qmenu; in v4l2_ctrl_new()
1627 ctrl->qmenu_int = qmenu_int; in v4l2_ctrl_new()
1628 ctrl->priv = priv; in v4l2_ctrl_new()
1629 ctrl->cur.val = ctrl->val = ctrl->default_value = def; in v4l2_ctrl_new()
1631 if (ctrl->type == V4L2_CTRL_TYPE_STRING) { in v4l2_ctrl_new()
1632 ctrl->cur.string = (char *)&ctrl[1] + sz_extra - (max + 1); in v4l2_ctrl_new()
1633 ctrl->string = (char *)&ctrl[1] + sz_extra - 2 * (max + 1); in v4l2_ctrl_new()
1634 if (ctrl->minimum) in v4l2_ctrl_new()
1635 memset(ctrl->cur.string, ' ', ctrl->minimum); in v4l2_ctrl_new()
1637 if (handler_new_ref(hdl, ctrl)) { in v4l2_ctrl_new()
1638 kfree(ctrl); in v4l2_ctrl_new()
1642 list_add_tail(&ctrl->node, &hdl->ctrls); in v4l2_ctrl_new()
1644 return ctrl; in v4l2_ctrl_new()
1651 struct v4l2_ctrl *ctrl; in v4l2_ctrl_new_custom() local
1680 ctrl = v4l2_ctrl_new(hdl, cfg->ops, cfg->id, name, in v4l2_ctrl_new_custom()
1684 if (ctrl) in v4l2_ctrl_new_custom()
1685 ctrl->is_private = cfg->is_private; in v4l2_ctrl_new_custom()
1686 return ctrl; in v4l2_ctrl_new_custom()
1785 struct v4l2_ctrl *ctrl) in v4l2_ctrl_add_ctrl() argument
1789 if (ctrl == NULL) { in v4l2_ctrl_add_ctrl()
1793 if (ctrl->handler == hdl) in v4l2_ctrl_add_ctrl()
1794 return ctrl; in v4l2_ctrl_add_ctrl()
1795 return handler_new_ref(hdl, ctrl) ? NULL : ctrl; in v4l2_ctrl_add_ctrl()
1802 bool (*filter)(const struct v4l2_ctrl *ctrl)) in v4l2_ctrl_add_handler() argument
1814 struct v4l2_ctrl *ctrl = ref->ctrl; in v4l2_ctrl_add_handler() local
1817 if (ctrl->is_private) in v4l2_ctrl_add_handler()
1820 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) in v4l2_ctrl_add_handler()
1823 if (filter && !filter(ctrl)) in v4l2_ctrl_add_handler()
1825 ret = handler_new_ref(hdl, ctrl); in v4l2_ctrl_add_handler()
1834 bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl) in v4l2_ctrl_radio_filter() argument
1836 if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) in v4l2_ctrl_radio_filter()
1838 if (V4L2_CTRL_ID2CLASS(ctrl->id) == V4L2_CTRL_CLASS_FM_RX) in v4l2_ctrl_radio_filter()
1840 switch (ctrl->id) { in v4l2_ctrl_radio_filter()
1903 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active) in v4l2_ctrl_activate() argument
1909 if (ctrl == NULL) in v4l2_ctrl_activate()
1914 old = test_and_set_bit(4, &ctrl->flags); in v4l2_ctrl_activate()
1917 old = test_and_clear_bit(4, &ctrl->flags); in v4l2_ctrl_activate()
1919 send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_FLAGS); in v4l2_ctrl_activate()
1929 void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed) in v4l2_ctrl_grab() argument
1933 if (ctrl == NULL) in v4l2_ctrl_grab()
1936 v4l2_ctrl_lock(ctrl); in v4l2_ctrl_grab()
1939 old = test_and_set_bit(1, &ctrl->flags); in v4l2_ctrl_grab()
1942 old = test_and_clear_bit(1, &ctrl->flags); in v4l2_ctrl_grab()
1944 send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_FLAGS); in v4l2_ctrl_grab()
1945 v4l2_ctrl_unlock(ctrl); in v4l2_ctrl_grab()
1950 static void log_ctrl(const struct v4l2_ctrl *ctrl, in log_ctrl() argument
1953 if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY)) in log_ctrl()
1955 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) in log_ctrl()
1958 printk(KERN_INFO "%s%s%s: ", prefix, colon, ctrl->name); in log_ctrl()
1960 switch (ctrl->type) { in log_ctrl()
1962 printk(KERN_CONT "%d", ctrl->cur.val); in log_ctrl()
1965 printk(KERN_CONT "%s", ctrl->cur.val ? "true" : "false"); in log_ctrl()
1968 printk(KERN_CONT "%s", ctrl->qmenu[ctrl->cur.val]); in log_ctrl()
1971 printk(KERN_CONT "%lld", ctrl->qmenu_int[ctrl->cur.val]); in log_ctrl()
1974 printk(KERN_CONT "0x%08x", ctrl->cur.val); in log_ctrl()
1977 printk(KERN_CONT "%lld", ctrl->cur.val64); in log_ctrl()
1980 printk(KERN_CONT "%s", ctrl->cur.string); in log_ctrl()
1983 printk(KERN_CONT "unknown type %d", ctrl->type); in log_ctrl()
1986 if (ctrl->flags & (V4L2_CTRL_FLAG_INACTIVE | in log_ctrl()
1989 if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE) in log_ctrl()
1991 if (ctrl->flags & V4L2_CTRL_FLAG_GRABBED) in log_ctrl()
1993 if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) in log_ctrl()
2003 struct v4l2_ctrl *ctrl; in v4l2_ctrl_handler_log_status() local
2015 list_for_each_entry(ctrl, &hdl->ctrls, node) in v4l2_ctrl_handler_log_status()
2016 if (!(ctrl->flags & V4L2_CTRL_FLAG_DISABLED)) in v4l2_ctrl_handler_log_status()
2017 log_ctrl(ctrl, prefix, colon); in v4l2_ctrl_handler_log_status()
2032 struct v4l2_ctrl *ctrl; in v4l2_ctrl_handler_setup() local
2038 list_for_each_entry(ctrl, &hdl->ctrls, node) in v4l2_ctrl_handler_setup()
2039 ctrl->done = false; in v4l2_ctrl_handler_setup()
2041 list_for_each_entry(ctrl, &hdl->ctrls, node) { in v4l2_ctrl_handler_setup()
2042 struct v4l2_ctrl *master = ctrl->cluster[0]; in v4l2_ctrl_handler_setup()
2047 if (ctrl->done || ctrl->type == V4L2_CTRL_TYPE_BUTTON || in v4l2_ctrl_handler_setup()
2048 (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)) in v4l2_ctrl_handler_setup()
2072 struct v4l2_ctrl *ctrl; in v4l2_queryctrl() local
2098 if (id < ref->ctrl->id) in v4l2_queryctrl()
2106 ctrl = ref->ctrl; in v4l2_queryctrl()
2111 qc->id = ctrl->id; in v4l2_queryctrl()
2112 strlcpy(qc->name, ctrl->name, sizeof(qc->name)); in v4l2_queryctrl()
2113 qc->minimum = ctrl->minimum; in v4l2_queryctrl()
2114 qc->maximum = ctrl->maximum; in v4l2_queryctrl()
2115 qc->default_value = ctrl->default_value; in v4l2_queryctrl()
2116 if (ctrl->type == V4L2_CTRL_TYPE_MENU in v4l2_queryctrl()
2117 || ctrl->type == V4L2_CTRL_TYPE_INTEGER_MENU) in v4l2_queryctrl()
2120 qc->step = ctrl->step; in v4l2_queryctrl()
2121 qc->flags = ctrl->flags; in v4l2_queryctrl()
2122 qc->type = ctrl->type; in v4l2_queryctrl()
2138 struct v4l2_ctrl *ctrl; in v4l2_querymenu() local
2141 ctrl = v4l2_ctrl_find(hdl, qm->id); in v4l2_querymenu()
2142 if (!ctrl) in v4l2_querymenu()
2147 switch (ctrl->type) { in v4l2_querymenu()
2149 if (ctrl->qmenu == NULL) in v4l2_querymenu()
2153 if (ctrl->qmenu_int == NULL) in v4l2_querymenu()
2160 if (i < ctrl->minimum || i > ctrl->maximum) in v4l2_querymenu()
2164 if (ctrl->menu_skip_mask & (1 << i)) in v4l2_querymenu()
2167 if (ctrl->type == V4L2_CTRL_TYPE_MENU) { in v4l2_querymenu()
2168 if (ctrl->qmenu[i] == NULL || ctrl->qmenu[i][0] == '\0') in v4l2_querymenu()
2170 strlcpy(qm->name, ctrl->qmenu[i], sizeof(qm->name)); in v4l2_querymenu()
2172 qm->value = ctrl->qmenu_int[i]; in v4l2_querymenu()
2238 struct v4l2_ctrl *ctrl; in prepare_ext_ctrls() local
2253 ctrl = ref->ctrl; in prepare_ext_ctrls()
2254 if (ctrl->flags & V4L2_CTRL_FLAG_DISABLED) in prepare_ext_ctrls()
2257 if (ctrl->cluster[0]->ncontrols > 1) in prepare_ext_ctrls()
2259 if (ctrl->cluster[0] != ctrl) in prepare_ext_ctrls()
2260 ref = find_ref_lock(hdl, ctrl->cluster[0]->id); in prepare_ext_ctrls()
2263 h->ctrl = ctrl; in prepare_ext_ctrls()
2345 if (helpers[i].ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY) in v4l2_g_ext_ctrls()
2350 struct v4l2_ctrl *ctrl) = cur_to_user; in v4l2_g_ext_ctrls()
2356 master = helpers[i].mref->ctrl; in v4l2_g_ext_ctrls()
2377 helpers[idx].ctrl); in v4l2_g_ext_ctrls()
2397 static int get_ctrl(struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c) in get_ctrl() argument
2399 struct v4l2_ctrl *master = ctrl->cluster[0]; in get_ctrl()
2407 if (ctrl->type == V4L2_CTRL_TYPE_STRING) in get_ctrl()
2410 if (ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY) in get_ctrl()
2415 if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) { in get_ctrl()
2419 new_to_user(c, ctrl); in get_ctrl()
2421 cur_to_user(c, ctrl); in get_ctrl()
2429 struct v4l2_ctrl *ctrl = v4l2_ctrl_find(hdl, control->id); in v4l2_g_ctrl() local
2433 if (ctrl == NULL || !type_is_int(ctrl)) in v4l2_g_ctrl()
2435 ret = get_ctrl(ctrl, &c); in v4l2_g_ctrl()
2447 s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl) in v4l2_ctrl_g_ctrl() argument
2452 WARN_ON(!type_is_int(ctrl)); in v4l2_ctrl_g_ctrl()
2454 get_ctrl(ctrl, &c); in v4l2_ctrl_g_ctrl()
2459 s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl) in v4l2_ctrl_g_ctrl_int64() argument
2464 WARN_ON(ctrl->type != V4L2_CTRL_TYPE_INTEGER64); in v4l2_ctrl_g_ctrl_int64()
2466 get_ctrl(ctrl, &c); in v4l2_ctrl_g_ctrl_int64()
2487 struct v4l2_ctrl *ctrl = master->cluster[i]; in try_or_set_cluster() local
2489 if (ctrl == NULL) in try_or_set_cluster()
2492 if (!ctrl->is_new) { in try_or_set_cluster()
2493 cur_to_new(ctrl); in try_or_set_cluster()
2498 if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)) in try_or_set_cluster()
2528 struct v4l2_ctrl *ctrl = helpers[i].ctrl; in validate_ctrls() local
2532 if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY) in validate_ctrls()
2540 if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)) in validate_ctrls()
2542 ret = validate_new(ctrl, &cs->controls[i]); in validate_ctrls()
2601 master = helpers[i].mref->ctrl; in try_set_ext_ctrls()
2624 if (helpers[tmp_idx].ctrl == master) in try_set_ext_ctrls()
2637 ret = user_to_new(cs->controls + idx, helpers[idx].ctrl); in try_set_ext_ctrls()
2649 helpers[idx].ctrl); in try_set_ext_ctrls()
2687 static int set_ctrl(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, in set_ctrl() argument
2690 struct v4l2_ctrl *master = ctrl->cluster[0]; in set_ctrl()
2697 if (ctrl->type == V4L2_CTRL_TYPE_STRING) in set_ctrl()
2708 if (master->is_auto && master->has_volatiles && ctrl == master && in set_ctrl()
2712 user_to_new(c, ctrl); in set_ctrl()
2717 static int set_ctrl_lock(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, in set_ctrl_lock() argument
2720 int ret = validate_new(ctrl, c); in set_ctrl_lock()
2723 v4l2_ctrl_lock(ctrl); in set_ctrl_lock()
2724 ret = set_ctrl(fh, ctrl, c, 0); in set_ctrl_lock()
2726 cur_to_user(c, ctrl); in set_ctrl_lock()
2727 v4l2_ctrl_unlock(ctrl); in set_ctrl_lock()
2735 struct v4l2_ctrl *ctrl = v4l2_ctrl_find(hdl, control->id); in v4l2_s_ctrl() local
2739 if (ctrl == NULL || !type_is_int(ctrl)) in v4l2_s_ctrl()
2742 if (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY) in v4l2_s_ctrl()
2746 ret = set_ctrl_lock(fh, ctrl, &c); in v4l2_s_ctrl()
2758 int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val) in v4l2_ctrl_s_ctrl() argument
2763 WARN_ON(!type_is_int(ctrl)); in v4l2_ctrl_s_ctrl()
2765 return set_ctrl_lock(NULL, ctrl, &c); in v4l2_ctrl_s_ctrl()
2769 int v4l2_ctrl_s_ctrl_int64(struct v4l2_ctrl *ctrl, s64 val) in v4l2_ctrl_s_ctrl_int64() argument
2774 WARN_ON(ctrl->type != V4L2_CTRL_TYPE_INTEGER64); in v4l2_ctrl_s_ctrl_int64()
2776 return set_ctrl_lock(NULL, ctrl, &c); in v4l2_ctrl_s_ctrl_int64()
2780 void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv) in v4l2_ctrl_notify() argument
2782 if (ctrl == NULL) in v4l2_ctrl_notify()
2785 ctrl->call_notify = 0; in v4l2_ctrl_notify()
2788 if (WARN_ON(ctrl->handler->notify && ctrl->handler->notify != notify)) in v4l2_ctrl_notify()
2790 ctrl->handler->notify = notify; in v4l2_ctrl_notify()
2791 ctrl->handler->notify_priv = priv; in v4l2_ctrl_notify()
2792 ctrl->call_notify = 1; in v4l2_ctrl_notify()
2796 int v4l2_ctrl_modify_range(struct v4l2_ctrl *ctrl, in v4l2_ctrl_modify_range() argument
2799 int ret = check_range(ctrl->type, min, max, step, def); in v4l2_ctrl_modify_range()
2802 switch (ctrl->type) { in v4l2_ctrl_modify_range()
2814 v4l2_ctrl_lock(ctrl); in v4l2_ctrl_modify_range()
2815 ctrl->minimum = min; in v4l2_ctrl_modify_range()
2816 ctrl->maximum = max; in v4l2_ctrl_modify_range()
2817 ctrl->step = step; in v4l2_ctrl_modify_range()
2818 ctrl->default_value = def; in v4l2_ctrl_modify_range()
2819 c.value = ctrl->cur.val; in v4l2_ctrl_modify_range()
2820 if (validate_new(ctrl, &c)) in v4l2_ctrl_modify_range()
2822 if (c.value != ctrl->cur.val) in v4l2_ctrl_modify_range()
2823 ret = set_ctrl(NULL, ctrl, &c, V4L2_EVENT_CTRL_CH_RANGE); in v4l2_ctrl_modify_range()
2825 send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_RANGE); in v4l2_ctrl_modify_range()
2826 v4l2_ctrl_unlock(ctrl); in v4l2_ctrl_modify_range()
2833 struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev->fh->ctrl_handler, sev->id); in v4l2_ctrl_add_event() local
2835 if (ctrl == NULL) in v4l2_ctrl_add_event()
2838 v4l2_ctrl_lock(ctrl); in v4l2_ctrl_add_event()
2839 list_add_tail(&sev->node, &ctrl->ev_subs); in v4l2_ctrl_add_event()
2840 if (ctrl->type != V4L2_CTRL_TYPE_CTRL_CLASS && in v4l2_ctrl_add_event()
2845 if (!(ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)) in v4l2_ctrl_add_event()
2847 fill_event(&ev, ctrl, changes); in v4l2_ctrl_add_event()
2853 v4l2_ctrl_unlock(ctrl); in v4l2_ctrl_add_event()
2859 struct v4l2_ctrl *ctrl = v4l2_ctrl_find(sev->fh->ctrl_handler, sev->id); in v4l2_ctrl_del_event() local
2861 v4l2_ctrl_lock(ctrl); in v4l2_ctrl_del_event()
2863 v4l2_ctrl_unlock(ctrl); in v4l2_ctrl_del_event()
2868 u32 old_changes = old->u.ctrl.changes; in v4l2_ctrl_replace()
2870 old->u.ctrl = new->u.ctrl; in v4l2_ctrl_replace()
2871 old->u.ctrl.changes |= old_changes; in v4l2_ctrl_replace()
2877 new->u.ctrl.changes |= old->u.ctrl.changes; in v4l2_ctrl_merge()