linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC
@ 2021-05-20 15:03 Maxime Ripard
  2021-05-20 15:03 ` [PATCH 1/4] drm/vc4: Fix clock source for VEC PixelValve on BCM2711 Maxime Ripard
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Maxime Ripard @ 2021-05-20 15:03 UTC (permalink / raw)
  To: dri-devel, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann, Maxime Ripard
  Cc: Florian Fainelli, Maxime Ripard, Eric Anholt,
	bcm-kernel-feedback-list, Ray Jui, devicetree, Scott Branden,
	linux-kernel, Daniel Vetter, Rob Herring, linux-rpi-kernel,
	Nicolas Saenz Julienne, linux-arm-kernel

Hi,

The composite output in the BCM2711 is dealt using the VEC. While the earlier
SoCs were properly supported, it wasn't functional on the BCM2711. Add the
needed support from the RPi downstream kernel.

Maxime

Mateusz Kwiatkowski (4):
  drm/vc4: Fix clock source for VEC PixelValve on BCM2711
  dt-bindings: display: bcm2835-vec: Add BCM2711 compatible
  drm/vc4: Separate VEC compatible variants
  ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible

 .../bindings/display/brcm,bcm2835-vec.yaml    |  4 ++-
 arch/arm/boot/dts/bcm2711.dtsi                |  1 +
 drivers/gpu/drm/vc4/vc4_crtc.c                |  2 +-
 drivers/gpu/drm/vc4/vc4_vec.c                 | 27 +++++++++++++++----
 4 files changed, 27 insertions(+), 7 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/4] drm/vc4: Fix clock source for VEC PixelValve on BCM2711
  2021-05-20 15:03 [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Maxime Ripard
@ 2021-05-20 15:03 ` Maxime Ripard
  2021-05-20 15:03 ` [PATCH 2/4] dt-bindings: display: bcm2835-vec: Add BCM2711 compatible Maxime Ripard
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2021-05-20 15:03 UTC (permalink / raw)
  To: dri-devel, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann, Maxime Ripard
  Cc: Florian Fainelli, Maxime Ripard, Eric Anholt,
	bcm-kernel-feedback-list, Ray Jui, devicetree, Scott Branden,
	linux-kernel, Daniel Vetter, Rob Herring, linux-rpi-kernel,
	Nicolas Saenz Julienne, linux-arm-kernel, Mateusz Kwiatkowski

From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>

On the BCM2711 (Raspberry Pi 4), the VEC is actually connected to
output 2 of pixelvalve3.

NOTE: This contradicts the Broadcom docs, but has been empirically
tested and confirmed by Raspberry Pi firmware devs.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 76657dcdf9b0..665ddf8f347f 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -994,7 +994,7 @@ static const struct vc4_pv_data bcm2711_pv3_data = {
 	.fifo_depth = 64,
 	.pixels_per_clock = 1,
 	.encoder_types = {
-		[0] = VC4_ENCODER_TYPE_VEC,
+		[PV_CONTROL_CLK_SELECT_VEC] = VC4_ENCODER_TYPE_VEC,
 	},
 };
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/4] dt-bindings: display: bcm2835-vec: Add BCM2711 compatible
  2021-05-20 15:03 [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Maxime Ripard
  2021-05-20 15:03 ` [PATCH 1/4] drm/vc4: Fix clock source for VEC PixelValve on BCM2711 Maxime Ripard
@ 2021-05-20 15:03 ` Maxime Ripard
  2021-05-20 15:03 ` [PATCH 3/4] drm/vc4: Separate VEC compatible variants Maxime Ripard
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2021-05-20 15:03 UTC (permalink / raw)
  To: dri-devel, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann, Maxime Ripard
  Cc: Florian Fainelli, Maxime Ripard, Eric Anholt,
	bcm-kernel-feedback-list, Ray Jui, devicetree, Scott Branden,
	linux-kernel, Daniel Vetter, Rob Herring, linux-rpi-kernel,
	Nicolas Saenz Julienne, linux-arm-kernel, Mateusz Kwiatkowski

From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>

