diff mbox series

[06/14] media: rockchip: cif: store endpoint information in private data

Message ID 20240220-v6-8-topic-rk3568-vicap-v1-6-2680a1fa640b@wolfvision.net (mailing list archive)
State New, archived
Headers show
Series media: rockchip: cif: add support for rk3568 vicap | expand

Commit Message

Michael Riesch Feb. 20, 2024, 9:39 a.m. UTC
The endpoint information such as bus width or flags are required
to set CIF (and on certain variants GRF) registers correctly. Store
the information in the private data of the driver in order to make
it accessible.

Signed-off-by: Michael Riesch <michael.riesch@wolfvision.net>
---
 drivers/media/platform/rockchip/cif/cif-common.h |  1 +
 drivers/media/platform/rockchip/cif/cif-dev.c    | 11 +++++------
 2 files changed, 6 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/media/platform/rockchip/cif/cif-common.h b/drivers/media/platform/rockchip/cif/cif-common.h
index 89ed9dd6f36d..34da800a0504 100644
--- a/drivers/media/platform/rockchip/cif/cif-common.h
+++ b/drivers/media/platform/rockchip/cif/cif-common.h
@@ -108,6 +108,7 @@  struct cif_device {
 	struct media_device		media_dev;
 	struct v4l2_async_notifier	notifier;
 	struct v4l2_async_connection	asd;
+	struct v4l2_fwnode_endpoint	vep;
 	struct cif_remote		remote;
 
 	struct cif_stream		stream;
diff --git a/drivers/media/platform/rockchip/cif/cif-dev.c b/drivers/media/platform/rockchip/cif/cif-dev.c
index 660e28397916..923831827be4 100644
--- a/drivers/media/platform/rockchip/cif/cif-dev.c
+++ b/drivers/media/platform/rockchip/cif/cif-dev.c
@@ -79,9 +79,7 @@  static int cif_subdev_notifier(struct cif_device *cif_dev)
 	struct v4l2_async_notifier *ntf = &cif_dev->notifier;
 	struct device *dev = cif_dev->dev;
 	struct v4l2_async_connection *asd;
-	struct v4l2_fwnode_endpoint vep = {
-		.bus_type = V4L2_MBUS_UNKNOWN,
-	};
+	struct v4l2_fwnode_endpoint *vep = &cif_dev->vep;
 	struct fwnode_handle *ep;
 	int ret;
 
@@ -92,12 +90,13 @@  static int cif_subdev_notifier(struct cif_device *cif_dev)
 	if (!ep)
 		return -ENODEV;
 
-	ret = v4l2_fwnode_endpoint_parse(ep, &vep);
+	vep->bus_type = V4L2_MBUS_UNKNOWN;
+	ret = v4l2_fwnode_endpoint_parse(ep, vep);
 	if (ret)
 		goto complete;
 
-	if (vep.bus_type != V4L2_MBUS_BT656 &&
-	    vep.bus_type != V4L2_MBUS_PARALLEL) {
+	if (vep->bus_type != V4L2_MBUS_BT656 &&
+	    vep->bus_type != V4L2_MBUS_PARALLEL) {
 		v4l2_err(&cif_dev->v4l2_dev, "unsupported bus type\n");
 		goto complete;
 	}