diff mbox series

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

Message ID 20240220-v6-8-topic-rk3568-vicap-v1-9-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
Some variants of the Rockchip CIF require the General Register File
for video input block control.

Signed-off-by: Michael Riesch <michael.riesch@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 mbox series

Patch

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));