mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
To: "Maxime Ripard" <mripard@kernel.org>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Ray Jui" <rjui@broadcom.com>,
	"Scott Branden" <sbranden@broadcom.com>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Javier Martinez Canillas" <javierm@redhat.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	 devicetree@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	 Dave Stevenson <dave.stevenson@raspberrypi.com>
Subject: [PATCH v2 11/36] drm/vc4: crtc: Add support for BCM2712 PixelValves
Date: Fri, 25 Oct 2024 18:15:42 +0100	[thread overview]
Message-ID: <20241025-drm-vc4-2712-support-v2-11-35efa83c8fc0@raspberrypi.com> (raw)
In-Reply-To: <20241025-drm-vc4-2712-support-v2-0-35efa83c8fc0@raspberrypi.com>

From: Maxime Ripard <mripard@kernel.org>

The PixelValves found on the BCM2712 are similar to the ones found in
the previous generation.

Compared to BCM2711:
- the pixelvalves only drive one HDMI controller each
- HDMI1 PixelValve has a FIFO long enough to support 4k at 60Hz
- support has been added for odd horizontal timings whilst at 2pixels/clock

Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 49 ++++++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/vc4/vc4_drv.h  |  2 ++
 drivers/gpu/drm/vc4/vc4_regs.h |  6 ++++++
 3 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 53bca104d0d5..bfa25efa5db2 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -240,6 +240,11 @@ static u32 vc4_get_fifo_full_level(struct vc4_crtc *vc4_crtc, u32 format)
 	const struct vc4_crtc_data *crtc_data = vc4_crtc_to_vc4_crtc_data(vc4_crtc);
 	const struct vc4_pv_data *pv_data = vc4_crtc_to_vc4_pv_data(vc4_crtc);
 	struct vc4_dev *vc4 = to_vc4_dev(vc4_crtc->base.dev);
+
+	/*
+	 * NOTE: Could we use register 0x68 (PV_HW_CFG1) to get the FIFO
+	 * size?
+	 */
 	u32 fifo_len_bytes = pv_data->fifo_depth;
 
 	/*
@@ -421,6 +426,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode
 		 */
 		CRTC_WRITE(PV_V_CONTROL,
 			   PV_VCONTROL_CONTINUOUS |
+			   (vc4->gen >= VC4_GEN_6_C ? PV_VCONTROL_ODD_TIMING : 0) |
 			   (is_dsi ? PV_VCONTROL_DSI : 0) |
 			   PV_VCONTROL_INTERLACE |
 			   (odd_field_first
@@ -432,6 +438,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode
 	} else {
 		CRTC_WRITE(PV_V_CONTROL,
 			   PV_VCONTROL_CONTINUOUS |
+			   (vc4->gen >= VC4_GEN_6_C ? PV_VCONTROL_ODD_TIMING : 0) |
 			   (is_dsi ? PV_VCONTROL_DSI : 0));
 		CRTC_WRITE(PV_VSYNCD_EVEN, 0);
 	}
@@ -446,11 +453,17 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, struct drm_encoder *encode
 	if (is_dsi)
 		CRTC_WRITE(PV_HACT_ACT, mode->hdisplay * pixel_rep);
 
-	if (vc4->gen == VC4_GEN_5)
+	if (vc4->gen >= VC4_GEN_5)
 		CRTC_WRITE(PV_MUX_CFG,
 			   VC4_SET_FIELD(PV_MUX_CFG_RGB_PIXEL_MUX_MODE_NO_SWAP,
 					 PV_MUX_CFG_RGB_PIXEL_MUX_MODE));
 
+	if (vc4->gen >= VC4_GEN_6_C)
+		CRTC_WRITE(PV_PIPE_INIT_CTRL,
+			   VC4_SET_FIELD(1, PV_PIPE_INIT_CTRL_PV_INIT_WIDTH) |
+			   VC4_SET_FIELD(1, PV_PIPE_INIT_CTRL_PV_INIT_IDLE) |
+			   PV_PIPE_INIT_CTRL_PV_INIT_EN);
+
 	CRTC_WRITE(PV_CONTROL, PV_CONTROL_FIFO_CLR |
 		   vc4_crtc_get_fifo_full_level_bits(vc4_crtc, format) |
 		   VC4_SET_FIELD(format, PV_CONTROL_FORMAT) |
@@ -549,7 +562,11 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)
 	if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node,
 				      "brcm,bcm2711-pixelvalve2") ||
 	      of_device_is_compatible(vc4_crtc->pdev->dev.of_node,
-				      "brcm,bcm2711-pixelvalve4")))
+				      "brcm,bcm2711-pixelvalve4") ||
+	      of_device_is_compatible(vc4_crtc->pdev->dev.of_node,
+				      "brcm,bcm2712-pixelvalve0") ||
+	      of_device_is_compatible(vc4_crtc->pdev->dev.of_node,
+				      "brcm,bcm2712-pixelvalve1")))
 		return 0;
 
 	if (!(CRTC_READ(PV_CONTROL) & PV_CONTROL_EN))
