diff options
Diffstat (limited to 'drivers/media/platform/mxc/capture/mxc_mipi_csi.c')
-rw-r--r-- | drivers/media/platform/mxc/capture/mxc_mipi_csi.c | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/drivers/media/platform/mxc/capture/mxc_mipi_csi.c b/drivers/media/platform/mxc/capture/mxc_mipi_csi.c index 069a0b9bb961..e489c83adea3 100644 --- a/drivers/media/platform/mxc/capture/mxc_mipi_csi.c +++ b/drivers/media/platform/mxc/capture/mxc_mipi_csi.c @@ -954,9 +954,13 @@ static int mipi_csis_parse_dt(struct platform_device *pdev, &state->max_num_lanes)) return -EINVAL; - node = of_graph_get_next_endpoint(node, NULL); + /* + * Explicitly get endpoint 1 being the sensor one as using overlays may + * reverse node order in the final device tree blob. + */ + node = of_graph_get_endpoint_by_regs(node, 0, 1); if (!node) { - dev_err(&pdev->dev, "No port node at %s\n", + dev_err(&pdev->dev, "No port/endpoint 1 sensor node at %s\n", pdev->dev.of_node->full_name); return -EINVAL; } @@ -988,38 +992,39 @@ static const struct v4l2_async_notifier_operations mxc_mipi_csi_subdev_ops = { static int mipi_csis_subdev_host(struct csi_state *state) { struct device_node *parent = state->dev->of_node; - struct device_node *node, *port, *rem; + struct device_node *node, *rem; int ret; v4l2_async_notifier_init(&state->subdev_notifier); - /* Attach sensors linked to csi receivers */ - for_each_available_child_of_node(parent, node) { - if (of_node_cmp(node->name, "port")) - continue; - - /* The csi node can have only port subnode. */ - port = of_get_next_child(node, NULL); - if (!port) - continue; - rem = of_graph_get_remote_port_parent(port); - of_node_put(port); - if (rem == NULL) { - v4l2_info(&state->v4l2_dev, - "Remote device at %s not found\n", - port->full_name); - return -1; - } - - INIT_LIST_HEAD(&state->asd.list); - state->asd.match_type = V4L2_ASYNC_MATCH_FWNODE; - state->asd.match.fwnode = of_fwnode_handle(rem); - state->async_subdevs[0] = &state->asd; + /* + * Explicitly get endpoint 1 being the sensor one as using overlays may + * reverse node order in the final device tree blob. + */ + node = of_graph_get_endpoint_by_regs(parent, 0, 1); + if (node == NULL) { + v4l2_info(&state->v4l2_dev, + "Port at %s not found\n", + parent->full_name); + return -1; + } - of_node_put(rem); - break; + rem = of_graph_get_remote_port_parent(node); + of_node_put(node); + if (rem == NULL) { + v4l2_info(&state->v4l2_dev, + "Remote device at %s not found\n", + node->full_name); + return -1; } + INIT_LIST_HEAD(&state->asd.list); + state->asd.match_type = V4L2_ASYNC_MATCH_FWNODE; + state->asd.match.fwnode = of_fwnode_handle(rem); + state->async_subdevs[0] = &state->asd; + + of_node_put(rem); + ret = v4l2_async_notifier_add_subdev(&state->subdev_notifier, &state->asd); if (ret) { |