Lines Matching full:chain
933 static struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, in uvc_find_control() argument
946 list_for_each_entry(entity, &chain->entities, chain) { in uvc_find_control()
953 uvc_dbg(chain->dev, CONTROL, "Control 0x%08x not found\n", in uvc_find_control()
959 static int uvc_ctrl_populate_cache(struct uvc_video_chain *chain, in uvc_ctrl_populate_cache() argument
965 ret = uvc_query_ctrl(chain->dev, UVC_GET_DEF, ctrl->entity->id, in uvc_ctrl_populate_cache()
966 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
974 ret = uvc_query_ctrl(chain->dev, UVC_GET_MIN, ctrl->entity->id, in uvc_ctrl_populate_cache()
975 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
982 ret = uvc_query_ctrl(chain->dev, UVC_GET_MAX, ctrl->entity->id, in uvc_ctrl_populate_cache()
983 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
990 ret = uvc_query_ctrl(chain->dev, UVC_GET_RES, ctrl->entity->id, in uvc_ctrl_populate_cache()
991 chain->dev->intfnum, ctrl->info.selector, in uvc_ctrl_populate_cache()
1004 uvc_warn_once(chain->dev, UVC_WARN_XU_GET_RES, in uvc_ctrl_populate_cache()
1042 static int __uvc_ctrl_load_cur(struct uvc_video_chain *chain, in __uvc_ctrl_load_cur() argument
1061 ret = ctrl->entity->get_cur(chain->dev, ctrl->entity, in __uvc_ctrl_load_cur()
1065 ret = uvc_query_ctrl(chain->dev, UVC_GET_CUR, in __uvc_ctrl_load_cur()
1066 ctrl->entity->id, chain->dev->intfnum, in __uvc_ctrl_load_cur()
1078 static int __uvc_ctrl_get(struct uvc_video_chain *chain, in __uvc_ctrl_get() argument
1088 ret = __uvc_ctrl_load_cur(chain, ctrl); in __uvc_ctrl_get()
1098 static int __uvc_query_v4l2_class(struct uvc_video_chain *chain, u32 req_id, in __uvc_query_v4l2_class() argument
1107 if (!(chain->ctrl_class_bitmap & BIT(i))) in __uvc_query_v4l2_class()
1122 static int uvc_query_v4l2_class(struct uvc_video_chain *chain, u32 req_id, in uvc_query_v4l2_class() argument
1127 idx = __uvc_query_v4l2_class(chain, req_id, found_id); in uvc_query_v4l2_class()
1151 int uvc_ctrl_is_accessible(struct uvc_video_chain *chain, u32 v4l2_id, in uvc_ctrl_is_accessible() argument
1164 if (__uvc_query_v4l2_class(chain, v4l2_id, 0) >= 0) in uvc_ctrl_is_accessible()
1167 ctrl = uvc_find_control(chain, v4l2_id, &mapping); in uvc_ctrl_is_accessible()
1196 ret = __uvc_ctrl_get(chain, master_ctrl, master_map, &val); in uvc_ctrl_is_accessible()
1236 static int __uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, in __uvc_query_v4l2_ctrl() argument
1262 int ret = __uvc_ctrl_get(chain, master_ctrl, master_map, &val); in __uvc_query_v4l2_ctrl()
1271 int ret = uvc_ctrl_populate_cache(chain, ctrl); in __uvc_query_v4l2_ctrl()
1340 int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, in uvc_query_v4l2_ctrl() argument
1347 ret = mutex_lock_interruptible(&chain->ctrl_mutex); in uvc_query_v4l2_ctrl()
1353 ret = uvc_query_v4l2_class(chain, v4l2_ctrl->id, 0, v4l2_ctrl); in uvc_query_v4l2_ctrl()
1358 ctrl = uvc_find_control(chain, v4l2_ctrl->id, &mapping); in uvc_query_v4l2_ctrl()
1370 ret = uvc_query_v4l2_class(chain, v4l2_ctrl->id, mapping->id, in uvc_query_v4l2_ctrl()
1376 ret = __uvc_query_v4l2_ctrl(chain, ctrl, mapping, v4l2_ctrl); in uvc_query_v4l2_ctrl()
1378 mutex_unlock(&chain->ctrl_mutex); in uvc_query_v4l2_ctrl()
1391 int uvc_query_v4l2_menu(struct uvc_video_chain *chain, in uvc_query_v4l2_menu() argument
1408 ret = mutex_lock_interruptible(&chain->ctrl_mutex); in uvc_query_v4l2_menu()
1412 ctrl = uvc_find_control(chain, query_menu->id, &mapping); in uvc_query_v4l2_menu()
1427 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_query_v4l2_menu()
1453 mutex_unlock(&chain->ctrl_mutex); in uvc_query_v4l2_menu()
1461 static void uvc_ctrl_fill_event(struct uvc_video_chain *chain, in uvc_ctrl_fill_event() argument
1469 __uvc_query_v4l2_ctrl(chain, ctrl, mapping, &v4l2_ctrl); in uvc_ctrl_fill_event()
1491 static void uvc_ctrl_send_event(struct uvc_video_chain *chain, in uvc_ctrl_send_event() argument
1502 uvc_ctrl_fill_event(chain, &ev, ctrl, mapping, value, changes); in uvc_ctrl_send_event()
1517 static void uvc_ctrl_send_slave_event(struct uvc_video_chain *chain, in uvc_ctrl_send_slave_event() argument
1529 if (__uvc_ctrl_get(chain, ctrl, mapping, &val) == 0) in uvc_ctrl_send_slave_event()
1532 uvc_ctrl_send_event(chain, handle, ctrl, mapping, val, changes); in uvc_ctrl_send_slave_event()
1535 void uvc_ctrl_status_event(struct uvc_video_chain *chain, in uvc_ctrl_status_event() argument
1542 mutex_lock(&chain->ctrl_mutex); in uvc_ctrl_status_event()
1558 uvc_ctrl_send_slave_event(chain, handle, ctrl, in uvc_ctrl_status_event()
1562 uvc_ctrl_send_event(chain, handle, ctrl, mapping, value, in uvc_ctrl_status_event()
1566 mutex_unlock(&chain->ctrl_mutex); in uvc_ctrl_status_event()
1576 uvc_ctrl_status_event(w->chain, w->ctrl, w->data); in uvc_ctrl_status_event_work()
1590 bool uvc_ctrl_status_event_async(struct urb *urb, struct uvc_video_chain *chain, in uvc_ctrl_status_event_async() argument
1593 struct uvc_device *dev = chain->dev; in uvc_ctrl_status_event_async()
1603 w->chain = chain; in uvc_ctrl_status_event_async()
1634 ctrl = uvc_find_control(handle->chain, xctrls[i].id, &mapping); in uvc_ctrl_send_events()
1654 uvc_ctrl_send_slave_event(handle->chain, handle, ctrl, in uvc_ctrl_send_events()
1667 uvc_ctrl_send_event(handle->chain, handle, ctrl, mapping, in uvc_ctrl_send_events()
1679 ret = mutex_lock_interruptible(&handle->chain->ctrl_mutex); in uvc_ctrl_add_event()
1683 if (__uvc_query_v4l2_class(handle->chain, sev->id, 0) >= 0) { in uvc_ctrl_add_event()
1688 ctrl = uvc_find_control(handle->chain, sev->id, &mapping); in uvc_ctrl_add_event()
1700 if (__uvc_ctrl_get(handle->chain, ctrl, mapping, &val) == 0) in uvc_ctrl_add_event()
1703 uvc_ctrl_fill_event(handle->chain, &ev, ctrl, mapping, val, in uvc_ctrl_add_event()
1714 mutex_unlock(&handle->chain->ctrl_mutex); in uvc_ctrl_add_event()
1722 mutex_lock(&handle->chain->ctrl_mutex); in uvc_ctrl_del_event()
1723 if (__uvc_query_v4l2_class(handle->chain, sev->id, 0) >= 0) in uvc_ctrl_del_event()
1727 mutex_unlock(&handle->chain->ctrl_mutex); in uvc_ctrl_del_event()
1761 int uvc_ctrl_begin(struct uvc_video_chain *chain) in uvc_ctrl_begin() argument
1763 return mutex_lock_interruptible(&chain->ctrl_mutex) ? -ERESTARTSYS : 0; in uvc_ctrl_begin()
1844 struct uvc_video_chain *chain = handle->chain; in __uvc_ctrl_commit() local
1850 list_for_each_entry(entity, &chain->entities, chain) { in __uvc_ctrl_commit()
1851 ret = uvc_ctrl_commit_entity(chain->dev, entity, rollback, in __uvc_ctrl_commit()
1863 mutex_unlock(&chain->ctrl_mutex); in __uvc_ctrl_commit()
1867 int uvc_ctrl_get(struct uvc_video_chain *chain, in uvc_ctrl_get() argument
1873 if (__uvc_query_v4l2_class(chain, xctrl->id, 0) >= 0) in uvc_ctrl_get()
1876 ctrl = uvc_find_control(chain, xctrl->id, &mapping); in uvc_ctrl_get()
1880 return __uvc_ctrl_get(chain, ctrl, mapping, &xctrl->value); in uvc_ctrl_get()
1886 struct uvc_video_chain *chain = handle->chain; in uvc_ctrl_set() local
1895 if (__uvc_query_v4l2_class(chain, xctrl->id, 0) >= 0) in uvc_ctrl_set()
1898 ctrl = uvc_find_control(chain, xctrl->id, &mapping); in uvc_ctrl_set()
1908 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
1933 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
1963 ret = uvc_ctrl_populate_cache(chain, ctrl); in uvc_ctrl_set()
1985 ret = __uvc_ctrl_load_cur(chain, ctrl); in uvc_ctrl_set()
2165 int uvc_xu_ctrl_query(struct uvc_video_chain *chain, in uvc_xu_ctrl_query() argument
2179 list_for_each_entry(entity, &chain->entities, chain) { in uvc_xu_ctrl_query()
2188 uvc_dbg(chain->dev, CONTROL, "Extension unit %u not found\n", in uvc_xu_ctrl_query()
2204 uvc_dbg(chain->dev, CONTROL, "Control %pUl/%u not found\n", in uvc_xu_ctrl_query()
2209 if (mutex_lock_interruptible(&chain->ctrl_mutex)) in uvc_xu_ctrl_query()
2212 ret = uvc_ctrl_init_xu_ctrl(chain->dev, ctrl); in uvc_xu_ctrl_query()
2274 ret = uvc_query_ctrl(chain->dev, xqry->query, xqry->unit, in uvc_xu_ctrl_query()
2275 chain->dev->intfnum, xqry->selector, data, size); in uvc_xu_ctrl_query()
2284 mutex_unlock(&chain->ctrl_mutex); in uvc_xu_ctrl_query()
2363 static int __uvc_ctrl_add_mapping(struct uvc_video_chain *chain, in __uvc_ctrl_add_mapping() argument
2417 chain->ctrl_class_bitmap |= BIT(i); in __uvc_ctrl_add_mapping()
2423 uvc_dbg(chain->dev, CONTROL, "Adding mapping '%s' to control %pUl/%u\n", in __uvc_ctrl_add_mapping()
2437 int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, in uvc_ctrl_add_mapping() argument
2440 struct uvc_device *dev = chain->dev; in uvc_ctrl_add_mapping()
2454 /* Search for the matching (GUID/CS) control on the current chain */ in uvc_ctrl_add_mapping()
2455 list_for_each_entry(entity, &chain->entities, chain) { in uvc_ctrl_add_mapping()
2476 if (mutex_lock_interruptible(&chain->ctrl_mutex)) in uvc_ctrl_add_mapping()
2513 ret = __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_add_mapping()
2518 mutex_unlock(&chain->ctrl_mutex); in uvc_ctrl_add_mapping()
2589 static void uvc_ctrl_init_ctrl(struct uvc_video_chain *chain, in uvc_ctrl_init_ctrl() argument
2609 uvc_ctrl_add_info(chain->dev, ctrl, info); in uvc_ctrl_init_ctrl()
2616 uvc_ctrl_get_flags(chain->dev, ctrl, &ctrl->info); in uvc_ctrl_init_ctrl()
2631 if (chain->dev->info->mappings) { in uvc_ctrl_init_ctrl()
2634 for (i = 0; chain->dev->info->mappings[i]; ++i) { in uvc_ctrl_init_ctrl()
2636 chain->dev->info->mappings[i]; in uvc_ctrl_init_ctrl()
2640 __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_init_ctrl()
2655 __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_init_ctrl()
2659 mappings = chain->dev->uvc_version < 0x0150 in uvc_ctrl_init_ctrl()
2667 __uvc_ctrl_add_mapping(chain, ctrl, mapping); in uvc_ctrl_init_ctrl()
2674 static int uvc_ctrl_init_chain(struct uvc_video_chain *chain) in uvc_ctrl_init_chain() argument
2680 list_for_each_entry(entity, &chain->entities, chain) { in uvc_ctrl_init_chain()
2700 uvc_ctrl_prune_entity(chain->dev, entity); in uvc_ctrl_init_chain()
2722 uvc_ctrl_init_ctrl(chain, ctrl); in uvc_ctrl_init_chain()
2732 struct uvc_video_chain *chain; in uvc_ctrl_init_device() local
2737 list_for_each_entry(chain, &dev->chains, list) { in uvc_ctrl_init_device()
2738 ret = uvc_ctrl_init_chain(chain); in uvc_ctrl_init_device()