@@ -1292,6 +1309,32 @@ const struct vc4_pv_data bcm2711_pv4_data = {
 	},
 };
 
+const struct vc4_pv_data bcm2712_pv0_data = {
+	.base = {
+		.debugfs_name = "crtc0_regs",
+		.hvs_available_channels = BIT(0),
+		.hvs_output = 0,
+	},
+	.fifo_depth = 64,
+	.pixels_per_clock = 1,
+	.encoder_types = {
+		[0] = VC4_ENCODER_TYPE_HDMI0,
+	},
+};
+
+const struct vc4_pv_data bcm2712_pv1_data = {
+	.base = {
+		.debugfs_name = "crtc1_regs",
+		.hvs_available_channels = BIT(1),
+		.hvs_output = 1,
+	},
+	.fifo_depth = 64,
+	.pixels_per_clock = 1,
+	.encoder_types = {
+		[0] = VC4_ENCODER_TYPE_HDMI1,
+	},
+};
+
 static const struct of_device_id vc4_crtc_dt_match[] = {
 	{ .compatible = "brcm,bcm2835-pixelvalve0", .data = &bcm2835_pv0_data },
 	{ .compatible = "brcm,bcm2835-pixelvalve1", .data = &bcm2835_pv1_data },
@@ -1301,6 +1344,8 @@ static const struct of_device_id vc4_crtc_dt_match[] = {
 	{ .compatible = "brcm,bcm2711-pixelvalve2", .data = &bcm2711_pv2_data },
 	{ .compatible = "brcm,bcm2711-pixelvalve3", .data = &bcm2711_pv3_data },
 	{ .compatible = "brcm,bcm2711-pixelvalve4", .data = &bcm2711_pv4_data },
+	{ .compatible = "brcm,bcm2712-pixelvalve0", .data = &bcm2712_pv0_data },
+	{ .compatible = "brcm,bcm2712-pixelvalve1", .data = &bcm2712_pv1_data },
 	{}
 };
 
diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h
index aea585bf83eb..a68cea921c11 100644
--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -558,6 +558,8 @@ extern const struct vc4_pv_data bcm2711_pv1_data;
 extern const struct vc4_pv_data bcm2711_pv2_data;
 extern const struct vc4_pv_data bcm2711_pv3_data;
 extern const struct vc4_pv_data bcm2711_pv4_data;
+extern const struct vc4_pv_data bcm2712_pv0_data;
+extern const struct vc4_pv_data bcm2712_pv1_data;
 
 struct vc4_crtc {
 	struct drm_crtc base;
diff --git a/drivers/gpu/drm/vc4/vc4_regs.h b/drivers/gpu/drm/vc4/vc4_regs.h
index 9226429539cf..731b13742ef5 100644
--- a/drivers/gpu/drm/vc4/vc4_regs.h
+++ b/drivers/gpu/drm/vc4/vc4_regs.h
@@ -155,6 +155,7 @@
 # define PV_CONTROL_EN				BIT(0)
 
 #define PV_V_CONTROL				0x04
+# define PV_VCONTROL_ODD_TIMING			BIT(29)
 # define PV_VCONTROL_ODD_DELAY_MASK		VC4_MASK(22, 6)
 # define PV_VCONTROL_ODD_DELAY_SHIFT		6
 # define PV_VCONTROL_ODD_FIRST			BIT(5)
@@ -215,6 +216,11 @@
 # define PV_MUX_CFG_RGB_PIXEL_MUX_MODE_SHIFT	2
 # define PV_MUX_CFG_RGB_PIXEL_MUX_MODE_NO_SWAP	8
 
+#define PV_PIPE_INIT_CTRL			0x94
+# define PV_PIPE_INIT_CTRL_PV_INIT_WIDTH_MASK	VC4_MASK(11, 8)
+# define PV_PIPE_INIT_CTRL_PV_INIT_IDLE_MASK	VC4_MASK(7, 4)
+# define PV_PIPE_INIT_CTRL_PV_INIT_EN		BIT(0)
+
 #define SCALER_CHANNELS_COUNT			3
 
 #define SCALER_DISPCTRL                         0x00000000

-- 
2.34.1


  parent reply	other threads:[~2024-10-25 17:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 17:15 [PATCH v2 00/36] drm/vc4: Add support for BCM2712 / Pi5 display hardware Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 01/36] drm/vc4: Use of_device_get_match_data to set generation Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 02/36] drm/vc4: Fix reading of frame count on GEN5 / Pi4 Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 03/36] dt-bindings: display: Add BCM2712 HDMI bindings Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 04/36] dt-bindings: display: Add BCM2712 HVS bindings Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 05/36] dt-bindings: display: Add BCM2712 PixelValve bindings Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 06/36] dt-bindings: display: Add BCM2712 MOP bindings Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 07/36] dt-bindings: display: Add BCM2712 MOPLET bindings Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 08/36] dt-bindings: display: Add BCM2712 KMS driver bindings Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 09/36] drm/vc4: drv: Support BCM2712 Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 10/36] drm/vc4: hvs: Add support for BCM2712 HVS Dave Stevenson
