Lines Matching defs:chain
1224 struct uvc_video_chain *chain;
1232 /* GPIO entities are always on the first chain. */
1233 chain = list_first_entry(&dev->chains, struct uvc_video_chain, list);
1234 uvc_ctrl_status_event(chain, unit->controls, &new_val);
1321 * Scan the UVC descriptors to locate a chain starting at an Output Terminal
1343 * Extension Units connected to the main chain as single-unit branches are
1346 static int uvc_scan_chain_entity(struct uvc_video_chain *chain,
1354 uvc_dbg(chain->dev, DESCR,
1365 if (chain->processing != NULL) {
1366 uvc_dbg(chain->dev, DESCR,
1367 "Found multiple Processing Units in chain\n");
1371 chain->processing = entity;
1381 if (chain->selector != NULL) {
1382 uvc_dbg(chain->dev, DESCR,
1383 "Found multiple Selector Units in chain\n");
1387 chain->selector = entity;
1413 uvc_dbg(chain->dev, DESCR,
1414 "Unsupported entity type 0x%04x found in chain\n",
1419 list_add_tail(&entity->chain, &chain->entities);
1423 static int uvc_scan_chain_forward(struct uvc_video_chain *chain,
1434 forward = uvc_entity_by_reference(chain->dev, entity->id,
1440 if (forward->chain.next || forward->chain.prev) {
1441 uvc_dbg(chain->dev, DESCR,
1442 "Found reference to entity %d already in chain\n",
1450 uvc_dbg(chain->dev, DESCR,
1469 source = uvc_entity_by_id(chain->dev,
1472 uvc_dbg(chain->dev, DESCR,
1473 "Can't connect extension unit %u in chain\n",
1481 list_add_tail(&forward->chain, &chain->entities);
1494 uvc_dbg(chain->dev, DESCR,
1501 uvc_dbg(chain->dev, DESCR,
1507 list_add_tail(&forward->chain, &chain->entities);
1522 static int uvc_scan_chain_backward(struct uvc_video_chain *chain,
1544 chain->selector = entity;
1547 term = uvc_entity_by_id(chain->dev, id);
1549 uvc_dbg(chain->dev, DESCR,
1555 if (term->chain.next || term->chain.prev) {
1556 uvc_dbg(chain->dev, DESCR,
1557 "Found reference to entity %d already in chain\n",
1564 list_add_tail(&term->chain, &chain->entities);
1565 uvc_scan_chain_forward(chain, term, entity);
1589 entity = uvc_entity_by_id(chain->dev, id);
1591 uvc_dbg(chain->dev, DESCR,
1600 static int uvc_scan_chain(struct uvc_video_chain *chain,
1605 uvc_dbg(chain->dev, PROBE, "Scanning UVC chain:");
1611 /* Entity must not be part of an existing chain */
1612 if (entity->chain.next || entity->chain.prev) {
1613 uvc_dbg(chain->dev, DESCR,
1614 "Found reference to entity %d already in chain\n",
1620 if (uvc_scan_chain_entity(chain, entity) < 0)
1624 if (uvc_scan_chain_forward(chain, entity, prev) < 0)
1629 if (uvc_scan_chain_backward(chain, &entity) < 0)
1643 list_for_each_entry(term, terms, chain) {
1660 static const char *uvc_print_chain(struct uvc_video_chain *chain)
1665 p += uvc_print_terms(&chain->entities, UVC_TERM_INPUT, p);
1667 uvc_print_terms(&chain->entities, UVC_TERM_OUTPUT, p);
1674 struct uvc_video_chain *chain;
1676 chain = kzalloc(sizeof(*chain), GFP_KERNEL);
1677 if (chain == NULL)
1680 INIT_LIST_HEAD(&chain->entities);
1681 mutex_init(&chain->ctrl_mutex);
1682 chain->dev = dev;
1683 v4l2_prio_init(&chain->prio);
1685 return chain;
1690 * valid chain.
1694 * in the most sensible chain we can think of, turns out they do work anyway.
1695 * Note: This heuristic assumes there is a single chain.
1697 * At the time of writing, devices known to have such a broken chain are
1703 struct uvc_video_chain *chain;
1730 /* Allocate the chain and fill it. */
1731 chain = uvc_alloc_chain(dev);
1732 if (chain == NULL)
1735 if (uvc_scan_chain_entity(chain, oterm) < 0)
1743 * UVC descriptor order as we build the chain from output to input. This
1755 if (uvc_scan_chain_entity(chain, entity) < 0)
1762 if (uvc_scan_chain_entity(chain, iterm) < 0)
1767 list_add_tail(&chain->list, &dev->chains);
1769 uvc_dbg(dev, PROBE, "Found a video chain by fallback heuristic (%s)\n",
1770 uvc_print_chain(chain));
1775 kfree(chain);
1786 struct uvc_video_chain *chain;
1794 * If the terminal is already included in a chain, skip it.
1797 * will be inserted in the chain in forward scans.
1799 if (term->chain.next || term->chain.prev)
1802 chain = uvc_alloc_chain(dev);
1803 if (chain == NULL)
1808 if (uvc_scan_chain(chain, term) < 0) {
1809 kfree(chain);
1813 uvc_dbg(dev, PROBE, "Found a valid video chain (%s)\n",
1814 uvc_print_chain(chain));
1816 list_add_tail(&chain->list, &dev->chains);
1823 dev_info(&dev->udev->dev, "No valid video chain found.\n");
1827 /* Add GPIO entity to the first chain. */
1829 chain = list_first_entry(&dev->chains,
1831 list_add_tail(&dev->gpio_unit->chain, &chain->entities);
1867 struct uvc_video_chain *chain;
1869 chain = list_entry(p, struct uvc_video_chain, list);
1870 kfree(chain);
1956 vdev->prio = &stream->chain->prio;
2009 stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE
2012 stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT;
2026 struct uvc_video_chain *chain)
2032 list_for_each_entry(term, &chain->entities, chain) {
2044 stream->chain = chain;
2063 struct uvc_video_chain *chain;
2066 list_for_each_entry(chain, &dev->chains, list) {
2067 ret = uvc_register_terms(dev, chain);
2072 ret = uvc_mc_register_entities(chain);