Lines Matching defs:chain
1441 * Scan the UVC descriptors to locate a chain starting at an Output Terminal
1463 * Extension Units connected to the main chain as single-unit branches are
1466 static int uvc_scan_chain_entity(struct uvc_video_chain *chain,
1486 if (chain->processing != NULL) {
1488 "Processing Units in chain.\n");
1492 chain->processing = entity;
1503 if (chain->selector != NULL) {
1505 "Units in chain.\n");
1509 chain->selector = entity;
1541 "0x%04x found in chain.\n", UVC_ENTITY_TYPE(entity));
1545 list_add_tail(&entity->chain, &chain->entities);
1549 static int uvc_scan_chain_forward(struct uvc_video_chain *chain,
1560 forward = uvc_entity_by_reference(chain->dev, entity->id,
1566 if (forward->chain.next || forward->chain.prev) {
1568 "entity %d already in chain.\n", forward->id);
1594 source = uvc_entity_by_id(chain->dev,
1598 "Can't connect extension unit %u in chain\n",
1606 list_add_tail(&forward->chain, &chain->entities);
1633 list_add_tail(&forward->chain, &chain->entities);
1650 static int uvc_scan_chain_backward(struct uvc_video_chain *chain,
1673 chain->selector = entity;
1676 term = uvc_entity_by_id(chain->dev, id);
1684 if (term->chain.next || term->chain.prev) {
1686 "entity %d already in chain.\n",
1694 list_add_tail(&term->chain, &chain->entities);
1695 uvc_scan_chain_forward(chain, term, entity);
1720 entity = uvc_entity_by_id(chain->dev, id);
1731 static int uvc_scan_chain(struct uvc_video_chain *chain,
1736 uvc_trace(UVC_TRACE_PROBE, "Scanning UVC chain:");
1742 /* Entity must not be part of an existing chain */
1743 if (entity->chain.next || entity->chain.prev) {
1745 "entity %d already in chain.\n", entity->id);
1750 if (uvc_scan_chain_entity(chain, entity) < 0)
1754 if (uvc_scan_chain_forward(chain, entity, prev) < 0)
1759 if (uvc_scan_chain_backward(chain, &entity) < 0)
1773 list_for_each_entry(term, terms, chain) {
1790 static const char *uvc_print_chain(struct uvc_video_chain *chain)
1795 p += uvc_print_terms(&chain->entities, UVC_TERM_INPUT, p);
1797 uvc_print_terms(&chain->entities, UVC_TERM_OUTPUT, p);
1804 struct uvc_video_chain *chain;
1806 chain = kzalloc(sizeof(*chain), GFP_KERNEL);
1807 if (chain == NULL)
1810 INIT_LIST_HEAD(&chain->entities);
1811 mutex_init(&chain->ctrl_mutex);
1812 chain->dev = dev;
1813 v4l2_prio_init(&chain->prio);
1815 return chain;
1820 * valid chain.
1824 * in the most sensible chain we can think of, turns out they do work anyway.
1825 * Note: This heuristic assumes there is a single chain.
1827 * At the time of writing, devices known to have such a broken chain are
1833 struct uvc_video_chain *chain;
1860 /* Allocate the chain and fill it. */
1861 chain = uvc_alloc_chain(dev);
1862 if (chain == NULL)
1865 if (uvc_scan_chain_entity(chain, oterm) < 0)
1873 * UVC descriptor order as we build the chain from output to input. This
1885 if (uvc_scan_chain_entity(chain, entity) < 0)
1892 if (uvc_scan_chain_entity(chain, iterm) < 0)
1897 list_add_tail(&chain->list, &dev->chains);
1900 "Found a video chain by fallback heuristic (%s).\n",
1901 uvc_print_chain(chain));
1906 kfree(chain);
1917 struct uvc_video_chain *chain;
1924 /* If the terminal is already included in a chain, skip it.
1927 * will be inserted in the chain in forward scans.
1929 if (term->chain.next || term->chain.prev)
1932 chain = uvc_alloc_chain(dev);
1933 if (chain == NULL)
1938 if (uvc_scan_chain(chain, term) < 0) {
1939 kfree(chain);
1943 uvc_trace(UVC_TRACE_PROBE, "Found a valid video chain (%s).\n",
1944 uvc_print_chain(chain));
1946 list_add_tail(&chain->list, &dev->chains);
1953 uvc_printk(KERN_INFO, "No valid video chain found.\n");
1990 struct uvc_video_chain *chain;
1991 chain = list_entry(p, struct uvc_video_chain, list);
1992 kfree(chain);
2076 vdev->prio = &stream->chain->prio;
2128 stream->chain->caps |= V4L2_CAP_VIDEO_CAPTURE
2131 stream->chain->caps |= V4L2_CAP_VIDEO_OUTPUT;
2145 struct uvc_video_chain *chain)
2151 list_for_each_entry(term, &chain->entities, chain) {
2162 stream->chain = chain;
2180 struct uvc_video_chain *chain;
2183 list_for_each_entry(chain, &dev->chains, list) {
2184 ret = uvc_register_terms(dev, chain);
2189 ret = uvc_mc_register_entities(chain);