]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
v4l: xilinx: vipp: Support entity matching on DT subnodes
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 3 Apr 2019 20:01:39 +0000 (13:01 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Fri, 5 Apr 2019 11:03:47 +0000 (13:03 +0200)
When the video IP pipeline is parsed in DT, the composite device stores
all entities found in the graph, along with their corresponding DT node.
Later on the DT nodes pointers are used to locate the corresponding V4L2
subdevs by matching them against subdev->dev->of_node.

This mechanism works fine for devices that register a single subdev. For
devices that register multiple subdevs, subdev->dev->of_node points to
the DT node of the device, while the entities parsed from the pipeline
point to child nodes of the device DT node.

The v4l2_subdev structure has a fwnode field that is set to point to the
fwnode corresponding to the device DT node. Drivers that register
multiple subdevs must set the fwnode field manually to the associated
child node of the device DT node. We can thus fix this issue by locating
V4L2 subdevs for an entity based on the subdev fwnode instead of the
dev->of_node.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hyun Kwon <hyun.kwon@xilinx.com>
drivers/media/platform/xilinx/xilinx-vipp.c

index 83241713f2068cc388d04ac9a95e6a8462524b47..7daa846ad729f2c92cad82dcd62d1b5352737ff3 100644 (file)
@@ -213,7 +213,7 @@ bool xvip_subdev_set_streaming(struct xvip_composite_device *xdev,
        struct xvip_graph_entity *entity;
 
        list_for_each_entry(entity, &xdev->entities, list)
-               if (entity->node == subdev->dev->of_node) {
+               if (of_fwnode_handle(entity->node) == subdev->fwnode) {
                        bool status = entity->streaming;
 
                        entity->streaming = enable;
@@ -362,7 +362,7 @@ static int xvip_graph_notify_bound(struct v4l2_async_notifier *notifier,
         * subdev pointer.
         */
        list_for_each_entry(entity, &xdev->entities, list) {
-               if (entity->node != subdev->dev->of_node)
+               if (of_fwnode_handle(entity->node) != subdev->fwnode)
                        continue;
 
                if (entity->subdev) {