2024-10-25 17:15 ` Dave Stevenson [this message]
2024-10-25 17:15 ` [PATCH v2 12/36] drm/vc4: hdmi: Add support for BCM2712 HDMI controllers Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 13/36] drm/vc4: txp: Introduce structure to deal with revision differences Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 14/36] drm/vc4: txp: Rename TXP data structure Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 15/36] drm/vc4: txp: Add byte enable toggle bit Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 16/36] drm/vc4: txp: Add horizontal and vertical size offset " Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 17/36] drm/vc4: txp: Handle 40-bits DMA Addresses Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 18/36] drm/vc4: txp: Move the encoder type in the variant structure Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 19/36] drm/vc4: txp: Add a new TXP encoder type Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 20/36] drm/vc4: txp: Add support for BCM2712 MOP Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 21/36] drm/vc4: txp: Add BCM2712 MOPLET support Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 22/36] drm/vc4: drv: Add support for 2712 D-step Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 23/36] drm/vc4: hvs: Add in " Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 24/36] drm/vc4: plane: Add " Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 25/36] drm/vc4: hdmi: Support 2712 D-step register map Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 26/36] drm/vc4: Add additional warn_on for incorrect revisions Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 27/36] drm/vc4: Enable bg_fill if there are no planes enabled Dave Stevenson
2024-10-25 17:15 ` [PATCH v2 28/36] drm/vc4: Drop planes that are completely off-screen or 0 crtc size Dave Stevenson
2024-10-25 17:16 ` [PATCH v2 29/36] clk: bcm: rpi: Add ISP to exported clocks Dave Stevenson
2024-10-25 17:16 ` [PATCH v2 30/36] clk: bcm: rpi: Allow cpufreq driver to also adjust gpu clocks Dave Stevenson
2024-10-25 17:16 ` [PATCH v2 31/36] clk: bcm: rpi: Enable minimize for all firmware clocks Dave Stevenson
2024-10-25 17:16 ` [PATCH v2 32/36] clk: bcm: rpi: Create helper to retrieve private data Dave Stevenson
2024-10-25 17:16 ` [PATCH v2 33/36] clk: bcm: rpi: Add disp clock Dave Stevenson
2024-10-25 17:16 ` [PATCH v2 34/36] arm64: dts: broadcom: Add firmware clocks and power nodes to Pi5 DT Dave Stevenson
2024-11-24 17:03   ` Florian Fainelli
2024-10-25 17:16 ` [PATCH v2 35/36] arm64: dts: broadcom: Add display pipeline support to BCM2712 Dave Stevenson
2024-11-24 17:04   ` Florian Fainelli
2024-10-25 17:16 ` [PATCH v2 36/36] arm64: dts: broadcom: Add DT for D-step version of BCM2712 Dave Stevenson
2024-11-24 17:04   ` Florian Fainelli
2024-10-27 21:17 ` [PATCH v2 00/36] drm/vc4: Add support for BCM2712 / Pi5 display hardware Rob Herring (Arm)

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=20241025-drm-vc4-2712-support-v2-11-35efa83c8fc0@raspberrypi.com \
    --to=dave.stevenson@raspberrypi.com \
    --cc=airlied@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=javierm@redhat.com \
    --cc=kernel-list@raspberrypi.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mcanal@igalia.com \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=rjui@broadcom.com \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sbranden@broadcom.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®