All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Chris Paterson <Chris.Paterson2@renesas.com>,
	Biju Das <biju.das@bp.renesas.com>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: [RFC 20/28] media: vsp1: Add support for the RZ/G2L VSPD
Date: Wed, 12 Jan 2022 17:46:04 +0000	[thread overview]
Message-ID: <20220112174612.10773-21-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20220112174612.10773-1-biju.das.jz@bp.renesas.com>

The RZ/G2L VSPD provides a single VSPD instance. it has the following
sub modules MAU, CTU, RPF, DPR, LUT, BRS, WPF and LIF.

It does not have version register, so added a new compatible string to
match to get the version value. Also the reset is shared with DU
module.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/media/platform/vsp1/vsp1.h      |  1 +
 drivers/media/platform/vsp1/vsp1_drv.c  | 31 ++++++++++++++++++++++++-
 drivers/media/platform/vsp1/vsp1_lif.c  |  7 ++++--
 drivers/media/platform/vsp1/vsp1_regs.h |  1 +
 4 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1.h b/drivers/media/platform/vsp1/vsp1.h
index 37cf33c7e6ca..b137c0233db5 100644
--- a/drivers/media/platform/vsp1/vsp1.h
+++ b/drivers/media/platform/vsp1/vsp1.h
@@ -103,6 +103,7 @@ struct vsp1_device {
 	struct media_entity_operations media_ops;
 
 	struct vsp1_drm *drm;
+	struct reset_control *rstc;
 };
 
 int vsp1_device_get(struct vsp1_device *vsp1);
diff --git a/drivers/media/platform/vsp1/vsp1_drv.c b/drivers/media/platform/vsp1/vsp1_drv.c
index c9044785b903..c00ba65030fd 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -16,6 +16,7 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 #include <linux/videodev2.h>
 
 #include <media/rcar-fcp.h>
@@ -559,6 +560,15 @@ static int vsp1_device_init(struct vsp1_device *vsp1)
  */
 int vsp1_device_get(struct vsp1_device *vsp1)
 {
+	int ret;
+
+	if (vsp1->rstc) {
+		ret = reset_control_deassert(vsp1->rstc);
+		if (ret < 0) {
+			reset_control_assert(vsp1->rstc);
+			return ret;
+		}
+	}
 	return pm_runtime_resume_and_get(vsp1->dev);
 }
 
