public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/9] drm/vc4: txp: Properly set the possible_crtcs mask
       [not found] <20210413145441.483977-1-maxime@cerno.tech>
@ 2021-04-13 14:54 ` Maxime Ripard
  2021-04-13 14:54 ` [PATCH v3 2/9] drm/vc4: crtc: Skip the TXP Maxime Ripard
  2021-04-13 14:54 ` [PATCH v3 4/9] drm/vc4: hdmi: Prevent clock unbalance Maxime Ripard
  2 siblings, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2021-04-13 14:54 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Thomas Zimmermann, Maxime Ripard
  Cc: Phil Elwell, Nicolas Saenz Julienne, Tim Gover, linux-rpi-kernel,
	Dave Stevenson, Daniel Vetter, David Airlie,
	bcm-kernel-feedback-list, stable

The current code does a binary OR on the possible_crtcs variable of the
TXP encoder, while we want to set it to that value instead.

Cc: <stable@vger.kernel.org> # v5.9+
Fixes: 39fcb2808376 ("drm/vc4: txp: Turn the TXP into a CRTC of its own")
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_txp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_txp.c b/drivers/gpu/drm/vc4/vc4_txp.c
index c0122d83b651..2fc7f4b5fa09 100644
--- a/drivers/gpu/drm/vc4/vc4_txp.c
+++ b/drivers/gpu/drm/vc4/vc4_txp.c
@@ -507,7 +507,7 @@ static int vc4_txp_bind(struct device *dev, struct device *master, void *data)
 		return ret;
 
 	encoder = &txp->connector.encoder;
-	encoder->possible_crtcs |= drm_crtc_mask(crtc);
+	encoder->possible_crtcs = drm_crtc_mask(crtc);
 
 	ret = devm_request_irq(dev, irq, vc4_txp_interrupt, 0,
 			       dev_name(dev), txp);
-- 
2.30.2


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

* [PATCH v3 2/9] drm/vc4: crtc: Skip the TXP
       [not found] <20210413145441.483977-1-maxime@cerno.tech>
  2021-04-13 14:54 ` [PATCH v3 1/9] drm/vc4: txp: Properly set the possible_crtcs mask Maxime Ripard
@ 2021-04-13 14:54 ` Maxime Ripard
  2021-04-13 14:54 ` [PATCH v3 4/9] drm/vc4: hdmi: Prevent clock unbalance Maxime Ripard
  2 siblings, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2021-04-13 14:54 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Thomas Zimmermann, Maxime Ripard
  Cc: Phil Elwell, Nicolas Saenz Julienne, Tim Gover, linux-rpi-kernel,
	Dave Stevenson, Daniel Vetter, David Airlie,
	bcm-kernel-feedback-list, stable

The vc4_set_crtc_possible_masks is meant to run over all the encoders
and then set their possible_crtcs mask to their associated pixelvalve.

However, since the commit 39fcb2808376 ("drm/vc4: txp: Turn the TXP into
a CRTC of its own"), the TXP has been turned to a CRTC and encoder of
its own, and while it does indeed register an encoder, it no longer has
an associated pixelvalve. The code will thus run over the TXP encoder
and set a bogus possible_crtcs mask, overriding the one set in the TXP
bind function.

In order to fix this, let's skip any virtual encoder.

Cc: <stable@vger.kernel.org> # v5.9+
Fixes: 39fcb2808376 ("drm/vc4: txp: Turn the TXP into a CRTC of its own")
Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_crtc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c
index 269390bc586e..f1f2e8cbce79 100644
--- a/drivers/gpu/drm/vc4/vc4_crtc.c
+++ b/drivers/gpu/drm/vc4/vc4_crtc.c
@@ -1018,6 +1018,9 @@ static void vc4_set_crtc_possible_masks(struct drm_device *drm,
 		struct vc4_encoder *vc4_encoder;
 		int i;
 
+		if (encoder->encoder_type == DRM_MODE_ENCODER_VIRTUAL)
+			continue;
+
 		vc4_encoder = to_vc4_encoder(encoder);
 		for (i = 0; i < ARRAY_SIZE(pv_data->encoder_types); i++) {
 			if (vc4_encoder->type == encoder_types[i]) {
-- 
2.30.2


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

* [PATCH v3 4/9] drm/vc4: hdmi: Prevent clock unbalance
       [not found] <20210413145441.483977-1-maxime@cerno.tech>
  2021-04-13 14:54 ` [PATCH v3 1/9] drm/vc4: txp: Properly set the possible_crtcs mask Maxime Ripard
  2021-04-13 14:54 ` [PATCH v3 2/9] drm/vc4: crtc: Skip the TXP Maxime Ripard
@ 2021-04-13 14:54 ` Maxime Ripard
  2 siblings, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2021-04-13 14:54 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Thomas Zimmermann, Maxime Ripard
  Cc: Phil Elwell, Nicolas Saenz Julienne, Tim Gover, linux-rpi-kernel,
	Dave Stevenson, Daniel Vetter, David Airlie,
	bcm-kernel-feedback-list, stable

Since we fixed the hooks to disable the encoder at boot, we now have an
unbalanced clk_disable call at boot since we never enabled them in the
first place.

Let's mimic the state of the hardware and enable the clocks at boot if
the controller is enabled to get the use-count right.

Cc: <stable@vger.kernel.org> # v5.10+
Fixes: 09c438139b8f ("drm/vc4: hdmi: Implement finer-grained hooks")
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 1fda574579af..9c919472ae84 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -1995,6 +1995,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
 	if (vc4_hdmi->variant->reset)
 		vc4_hdmi->variant->reset(vc4_hdmi);
 
+	if ((of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi0") ||
+	     of_device_is_compatible(dev->of_node, "brcm,bcm2711-hdmi1")) &&
+	    HDMI_READ(HDMI_VID_CTL) & VC4_HD_VID_CTL_ENABLE) {
+		clk_prepare_enable(vc4_hdmi->pixel_clock);
+		clk_prepare_enable(vc4_hdmi->hsm_clock);
+		clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
+	}
+
 	pm_runtime_enable(dev);
 
 	drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
-- 
2.30.2


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

end of thread, other threads:[~2021-04-13 14:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20210413145441.483977-1-maxime@cerno.tech>
2021-04-13 14:54 ` [PATCH v3 1/9] drm/vc4: txp: Properly set the possible_crtcs mask Maxime Ripard
2021-04-13 14:54 ` [PATCH v3 2/9] drm/vc4: crtc: Skip the TXP Maxime Ripard
2021-04-13 14:54 ` [PATCH v3 4/9] drm/vc4: hdmi: Prevent clock unbalance Maxime Ripard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox