Lines Matching full:chain
886 static struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, in uvc_find_control() argument
899 list_for_each_entry(entity, &chain->entities, chain) { in uvc_find_control()
906 uvc_dbg(chain->dev, CONTROL, "Control 0x%08x not found\n", in uvc_find_control()
912 static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain, in uvc_ctrl_populate_cache() argument
918 ret = uvc_query_ctrl(chain->dev, UVC_GET_DEF, ctrl->entity->id, in uvc_ctrl_populate_cache()
919 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
927 ret = uvc_query_ctrl(chain->dev, UVC_GET_MIN, ctrl->entity->id, in uvc_ctrl_populate_cache()
928 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
935 ret = uvc_query_ctrl(chain->dev, UVC_GET_MAX, ctrl->entity->id, in uvc_ctrl_populate_cache()
936 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
943 ret = uvc_query_ctrl(chain->dev, UVC_GET_RES, ctrl->entity->id, in uvc_ctrl_populate_cache()
944 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
957 uvc_warn_once(chain->dev, UVC_WARN_XU_GET_RES, in uvc_ctrl_populate_cache()
989 static int __uvc_ctrl_load_cur(struct uvc_video_chain *chain, in __uvc_ctrl_load_cur() argument
1008 ret = ctrl->entity->get_cur(chain->dev, ctrl->entity, in __uvc_ctrl_load_cur()
1012 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, in __uvc_ctrl_load_cur()
1013 ctrl->entity->id, chain->dev->intfnum, in __uvc_ctrl_load_cur()
1025 static int __uvc_ctrl_get(struct uvc_video_chain *chain, in __uvc_ctrl_get() argument
1035 ret = __uvc_ctrl_load_cur(chain, ctrl); in __uvc_ctrl_get()
1045 static int __uvc_query_v4l2_class(struct uvc_video_chain *chain, u32 req_id, in __uvc_query_v4l2_class() argument
1054 if (!(chain->ctrl_class_bitmap & BIT(i))) in __uvc_query_v4l2_class()
1069 static int uvc_query_v4l2_class(struct uvc_video_chain *chain, u32 req_id, in uvc_query_v4l2_class() argument
1074 idx = __uvc_query_v4l2_class(chain, req_id, found_id); in uvc_query_v4l2_class()
1088 int uvc_ctrl_is_accessible(struct uvc_video_chain *chain, u32 v4l2_id, in uvc_ctrl_is_accessible() argument
1094 if (__uvc_query_v4l2_class(chain, v4l2_id, 0) >= 0) in uvc_ctrl_is_accessible()
1097 ctrl = uvc_find_control(chain, v4l2_id, &mapping); in uvc_ctrl_is_accessible()
1124 static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, in __uvc_query_v4l2_ctrl() argument
1151 int ret = __uvc_ctrl_get(chain, master_ctrl, master_map, &val); in __uvc_query_v4l2_ctrl()
1160 int ret = uvc_ctrl_populate_cache(chain, ctrl); in __uvc_query_v4l2_ctrl()
1217 int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, in uvc_query_v4l2_ctrl() argument
1224 ret = mutex_lock_interruptible(&chain->ctrl_mutex); in uvc_query_v4l2_ctrl()
1230 ret = uvc_query_v4l2_class(chain, v4l2_ctrl->id, 0, v4l2_ctrl); in uvc_query_v4l2_ctrl()
1235 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); in uvc_query_v4l2_ctrl()
1247 ret = uvc_query_v4l2_class(chain, v4l2_ctrl->id, mapping->id, in uvc_query_v4l2_ctrl()
1253 ret = __uvc_query_v4l2_ctrl(chain, ctrl, mapping, v4l2_ctrl); in uvc_query_v4l2_ctrl()
1255 mutex_unlock(&chain->ctrl_mutex); in uvc_query_v4l2_ctrl()
1268 int uvc_query_v4l2_menu(struct uvc_video_chain *chain, in uvc_query_v4l2_menu() argument
1282 ret = mutex_lock_interruptible(&chain->ctrl_mutex); in uvc_query_v4l2_menu()
1286 ctrl = uvc_find_control(chain, query_menu->id, &mapping); in uvc_query_v4l2_menu()
1304 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_query_v4l2_menu()
1320 mutex_unlock(&chain->ctrl_mutex); in uvc_query_v4l2_menu()
1328 static void uvc_ctrl_fill_event(struct uvc_video_chain *chain, in uvc_ctrl_fill_event() argument
1336 __uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl); in uvc_ctrl_fill_event()
1358 static void uvc_ctrl_send_event(struct uvc_video_chain *chain, in uvc_ctrl_send_event() argument
1369 uvc_ctrl_fill_event(chain, &ev, ctrl, mapping, value, changes); in uvc_ctrl_send_event()
1384 static void uvc_ctrl_send_slave_event(struct uvc_video_chain *chain, in uvc_ctrl_send_slave_event() argument
1396 if (__uvc_ctrl_get(chain, ctrl, mapping, &val) == 0) in uvc_ctrl_send_slave_event()
1399 uvc_ctrl_send_event(chain, handle, ctrl, mapping, val, changes); in uvc_ctrl_send_slave_event()
1402 void uvc_ctrl_status_event(struct uvc_video_chain *chain, in uvc_ctrl_status_event() argument
1409 mutex_lock(&chain->ctrl_mutex); in uvc_ctrl_status_event()
1425 uvc_ctrl_send_slave_event(chain, handle, ctrl, in uvc_ctrl_status_event()
1429 uvc_ctrl_send_event(chain, handle, ctrl, mapping, value, in uvc_ctrl_status_event()
1433 mutex_unlock(&chain->ctrl_mutex); in uvc_ctrl_status_event()
1443 uvc_ctrl_status_event(w->chain, w->ctrl, w->data); in uvc_ctrl_status_event_work()
1453 bool uvc_ctrl_status_event_async(struct urb *urb, struct uvc_video_chain *chain, in uvc_ctrl_status_event_async() argument
1456 struct uvc_device *dev = chain->dev; in uvc_ctrl_status_event_async()
1466 w->chain = chain; in uvc_ctrl_status_event_async()
1497 ctrl = uvc_find_control(handle->chain, xctrls[i].id, &mapping); in uvc_ctrl_send_events()
1517 uvc_ctrl_send_slave_event(handle->chain, handle, ctrl, in uvc_ctrl_send_events()
1530 uvc_ctrl_send_event(handle->chain, handle, ctrl, mapping, in uvc_ctrl_send_events()
1542 ret = mutex_lock_interruptible(&handle->chain->ctrl_mutex); in uvc_ctrl_add_event()
1546 if (__uvc_query_v4l2_class(handle->chain, sev->id, 0) >= 0) { in uvc_ctrl_add_event()
1551 ctrl = uvc_find_control(handle->chain, sev->id, &mapping); in uvc_ctrl_add_event()
1563 if (__uvc_ctrl_get(handle->chain, ctrl, mapping, &val) == 0) in uvc_ctrl_add_event()
1566 uvc_ctrl_fill_event(handle->chain, &ev, ctrl, mapping, val, in uvc_ctrl_add_event()
1577 mutex_unlock(&handle->chain->ctrl_mutex); in uvc_ctrl_add_event()
1585 mutex_lock(&handle->chain->ctrl_mutex); in uvc_ctrl_del_event()
1586 if (__uvc_query_v4l2_class(handle->chain, sev->id, 0) >= 0) in uvc_ctrl_del_event()
1590 mutex_unlock(&handle->chain->ctrl_mutex); in uvc_ctrl_del_event()
1624 int uvc_ctrl_begin(struct uvc_video_chain *chain) in uvc_ctrl_begin() argument
1626 return mutex_lock_interruptible(&chain->ctrl_mutex) ? -ERESTARTSYS : 0; in uvc_ctrl_begin()
1707 struct uvc_video_chain *chain = handle->chain; in __uvc_ctrl_commit() local
1713 list_for_each_entry(entity, &chain->entities, chain) { in __uvc_ctrl_commit()
1714 ret = uvc_ctrl_commit_entity(chain->dev, entity, rollback, in __uvc_ctrl_commit()
1726 mutex_unlock(&chain->ctrl_mutex); in __uvc_ctrl_commit()
1730 int uvc_ctrl_get(struct uvc_video_chain *chain, in uvc_ctrl_get() argument
1736 if (__uvc_query_v4l2_class(chain, xctrl->id, 0) >= 0) in uvc_ctrl_get()
1739 ctrl = uvc_find_control(chain, xctrl->id, &mapping); in uvc_ctrl_get()
1743 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); in uvc_ctrl_get()
1749 struct uvc_video_chain *chain = handle->chain; in uvc_ctrl_set() local
1758 if (__uvc_query_v4l2_class(chain, xctrl->id, 0) >= 0) in uvc_ctrl_set()
1761 ctrl = uvc_find_control(chain, xctrl->id, &mapping); in uvc_ctrl_set()
1771 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
1811 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
1835 ret = __uvc_ctrl_load_cur(chain, ctrl); in uvc_ctrl_set()
2015 int uvc_xu_ctrl_query(struct uvc_video_chain *chain, in uvc_xu_ctrl_query() argument
2029 list_for_each_entry(entity, &chain->entities, chain) { in uvc_xu_ctrl_query()
2038 uvc_dbg(chain->dev, CONTROL, "Extension unit %u not found\n", in uvc_xu_ctrl_query()
2054 uvc_dbg(chain->dev, CONTROL, "Control %pUl/%u not found\n", in uvc_xu_ctrl_query()
2059 if (mutex_lock_interruptible(&chain->ctrl_mutex)) in uvc_xu_ctrl_query()
2062 ret = uvc_ctrl_init_xu_ctrl(chain->dev, ctrl); in uvc_xu_ctrl_query()
2124 ret = uvc_query_ctrl(chain->dev, xqry->query, xqry->unit, in uvc_xu_ctrl_query()
2125 chain->dev->intfnum, xqry->selector, data, size); in uvc_xu_ctrl_query()
2134 mutex_unlock(&chain->ctrl_mutex); in uvc_xu_ctrl_query()
2213 static int __uvc_ctrl_add_mapping(struct uvc_video_chain *chain, in __uvc_ctrl_add_mapping() argument
2256 chain->ctrl_class_bitmap |= BIT(i); in __uvc_ctrl_add_mapping()
2262 uvc_dbg(chain->dev, CONTROL, "Adding mapping '%s' to control %pUl/%u\n", in __uvc_ctrl_add_mapping()
2269 int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, in uvc_ctrl_add_mapping() argument
2272 struct uvc_device *dev = chain->dev; in uvc_ctrl_add_mapping()
2286 /* Search for the matching (GUID/CS) control on the current chain */ in uvc_ctrl_add_mapping()
2287 list_for_each_entry(entity, &chain->entities, chain) { in uvc_ctrl_add_mapping()
2308 if (mutex_lock_interruptible(&chain->ctrl_mutex)) in uvc_ctrl_add_mapping()
2345 ret = __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_add_mapping()
2350 mutex_unlock(&chain->ctrl_mutex); in uvc_ctrl_add_mapping()
2421 static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain, in uvc_ctrl_init_ctrl() argument
2442 uvc_ctrl_add_info(chain->dev, ctrl, info); in uvc_ctrl_init_ctrl()
2449 uvc_ctrl_get_flags(chain->dev, ctrl, &ctrl->info); in uvc_ctrl_init_ctrl()
2464 if (chain->dev->info->mappings) { in uvc_ctrl_init_ctrl()
2467 for (i = 0; chain->dev->info->mappings[i]; ++i) { in uvc_ctrl_init_ctrl()
2469 chain->dev->info->mappings[i]; in uvc_ctrl_init_ctrl()
2473 __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_init_ctrl()
2488 __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_init_ctrl()
2492 if (chain->dev->uvc_version < 0x0150) { in uvc_ctrl_init_ctrl()
2505 __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_init_ctrl()
2512 static int uvc_ctrl_init_chain(struct uvc_video_chain *chain) in uvc_ctrl_init_chain() argument
2518 list_for_each_entry(entity, &chain->entities, chain) { in uvc_ctrl_init_chain()
2538 uvc_ctrl_prune_entity(chain->dev, entity); in uvc_ctrl_init_chain()
2560 uvc_ctrl_init_ctrl(chain, ctrl); in uvc_ctrl_init_chain()
2570 struct uvc_video_chain *chain; in uvc_ctrl_init_device() local
2575 list_for_each_entry(chain, &dev->chains, list) { in uvc_ctrl_init_device()
2576 ret = uvc_ctrl_init_chain(chain); in uvc_ctrl_init_device()