From patchwork Sun Jun 30 15:36:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13717176 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 E75D3C27C4F for ; Sun, 30 Jun 2024 15:38:17 +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=g8bLwDV9vv1b9MjKzssmd/pW+2/RUfnLBRsyg8CTzsY=; b=PIv5ElQObmZr9CD0NlZMjYXzLz 71Q5U8JwHNn/k9ZYi1m+rlQxy7HKqTD1Uuxje3mD/iH+qhbsyeiExfwrAQrR/ObCqcF2KIAcq6fLp LLN9GE74jMWSBp8c+WhSP1zf7MzBxXUSgXiwXw0Z6YHMGBgRVHrHMgkblvz9syj1dz3cbz/3DN2Yx nGhHVpgaLPIa1wiNHzFEcYWB/AmUtsZaRCxE2GgKFMQVO/DGY8TtssEVH1gUf/5T0IvZtz26NOeb0 xEz8zzR28Kpsa9zDDK+tgmqPxygzqFfPjivDfEhmQPOdCw4uldYTO5GwfZyacDcRLIxOUtHPtAoTk mAia1qEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sNwcz-00000000caa-0Egq; Sun, 30 Jun 2024 15:38:09 +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 1sNwcZ-00000000cOA-32ii for linux-arm-kernel@lists.infradead.org; Sun, 30 Jun 2024 15:37:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1719761843; x=1720366643; i=wahrenst@gmx.net; bh=g8bLwDV9vv1b9MjKzssmd/pW+2/RUfnLBRsyg8CTzsY=; 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=qGzzQJuBaoggAKtGrq8PdHltRSA+ZJEhsqNuVhNzZ7MQcWP8si8dNNOFewgGaY2V gWpQ00aFkvrLUmT0LBVQ+F4yCN13o4Tz1Y3UKNJRDjdCjSSsDZC1BH735Kai3h3w+ rk3PMPpUEgDIQiSkPhkC/hfNCOTtFzDvlUR3Z4cA7L/D5JGH2uW7bOrJY0vb4+XLA V7qg7FixqNeYnMJG2D8YBiRu+HVuQctHjVzNFxK/eVuJn7GwAAMMiwKjrDHJ4DKbC GYlvj5QwZoXr53rdnD7ZeRDj2Kjv5xYcittddBB3CkdGU6ajJ3ppiiMAKI3tONvW1 92nnXAbToM6oKfs0sg== 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 1MoO2E-1s4DqU34eG-00qLoN; Sun, 30 Jun 2024 17:37:22 +0200 From: Stefan Wahren To: Greg Kroah-Hartman , Florian Fainelli , Ray Jui , Scott Branden , Maxime Ripard , Thomas Gleixner , Jassi Brar , Ulf Hansson , Jiri Slaby , Minas Harutyunyan Cc: Dave Stevenson , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Lukas Wunner , 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 06/11] drm/vc4: hdmi: Handle error case of pm_runtime_resume_and_get Date: Sun, 30 Jun 2024 17:36:47 +0200 Message-Id: <20240630153652.318882-7-wahrenst@gmx.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240630153652.318882-1-wahrenst@gmx.net> References: <20240630153652.318882-1-wahrenst@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:o69+hBbDReia1Doo4Ua3Ap4tjIE5FyVFPvweuwOPKrNdWE2Eyje By+/XWKIkUjXGa4HdY4rDd0THstR9kLGO9WtHySi849Aq8O8XA0QTYI1kuLhjGrc2pDXAxV Rnq+qCbeXhbq0oaML/vuatyAXa3F2q54Y4s7gx1Ss/AqUnBGUfUaCMExkbfCYl2qMowQT6N WX1CXhGE/fU4mw+tKg2WQ== UI-OutboundReport: notjunk:1;M01:P0:NDt+LCOQYCA=;vGODWVysfJmV2IQbHHklMS9vJx+ SH7O3KrTaP3EhoIqV9fGlnhmH1+b2Vsd5E8JUkyUXWNuYj49dgZEmD3sVKNIfy0rGA+BnSlWw bohaFfTzLm2qMSEk7ZVuTxI2/4Lj9Turh4sXwHzZXbDKwGryOu9G4Wn1K6nM9DLGWI8fYKni+ JB1iC8/9Z9V7TRVxIflCDnThLTRzTaTdD5fo2j5y7gt+B45duZ31yTl/TNDteYbb60A93rUFH zOCUwgZDoeXomGbFRSmQMWoGsvSW+BFrctwUI2hb5w09h1HmDv6/y3e489MdKlzdIInBbgjXM t1mQaOl9TK5roixBzDXdkfI6mTKUyVKe94lF8ZFhhvhMSvyduUyQ4rD597w4HxpL1b4/EuhK7 QuuYuAaaOwjes5WRORS7XYJ2mz3ESub7m2b0usrX60HKbN5rwnB2LRg5OKYEcSsiEw9BLyC+6 Er/CwjWf+DKk46xsVdblADf8B69FeIzmorRUxV7Er69s3IFCsqVXdd0BqdmR7dYIdVSlUsdb7 iHmz7H2iOPnXWNjGivMU1ywfwOhhXj60wPm+KyPeb18Zsu6TFstx8ygeAFs/LT2AY0JYsQnoT W9rJTjSXavcMUUJv1YKPHKrEimrOvJaTexrnQe0FjRthC/A+CS18vSrvYaDllq2ORmwb5S8iW Vuc5ROWWSMRUMA6svk6Sr/jXiTvbHgGt3snp/5FxNbj6wQggN2s8MMOmirkmiASRY4qwkbZXh KnidWOdaabSuyzvjoHdtonCXhTOf0CLtU/4ma2QsW25f1YffG/OGbbQUdgfgHhGOXF54/yu92 pXmAaYiNa1gDdD9DzH8TFRt8ve4lC2EZI2XvW8a9g4ZVQ= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240630_083744_130545_02FA7887 X-CRM114-Status: GOOD ( 13.28 ) 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 --- drivers/gpu/drm/vc4/vc4_hdmi.c | 7 ++++++- 1 file changed, 6 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..b3a42b709718 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,11 @@ 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_ERROR("Failed to retain HDMI power domain: %d\n", ret); + return status; + } if (vc4_hdmi->hpd_gpio) { if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))