@@ -571,6 +581,8 @@ int vsp1_device_get(struct vsp1_device *vsp1)
 void vsp1_device_put(struct vsp1_device *vsp1)
 {
 	pm_runtime_put_sync(vsp1->dev);
+	if (vsp1->rstc)
+		reset_control_assert(vsp1->rstc);
 }
 
 /* -----------------------------------------------------------------------------
@@ -787,6 +799,14 @@ static const struct vsp1_device_info vsp1_device_infos[] = {
 		.uif_count = 2,
 		.wpf_count = 1,
 		.num_bru_inputs = 5,
+	}, {
+		.version = VI6_IP_VERSION_MODEL_VSPD_RZG2L,
+		.model = "VSP2-D",
+		.gen = 3,
+		.features = VSP1_HAS_BRS | VSP1_HAS_WPF_VFLIP | VSP1_HAS_EXT_DL,
+		.lif_count = 1,
+		.rpf_count = 2,
+		.wpf_count = 1,
 	},
 };
 
@@ -826,6 +846,13 @@ static int vsp1_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	vsp1->version = (uintptr_t)of_device_get_match_data(&pdev->dev);
+	if (vsp1->version == VI6_IP_VERSION_MODEL_VSPD_RZG2L) {
+		vsp1->rstc = devm_reset_control_get_shared(&pdev->dev, NULL);
+		if (IS_ERR(vsp1->rstc))
+			return PTR_ERR(vsp1->rstc);
+	}
+
 	/* FCP (optional). */
 	fcp_node = of_parse_phandle(pdev->dev.of_node, "renesas,fcp", 0);
 	if (fcp_node) {
@@ -854,7 +881,8 @@ static int vsp1_probe(struct platform_device *pdev)
 	if (ret < 0)
 		goto done;
 
-	vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION);
+	if (vsp1->version != VI6_IP_VERSION_MODEL_VSPD_RZG2L)
+		vsp1->version = vsp1_read(vsp1, VI6_IP_VERSION);
 	vsp1_device_put(vsp1);
 
 	for (i = 0; i < ARRAY_SIZE(vsp1_device_infos); ++i) {
@@ -905,6 +933,7 @@ static int vsp1_remove(struct platform_device *pdev)
 static const struct of_device_id vsp1_of_match[] = {
 	{ .compatible = "renesas,vsp1" },
 	{ .compatible = "renesas,vsp2" },
+	{ .compatible = "renesas,vsp2-r9a07g044", .data = (void *)VI6_IP_VERSION_MODEL_VSPD_RZG2L },
 	{ },
 };
 MODULE_DEVICE_TABLE(of, vsp1_of_match);
diff --git a/drivers/media/platform/vsp1/vsp1_lif.c b/drivers/media/platform/vsp1/vsp1_lif.c
index 6a6857ac9327..6e997653cfac 100644
--- a/drivers/media/platform/vsp1/vsp1_lif.c
+++ b/drivers/media/platform/vsp1/vsp1_lif.c
@@ -107,6 +107,7 @@ static void lif_configure_stream(struct vsp1_entity *entity,
 
 	case VI6_IP_VERSION_MODEL_VSPDL_GEN3:
 	case VI6_IP_VERSION_MODEL_VSPD_V3:
+	case VI6_IP_VERSION_MODEL_VSPD_RZG2L:
 		hbth = 0;
 		obth = 1500;
 		lbth = 0;
@@ -135,8 +136,10 @@ static void lif_configure_stream(struct vsp1_entity *entity,
 	 * may appear on the output). The value required by the manual is not
 	 * explained but is likely a buffer size or threshold.
 	 */
-	if ((entity->vsp1->version & VI6_IP_VERSION_MASK) ==
-	    (VI6_IP_VERSION_MODEL_VSPD_V3 | VI6_IP_VERSION_SOC_V3M))
+	if (((entity->vsp1->version & VI6_IP_VERSION_MASK) ==
+	    (VI6_IP_VERSION_MODEL_VSPD_V3 | VI6_IP_VERSION_SOC_V3M)) ||
+	    ((entity->vsp1->version & VI6_IP_VERSION_MASK) ==
+	     VI6_IP_VERSION_MODEL_VSPD_RZG2L))
 		vsp1_lif_write(lif, dlb, VI6_LIF_LBA,
 			       VI6_LIF_LBA_LBA0 |
 			       (1536 << VI6_LIF_LBA_LBA1_SHIFT));
diff --git a/drivers/media/platform/vsp1/vsp1_regs.h b/drivers/media/platform/vsp1/vsp1_regs.h
index fae7286eb01e..12c5b09885dc 100644
--- a/drivers/media/platform/vsp1/vsp1_regs.h
+++ b/drivers/media/platform/vsp1/vsp1_regs.h
@@ -766,6 +766,7 @@
 #define VI6_IP_VERSION_MODEL_VSPD_V3	(0x18 << 8)
 #define VI6_IP_VERSION_MODEL_VSPDL_GEN3	(0x19 << 8)
 #define VI6_IP_VERSION_MODEL_VSPBS_GEN3	(0x1a << 8)
+#define VI6_IP_VERSION_MODEL_VSPD_RZG2L	(0x1b << 8)
 #define VI6_IP_VERSION_MODEL_VSPD_V3U	(0x1c << 8)
 
 #define VI6_IP_VERSION_SOC_MASK		(0xff << 0)
-- 
2.17.1


  parent reply	other threads:[~2022-01-12 17:47 UTC|newest]

Thread overview: 108+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-12 17:45 [RFC 00/28] Add RZ/G2L Display support Biju Das
2022-01-12 17:45 ` Biju Das
2022-01-12 17:45 ` [RFC 01/28] clk: renesas: rzg2l: Add FOUTPOSTDIV clk support Biju Das
2022-01-12 21:37   ` kernel test robot
2022-01-13  9:40   ` kernel test robot
2022-01-13  9:40     ` kernel test robot
2022-02-01 11:44   ` Geert Uytterhoeven
2022-03-18 10:21     ` Biju Das
2022-01-12 17:45 ` [RFC 02/28] clk: renesas: rzg2l: Add PLL5_4 clk mux support Biju Das
2022-02-01 14:33   ` Geert Uytterhoeven
2022-03-18 10:28     ` Biju Das
2022-01-12 17:45 ` [RFC 03/28] clk: renesas: rzg2l: Add DSI divider clk support Biju Das
2022-01-12 17:45 ` [RFC 04/28] clk: renesas: r9a07g044: Add M1 clock support Biju Das
2022-02-01 14:36   ` Geert Uytterhoeven
2022-03-18 10:29     ` Biju Das
2022-01-12 17:45 ` [RFC 05/28] clk: renesas: r9a07g044: Add {M2, M2_DIV2} Clocks support Biju Das
2022-02-01  9:19   ` Geert Uytterhoeven
2022-01-12 17:45 ` [RFC 06/28] clk: renesas: r9a07g044: Add M3 Clock support Biju Das
2022-02-01  9:19   ` Geert Uytterhoeven
2022-01-12 17:45 ` [RFC 07/28] clk: renesas: r9a07g044: Add M4 " Biju Das
2022-02-01  9:19   ` Geert Uytterhoeven
2022-01-12 17:45 ` [RFC 08/28] clk: renesas: r9a07g044: Add LCDC clock and reset entries Biju Das
2022-02-01  9:19   ` Geert Uytterhoeven
2022-01-12 17:45 ` [RFC 09/28] clk: renesas: r9a07g044: Add DSI " Biju Das
2022-02-01  9:21   ` Geert Uytterhoeven
2022-01-12 17:45 ` [RFC 10/28] drm: rcar-du: of: Increase buff size for compatible variable Biju Das
2022-01-12 17:45   ` Biju Das
2022-01-14 10:17   ` Geert Uytterhoeven
2022-01-14 10:17     ` Geert Uytterhoeven
2022-01-14 12:54     ` Biju Das
2022-01-14 12:54       ` Biju Das
2022-01-23 13:52     ` Laurent Pinchart
2022-01-23 13:52       ` Laurent Pinchart
2022-01-24  8:18       ` Geert Uytterhoeven
2022-01-24  8:18         ` Geert Uytterhoeven
2022-01-26  0:53         ` Laurent Pinchart
2022-01-26  0:53           ` Laurent Pinchart
2022-01-26  6:55           ` Biju Das
2022-01-26  6:55             ` Biju Das
2022-01-12 17:45 ` [RFC 11/28] drm: rcar-du: Add num_rpf to struct rcar_du_device_info Biju Das
2022-01-12 17:45   ` Biju Das
2022-01-23 13:55   ` Laurent Pinchart
2022-01-23 13:55     ` Laurent Pinchart
2022-03-13 10:12     ` Biju Das
2022-03-13 10:12       ` Biju Das
2022-01-12 17:45 ` [RFC 12/28] drm: rcar-du: Add max_width and max_height " Biju Das
2022-01-12 17:45   ` Biju Das
2022-01-12 17:45 ` [RFC 13/28] drm: rcar-du: Add RCAR_DU_FEATURE_PLANE feature bit Biju Das
2022-01-12 17:45   ` Biju Das
2022-01-12 17:45 ` [RFC 14/28] drm: rcar-du: Allow DU plane feature based on DU " Biju Das
2022-01-12 17:45   ` Biju Das
2022-01-12 17:45 ` [RFC 15/28] drm: rcar_du: Add RCAR_DU_FEATURE_GROUP " Biju Das
2022-01-12 17:45   ` Biju Das
2022-01-12 17:46 ` [RFC 16/28] drm: rcar-du: Allow DU group feature based on " Biju Das
2022-01-12 17:46   ` Biju Das
2022-01-23 13:57   ` Laurent Pinchart
2022-01-23 13:57     ` Laurent Pinchart
2022-01-12 17:46 ` [RFC 17/28] dt-bindings: display: renesas,du: Document r9a07g044l bindings Biju Das
2022-01-12 17:46   ` [RFC 17/28] dt-bindings: display: renesas, du: " Biju Das
2022-01-22  1:01   ` [RFC 17/28] dt-bindings: display: renesas,du: " Rob Herring
2022-01-22  1:01     ` Rob Herring
2022-01-22 11:20     ` Biju Das
2022-01-22 11:20       ` [RFC 17/28] dt-bindings: display: renesas, du: " Biju Das
2022-01-12 17:46 ` [RFC 18/28] drm: rcar-du: Add RZ/G2L LCDC Support Biju Das
2022-01-12 17:46   ` Biju Das
2022-01-23  1:35   ` Laurent Pinchart
2022-01-23  1:35     ` Laurent Pinchart
2022-03-08 18:54     ` Biju Das
2022-03-08 18:54       ` Biju Das
2022-01-12 17:46 ` [RFC 19/28] media: dt-bindings: media: renesas,vsp1: Document RZ/{G2L,V2L} VSPD bindings Biju Das
2022-01-22  1:02   ` Rob Herring
2022-01-22 11:23     ` Biju Das
2022-01-23  0:14       ` Laurent Pinchart
2022-01-23 14:47         ` Biju Das
2022-01-12 17:46 ` Biju Das [this message]
2022-01-23  1:26   ` [RFC 20/28] media: vsp1: Add support for the RZ/G2L VSPD Laurent Pinchart
2022-01-23 15:20     ` Biju Das
2022-01-24  8:06       ` Geert Uytterhoeven
2022-03-08 19:18         ` Biju Das
2022-01-12 17:46 ` [RFC 21/28] dt-bindings: display: bridge: Document RZ/G2L MIPI DSI TX bindings Biju Das
2022-01-12 17:46   ` Biju Das
2022-01-22  1:05   ` Rob Herring
2022-01-22  1:05     ` Rob Herring
2022-01-22 11:19     ` Biju Das
2022-01-22 11:19       ` Biju Das
2022-01-12 17:46 ` [RFC 22/28] drm: rcar-du: Add RZ/G2L DSI driver Biju Das
2022-01-12 17:46   ` Biju Das
2022-01-14 10:24   ` Geert Uytterhoeven
2022-01-14 10:24     ` Geert Uytterhoeven
2022-01-14 12:48     ` Biju Das
2022-01-14 12:48       ` Biju Das
2022-01-14 10:28   ` Philipp Zabel
2022-01-14 10:28     ` Philipp Zabel
2022-01-14 12:49     ` Biju Das
2022-01-14 12:49       ` Biju Das
2022-01-23 13:51   ` Laurent Pinchart
2022-01-23 13:51     ` Laurent Pinchart
2022-03-14 14:33     ` Biju Das
2022-03-14 14:33       ` Biju Das
2022-01-12 17:46 ` [RFC 23/28] arm64: dts: renesas: r9a07g044: Add fcpvd node Biju Das
2022-01-13  9:47   ` Sergey Shtylyov
2022-01-12 17:46 ` [RFC 24/28] arm64: dts: renesas: r9a07g044: Add vspd node Biju Das
2022-01-13  9:46   ` Sergey Shtylyov
2022-01-12 17:46 ` [RFC 25/28] arm64: dts: renesas: r9a07g044: Add DU node Biju Das
2022-01-12 17:46 ` [RFC 26/28] arm64: dts: renesas: r9a07g044: Add dsi node Biju Das
2022-01-12 17:46 ` [RFC 27/28] arm64: dts: renesas: r9a07g044: Link DSI with DU node Biju Das
2022-01-12 17:46 ` [RFC 28/28] arm64: dts: renesas: rzg2l-smarc: Enable Display on carrier board Biju Das
2022-02-01 15:52   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220112174612.10773-21-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=Chris.Paterson2@renesas.com \
    --cc=biju.das@bp.renesas.com \
    --cc=geert+renesas@glider.be \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.