The BCM2711 VEC uses a slightly different, incompatible, setup than the
one used for the earlier SoC. Add a new compatible for it.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 .../devicetree/bindings/display/brcm,bcm2835-vec.yaml         | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/display/brcm,bcm2835-vec.yaml b/Documentation/devicetree/bindings/display/brcm,bcm2835-vec.yaml
index d900cc57b4ec..9b24081a0dbd 100644
--- a/Documentation/devicetree/bindings/display/brcm,bcm2835-vec.yaml
+++ b/Documentation/devicetree/bindings/display/brcm,bcm2835-vec.yaml
@@ -11,7 +11,9 @@ maintainers:
 
 properties:
   compatible:
-    const: brcm,bcm2835-vec
+    enum:
+      - brcm,bcm2711-vec
+      - brcm,bcm2835-vec
 
   reg:
     maxItems: 1
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/4] drm/vc4: Separate VEC compatible variants
  2021-05-20 15:03 [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Maxime Ripard
  2021-05-20 15:03 ` [PATCH 1/4] drm/vc4: Fix clock source for VEC PixelValve on BCM2711 Maxime Ripard
  2021-05-20 15:03 ` [PATCH 2/4] dt-bindings: display: bcm2835-vec: Add BCM2711 compatible Maxime Ripard
@ 2021-05-20 15:03 ` Maxime Ripard
  2021-05-20 15:03 ` [PATCH 4/4] ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible Maxime Ripard
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2021-05-20 15:03 UTC (permalink / raw)
  To: dri-devel, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann, Maxime Ripard
  Cc: Florian Fainelli, Maxime Ripard, Eric Anholt,
	bcm-kernel-feedback-list, Ray Jui, devicetree, Scott Branden,
	linux-kernel, Daniel Vetter, Rob Herring, linux-rpi-kernel,
	Nicolas Saenz Julienne, linux-arm-kernel, Mateusz Kwiatkowski

From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>

The VEC's DAC on BCM2711 is slightly different compared to the one on
BCM283x and needs different configuration. In particular, bit 3
(mask 0x8) switches the BCM2711 DAC input to "self-test input data",
which makes the output unusable. Separating two compatible variants in
devicetrees and the DRM driver was therefore necessary.

The configurations used for both variants have been borrowed from
Raspberry Pi (model 3B for BCM283x, 4B for BCM2711) firmware defaults.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_vec.c | 27 ++++++++++++++++++++++-----
 1 file changed, 22 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
index bd5b8eb58b18..a467ceba75e4 100644
--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -154,9 +154,14 @@
 #define VEC_DAC_MISC_DAC_RST_N		BIT(0)
 
 
+struct vc4_vec_variant {
+	u32 dac_config;
+};
+
 /* General VEC hardware state. */
 struct vc4_vec {
 	struct platform_device *pdev;
+	const struct vc4_vec_variant *variant;
 
 	struct drm_encoder *encoder;
 	struct drm_connector *connector;
@@ -451,10 +456,7 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder)
 	VEC_WRITE(VEC_CONFIG2,
 		  VEC_CONFIG2_UV_DIG_DIS | VEC_CONFIG2_RGB_DIG_DIS);
 	VEC_WRITE(VEC_CONFIG3, VEC_CONFIG3_HORIZ_LEN_STD);
-	VEC_WRITE(VEC_DAC_CONFIG,
-		  VEC_DAC_CONFIG_DAC_CTRL(0xc) |
-		  VEC_DAC_CONFIG_DRIVER_CTRL(0xc) |
-		  VEC_DAC_CONFIG_LDO_BIAS_CTRL(0x46));
+	VEC_WRITE(VEC_DAC_CONFIG, vec->variant->dac_config);
 
 	/* Mask all interrupts. */
 	VEC_WRITE(VEC_MASK0, 0);
@@ -507,8 +509,21 @@ static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = {
 	.atomic_mode_set = vc4_vec_encoder_atomic_mode_set,
 };
 
+static const struct vc4_vec_variant bcm2835_vec_variant = {
+	.dac_config = VEC_DAC_CONFIG_DAC_CTRL(0xc) |
+		      VEC_DAC_CONFIG_DRIVER_CTRL(0xc) |
+		      VEC_DAC_CONFIG_LDO_BIAS_CTRL(0x46)
+};
+
+static const struct vc4_vec_variant bcm2711_vec_variant = {
+	.dac_config = VEC_DAC_CONFIG_DAC_CTRL(0x0) |
+		      VEC_DAC_CONFIG_DRIVER_CTRL(0x80) |
+		      VEC_DAC_CONFIG_LDO_BIAS_CTRL(0x61)
+};
+
 static const struct of_device_id vc4_vec_dt_match[] = {
-	{ .compatible = "brcm,bcm2835-vec", .data = NULL },
+	{ .compatible = "brcm,bcm2835-vec", .data = &bcm2835_vec_variant },
+	{ .compatible = "brcm,bcm2711-vec", .data = &bcm2711_vec_variant },
 	{ /* sentinel */ },
 };
 
@@ -546,6 +561,8 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data)
 	vec->encoder = &vc4_vec_encoder->base.base;
 
 	vec->pdev = pdev;
