From patchwork Thu Sep 23 18:50:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12513527 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6EFAC433EF for ; Thu, 23 Sep 2021 18:52:55 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A940760F12 for ; Thu, 23 Sep 2021 18:52:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A940760F12 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cerno.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=/KK1NYzKuIEtRaVH698grQFw8OEtaMnSe/G0P5IO8YU=; b=FOAm3RZeUWLJZH aiYeNxajWkLne6JCvrTqCLH7jpdlXs2k6i1t9Ks7zq7bfLN54+XxNT54w7c4Pr+GCeT0V4+CGoVqL VHpjm79H4Ts9zm6QoeXOUBTd3M1e1Ek20g6sn9Fm68eBwyiIfIsWCBkERSZ96qM85KpPFwoQyoxrN K1JyhpL9W5f8Bjgg4vUROwcE4b6jBYeuiMah6+YvEW6/pmS/7MlCSPDU1NrZKBIEbNZP343g+/t9K aDsRAev9BmLcZZ0EiYpIAz3Cse0BvpxPGyn6YZRb/KfSD+uHgZ3DsY3cfcQ26rWoSLX9QwtU+/pNY aUYDSDbuS0kC/2gmzzyw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTTnd-00COYV-DX; Thu, 23 Sep 2021 18:50:25 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mTTnY-00COWk-Ui; Thu, 23 Sep 2021 18:50:22 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id A0DBD3201EB1; Thu, 23 Sep 2021 14:50:17 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 23 Sep 2021 14:50:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm3; bh=3az7OdV7Z3JaXLLheQndiqCilD FEjUNPtbedszlC/7o=; b=L66XcP3PnBokEOCMUPHYGOPL+6JL9ZowG7e3B0VI2T XWTQbOhAUgOtDTCmRQaLnE5Uv3EkquaGhhxuCxy85qZdofzimA7VB4NdNj/rFQFi cgIaVDc7faJ1+4HvQ6bx0xaQr+6T9WdgUduXuiiwp0j68KcSkJLshVeUQiV3hEZk UdZ0ZtKZeu7/+96xZwtLO86eURok6CSLgins0PD0bpOUc0vbI16eJHA6QAdZAZP6 +q1IwIF72h+u75OGlJfvjBlAfSA9evx1rn0m5g+Maugc+CgNJ/r+AbYU3yYl4TZj WKy57MsZwAtlHNK7xx9Wf1++CGJJAxLKkCLVgv8p5eZA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=3az7OdV7Z3JaXLLhe QndiqCilDFEjUNPtbedszlC/7o=; b=TilS0PEqvSQLft14JtQ1SDyz5iVHM1Lxl TuYygupHI6e0Pt1k8wc1a80TNKQjrGdj+zW77rpKn2SoftEUSnWVXvFkImCvziUh TdbF1Kgzzieg2SGQ+3s+b55q7qD1yelWAPI6nVBQZG5ujdevJWBBJ9xpdpItZ359 BQLFMsk+u4otJ0CGi/BC/h+8BbjxkFk0/UNQpYX9vJ1ZMZm1/63yXvSM+DWMVQQh iX2LEOsAMoFOruuxSJ2ol6NbFDHh5K7PTQTHnh9SL6si/Pr+ASr8f7PiUKhqTFkJ N9etjG3CbrwHtSb3UuBISgycS2DcunQAIGXQsooU1Xe+2x7H16hJA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeiledguddvkecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpeejffehuddvvddvlefhgeelleffgfeijedvhefgieejtdeiueetjeetfeeukeej geenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 23 Sep 2021 14:50:15 -0400 (EDT) From: Maxime Ripard To: Maarten Lankhorst , Thomas Zimmermann , Maxime Ripard , Daniel Vetter , David Airlie Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, Florian Fainelli , Nicolas Saenz Julienne , linux-arm-kernel@lists.infradead.org Subject: [PATCH] drm/vc4: crtc: Make sure the HDMI controller is powered when disabling Date: Thu, 23 Sep 2021 20:50:13 +0200 Message-Id: <20210923185013.826679-1-maxime@cerno.tech> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210923_115021_228902_724C90AA X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Since commit 875a4d536842 ("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: 875a4d536842 ("drm/vc4: drv: Disable the CRTC at boot time") Signed-off-by: Maxime Ripard Reviewed-by: Nicolas Saenz Julienne Tested-by: Nicolas Saenz Julienne --- drivers/gpu/drm/vc4/vc4_crtc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 18f5009ce90e..c0df11e5fcf2 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ #include #include "vc4_drv.h" +#include "vc4_hdmi.h" #include "vc4_regs.h" #define HVS_FIFO_LATENCY_PIX 6 @@ -496,8 +498,10 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) enum vc4_encoder_type encoder_type; const struct vc4_pv_data *pv_data; struct drm_encoder *encoder; + struct vc4_hdmi *vc4_hdmi; unsigned encoder_sel; int channel; + int ret; if (!(of_device_is_compatible(vc4_crtc->pdev->dev.of_node, "brcm,bcm2711-pixelvalve2") || @@ -525,7 +529,20 @@ int vc4_crtc_disable_at_boot(struct drm_crtc *crtc) if (WARN_ON(!encoder)) return 0; - return vc4_crtc_disable(crtc, encoder, NULL, channel); + vc4_hdmi = encoder_to_vc4_hdmi(encoder); + ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret) + return ret; + + ret = vc4_crtc_disable(crtc, encoder, NULL, channel); + if (ret) + return ret; + + ret = pm_runtime_put(&vc4_hdmi->pdev->dev); + if (ret) + return ret; + + return 0; } static void vc4_crtc_atomic_disable(struct drm_crtc *crtc,