提交 4ca052b4 编写于 作者: L Laurent Pinchart 提交者: Mauro Carvalho Chehab

media: uvcvideo: Support devices that report an OT as an entity source

Some devices reference an output terminal as the source of extension
units. This is incorrect, as output terminals only have an input pin,
and thus can't be connected to any entity in the forward direction. The
resulting topology would cause issues when registering the media
controller graph. To avoid this problem, connect the extension unit to
the source of the output terminal instead.

While at it, and while no device has been reported to be affected by
this issue, also handle forward scans where two output terminals would
be connected together, and skip the terminals found through such an
invalid connection.
Reported-and-tested-by: NJohn Nealy <jnealy3@yahoo.com>
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: NHans de Goede <hdegoede@redhat.com>
Signed-off-by: NMauro Carvalho Chehab <mchehab+huawei@kernel.org>
上级 32934486
...@@ -1716,6 +1716,31 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, ...@@ -1716,6 +1716,31 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain,
return -EINVAL; return -EINVAL;
} }
/*
* Some devices reference an output terminal as the
* source of extension units. This is incorrect, as
* output terminals only have an input pin, and thus
* can't be connected to any entity in the forward
* direction. The resulting topology would cause issues
* when registering the media controller graph. To
* avoid this problem, connect the extension unit to
* the source of the output terminal instead.
*/
if (UVC_ENTITY_IS_OTERM(entity)) {
struct uvc_entity *source;
source = uvc_entity_by_id(chain->dev,
entity->baSourceID[0]);
if (!source) {
uvc_dbg(chain->dev, DESCR,
"Can't connect extension unit %u in chain\n",
forward->id);
break;
}
forward->baSourceID[0] = source->id;
}
list_add_tail(&forward->chain, &chain->entities); list_add_tail(&forward->chain, &chain->entities);
if (!found) if (!found)
uvc_dbg_cont(PROBE, " (->"); uvc_dbg_cont(PROBE, " (->");
...@@ -1735,6 +1760,13 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain, ...@@ -1735,6 +1760,13 @@ static int uvc_scan_chain_forward(struct uvc_video_chain *chain,
return -EINVAL; return -EINVAL;
} }
if (UVC_ENTITY_IS_OTERM(entity)) {
uvc_dbg(chain->dev, DESCR,
"Unsupported connection between output terminals %u and %u\n",
entity->id, forward->id);
break;
}
list_add_tail(&forward->chain, &chain->entities); list_add_tail(&forward->chain, &chain->entities);
if (!found) if (!found)
uvc_dbg_cont(PROBE, " (->"); uvc_dbg_cont(PROBE, " (->");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册