[PATCH 09/14] media: rockchip: cif: add support for grf

Michael Riesch michael.riesch at wolfvision.net
Tue Feb 20 01:39:19 PST 2024


Some variants of the Rockchip CIF require the General Register File
for video input block control.

Signed-off-by: Michael Riesch <michael.riesch at wolfvision.net>
---
 drivers/media/platform/rockchip/cif/cif-common.h | 3 +++
 drivers/media/platform/rockchip/cif/cif-dev.c    | 7 +++++++
 2 files changed, 10 insertions(+)

diff --git a/drivers/media/platform/rockchip/cif/cif-common.h b/drivers/media/platform/rockchip/cif/cif-common.h
index 34da800a0504..ae8fedeadd1c 100644
--- a/drivers/media/platform/rockchip/cif/cif-common.h
+++ b/drivers/media/platform/rockchip/cif/cif-common.h
@@ -11,6 +11,7 @@
 
 #include <linux/clk.h>
 #include <linux/mutex.h>
+#include <linux/regmap.h>
 
 #include <media/media-device.h>
 #include <media/media-entity.h>
@@ -96,6 +97,7 @@ static inline struct cif_stream *to_cif_stream(struct video_device *vdev)
 struct cif_match_data {
 	struct clk_bulk_data *clks;
 	int clks_num;
+	void (*grf_dvp_setup)(struct cif_device *cif_dev);
 };
 
 struct cif_device {
@@ -103,6 +105,7 @@ struct cif_device {
 	int				irq;
 	void __iomem			*base_addr;
 	struct reset_control		*cif_rst;
+	struct regmap			*grf;
 
 	struct v4l2_device		v4l2_dev;
 	struct media_device		media_dev;
diff --git a/drivers/media/platform/rockchip/cif/cif-dev.c b/drivers/media/platform/rockchip/cif/cif-dev.c
index c4282449a93d..b75b76508793 100644
--- a/drivers/media/platform/rockchip/cif/cif-dev.c
+++ b/drivers/media/platform/rockchip/cif/cif-dev.c
@@ -11,6 +11,7 @@
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_graph.h>
@@ -103,6 +104,9 @@ static int cif_subdev_notifier(struct cif_device *cif_dev)
 		goto complete;
 	}
 
+	if (cif_dev->match_data->grf_dvp_setup)
+		cif_dev->match_data->grf_dvp_setup(cif_dev);
+
 	asd = v4l2_async_nf_add_fwnode_remote(ntf, ep,
 					      struct v4l2_async_connection);
 	if (IS_ERR(asd)) {
@@ -191,6 +195,9 @@ static int cif_plat_probe(struct platform_device *pdev)
 	if (IS_ERR(cif_dev->cif_rst))
 		return PTR_ERR(cif_dev->cif_rst);
 
+	cif_dev->grf = syscon_regmap_lookup_by_phandle(dev->of_node,
+						       "rockchip,grf");
+
 	cif_stream_init(cif_dev);
 	strscpy(cif_dev->media_dev.model, "cif",
 		sizeof(cif_dev->media_dev.model));

-- 
2.30.2




More information about the Linux-rockchip mailing list