From patchwork Sun Jul 28 11:41:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13743908 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 93A3BC3DA49 for ; Sun, 28 Jul 2024 11:49:30 +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: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+RSO60HpkoAR0KgK8nLHKjh1dUUkKYc0+NfSi30ZRwM=; b=NgNo8v8wE9IWw1/uawDdgUSm0B IB0+W4L58VdEGRoQ+vRztGfyfOEBZgAFTq7GlRW4gyE78b8p04pqnMD7NSOVyi2IDZp3n/Econe6U 9J5ocN8lnu2W9JrQdOGdcOrtX8jaCNtTW1qZMD/tCYr01fSup/juRg7QNq9rCl8JMC4aWB67Nk6VD Q3hLf3zmo1z8hhEThMb9cPs2oDO3G/6Ng/1GUiqt5cmwKf+SPBmvAXZ6tdBv+krJMLwNHiYYNmYp9 vLFMXpc2uEf3Er9IFGIipOwxKEpruEjAeB8As9UD8iE05nU0gROMl16DBZCrErxqFV5j/DVc2h4Nx UhesFTJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sY2Ot-00000008OaA-3ocS; Sun, 28 Jul 2024 11:49:19 +0000 Received: from mout.gmx.net ([212.227.17.22]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sY2OT-00000008OXB-2pBW for linux-arm-kernel@lists.infradead.org; Sun, 28 Jul 2024 11:48:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1722167305; x=1722772105; i=wahrenst@gmx.net; bh=+RSO60HpkoAR0KgK8nLHKjh1dUUkKYc0+NfSi30ZRwM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=Bf4mnsNpb7eas1zVdSt9O0PprDA5z01alB4vNWXihMPMCU38BakZXxnHECelpiMH 2kjmYl6h0EaS/ssuLHE7d0J+GP3K/zMjoguo4RvevFn9e9b83XiIVIZ+MInXhwIih Wd9xYe3MJbWoCLqzOgdOSUSAXu3LdndrC3EqMuxGRyJVg6K/P+yGgPOvbTrfxHSvy Gk3+d2av7WZheuE+llGET9W0drR73RISvn9qlMD7CbEkrMju48ifHNK4O2/JNQpGz NdGyM2vmJcFWrGKGTUB2mFb5JHYTIXrnATKDvnvWUAa2bc/5Uk77NamxVQ5QBjL8J UZ+DIh/ESW78Ms62KQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from stefanw-SCHENKER ([37.4.248.43]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MBUqF-1sQ2qN3JSp-008ATd; Sun, 28 Jul 2024 13:48:24 +0200 From: Stefan Wahren To: Greg Kroah-Hartman , Florian Fainelli , Ray Jui , Scott Branden , Maxime Ripard , Jassi Brar , Ulf Hansson , =?utf-8?q?Ma=C3=ADra_Canal?= , Jiri Slaby , 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-serial@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-list@raspberrypi.com, Stefan Wahren Subject: [PATCH V2 06/16] drm/vc4: hdmi: Handle error case of pm_runtime_resume_and_get Date: Sun, 28 Jul 2024 13:41:50 +0200 Message-Id: <20240728114200.75559-7-wahrenst@gmx.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240728114200.75559-1-wahrenst@gmx.net> References: <20240728114200.75559-1-wahrenst@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:L7OrAzJpv8XxwcKtjfsgVpdvZhEK3mZJ0zOlR3NCxGwCNbbV5LC 8cqO/xoX4g564Y7hTk0eAm3PoETG0D8w2dBEDeMSYKCeSCR4sini4theANuPxmpissjbvgY jszIeE9YldH+vBI4cyfjzh3g8NavBM+EZf1cTEcZUKng2IT+dSN04cUnsyTbc2fRUJOO2UF iYy/6Tvbb9HwH9/EQQlhw== UI-OutboundReport: notjunk:1;M01:P0:AkUL9GoOT/M=;JWUAOx/K56tKZf3lNCIdFDNa411 a3BJlA29z65QTlZp1VV7P5OecrH6EtgTs1QxhRirqH4yJftA6EmHaaTHgUH1o+QPmMQR9TIws b3Zmc0y5k8N6Gy5ES9SRCwlLtKDaFPAVIknJYBQWwu1wGf4uHywl0ZU3VFLVyl3uVfDQxVw6j 39PM6AuDu61lclmaWdJQ3z5mI0MhYC9TH8NmLzJkGq/oO9zrxYBtSk5RVs/n29fhSb/TU2Irh vW1n7S8IS9+eChB5CwueQsuiRE8PFKppR3/uSS07BSz7yGjuYcecTyRdh77H7r1NiWo9OF5Yi L3bOSbZdFcfprp99zfJQFb+6zZlGkLkh1zN+H0qJLR2OfkWjPlsgVF7AkTRHXKLQRiv9oIhDw os3dq717Z8lWQIFAr+qpUQbzui2gVBHQunPls36WvmJSyExoAF4KlZBo2Huc85bQTuyrR4txO swquAlNSMF6WqyNvZomeQBUMn9dum7M5FBDpTJ8qjRQzOPkW1jiz4nm08TQCegAu6YT8XpIIN NZED1j48KVunaXFZ+GZgpjuvFeH8ByJaXFn0Y/Xgt6QXbg9KcdXcERtfGARga82IOOpc8ov1m bc7PYRUhLmHLsUtU7UVNrE1r44KqlwYaXeTWpavkUOJQQsF58zrqCp2dBbj1cVb6LZwEOEEwA 6OyC7xLwMDZ6ImFtaafim3/QNkz3JTHjV61GvujcQNdfuDyAdOyDsxI0dvRySdPA7nGosuHKB gLBxcSxjiXDuEzeooJ4ejojkXxyORJMtruh04uHvHwd27G3V1rjL6r77gXKz010FmQPrskNTq zzJYpbdp+9cfeMKeTZnl+Sag== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240728_044854_027284_631472EE X-CRM114-Status: GOOD ( 14.06 ) 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))