Skip to content

Commit bca10db

Browse files
committed
drm/vc4: crtc: Make sure the HDMI controller is powered when disabling
Since commit 875a4d5 ("drm/vc4: drv: Disable the CRTC at boot time"), during the initial setup of the driver we call into the VC4 HDMI controller hooks to make sure the controller is properly disabled. However, we were never making sure that the device was properly powered while doing so. This never resulted in any (reported) issue in practice, but since the introduction of commit 4209f03fcb8e ("drm/vc4: hdmi: Warn if we access the controller while disabled") we get a loud complaint when we do that kind of access. Let's make sure we have the HDMI controller properly powered while disabling it. Fixes: 875a4d5 ("drm/vc4: drv: Disable the CRTC at boot time") Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Tested-by: Nicolas Saenz Julienne <nsaenz@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20210923185013.826679-1-maxime@cerno.tech
1 parent 14e193b commit bca10db

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

drivers/gpu/drm/vc4/vc4_crtc.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <linux/clk.h>
3333
#include <linux/component.h>
3434
#include <linux/of_device.h>
35+
#include <linux/pm_runtime.h>
3536

3637
#include <drm/drm_atomic.h>
3738
#include <drm/drm_atomic_helper.h>
@@ -42,6 +43,7 @@
4243
#include <drm/drm_vblank.h>
4344

4445
#include "vc4_drv.h"
46+
#include "vc4_hdmi.h"
4547
#include "vc4_regs.h"
4648

4749
#define HVS_FIFO_LATENCY_PIX 6
@@ -496,8 +498,10 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)
496498
enum vc4_encoder_type encoder_type;
497499
const struct vc4_pv_data *pv_data;
498500
struct drm_encoder *encoder;
501+
struct vc4_hdmi *vc4_hdmi;
499502
unsigned encoder_sel;
500503
int channel;
504+
int ret;
501505

502506
if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node,
503507
"brcm,bcm2711-pixelvalve2") ||
@@ -525,7 +529,20 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc)
525529
if (WARN_ON(!encoder))
526530
return 0;
527531

528-
return vc4_crtc_disable(crtc, encoder, NULL, channel);
532+
vc4_hdmi = encoder_to_vc4_hdmi(encoder);
533+
ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
534+
if (ret)
535+
return ret;
536+
537+
ret = vc4_crtc_disable(crtc, encoder, NULL, channel);
538+
if (ret)
539+
return ret;
540+
541+
ret = pm_runtime_put(&vc4_hdmi->pdev->dev);
542+
if (ret)
543+
return ret;
544+
545+
return 0;
529546
}
530547

531548
static void vc4_crtc_atomic_disable(struct drm_crtc *crtc,

0 commit comments

Comments
 (0)