From patchwork Sun Jul 28 11:41:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13743910 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 9D577C3DA64 for ; Sun, 28 Jul 2024 11:51:24 +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=mAP5K6rjjZ9h+Kyxjb/TLxq8qO4pvkW+IrtXzsPAOy0=; b=ArBZUhj8kEGmHqlh/ExPEK1Tuq j3vtfk/o3TtBH1jUCVodPSM8/rHUDY4lLHlIKnpCV5zNn1G0olXYAS1zzosKNWAL87WUZrTT5QlMR 1xEnzn9FREaCgVATDI8Pk6T63/2b+KD04ZNjYCvoeHrp5kMnoEiAhwLpg4hjm4f+WhPn3N90VW+nl DtFiGtzkzbaGBw0rzZGTLi4YuYoFoOIrafUzTB6yH3sSwkZgyflTyxk6UW22pv69QnBQ5fA4hGKoL CzvqZ2jaFnSmR6O4IvrCojGAC1aFLHWp2BmwC7R5FPMASR9c5pVNyd/rIFTRoXbue56QpWWhjW+vY GhilBW/g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sY2Qk-00000008Oq7-24iU; Sun, 28 Jul 2024 11:51:14 +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 1sY2QK-00000008Omy-24K9 for linux-arm-kernel@lists.infradead.org; Sun, 28 Jul 2024 11:50:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1722167429; x=1722772229; i=wahrenst@gmx.net; bh=mAP5K6rjjZ9h+Kyxjb/TLxq8qO4pvkW+IrtXzsPAOy0=; 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=LfxGG3lOy6OxRESct9xiOlbE9Z2Y7Nr1g7apwiIVOPtmlfyXpEGmRGAF4LVJXdfm e9xl9QbkbyD89gE7aw9p2pfUPkzydUiX6xiLz2OfbiRy58Z/np2LeSoC2xU/zyRkP S74j/EZ76q1ZWncvp86yp3zwcL72rTSY1pYeTnMLS5ZZ6VfHJV4P06UCjnalHIm60 N/mk1g+3s0cxFMtRLjSCFAzhHzb6kHGltNSpvqLlFCDGsxCXgc2soOcAWd/KoJMBy KWvDBAgQwozvg3R0aTEslbrwwO3UGuwpD9mZiV2gZs6LkqkpEMyKm20xkn/3W8rSB /9eNns3wUz/Po9OnOw== 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 1MNsw4-1swITV0az2-00TM6x; Sun, 28 Jul 2024 13:50:29 +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 08/16] drm/vc4: hdmi: add PM suspend/resume support Date: Sun, 28 Jul 2024 13:41:52 +0200 Message-Id: <20240728114200.75559-9-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:6d0dGDGm+dLjlwAyJtKK5CyUIflHh+zg4bpcrw5lentD0RqV+R1 BBYSPoh7fGH4pcoJ7loQRU3lQ9Fj9HRVJRjj92jVXX4mBACK3HAr6Y8CWN+g48h5EsSUVRR 3ngzvujax5a1GJEEcrVre8N3PmMKCp4W+Xeu8LH6NhOPMP3wO5ZRyb/O1s5TUC/pbJbgpYo Xi8a2Y2V4HYfkNGVXID6Q== UI-OutboundReport: notjunk:1;M01:P0:3fXImmlf+gA=;2OZ4akwS2nqG/5zVHPHoAraiCK+ skDAInbpKJEO9b6cdbrtpQCGtX7esVnV1uKbTnWfnMpK3at1CcyS+FFtNf3qV0Hp3UiNtB9lx CsmODXFfmsqc+LxnwxHxMLn2RRfxU3HFw9zidk65IRlsCNhv4ia7r4VUynLafkkyga6k2jhrB bmwy+slj4yYL09a2Aiv7spuHAZPI9i2Za0pgOU3UOq1AMKsTREkfO8sEPeRGxZwHmsBDLwz0z cSAqgk0OiR1PyjTX/ks0HfDZeUTDKFp3JboK76ggi2EQDSHPwcoBFelm39oq0nBOj/ceG71RL b2kBUnqkMZxsXTRBpIPDSDFk4NA1SjbEQDVDr6TXcBLghnQGjGz/OmSbDsBsnuMi1gVezdOGs YUla1A9n3EyeKNo8LDaLKsyLGVMhgGa/3+oM8TRzHcVMPRUKhNvYbfKvrO8k4sdva5zwTJlmW qE7UwFkBLlgBwKPgdUuiq9dYRl3VhnBFphxI+se8gXYf+1zoQdl6pDcRlb/epnW5exFFmFrKO B+nD0UrQWc1oNmfCmrP09ow1gYsN53+YtCZU8P1bwc7nKT71oVxEfgcjCqrKX3m9nr9jZ69dg gckazYUylKJkNBrGbAcGsT82fEZmggIKEb25QJoWoKz6BkTxeAXB8Yd6cQjSUqOShhJczO280 fH7YNLu5vbE12Stt1cdICidCZMgYZ0a0LvgUnDQdn7vNqCrvuwZnXambSBj48KxQXPbtZWOd7 YQnMxI5c3LIgZBgA+RhunTOXAV9kxFKPD6dTqQXZU+ymGNGd2yIgqLHfxLR47jwQXiV7UPvGu bthSAKzbrTVOL14sBy8K1hxg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240728_045048_830963_D5B9AD00 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 Add suspend/resume support for the VC4 HDMI component in order to handle suspend to idle properly. Since the HDMI power domain is powered down during suspend, this makes connector status polling pointless. Link: https://lore.kernel.org/dri-devel/7003512d-7303-4f41-b0d6-a8af5bf8e497@gmx.net/ Signed-off-by: Stefan Wahren Acked-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) -- 2.34.1 diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 6611ab7c26a6..f7a4ed16094e 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -3104,6 +3104,31 @@ static int vc5_hdmi_init_resources(struct drm_device *drm, return 0; } +static int vc4_hdmi_suspend(struct device *dev) +{ + struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); + struct drm_device *drm = vc4_hdmi->connector.dev; + + if (drm && drm->mode_config.poll_enabled) + drm_kms_helper_poll_disable(drm); + + return pm_runtime_force_suspend(dev); +} + +static int vc4_hdmi_resume(struct device *dev) +{ + struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); + struct drm_device *drm = vc4_hdmi->connector.dev; + int ret; + + ret = pm_runtime_force_resume(dev); + + if (drm && drm->mode_config.poll_enabled) + drm_kms_helper_poll_enable(drm); + + return ret; +} + static int vc4_hdmi_runtime_suspend(struct device *dev) { struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); @@ -3405,6 +3430,7 @@ static const struct dev_pm_ops vc4_hdmi_pm_ops = { SET_RUNTIME_PM_OPS(vc4_hdmi_runtime_suspend, vc4_hdmi_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(vc4_hdmi_suspend, vc4_hdmi_resume) }; struct platform_driver vc4_hdmi_driver = {