+	vec->variant = (const struct vc4_vec_variant *)
+		of_device_get_match_data(dev);
 	vec->regs = vc4_ioremap_regs(pdev, 0);
 	if (IS_ERR(vec->regs))
 		return PTR_ERR(vec->regs);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/4] ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible
  2021-05-20 15:03 [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Maxime Ripard
                   ` (2 preceding siblings ...)
  2021-05-20 15:03 ` [PATCH 3/4] drm/vc4: Separate VEC compatible variants Maxime Ripard
@ 2021-05-20 15:03 ` Maxime Ripard
  2021-06-08 10:06   ` nicolas saenz julienne
  2021-05-20 16:53 ` [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Dave Stevenson
  2021-05-24 11:52 ` Maxime Ripard
  5 siblings, 1 reply; 8+ messages in thread
From: Maxime Ripard @ 2021-05-20 15:03 UTC (permalink / raw)
  To: dri-devel, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann, Maxime Ripard
  Cc: Florian Fainelli, Maxime Ripard, Eric Anholt,
	bcm-kernel-feedback-list, Ray Jui, devicetree, Scott Branden,
	linux-kernel, Daniel Vetter, Rob Herring, linux-rpi-kernel,
	Nicolas Saenz Julienne, linux-arm-kernel, Mateusz Kwiatkowski

From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>

The BCM2711 has a slightly different VEC than the one found in the older
SoCs. Now that we support the new variant, add its compatible to the
device tree.

Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 arch/arm/boot/dts/bcm2711.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/bcm2711.dtsi b/arch/arm/boot/dts/bcm2711.dtsi
index 720beec54d61..0b6900815d19 100644
--- a/arch/arm/boot/dts/bcm2711.dtsi
+++ b/arch/arm/boot/dts/bcm2711.dtsi
@@ -1087,5 +1087,6 @@ &usb {
 };
 
 &vec {
+	compatible = "brcm,bcm2711-vec";
 	interrupts = <GIC_SPI 123 IRQ_TYPE_LEVEL_HIGH>;
 };
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC
  2021-05-20 15:03 [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Maxime Ripard
                   ` (3 preceding siblings ...)
  2021-05-20 15:03 ` [PATCH 4/4] ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible Maxime Ripard
@ 2021-05-20 16:53 ` Dave Stevenson
  2021-05-24 11:52 ` Maxime Ripard
  5 siblings, 0 replies; 8+ messages in thread
From: Dave Stevenson @ 2021-05-20 16:53 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: DRI Development, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann, devicetree, Florian Fainelli, Scott Branden,
	Ray Jui, LKML, Nicolas Saenz Julienne, Rob Herring,
	bcm-kernel-feedback-list, linux-rpi-kernel, linux-arm-kernel

Hi Maxime

On Thu, 20 May 2021 at 16:03, Maxime Ripard <maxime@cerno.tech> wrote:
>
> Hi,
>
> The composite output in the BCM2711 is dealt using the VEC. While the earlier
> SoCs were properly supported, it wasn't functional on the BCM2711. Add the
> needed support from the RPi downstream kernel.

Thanks for upstreaming these.
As far as I'm concerned they're all good, but DT bindings aren't an
area of expertise for me.

Patches 1&3:
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Patches 2&4:
Acked-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

This is going to need firmware from 23rd March 2021 or later in order
to ensure that the VEC can use an integer divider from the PLL. PLLC
was rejigged to run at 2592MHz so that /24 gives the VEC the 108MHz
clock it requires. (Before that it needed a special config.txt option
to set the PLLs appropriately).

 Dave

> Maxime
>
> Mateusz Kwiatkowski (4):
>   drm/vc4: Fix clock source for VEC PixelValve on BCM2711
>   dt-bindings: display: bcm2835-vec: Add BCM2711 compatible
>   drm/vc4: Separate VEC compatible variants
>   ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible
>
>  .../bindings/display/brcm,bcm2835-vec.yaml    |  4 ++-
>  arch/arm/boot/dts/bcm2711.dtsi                |  1 +
>  drivers/gpu/drm/vc4/vc4_crtc.c                |  2 +-
>  drivers/gpu/drm/vc4/vc4_vec.c                 | 27 +++++++++++++++----
>  4 files changed, 27 insertions(+), 7 deletions(-)
>
> --
> 2.31.1
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC
  2021-05-20 15:03 [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Maxime Ripard
                   ` (4 preceding siblings ...)
  2021-05-20 16:53 ` [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Dave Stevenson
@ 2021-05-24 11:52 ` Maxime Ripard
  5 siblings, 0 replies; 8+ messages in thread
From: Maxime Ripard @ 2021-05-24 11:52 UTC (permalink / raw)
  To: dri-devel, Daniel Vetter, David Airlie, Maarten Lankhorst,
	Thomas Zimmermann
  Cc: Florian Fainelli, Eric Anholt, bcm-kernel-feedback-list, Ray Jui,
	devicetree, Scott Branden, linux-kernel, Daniel Vetter,
	Rob Herring, linux-rpi-kernel, Nicolas Saenz Julienne,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

On Thu, May 20, 2021 at 05:03:40PM +0200, Maxime Ripard wrote:
> Hi,
> 
> The composite output in the BCM2711 is dealt using the VEC. While the earlier
> SoCs were properly supported, it wasn't functional on the BCM2711. Add the
> needed support from the RPi downstream kernel.
> 
> Maxime

Applied patches 1-3 to drm-misc-next

Maxime

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 4/4] ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible
  2021-05-20 15:03 ` [PATCH 4/4] ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible Maxime Ripard
@ 2021-06-08 10:06   ` nicolas saenz julienne
  0 siblings, 0 replies; 8+ messages in thread
From: nicolas saenz julienne @ 2021-06-08 10:06 UTC (permalink / raw)
  To: Maxime Ripard, dri-devel, Daniel Vetter, David Airlie,
	Maarten Lankhorst, Thomas Zimmermann
  Cc: Florian Fainelli, Maxime Ripard, Eric Anholt,
	bcm-kernel-feedback-list, Ray Jui, devicetree, Scott Branden,
	linux-kernel, Daniel Vetter, Rob Herring, linux-rpi-kernel,
	linux-arm-kernel, Mateusz Kwiatkowski

On Thu, 2021-05-20 at 17:03 +0200, Maxime Ripard wrote:
> From: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
> 
> The BCM2711 has a slightly different VEC than the one found in the older
> SoCs. Now that we support the new variant, add its compatible to the
> device tree.
> 
> Signed-off-by: Mateusz Kwiatkowski <kfyatek+publicgit@gmail.com>
> Signed-off-by: Maxime Ripard <maxime@cerno.tech>
> ---

Aplied for-next,

Regards,
Nicolas


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-06-08 10:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 15:03 [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Maxime Ripard
2021-05-20 15:03 ` [PATCH 1/4] drm/vc4: Fix clock source for VEC PixelValve on BCM2711 Maxime Ripard
2021-05-20 15:03 ` [PATCH 2/4] dt-bindings: display: bcm2835-vec: Add BCM2711 compatible Maxime Ripard
2021-05-20 15:03 ` [PATCH 3/4] drm/vc4: Separate VEC compatible variants Maxime Ripard
2021-05-20 15:03 ` [PATCH 4/4] ARM: boot: dts: bcm2711: Add BCM2711 VEC compatible Maxime Ripard
2021-06-08 10:06   ` nicolas saenz julienne
2021-05-20 16:53 ` [PATCH 0/4] drm/vc4: Add support for the BCM2711 VEC Dave Stevenson
2021-05-24 11:52 ` Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).