From patchwork Wed Aug 21 21:40:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772099 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 92D92C52D7C for ; Wed, 21 Aug 2024 21:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To: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:List-Owner; bh=cQY4hRDbG/mN48nwz0CKJd9xVLzJCWuo9bxt0VUNn7M=; b=2Ku0VPArV/JNKAXs5KUAwU42dY PDxnXGVUvvX0bc7bRAeEADYzkdeVffI7OZypxWVrj+5/mKcwEWW2gbRkSekPBatKPTrjXEQbdXXYq cnMTDfn4AEDVBz3YG3IQvjWptExIuvbPN5ShkbB6Q+gxbdFMJ20HRtHQeEjsDYRjisYJ3QblEx1Yq 54wTZFynBsKaMSA6toVD7fm7ykk7mzVmv0C+4KoqTWZVvay/LxdU1K7gadrYPRzSv4hmwjvUWXwvi /+VJZMeSOenu4Fm+5g7GZ4nat04b2R7SiVhp3cByyeIwbCO3yUIEsVDN6GTNaV+ySj+cJq4DyWp1m ut7IfThQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt7w-0000000ARsr-0TRL; Wed, 21 Aug 2024 21:44:24 +0000 Received: from mout.gmx.net ([212.227.15.15]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt55-0000000AREX-3qOC for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 21:41:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724276466; x=1724881266; i=wahrenst@gmx.net; bh=cQY4hRDbG/mN48nwz0CKJd9xVLzJCWuo9bxt0VUNn7M=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Q3BGSdC33AdlS6K3Wjc6qL3k8rkqCxFIjApQmQZtLA8bZNKO5lBeePM/AW6+vPnj 7tmveOOaisZXn61VZzcrsln7vheDCE/l402/awC3j13XTW7RV8nuYwZGVFt+IhBAG OYQoSOA+1saXQghSbgACYDk2klyQCFupP33779uAUy+uIGODvnwN9la+1tMF67ExE EKgEn2/rlnAbg6tk6nzrRnTaAgMVxyFEwD/UXZZaCaicWQ7abSxrJc5cnJf2BTu/K yesB+NnQVQyMfg1IRIyVgw6dOg6rdUWKVcmKcIqaKkiqzGVZq1aesUYaOggiG+0PE oFKR9r4IKkdBBUZSfQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from stefanw-SCHENKER ([37.4.248.43]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M9o1v-1skRRX0OZx-004SBn; Wed, 21 Aug 2024 23:41:06 +0200 From: Stefan Wahren To: Russell King , Doug Anderson , Florian Fainelli , Ray Jui , Scott Branden , Maxime Ripard , Jassi Brar , =?utf-8?q?Ma=C3=ADra_Canal?= , Greg Kroah-Hartman , Minas Harutyunyan Cc: Dave Stevenson , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Lukas Wunner , Artur Petrosyan , Peter Robinson , dri-devel@lists.freedesktop.org, bcm-kernel-feedback-list@broadcom.com, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-list@raspberrypi.com, Stefan Wahren Subject: [PATCH V3 2/9] drm/vc4: hdmi: Handle error case of pm_runtime_resume_and_get Date: Wed, 21 Aug 2024 23:40:45 +0200 Message-Id: <20240821214052.6800-3-wahrenst@gmx.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240821214052.6800-1-wahrenst@gmx.net> References: <20240821214052.6800-1-wahrenst@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:SYu0atATSJi2LLtaA7iRfrykbMjC2ntZZhlC8BBQR4Dd43fm7p+ QGnzklCAc4BcEn73hukgPfVICFvTqZthCMrwpPOCva73I95NfjwMBDE3E3GwbGlLDiKfWYg wJ96yCe1GE5wrSAaynrcM3SFwQ+Yd09Hjd8cq6HUQDPk8hcInxZhinJ8tpE3IgkbeVWMoPW c47SpLu7fWMhRl+HKmLLQ== UI-OutboundReport: notjunk:1;M01:P0:m6ph2I7d/Tw=;IQD2wlv8W4JjTviZyvck0CjTTpP IORoRISPPUYiEiPw6NpEQrCRxLivACeKQ0K8UAG5syeleRnTuYCqY7xotNFXVPex3tL5abDI8 6fjTqrnrpeplbdzzynv+qAVzFCDF2ZgObTVeMjSgZWz8E9hFwrws4v8wVyE1GDWuo1rv91iPO ta5EWGuU+NyqtUZgJGqj8KuJ4HKmzdHnaiM6UF2TvmT+XDRFmHwfefH0mz6kG1ofvKgNF2C3B ORPvT99rIJvKrFqHhm+0fSLTpEPSekDm4uxI1wWWaSL/6myffjIaYdY+kTHMX+sQvDDEqHAhZ RfFFZr+wm2gn+vueXHtJmMQHY6RP5Ko8yGnb5jhwWopdUkx4mFUEkCs3UWl9CdOhYKA/Hk7E9 nDcmbrSSwnuKHdnpiAOi84KO650WyTCNCzFYtc1FWsGPXZgr/uVlZufKZMJT440G8Uo9YbkQJ R+nLfXE/p7bLYniYyfAnkMzwxHNpIzpwAFWpQQfMiWG2x8KpQ2j3Fa0p4ZqFqtcy35UA1RKZ4 h9ktNqF/cydg0G03AdA0bGS50UdOM2PxHc5UZ1rCT13M3jV0InulmIURsfMosnmlog7hYQ9Lz wEePvecFIcCJyyIXDxIEOf2YKlRQdssOTcc7k4kr/XNvz3U1Ka4K6YL53eDNySPtRBAxuif4G g0fjf4I0O2BamvlVYDMi9Dqlkq/LvI7dXNKX0x2Y6I0sPq91Pmp1zq1Uvl9F9gmHEs7YQGHae TrrwfmUpW/U6U1e2SdKOKxjVO6JcJHU+SsMhtn+y6zpRtNCmK6LKqnEc8ZxTARhzLzIKDLiXO v2az4Ax0zYQX9CmaFXDo5V2g== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144128_265390_52C8A71E X-CRM114-Status: GOOD ( 14.16 ) 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 The commit 0f5251339eda ("drm/vc4: hdmi: Make sure the controller is powered in detect") introduced the necessary power management handling to avoid register access while controller is powered down. Unfortunately it just print a warning if pm_runtime_resume_and_get() fails and proceed anyway. This could happen during suspend to idle. So we must assume it is unsafe to access the HDMI register. So bail out properly. Fixes: 0f5251339eda ("drm/vc4: hdmi: Make sure the controller is powered in detect") Signed-off-by: Stefan Wahren Reviewed-by: MaĆ­ra Canal Acked-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) -- 2.34.1 diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index d57c4a5948c8..cb424604484f 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -429,6 +429,7 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, { struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); enum drm_connector_status status = connector_status_disconnected; + int ret; /* * NOTE: This function should really take vc4_hdmi->mutex, but @@ -441,7 +442,12 @@ static int vc4_hdmi_connector_detect_ctx(struct drm_connector *connector, * the lock for now. */ - WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); + ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); + if (ret) { + drm_err_once(connector->dev, "Failed to retain HDMI power domain: %d\n", + ret); + return connector_status_unknown; + } if (vc4_hdmi->hpd_gpio) { if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))