Lines Matching full:chain
499 struct uvc_video_chain *chain, struct uvc_control *ctrl) in uvc_ctrl_filter_plf_mapping() argument
512 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, ctrl->entity->id, in uvc_ctrl_filter_plf_mapping()
513 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_filter_plf_mapping()
522 ret = uvc_query_ctrl(chain->dev, UVC_SET_CUR, ctrl->entity->id, in uvc_ctrl_filter_plf_mapping()
523 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_filter_plf_mapping()
529 if (chain->dev->uvc_version < 0x150) in uvc_ctrl_filter_plf_mapping()
534 ret = uvc_query_ctrl(chain->dev, UVC_SET_CUR, ctrl->entity->id, in uvc_ctrl_filter_plf_mapping()
535 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_filter_plf_mapping()
543 uvc_query_ctrl(chain->dev, UVC_SET_CUR, ctrl->entity->id, in uvc_ctrl_filter_plf_mapping()
544 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_filter_plf_mapping()
980 static struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, in uvc_find_control() argument
993 list_for_each_entry(entity, &chain->entities, chain) { in uvc_find_control()
1000 uvc_dbg(chain->dev, CONTROL, "Control 0x%08x not found\n", in uvc_find_control()
1006 static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain, in uvc_ctrl_populate_cache() argument
1012 ret = uvc_query_ctrl(chain->dev, UVC_GET_DEF, ctrl->entity->id, in uvc_ctrl_populate_cache()
1013 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
1021 ret = uvc_query_ctrl(chain->dev, UVC_GET_MIN, ctrl->entity->id, in uvc_ctrl_populate_cache()
1022 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
1029 ret = uvc_query_ctrl(chain->dev, UVC_GET_MAX, ctrl->entity->id, in uvc_ctrl_populate_cache()
1030 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
1037 ret = uvc_query_ctrl(chain->dev, UVC_GET_RES, ctrl->entity->id, in uvc_ctrl_populate_cache()
1038 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
1051 uvc_warn_once(chain->dev, UVC_WARN_XU_GET_RES, in uvc_ctrl_populate_cache()
1089 static int __uvc_ctrl_load_cur(struct uvc_video_chain *chain, in __uvc_ctrl_load_cur() argument
1108 ret = ctrl->entity->get_cur(chain->dev, ctrl->entity, in __uvc_ctrl_load_cur()
1112 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, in __uvc_ctrl_load_cur()
1113 ctrl->entity->id, chain->dev->intfnum, in __uvc_ctrl_load_cur()
1125 static int __uvc_ctrl_get(struct uvc_video_chain *chain, in __uvc_ctrl_get() argument
1135 ret = __uvc_ctrl_load_cur(chain, ctrl); in __uvc_ctrl_get()
1145 static int __uvc_query_v4l2_class(struct uvc_video_chain *chain, u32 req_id, in __uvc_query_v4l2_class() argument
1154 if (!(chain->ctrl_class_bitmap & BIT(i))) in __uvc_query_v4l2_class()
1169 static int uvc_query_v4l2_class(struct uvc_video_chain *chain, u32 req_id, in uvc_query_v4l2_class() argument
1174 idx = __uvc_query_v4l2_class(chain, req_id, found_id); in uvc_query_v4l2_class()
1198 int uvc_ctrl_is_accessible(struct uvc_video_chain *chain, u32 v4l2_id, in uvc_ctrl_is_accessible() argument
1211 if (__uvc_query_v4l2_class(chain, v4l2_id, 0) >= 0) in uvc_ctrl_is_accessible()
1214 ctrl = uvc_find_control(chain, v4l2_id, &mapping); in uvc_ctrl_is_accessible()
1243 ret = __uvc_ctrl_get(chain, master_ctrl, master_map, &val); in uvc_ctrl_is_accessible()
1283 static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, in __uvc_query_v4l2_ctrl() argument
1309 int ret = __uvc_ctrl_get(chain, master_ctrl, master_map, &val); in __uvc_query_v4l2_ctrl()
1318 int ret = uvc_ctrl_populate_cache(chain, ctrl); in __uvc_query_v4l2_ctrl()
1387 int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, in uvc_query_v4l2_ctrl() argument
1394 ret = mutex_lock_interruptible(&chain->ctrl_mutex); in uvc_query_v4l2_ctrl()
1400 ret = uvc_query_v4l2_class(chain, v4l2_ctrl->id, 0, v4l2_ctrl); in uvc_query_v4l2_ctrl()
1405 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); in uvc_query_v4l2_ctrl()
1417 ret = uvc_query_v4l2_class(chain, v4l2_ctrl->id, mapping->id, in uvc_query_v4l2_ctrl()
1423 ret = __uvc_query_v4l2_ctrl(chain, ctrl, mapping, v4l2_ctrl); in uvc_query_v4l2_ctrl()
1425 mutex_unlock(&chain->ctrl_mutex); in uvc_query_v4l2_ctrl()
1438 int uvc_query_v4l2_menu(struct uvc_video_chain *chain, in uvc_query_v4l2_menu() argument
1455 ret = mutex_lock_interruptible(&chain->ctrl_mutex); in uvc_query_v4l2_menu()
1459 ctrl = uvc_find_control(chain, query_menu->id, &mapping); in uvc_query_v4l2_menu()
1474 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_query_v4l2_menu()
1500 mutex_unlock(&chain->ctrl_mutex); in uvc_query_v4l2_menu()
1508 static void uvc_ctrl_fill_event(struct uvc_video_chain *chain, in uvc_ctrl_fill_event() argument
1516 __uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl); in uvc_ctrl_fill_event()
1538 static void uvc_ctrl_send_event(struct uvc_video_chain *chain, in uvc_ctrl_send_event() argument
1549 uvc_ctrl_fill_event(chain, &ev, ctrl, mapping, value, changes); in uvc_ctrl_send_event()
1564 static void uvc_ctrl_send_slave_event(struct uvc_video_chain *chain, in uvc_ctrl_send_slave_event() argument
1576 if (__uvc_ctrl_get(chain, ctrl, mapping, &val) == 0) in uvc_ctrl_send_slave_event()
1579 uvc_ctrl_send_event(chain, handle, ctrl, mapping, val, changes); in uvc_ctrl_send_slave_event()
1582 void uvc_ctrl_status_event(struct uvc_video_chain *chain, in uvc_ctrl_status_event() argument
1589 mutex_lock(&chain->ctrl_mutex); in uvc_ctrl_status_event()
1605 uvc_ctrl_send_slave_event(chain, handle, ctrl, in uvc_ctrl_status_event()
1609 uvc_ctrl_send_event(chain, handle, ctrl, mapping, value, in uvc_ctrl_status_event()
1613 mutex_unlock(&chain->ctrl_mutex); in uvc_ctrl_status_event()
1623 uvc_ctrl_status_event(w->chain, w->ctrl, w->data); in uvc_ctrl_status_event_work()
1637 bool uvc_ctrl_status_event_async(struct urb *urb, struct uvc_video_chain *chain, in uvc_ctrl_status_event_async() argument
1640 struct uvc_device *dev = chain->dev; in uvc_ctrl_status_event_async()
1650 w->chain = chain; in uvc_ctrl_status_event_async()
1681 ctrl = uvc_find_control(handle->chain, xctrls[i].id, &mapping); in uvc_ctrl_send_events()
1701 uvc_ctrl_send_slave_event(handle->chain, handle, ctrl, in uvc_ctrl_send_events()
1714 uvc_ctrl_send_event(handle->chain, handle, ctrl, mapping, in uvc_ctrl_send_events()
1726 ret = mutex_lock_interruptible(&handle->chain->ctrl_mutex); in uvc_ctrl_add_event()
1730 if (__uvc_query_v4l2_class(handle->chain, sev->id, 0) >= 0) { in uvc_ctrl_add_event()
1735 ctrl = uvc_find_control(handle->chain, sev->id, &mapping); in uvc_ctrl_add_event()
1747 if (__uvc_ctrl_get(handle->chain, ctrl, mapping, &val) == 0) in uvc_ctrl_add_event()
1750 uvc_ctrl_fill_event(handle->chain, &ev, ctrl, mapping, val, in uvc_ctrl_add_event()
1761 mutex_unlock(&handle->chain->ctrl_mutex); in uvc_ctrl_add_event()
1769 mutex_lock(&handle->chain->ctrl_mutex); in uvc_ctrl_del_event()
1770 if (__uvc_query_v4l2_class(handle->chain, sev->id, 0) >= 0) in uvc_ctrl_del_event()
1774 mutex_unlock(&handle->chain->ctrl_mutex); in uvc_ctrl_del_event()
1808 int uvc_ctrl_begin(struct uvc_video_chain *chain) in uvc_ctrl_begin() argument
1810 return mutex_lock_interruptible(&chain->ctrl_mutex) ? -ERESTARTSYS : 0; in uvc_ctrl_begin()
1891 struct uvc_video_chain *chain = handle->chain; in __uvc_ctrl_commit() local
1897 list_for_each_entry(entity, &chain->entities, chain) { in __uvc_ctrl_commit()
1898 ret = uvc_ctrl_commit_entity(chain->dev, entity, rollback, in __uvc_ctrl_commit()
1912 mutex_unlock(&chain->ctrl_mutex); in __uvc_ctrl_commit()
1916 int uvc_ctrl_get(struct uvc_video_chain *chain, in uvc_ctrl_get() argument
1922 if (__uvc_query_v4l2_class(chain, xctrl->id, 0) >= 0) in uvc_ctrl_get()
1925 ctrl = uvc_find_control(chain, xctrl->id, &mapping); in uvc_ctrl_get()
1929 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); in uvc_ctrl_get()
1935 struct uvc_video_chain *chain = handle->chain; in uvc_ctrl_set() local
1944 if (__uvc_query_v4l2_class(chain, xctrl->id, 0) >= 0) in uvc_ctrl_set()
1947 ctrl = uvc_find_control(chain, xctrl->id, &mapping); in uvc_ctrl_set()
1957 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
1982 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
2012 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
2034 ret = __uvc_ctrl_load_cur(chain, ctrl); in uvc_ctrl_set()
2221 int uvc_xu_ctrl_query(struct uvc_video_chain *chain, in uvc_xu_ctrl_query() argument
2235 list_for_each_entry(iter, &chain->entities, chain) { in uvc_xu_ctrl_query()
2244 uvc_dbg(chain->dev, CONTROL, "Extension unit %u not found\n", in uvc_xu_ctrl_query()
2260 uvc_dbg(chain->dev, CONTROL, "Control %pUl/%u not found\n", in uvc_xu_ctrl_query()
2265 if (mutex_lock_interruptible(&chain->ctrl_mutex)) in uvc_xu_ctrl_query()
2268 ret = uvc_ctrl_init_xu_ctrl(chain->dev, ctrl); in uvc_xu_ctrl_query()
2330 ret = uvc_query_ctrl(chain->dev, xqry->query, xqry->unit, in uvc_xu_ctrl_query()
2331 chain->dev->intfnum, xqry->selector, data, size); in uvc_xu_ctrl_query()
2340 mutex_unlock(&chain->ctrl_mutex); in uvc_xu_ctrl_query()
2419 static int __uvc_ctrl_add_mapping(struct uvc_video_chain *chain, in __uvc_ctrl_add_mapping() argument
2473 chain->ctrl_class_bitmap |= BIT(i); in __uvc_ctrl_add_mapping()
2479 uvc_dbg(chain->dev, CONTROL, "Adding mapping '%s' to control %pUl/%u\n", in __uvc_ctrl_add_mapping()
2493 int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, in uvc_ctrl_add_mapping() argument
2496 struct uvc_device *dev = chain->dev; in uvc_ctrl_add_mapping()
2510 /* Search for the matching (GUID/CS) control on the current chain */ in uvc_ctrl_add_mapping()
2511 list_for_each_entry(entity, &chain->entities, chain) { in uvc_ctrl_add_mapping()
2532 if (mutex_lock_interruptible(&chain->ctrl_mutex)) in uvc_ctrl_add_mapping()
2569 ret = __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_add_mapping()
2574 mutex_unlock(&chain->ctrl_mutex); in uvc_ctrl_add_mapping()
2645 static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain, in uvc_ctrl_init_ctrl() argument
2664 uvc_ctrl_add_info(chain->dev, ctrl, info); in uvc_ctrl_init_ctrl()
2671 uvc_ctrl_get_flags(chain->dev, ctrl, &ctrl->info); in uvc_ctrl_init_ctrl()
2689 mapping = mapping->filter_mapping(chain, ctrl); in uvc_ctrl_init_ctrl()
2694 __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_init_ctrl()
2701 static int uvc_ctrl_init_chain(struct uvc_video_chain *chain) in uvc_ctrl_init_chain() argument
2707 list_for_each_entry(entity, &chain->entities, chain) { in uvc_ctrl_init_chain()
2727 uvc_ctrl_prune_entity(chain->dev, entity); in uvc_ctrl_init_chain()
2749 uvc_ctrl_init_ctrl(chain, ctrl); in uvc_ctrl_init_chain()
2759 struct uvc_video_chain *chain; in uvc_ctrl_init_device() local
2764 list_for_each_entry(chain, &dev->chains, list) { in uvc_ctrl_init_device()
2765 ret = uvc_ctrl_init_chain(chain); in uvc_ctrl_init_device()