Lines Matching full:ctrl

19 static void fill_event(struct v4l2_event *ev, struct v4l2_ctrl *ctrl,  in fill_event()  argument
24 ev->id = ctrl->id; in fill_event()
25 ev->u.ctrl.changes = changes; in fill_event()
26 ev->u.ctrl.type = ctrl->type; in fill_event()
27 ev->u.ctrl.flags = user_flags(ctrl); in fill_event()
28 if (ctrl->is_ptr) in fill_event()
29 ev->u.ctrl.value64 = 0; in fill_event()
31 ev->u.ctrl.value64 = *ctrl->p_cur.p_s64; in fill_event()
32 ev->u.ctrl.minimum = ctrl->minimum; in fill_event()
33 ev->u.ctrl.maximum = ctrl->maximum; in fill_event()
34 if (ctrl->type == V4L2_CTRL_TYPE_MENU in fill_event()
35 || ctrl->type == V4L2_CTRL_TYPE_INTEGER_MENU) in fill_event()
36 ev->u.ctrl.step = 1; in fill_event()
38 ev->u.ctrl.step = ctrl->step; in fill_event()
39 ev->u.ctrl.default_value = ctrl->default_value; in fill_event()
42 void send_initial_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl) in send_initial_event() argument
47 if (!(ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)) in send_initial_event()
49 fill_event(&ev, ctrl, changes); in send_initial_event()
53 void send_event(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 changes) in send_event() argument
58 if (list_empty(&ctrl->ev_subs)) in send_event()
60 fill_event(&ev, ctrl, changes); in send_event()
62 list_for_each_entry(sev, &ctrl->ev_subs, node) in send_event()
68 bool v4l2_ctrl_type_op_equal(const struct v4l2_ctrl *ctrl, in v4l2_ctrl_type_op_equal() argument
73 switch (ctrl->type) { in v4l2_ctrl_type_op_equal()
77 for (i = 0; i < ctrl->elems; i++) { in v4l2_ctrl_type_op_equal()
78 unsigned int idx = i * ctrl->elem_size; in v4l2_ctrl_type_op_equal()
87 ctrl->elems * ctrl->elem_size); in v4l2_ctrl_type_op_equal()
104 static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx, in std_init_compound() argument
115 void *p = ptr.p + idx * ctrl->elem_size; in std_init_compound()
117 if (ctrl->p_def.p_const) in std_init_compound()
118 memcpy(p, ctrl->p_def.p_const, ctrl->elem_size); in std_init_compound()
120 memset(p, 0, ctrl->elem_size); in std_init_compound()
122 switch ((u32)ctrl->type) { in std_init_compound()
185 void v4l2_ctrl_type_op_init(const struct v4l2_ctrl *ctrl, u32 from_idx, in v4l2_ctrl_type_op_init() argument
189 u32 tot_elems = ctrl->elems; in v4l2_ctrl_type_op_init()
195 switch (ctrl->type) { in v4l2_ctrl_type_op_init()
198 unsigned int offset = i * ctrl->elem_size; in v4l2_ctrl_type_op_init()
200 memset(ptr.p_char + offset, ' ', ctrl->minimum); in v4l2_ctrl_type_op_init()
201 ptr.p_char[offset + ctrl->minimum] = '\0'; in v4l2_ctrl_type_op_init()
205 if (ctrl->default_value) { in v4l2_ctrl_type_op_init()
207 ptr.p_s64[i] = ctrl->default_value; in v4l2_ctrl_type_op_init()
217 if (ctrl->default_value) { in v4l2_ctrl_type_op_init()
219 ptr.p_s32[i] = ctrl->default_value; in v4l2_ctrl_type_op_init()
229 memset(ptr.p_u8 + from_idx, ctrl->default_value, elems); in v4l2_ctrl_type_op_init()
232 if (ctrl->default_value) { in v4l2_ctrl_type_op_init()
234 ptr.p_u16[i] = ctrl->default_value; in v4l2_ctrl_type_op_init()
240 if (ctrl->default_value) { in v4l2_ctrl_type_op_init()
242 ptr.p_u32[i] = ctrl->default_value; in v4l2_ctrl_type_op_init()
249 std_init_compound(ctrl, i, ptr); in v4l2_ctrl_type_op_init()
255 void v4l2_ctrl_type_op_log(const struct v4l2_ctrl *ctrl) in v4l2_ctrl_type_op_log() argument
257 union v4l2_ctrl_ptr ptr = ctrl->p_cur; in v4l2_ctrl_type_op_log()
259 if (ctrl->is_array) { in v4l2_ctrl_type_op_log()
262 for (i = 0; i < ctrl->nr_of_dims; i++) in v4l2_ctrl_type_op_log()
263 pr_cont("[%u]", ctrl->dims[i]); in v4l2_ctrl_type_op_log()
267 switch (ctrl->type) { in v4l2_ctrl_type_op_log()
275 pr_cont("%s", ctrl->qmenu[*ptr.p_s32]); in v4l2_ctrl_type_op_log()
278 pr_cont("%lld", ctrl->qmenu_int[*ptr.p_s32]); in v4l2_ctrl_type_op_log()
372 pr_cont("unknown type %d", ctrl->type); in v4l2_ctrl_type_op_log()
383 #define ROUND_TO_RANGE(val, offset_type, ctrl) \ argument
386 if ((ctrl)->maximum >= 0 && \
387 val >= (ctrl)->maximum - (s32)((ctrl)->step / 2)) \
388 val = (ctrl)->maximum; \
390 val += (s32)((ctrl)->step / 2); \
392 (ctrl)->minimum, (ctrl)->maximum); \
393 offset = (val) - (ctrl)->minimum; \
394 offset = (ctrl)->step * (offset / (u32)(ctrl)->step); \
395 val = (ctrl)->minimum + offset; \
798 static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, in std_validate_compound() argument
815 void *p = ptr.p + idx * ctrl->elem_size; in std_validate_compound()
818 switch ((u32)ctrl->type) { in std_validate_compound()
1179 static int std_validate_elem(const struct v4l2_ctrl *ctrl, u32 idx, in std_validate_elem() argument
1186 switch ((u32)ctrl->type) { in std_validate_elem()
1188 return ROUND_TO_RANGE(ptr.p_s32[idx], u32, ctrl); in std_validate_elem()
1195 if (ctrl->maximum >= 0 && val >= ctrl->maximum - (s64)(ctrl->step / 2)) in std_validate_elem()
1196 val = ctrl->maximum; in std_validate_elem()
1198 val += (s64)(ctrl->step / 2); in std_validate_elem()
1199 val = clamp_t(s64, val, ctrl->minimum, ctrl->maximum); in std_validate_elem()
1200 offset = val - ctrl->minimum; in std_validate_elem()
1201 do_div(offset, ctrl->step); in std_validate_elem()
1202 ptr.p_s64[idx] = ctrl->minimum + offset * ctrl->step; in std_validate_elem()
1205 return ROUND_TO_RANGE(ptr.p_u8[idx], u8, ctrl); in std_validate_elem()
1207 return ROUND_TO_RANGE(ptr.p_u16[idx], u16, ctrl); in std_validate_elem()
1209 return ROUND_TO_RANGE(ptr.p_u32[idx], u32, ctrl); in std_validate_elem()
1217 if (ptr.p_s32[idx] < ctrl->minimum || ptr.p_s32[idx] > ctrl->maximum) in std_validate_elem()
1220 (ctrl->menu_skip_mask & BIT_ULL(ptr.p_s32[idx]))) in std_validate_elem()
1222 if (ctrl->type == V4L2_CTRL_TYPE_MENU && in std_validate_elem()
1223 ctrl->qmenu[ptr.p_s32[idx]][0] == '\0') in std_validate_elem()
1228 ptr.p_s32[idx] &= ctrl->maximum; in std_validate_elem()
1237 idx *= ctrl->elem_size; in std_validate_elem()
1239 if (len < ctrl->minimum) in std_validate_elem()
1241 if ((len - (u32)ctrl->minimum) % (u32)ctrl->step) in std_validate_elem()
1246 return std_validate_compound(ctrl, idx, ptr); in std_validate_elem()
1250 int v4l2_ctrl_type_op_validate(const struct v4l2_ctrl *ctrl, in v4l2_ctrl_type_op_validate() argument
1256 switch ((u32)ctrl->type) { in v4l2_ctrl_type_op_validate()
1258 if (ctrl->maximum == 0xff && ctrl->minimum == 0 && ctrl->step == 1) in v4l2_ctrl_type_op_validate()
1262 if (ctrl->maximum == 0xffff && ctrl->minimum == 0 && ctrl->step == 1) in v4l2_ctrl_type_op_validate()
1266 if (ctrl->maximum == 0xffffffff && ctrl->minimum == 0 && ctrl->step == 1) in v4l2_ctrl_type_op_validate()
1272 memset(ptr.p_s32, 0, ctrl->new_elems * sizeof(s32)); in v4l2_ctrl_type_op_validate()
1276 for (i = 0; !ret && i < ctrl->new_elems; i++) in v4l2_ctrl_type_op_validate()
1277 ret = std_validate_elem(ctrl, i, ptr); in v4l2_ctrl_type_op_validate()
1289 void v4l2_ctrl_notify(struct v4l2_ctrl *ctrl, v4l2_ctrl_notify_fnc notify, void *priv) in v4l2_ctrl_notify() argument
1291 if (!ctrl) in v4l2_ctrl_notify()
1294 ctrl->call_notify = 0; in v4l2_ctrl_notify()
1297 if (WARN_ON(ctrl->handler->notify && ctrl->handler->notify != notify)) in v4l2_ctrl_notify()
1299 ctrl->handler->notify = notify; in v4l2_ctrl_notify()
1300 ctrl->handler->notify_priv = priv; in v4l2_ctrl_notify()
1301 ctrl->call_notify = 1; in v4l2_ctrl_notify()
1306 static void ptr_to_ptr(struct v4l2_ctrl *ctrl, in ptr_to_ptr() argument
1310 if (ctrl == NULL) in ptr_to_ptr()
1312 memcpy(to.p, from.p_const, elems * ctrl->elem_size); in ptr_to_ptr()
1316 void new_to_cur(struct v4l2_fh *fh, struct v4l2_ctrl *ctrl, u32 ch_flags) in new_to_cur() argument
1320 if (ctrl == NULL) in new_to_cur()
1324 changed = ctrl->has_changed; in new_to_cur()
1326 if (ctrl->is_dyn_array) in new_to_cur()
1327 ctrl->elems = ctrl->new_elems; in new_to_cur()
1328 ptr_to_ptr(ctrl, ctrl->p_new, ctrl->p_cur, ctrl->elems); in new_to_cur()
1333 ctrl->flags &= in new_to_cur()
1335 if (!is_cur_manual(ctrl->cluster[0])) { in new_to_cur()
1336 ctrl->flags |= V4L2_CTRL_FLAG_INACTIVE; in new_to_cur()
1337 if (ctrl->cluster[0]->has_volatiles) in new_to_cur()
1338 ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; in new_to_cur()
1345 if (!ctrl->is_new) in new_to_cur()
1347 send_event(fh, ctrl, in new_to_cur()
1349 if (ctrl->call_notify && changed && ctrl->handler->notify) in new_to_cur()
1350 ctrl->handler->notify(ctrl, ctrl->handler->notify_priv); in new_to_cur()
1355 void cur_to_new(struct v4l2_ctrl *ctrl) in cur_to_new() argument
1357 if (ctrl == NULL) in cur_to_new()
1359 if (ctrl->is_dyn_array) in cur_to_new()
1360 ctrl->new_elems = ctrl->elems; in cur_to_new()
1361 ptr_to_ptr(ctrl, ctrl->p_cur, ctrl->p_new, ctrl->new_elems); in cur_to_new()
1370 if (ref->ctrl->is_dyn_array && in req_alloc_array()
1374 tmp = kvmalloc(elems * ref->ctrl->elem_size, GFP_KERNEL); in req_alloc_array()
1390 struct v4l2_ctrl *ctrl; in new_to_req() local
1395 ctrl = ref->ctrl; in new_to_req()
1396 if (ctrl->is_array && !req_alloc_array(ref, ctrl->new_elems)) in new_to_req()
1399 ref->p_req_elems = ctrl->new_elems; in new_to_req()
1400 ptr_to_ptr(ctrl, ctrl->p_new, ref->p_req, ref->p_req_elems); in new_to_req()
1407 struct v4l2_ctrl *ctrl; in cur_to_req() local
1412 ctrl = ref->ctrl; in cur_to_req()
1413 if (ctrl->is_array && !req_alloc_array(ref, ctrl->elems)) in cur_to_req()
1416 ref->p_req_elems = ctrl->elems; in cur_to_req()
1417 ptr_to_ptr(ctrl, ctrl->p_cur, ref->p_req, ctrl->elems); in cur_to_req()
1424 struct v4l2_ctrl *ctrl; in req_to_new() local
1429 ctrl = ref->ctrl; in req_to_new()
1436 if (ctrl->is_dyn_array) in req_to_new()
1437 ctrl->new_elems = ctrl->elems; in req_to_new()
1438 ptr_to_ptr(ctrl, ctrl->p_cur, ctrl->p_new, ctrl->new_elems); in req_to_new()
1443 if (!ctrl->is_array) { in req_to_new()
1444 ptr_to_ptr(ctrl, ref->p_req, ctrl->p_new, ctrl->new_elems); in req_to_new()
1452 if (!ctrl->is_dyn_array && in req_to_new()
1453 ref->p_req_elems != ctrl->p_array_alloc_elems) in req_to_new()
1458 * elements in ctrl->p_array. If so, attempt to realloc ctrl->p_array. in req_to_new()
1463 if (ref->p_req_elems > ctrl->p_array_alloc_elems) { in req_to_new()
1464 unsigned int sz = ref->p_req_elems * ctrl->elem_size; in req_to_new()
1465 void *old = ctrl->p_array; in req_to_new()
1470 memcpy(tmp, ctrl->p_new.p, ctrl->elems * ctrl->elem_size); in req_to_new()
1471 memcpy(tmp + sz, ctrl->p_cur.p, ctrl->elems * ctrl->elem_size); in req_to_new()
1472 ctrl->p_new.p = tmp; in req_to_new()
1473 ctrl->p_cur.p = tmp + sz; in req_to_new()
1474 ctrl->p_array = tmp; in req_to_new()
1475 ctrl->p_array_alloc_elems = ref->p_req_elems; in req_to_new()
1479 ctrl->new_elems = ref->p_req_elems; in req_to_new()
1480 ptr_to_ptr(ctrl, ref->p_req, ctrl->p_new, ctrl->new_elems); in req_to_new()
1554 struct v4l2_ctrl *ctrl, *next_ctrl; in v4l2_ctrl_handler_free() local
1571 list_for_each_entry_safe(ctrl, next_ctrl, &hdl->ctrls, node) { in v4l2_ctrl_handler_free()
1572 list_del(&ctrl->node); in v4l2_ctrl_handler_free()
1573 list_for_each_entry_safe(sev, next_sev, &ctrl->ev_subs, node) in v4l2_ctrl_handler_free()
1575 kvfree(ctrl->p_array); in v4l2_ctrl_handler_free()
1576 kvfree(ctrl); in v4l2_ctrl_handler_free()
1602 if (V4L2_CTRL_ID2WHICH(ref->ctrl->id) == V4L2_CTRL_CLASS_USER && in find_private_ref()
1603 V4L2_CTRL_DRIVER_PRIV(ref->ctrl->id)) { in find_private_ref()
1604 if (!ref->ctrl->is_int) in find_private_ref()
1628 if (hdl->cached && hdl->cached->ctrl->id == id) in find_ref()
1633 while (ref && ref->ctrl->id != id) in find_ref()
1659 return ref ? ref->ctrl : NULL; in v4l2_ctrl_find()
1665 struct v4l2_ctrl *ctrl, in handler_new_ref() argument
1671 u32 id = ctrl->id; in handler_new_ref()
1683 if (ctrl->type < V4L2_CTRL_COMPOUND_TYPES && in handler_new_ref()
1691 if (allocate_req && !ctrl->is_array) in handler_new_ref()
1692 size_extra_req = ctrl->elems * ctrl->elem_size; in handler_new_ref()
1696 new_ref->ctrl = ctrl; in handler_new_ref()
1716 if (ref->ctrl->id < id) in handler_new_ref()
1719 if (ref->ctrl->id == id) { in handler_new_ref()
1733 if (ctrl->handler == hdl) { in handler_new_ref()
1735 * new_ref->ctrl is basically a cluster array with one in handler_new_ref()
1739 ctrl->cluster = &new_ref->ctrl; in handler_new_ref()
1740 ctrl->ncontrols = 1; in handler_new_ref()
1759 struct v4l2_ctrl *ctrl; in v4l2_ctrl_new() local
1927 ctrl = kvzalloc(sizeof(*ctrl) + sz_extra, GFP_KERNEL); in v4l2_ctrl_new()
1928 if (ctrl == NULL) { in v4l2_ctrl_new()
1933 INIT_LIST_HEAD(&ctrl->node); in v4l2_ctrl_new()
1934 INIT_LIST_HEAD(&ctrl->ev_subs); in v4l2_ctrl_new()
1935 ctrl->handler = hdl; in v4l2_ctrl_new()
1936 ctrl->ops = ops; in v4l2_ctrl_new()
1937 ctrl->type_ops = type_ops ? type_ops : &std_type_ops; in v4l2_ctrl_new()
1938 ctrl->id = id; in v4l2_ctrl_new()
1939 ctrl->name = name; in v4l2_ctrl_new()
1940 ctrl->type = type; in v4l2_ctrl_new()
1941 ctrl->flags = flags; in v4l2_ctrl_new()
1942 ctrl->minimum = min; in v4l2_ctrl_new()
1943 ctrl->maximum = max; in v4l2_ctrl_new()
1944 ctrl->step = step; in v4l2_ctrl_new()
1945 ctrl->default_value = def; in v4l2_ctrl_new()
1946 ctrl->is_string = !is_array && type == V4L2_CTRL_TYPE_STRING; in v4l2_ctrl_new()
1947 ctrl->is_ptr = is_array || type >= V4L2_CTRL_COMPOUND_TYPES || ctrl->is_string; in v4l2_ctrl_new()
1948 ctrl->is_int = !ctrl->is_ptr && type != V4L2_CTRL_TYPE_INTEGER64; in v4l2_ctrl_new()
1949 ctrl->is_array = is_array; in v4l2_ctrl_new()
1950 ctrl->is_dyn_array = !!(flags & V4L2_CTRL_FLAG_DYNAMIC_ARRAY); in v4l2_ctrl_new()
1951 ctrl->elems = elems; in v4l2_ctrl_new()
1952 ctrl->new_elems = elems; in v4l2_ctrl_new()
1953 ctrl->nr_of_dims = nr_of_dims; in v4l2_ctrl_new()
1955 memcpy(ctrl->dims, dims, nr_of_dims * sizeof(dims[0])); in v4l2_ctrl_new()
1956 ctrl->elem_size = elem_size; in v4l2_ctrl_new()
1958 ctrl->qmenu = qmenu; in v4l2_ctrl_new()
1960 ctrl->qmenu_int = qmenu_int; in v4l2_ctrl_new()
1961 ctrl->priv = priv; in v4l2_ctrl_new()
1962 ctrl->cur.val = ctrl->val = def; in v4l2_ctrl_new()
1963 data = &ctrl[1]; in v4l2_ctrl_new()
1965 if (ctrl->is_array) { in v4l2_ctrl_new()
1966 ctrl->p_array_alloc_elems = elems; in v4l2_ctrl_new()
1967 ctrl->p_array = kvzalloc(2 * elems * elem_size, GFP_KERNEL); in v4l2_ctrl_new()
1968 if (!ctrl->p_array) { in v4l2_ctrl_new()
1969 kvfree(ctrl); in v4l2_ctrl_new()
1972 data = ctrl->p_array; in v4l2_ctrl_new()
1975 if (!ctrl->is_int) { in v4l2_ctrl_new()
1976 ctrl->p_new.p = data; in v4l2_ctrl_new()
1977 ctrl->p_cur.p = data + tot_ctrl_size; in v4l2_ctrl_new()
1979 ctrl->p_new.p = &ctrl->val; in v4l2_ctrl_new()
1980 ctrl->p_cur.p = &ctrl->cur.val; in v4l2_ctrl_new()
1984 if (ctrl->is_array) in v4l2_ctrl_new()
1985 ctrl->p_def.p = &ctrl[1]; in v4l2_ctrl_new()
1987 ctrl->p_def.p = ctrl->p_cur.p + tot_ctrl_size; in v4l2_ctrl_new()
1988 memcpy(ctrl->p_def.p, p_def.p_const, elem_size); in v4l2_ctrl_new()
1991 ctrl->type_ops->init(ctrl, 0, ctrl->p_cur); in v4l2_ctrl_new()
1992 cur_to_new(ctrl); in v4l2_ctrl_new()
1994 if (handler_new_ref(hdl, ctrl, NULL, false, false)) { in v4l2_ctrl_new()
1995 kvfree(ctrl->p_array); in v4l2_ctrl_new()
1996 kvfree(ctrl); in v4l2_ctrl_new()
2000 list_add_tail(&ctrl->node, &hdl->ctrls); in v4l2_ctrl_new()
2002 return ctrl; in v4l2_ctrl_new()
2009 struct v4l2_ctrl *ctrl; in v4l2_ctrl_new_custom() local
2037 ctrl = v4l2_ctrl_new(hdl, cfg->ops, cfg->type_ops, cfg->id, name, in v4l2_ctrl_new_custom()
2042 if (ctrl) in v4l2_ctrl_new_custom()
2043 ctrl->is_private = cfg->is_private; in v4l2_ctrl_new_custom()
2044 return ctrl; in v4l2_ctrl_new_custom()
2184 bool (*filter)(const struct v4l2_ctrl *ctrl), in v4l2_ctrl_add_handler() argument
2197 struct v4l2_ctrl *ctrl = ref->ctrl; in v4l2_ctrl_add_handler() local
2200 if (ctrl->is_private) in v4l2_ctrl_add_handler()
2203 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) in v4l2_ctrl_add_handler()
2206 if (filter && !filter(ctrl)) in v4l2_ctrl_add_handler()
2208 ret = handler_new_ref(hdl, ctrl, NULL, from_other_dev, false); in v4l2_ctrl_add_handler()
2217 bool v4l2_ctrl_radio_filter(const struct v4l2_ctrl *ctrl) in v4l2_ctrl_radio_filter() argument
2219 if (V4L2_CTRL_ID2WHICH(ctrl->id) == V4L2_CTRL_CLASS_FM_TX) in v4l2_ctrl_radio_filter()
2221 if (V4L2_CTRL_ID2WHICH(ctrl->id) == V4L2_CTRL_CLASS_FM_RX) in v4l2_ctrl_radio_filter()
2223 switch (ctrl->id) { in v4l2_ctrl_radio_filter()
2312 struct v4l2_ctrl *ctrl = master->cluster[i]; in cluster_changed() local
2315 if (!ctrl) in cluster_changed()
2318 if (ctrl->flags & V4L2_CTRL_FLAG_EXECUTE_ON_WRITE) { in cluster_changed()
2327 if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) { in cluster_changed()
2328 ctrl->has_changed = false; in cluster_changed()
2332 if (ctrl->elems != ctrl->new_elems) in cluster_changed()
2335 ctrl_changed = !ctrl->type_ops->equal(ctrl, in cluster_changed()
2336 ctrl->p_cur, ctrl->p_new); in cluster_changed()
2337 ctrl->has_changed = ctrl_changed; in cluster_changed()
2338 changed |= ctrl->has_changed; in cluster_changed()
2346 * Must be called with ctrl->handler->lock held.
2362 struct v4l2_ctrl *ctrl = master->cluster[i]; in try_or_set_cluster() local
2364 if (!ctrl) in try_or_set_cluster()
2367 if (!ctrl->is_new) { in try_or_set_cluster()
2368 cur_to_new(ctrl); in try_or_set_cluster()
2375 if (set && (ctrl->flags & V4L2_CTRL_FLAG_GRABBED)) in try_or_set_cluster()
2410 void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active) in v4l2_ctrl_activate() argument
2416 if (ctrl == NULL) in v4l2_ctrl_activate()
2421 old = test_and_set_bit(4, &ctrl->flags); in v4l2_ctrl_activate()
2424 old = test_and_clear_bit(4, &ctrl->flags); in v4l2_ctrl_activate()
2426 send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_FLAGS); in v4l2_ctrl_activate()
2430 void __v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed) in __v4l2_ctrl_grab() argument
2434 if (ctrl == NULL) in __v4l2_ctrl_grab()
2437 lockdep_assert_held(ctrl->handler->lock); in __v4l2_ctrl_grab()
2441 old = test_and_set_bit(1, &ctrl->flags); in __v4l2_ctrl_grab()
2444 old = test_and_clear_bit(1, &ctrl->flags); in __v4l2_ctrl_grab()
2446 send_event(NULL, ctrl, V4L2_EVENT_CTRL_CH_FLAGS); in __v4l2_ctrl_grab()
2453 struct v4l2_ctrl *ctrl; in __v4l2_ctrl_handler_setup() local
2461 list_for_each_entry(ctrl, &hdl->ctrls, node) in __v4l2_ctrl_handler_setup()
2462 ctrl->done = false; in __v4l2_ctrl_handler_setup()
2464 list_for_each_entry(ctrl, &hdl->ctrls, node) { in __v4l2_ctrl_handler_setup()
2465 struct v4l2_ctrl *master = ctrl->cluster[0]; in __v4l2_ctrl_handler_setup()
2470 if (ctrl->done || ctrl->type == V4L2_CTRL_TYPE_BUTTON || in __v4l2_ctrl_handler_setup()
2471 (ctrl->flags & V4L2_CTRL_FLAG_READ_ONLY)) in __v4l2_ctrl_handler_setup()
2506 static void log_ctrl(const struct v4l2_ctrl *ctrl, in log_ctrl() argument
2509 if (ctrl->flags & (V4L2_CTRL_FLAG_DISABLED | V4L2_CTRL_FLAG_WRITE_ONLY)) in log_ctrl()
2511 if (ctrl->type == V4L2_CTRL_TYPE_CTRL_CLASS) in log_ctrl()
2514 pr_info("%s%s%s: ", prefix, colon, ctrl->name); in log_ctrl()
2516 ctrl->type_ops->log(ctrl); in log_ctrl()
2518 if (ctrl->flags & (V4L2_CTRL_FLAG_INACTIVE | in log_ctrl()
2521 if (ctrl->flags & V4L2_CTRL_FLAG_INACTIVE) in log_ctrl()
2523 if (ctrl->flags & V4L2_CTRL_FLAG_GRABBED) in log_ctrl()
2525 if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) in log_ctrl()
2535 struct v4l2_ctrl *ctrl; in v4l2_ctrl_handler_log_status() local
2547 list_for_each_entry(ctrl, &hdl->ctrls, node) in v4l2_ctrl_handler_log_status()
2548 if (!(ctrl->flags & V4L2_CTRL_FLAG_DISABLED)) in v4l2_ctrl_handler_log_status()
2549 log_ctrl(ctrl, prefix, colon); in v4l2_ctrl_handler_log_status()