media: imx: imx-mipi-csis: Set the subdev fwnode for endpoint matching

Endpoint matching is preferred over device matching with the async
notifier framework. Set the fwnode in the v4l2_subdev for the CSIS to
the endpoint connected to the next device.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Laurent Pinchart 2022-03-21 07:58:14 +00:00 committed by Mauro Carvalho Chehab
parent ca24fef0f2
commit 0edd95f25e

View File

@ -1378,6 +1378,13 @@ static int mipi_csis_subdev_init(struct mipi_csis_device *csis)
sd->dev = csis->dev;
sd->fwnode = fwnode_graph_get_endpoint_by_id(dev_fwnode(csis->dev),
1, 0, 0);
if (!sd->fwnode) {
dev_err(csis->dev, "Unable to retrieve endpoint for port@1\n");
return -ENOENT;
}
csis->csis_fmt = &mipi_csis_formats[0];
mipi_csis_init_cfg(sd, NULL);
@ -1498,6 +1505,7 @@ static int mipi_csis_probe(struct platform_device *pdev)
v4l2_async_unregister_subdev(&csis->sd);
disable_clock:
mipi_csis_clk_disable(csis);
fwnode_handle_put(csis->sd.fwnode);
mutex_destroy(&csis->lock);
return ret;
@ -1517,6 +1525,7 @@ static int mipi_csis_remove(struct platform_device *pdev)
mipi_csis_runtime_suspend(&pdev->dev);
mipi_csis_clk_disable(csis);
media_entity_cleanup(&csis->sd.entity);
fwnode_handle_put(csis->sd.fwnode);
mutex_destroy(&csis->lock);
pm_runtime_set_suspended(&pdev->dev);