From patchwork Wed Aug 21 21:40:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772096 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 0576CC52D6F for ; Wed, 21 Aug 2024 21:42:27 +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=IbGjewfMVvYXbrFbwzubZ45vd9Gh3tFpLWbhBJeYuoI=; b=0sZl3Q78J4m5wZjHRLG+ZWiSPb hwVI6+4+Xs306alY2NxkNuY5NUlSr0DPXZybbRJ7kCsR2Z+R0Q0eL1KynGai1D1vTpCg7C/poMtHB tYzMcNq0Zwm6dtOngdtjjaxxvb1uyh7ydR9N8luOGaiiWe/0tBWmvqzkO3rMfWNLJpJsSMqf1WyE9 knaJKJzMhdwlTFfu+m+d62figEBEwtOJQUkpFttBnIkeFfl24tfKPuk6gtywK2MLd8RFasWIJLxsr x3G1qslbUaVopgAiZcLPo0Zpfjc9IKWCoQaO/K7Z0SpWokZqsyMe/EZCE8AaDkTUeJXfFcBMFby8V MVTsOdGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt5r-0000000ARRa-0qXs; Wed, 21 Aug 2024 21:42:15 +0000 Received: from mout.gmx.net ([212.227.15.18]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt55-0000000ARES-0skh for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 21:41:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724276465; x=1724881265; i=wahrenst@gmx.net; bh=IbGjewfMVvYXbrFbwzubZ45vd9Gh3tFpLWbhBJeYuoI=; 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=NKWtp8ZEQ6mzpsbeG9vy+n0d59v7F1XtuK+/PFazbByxFfjvMdq4crvcdJHz4U0b VnJ09qbsMIdxHdUVVdbRjhIZZ9vdASHOWmOs0vrRevT76+ezgC6ksTIJHrILymTkX IGyoK3ixIKruTQ/SedKVlv4cDhuG9800RXIpmM0nuCTvBys1bWIp0jDtc0+Vbpuw4 oXQa7cW8dh7I7n7eYe4EdAHz4LvgxpVDX8nh5aJiXS1IEVmgdCaA7xyLvRgZzDxyy EILzvgAvUcCXuT2+6W5zddu+WoDhj9p5KSD38ht8OVvCpB1eHbpoG0CQgmUFA++l5 PN05yUDnkbYhF7rEBg== 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 1MCbIn-1spReE0Nz1-00ASCL; Wed, 21 Aug 2024 23:41:05 +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 1/9] mailbox: bcm2835: Fix timeout during suspend mode Date: Wed, 21 Aug 2024 23:40:44 +0200 Message-Id: <20240821214052.6800-2-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:Ps0daNFio1td97HjGTIDdopoApycSfa8qEfrfkoFZ4k/zzsd4TR wh+HRKwaAmNSD2cF+626TBdV8+DAqDQ2FNzganb2joUii7lzPv7UFjB4bNUHTi8UJksheQt 5U53WMIb7T/vsiG9v8jj0YNO0Xfj/G2c6xOOUmro8R0JtipHaY+VYz7F8qWrBgx7YHCzOsy CxyXiky9R66N8L7GxhjSQ== UI-OutboundReport: notjunk:1;M01:P0:U16rvxg5ux0=;g/2hdCvWDWc5NREG2mi0oVON4Br PiGxu4pgvJ82XvwpCw6YcxKbyU3dR8bGrFqZ1sj6xVULooPQlJ2KZRzkqXJdj1z9AOHE86ZDx Cyp71JGEgKzUz2wyg0GL40ci+R8tPyOO06mD8/CJJPdefznxYaXI+4aeGtDvgM6sZIGUWk6/P +VxNJf6V6ZvjyPK51RuBnoH+ib/Mex3Nzloyo5ICa3ON2U5N9tXwmbeieQ2SNu8UDkntHhMC4 sTRTMIYh7GspMJ5M2BULxnhBELpXZUSo1NQiENV+Nok8exR0fuq1diTaMcm2qfUecuPtiSt3L M3vRKHWRjkfLWFXxcudklrM6GZehddpilcVfMCYeI1HO9P0Qn9mijRSHL+k7sbmpahAnT2f0T bLvpVDH+BtU7nZrza1Vpct/D3IGGxFTGd6mk0oCvjME2zR8Q7pVL8/5MDb2Qd9ibvhjbqjTuR lrmCWMlkN/OfNM7BGQOi+PX5I0xoUcipIPNiPImbAf1brOVsiwoQPVTy+zV2zsUEgDpmqLUyf Zdh+/fJzcWhhnM+yPDUUwzXSOf5Vx7iQXXLP8dVOfx82tLZrEwMIX0j2x1OO6d4+QoborAYsr b+oQsYlmm/HTgJZldCnaacFTBY8rCGtNDE0C4T2eoIf9Y9PRJ/jZZZYMAbLdIx1y5voRKDBwB LGeUSK6xkbVXLAIO4Kxq+JUKF/r+2PsJpVwfcc6+akSiegmgyCro1VYKpjDfXWjOQi3q/8GY/ V5u0d3G5lhrLOhB0PQtKZ+SGV2zAVA75hxNzinI5fO1H47TlZxGkN1dsoOyrMXokZ7ywo1wSw /4A0+iC6kO67nbcjq/DK1NHA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144127_599396_2CE00576 X-CRM114-Status: GOOD ( 13.90 ) 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 During noirq suspend phase the Raspberry Pi power driver suffer of firmware property timeouts. The reason is that the IRQ of the underlying BCM2835 mailbox is disabled and rpi_firmware_property_list() will always run into a timeout [1]. Since the VideoCore side isn't consider as a wakeup source, set the IRQF_NO_SUSPEND flag for the mailbox IRQ in order to keep it enabled during suspend-resume cycle. [1] PM: late suspend of devices complete after 1.754 msecs WARNING: CPU: 0 PID: 438 at drivers/firmware/raspberrypi.c:128 rpi_firmware_property_list+0x204/0x22c Firmware transaction 0x00028001 timeout Modules linked in: CPU: 0 PID: 438 Comm: bash Tainted: G C 6.9.3-dirty #17 Hardware name: BCM2835 Call trace: unwind_backtrace from show_stack+0x18/0x1c show_stack from dump_stack_lvl+0x34/0x44 dump_stack_lvl from __warn+0x88/0xec __warn from warn_slowpath_fmt+0x7c/0xb0 warn_slowpath_fmt from rpi_firmware_property_list+0x204/0x22c rpi_firmware_property_list from rpi_firmware_property+0x68/0x8c rpi_firmware_property from rpi_firmware_set_power+0x54/0xc0 rpi_firmware_set_power from _genpd_power_off+0xe4/0x148 _genpd_power_off from genpd_sync_power_off+0x7c/0x11c genpd_sync_power_off from genpd_finish_suspend+0xcc/0xe0 genpd_finish_suspend from dpm_run_callback+0x78/0xd0 dpm_run_callback from device_suspend_noirq+0xc0/0x238 device_suspend_noirq from dpm_suspend_noirq+0xb0/0x168 dpm_suspend_noirq from suspend_devices_and_enter+0x1b8/0x5ac suspend_devices_and_enter from pm_suspend+0x254/0x2e4 pm_suspend from state_store+0xa8/0xd4 state_store from kernfs_fop_write_iter+0x154/0x1a0 kernfs_fop_write_iter from vfs_write+0x12c/0x184 vfs_write from ksys_write+0x78/0xc0 ksys_write from ret_fast_syscall+0x0/0x54 Exception stack(0xcc93dfa8 to 0xcc93dff0) [...] PM: noirq suspend of devices complete after 3095.584 msecs Link: https://github.com/raspberrypi/firmware/issues/1894 Fixes: 0bae6af6d704 ("mailbox: Enable BCM2835 mailbox support") Signed-off-by: Stefan Wahren Reviewed-by: Florian Fainelli --- drivers/mailbox/bcm2835-mailbox.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.34.1 diff --git a/drivers/mailbox/bcm2835-mailbox.c b/drivers/mailbox/bcm2835-mailbox.c index fbfd0202047c..ea12fb8d2401 100644 --- a/drivers/mailbox/bcm2835-mailbox.c +++ b/drivers/mailbox/bcm2835-mailbox.c @@ -145,7 +145,8 @@ static int bcm2835_mbox_probe(struct platform_device *pdev) spin_lock_init(&mbox->lock); ret = devm_request_irq(dev, irq_of_parse_and_map(dev->of_node, 0), - bcm2835_mbox_irq, 0, dev_name(dev), mbox); + bcm2835_mbox_irq, IRQF_NO_SUSPEND, dev_name(dev), + mbox); if (ret) { dev_err(dev, "Failed to register a mailbox IRQ handler: %d\n", ret); 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)) From patchwork Wed Aug 21 21:40:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772100 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 35439C52D6F for ; Wed, 21 Aug 2024 21:45:21 +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=opDy7pF2rrAJWQtd8nsB68ywH9cWiZDKeqAKvEPJhjI=; b=f34PiavLU6cIUI38D/OOci/xBf nQO7ReSN618yjNtDb2fuEbS4JeEeL8vVbgA7EOLz+D9lk3F0Wy94BWrIpTAnPpxCtA+El9vp0D0p5 i39sqC98fnoj/DexSIuAKdPj0LSNM6mCuoJJAkcLxm421E0Ksu0nbzQ9dHtCYXINpB5aROnvc8e78 7q7RQO7XvdlcqR8IYIi7gK3f6DTF6JK8vZsDWEvbyZ60HUCNjrG08AJ2rDhzGsxNBL9PjPsGVdD5c DmqRtrVSCkP7/dsPEibr1WT1gApo1WVwYrNxxJtbqpIoEiOcjsSPgEEJxe5y0hQIi2Ix9OTlCsJYM GToGy1DA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt8c-0000000AS28-2FYf; Wed, 21 Aug 2024 21:45:06 +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-0000000ARET-0sMm for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 21:41:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724276467; x=1724881267; i=wahrenst@gmx.net; bh=opDy7pF2rrAJWQtd8nsB68ywH9cWiZDKeqAKvEPJhjI=; 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=XWqL5fXkjFIs1uKkpyou2MKpFx7vetwYAF+Gyn3iCKpaOvQSW8/0J4AumI5qtNBu KjcqmpvsN2OrvXZAl5k5j4CtAGW/Bpl1Z09eWF6MdxcMZNpEb9gh8JGrFVnb1Tw60 OVJnM407gGssmgfl1fUJnIh5cVpQtL6Hd8fBAw9OeRmKtN9L4tlXEm0WpwkQhqHrn KdC15TlrG9dp7Ot1lt6EnPEvfiREUBietUWTPCUsD+kNgo8MrjCN3/snfNLqRr9Y/ RuonLB+UNYv85eHfuBgysyJ1KSZEeux9OJoCp7TgZ/f9B3+W+JIJps7maYLYuSVro 8sjh5wpa+ve1wQ4c3w== 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 1MfpSl-1sEfzm0erZ-00h6ON; Wed, 21 Aug 2024 23:41:07 +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 3/9] drm/vc4: Get the rid of DRM_ERROR() Date: Wed, 21 Aug 2024 23:40:46 +0200 Message-Id: <20240821214052.6800-4-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:ca/hYWr2pm8gV83euADaX7HY/R3/Kl+g0Hfeku2dp9Kju3jAYgs JW4T7cskVXpTMlGcIGOanq3abQ2JAtSjNlT9xTQs5JHcjqnffYb1Ir/ge+XnK00iTAQ0eTK S11SLQkiKlmHWNBMbPMTEOdBfDlMYzXOcoli/5Y9aTGNJo4pJ6t44Dr7wsr8zHobVuHG9cm K2HANo7OO8UskL387W8LQ== UI-OutboundReport: notjunk:1;M01:P0:9g1iJS+zxdI=;tTvbFJ54dNe1VJP7AEPUnfWOmN8 elqPm8MTOxnDgBbMuEedHww4xTRaq8K00AJnaHbYqrIIPz1XtXlsM/ootARHiSCWGi6TUiSQU H+0Eg3Un1XfEsFh1Xtq81jy0Iy9iioGvrKDyBWvmR/KvoC1ByWjksIyCR8QnxattoYO8FtqMQ 2cc09KpRl2sM2w9FwI3mmG4Nf5DalS7wXFHW2r3/HOVsHQCGCMW5MqAxJNz4A4hKBoc9U3f5Z KSIED5c3slpUQrHOEzSG4HfjCYBj5y5ICPsLv2rCykQqNXDeP3X1JjXL2peb6a8XscunqSCa7 BHh0TshbKmsUj7Qr6aj6VoL/tzFB5JPLITju6J6o084kkDNZzMWF4mJV9DehROunL8ab7+yrn PNELzuPEElxXAIQNn95o+P3JWNCHftKc0DIasXqajEyGs63tlb5P421fhqE01i4Db4xZdzFXi WSUi0gmrWUj4c3JZQYMKl0GMDrpgVJq7uk4zEmdABL0wQfZPYJlMdwJvSBXHx+xAReUWvp+VY EK8CfNV37c2HbCwQScxM09dryUYJREiWm4rQYkPvQ7FMl9COCN4SBHonTdSm65+ctsneOCkoO i8bApPf0cRqOAZyF1kMwLKEnA1jpfzBJdPi6KeRhOHSgN6t/NLKmMdfVVu+iEQBt5cK8Bsvv0 Pt4tw2efkypE3GN5hck+k0Nqp7s/3I15spmj56jCiawTXQ8ClMQ44QzJt6kLJA2uKqCN6bD1H VvXTrdXJ70GueFuGwWZvLMcPFNWXhN7YrFm7U9QO+t3nLn7YemjAObTJVEBCeEJcnDO6bH9mc OTfeUpXInRQFUimdGsLP9ejA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144127_682688_BE048E12 X-CRM114-Status: GOOD ( 18.40 ) 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 DRM_ERROR() has been deprecated in favor of pr_err(). However, we should prefer to use drm_err() whenever possible so we get device- specific output with the error message. In error case of kcalloc, we can simply drop DRM_ERROR(), because kcalloc already logs errors. Suggested-by: Maíra Canal Signed-off-by: Stefan Wahren Reviewed-by: Maxime Ripard Reviewed-by: Maíra Canal --- drivers/gpu/drm/vc4/vc4_bo.c | 14 ++++++------ drivers/gpu/drm/vc4/vc4_dpi.c | 14 ++++++------ drivers/gpu/drm/vc4/vc4_dsi.c | 32 ++++++++++++++------------ drivers/gpu/drm/vc4/vc4_gem.c | 11 +++++---- drivers/gpu/drm/vc4/vc4_hdmi.c | 36 +++++++++++++++--------------- drivers/gpu/drm/vc4/vc4_hvs.c | 4 ++-- drivers/gpu/drm/vc4/vc4_irq.c | 2 +- drivers/gpu/drm/vc4/vc4_v3d.c | 6 ++--- drivers/gpu/drm/vc4/vc4_validate.c | 8 +++---- drivers/gpu/drm/vc4/vc4_vec.c | 10 ++++----- 10 files changed, 70 insertions(+), 67 deletions(-) -- 2.34.1 diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c index 86d629e45307..3f72be7490d5 100644 --- a/drivers/gpu/drm/vc4/vc4_bo.c +++ b/drivers/gpu/drm/vc4/vc4_bo.c @@ -469,7 +469,7 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, if (IS_ERR(dma_obj)) { struct drm_printer p = drm_info_printer(vc4->base.dev); - DRM_ERROR("Failed to allocate from GEM DMA helper:\n"); + drm_err(dev, "Failed to allocate from GEM DMA helper:\n"); vc4_bo_stats_print(&p, vc4); return ERR_PTR(-ENOMEM); } @@ -702,7 +702,7 @@ static struct dma_buf *vc4_prime_export(struct drm_gem_object *obj, int flags) */ ret = vc4_bo_inc_usecnt(bo); if (ret) { - DRM_ERROR("Failed to increment BO usecnt\n"); + drm_err(obj->dev, "Failed to increment BO usecnt\n"); return ERR_PTR(ret); } @@ -1050,10 +1050,10 @@ static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused) for (i = 0; i < vc4->num_labels; i++) { if (vc4->bo_labels[i].num_allocated) { - DRM_ERROR("Destroying BO cache with %d %s " - "BOs still allocated\n", - vc4->bo_labels[i].num_allocated, - vc4->bo_labels[i].name); + drm_err(dev, "Destroying BO cache with %d %s " + "BOs still allocated\n", + vc4->bo_labels[i].num_allocated, + vc4->bo_labels[i].name); } if (is_user_label(i)) @@ -1083,7 +1083,7 @@ int vc4_label_bo_ioctl(struct drm_device *dev, void *data, gem_obj = drm_gem_object_lookup(file_priv, args->handle); if (!gem_obj) { - DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); + drm_err(dev, "Failed to look up GEM BO %d\n", args->handle); kfree(name); return -ENOENT; } diff --git a/drivers/gpu/drm/vc4/vc4_dpi.c b/drivers/gpu/drm/vc4/vc4_dpi.c index 39152e755a13..a382dc4654bd 100644 --- a/drivers/gpu/drm/vc4/vc4_dpi.c +++ b/drivers/gpu/drm/vc4/vc4_dpi.c @@ -199,8 +199,8 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) DPI_FORMAT); break; default: - DRM_ERROR("Unknown media bus format %d\n", - bus_format); + drm_err(dev, "Unknown media bus format %d\n", + bus_format); break; } } @@ -236,11 +236,11 @@ static void vc4_dpi_encoder_enable(struct drm_encoder *encoder) ret = clk_set_rate(dpi->pixel_clock, mode->clock * 1000); if (ret) - DRM_ERROR("Failed to set clock rate: %d\n", ret); + drm_err(dev, "Failed to set clock rate: %d\n", ret); ret = clk_prepare_enable(dpi->pixel_clock); if (ret) - DRM_ERROR("Failed to set clock rate: %d\n", ret); + drm_err(dev, "Failed to set clock rate: %d\n", ret); drm_dev_exit(idx); } @@ -339,7 +339,7 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data) if (IS_ERR(dpi->core_clock)) { ret = PTR_ERR(dpi->core_clock); if (ret != -EPROBE_DEFER) - DRM_ERROR("Failed to get core clock: %d\n", ret); + drm_err(drm, "Failed to get core clock: %d\n", ret); return ret; } @@ -347,13 +347,13 @@ static int vc4_dpi_bind(struct device *dev, struct device *master, void *data) if (IS_ERR(dpi->pixel_clock)) { ret = PTR_ERR(dpi->pixel_clock); if (ret != -EPROBE_DEFER) - DRM_ERROR("Failed to get pixel clock: %d\n", ret); + drm_err(drm, "Failed to get pixel clock: %d\n", ret); return ret; } ret = clk_prepare_enable(dpi->core_clock); if (ret) { - DRM_ERROR("Failed to turn on core clock: %d\n", ret); + drm_err(drm, "Failed to turn on core clock: %d\n", ret); return ret; } diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 46f6c4ce61c5..f5ccc1bf7a63 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -613,6 +613,7 @@ struct vc4_dsi { static inline void dsi_dma_workaround_write(struct vc4_dsi *dsi, u32 offset, u32 val) { + struct drm_device *drm = dsi->bridge.dev; struct dma_chan *chan = dsi->reg_dma_chan; struct dma_async_tx_descriptor *tx; dma_cookie_t cookie; @@ -633,19 +634,19 @@ dsi_dma_workaround_write(struct vc4_dsi *dsi, u32 offset, u32 val) dsi->reg_dma_paddr, 4, 0); if (!tx) { - DRM_ERROR("Failed to set up DMA register write\n"); + drm_err(drm, "Failed to set up DMA register write\n"); return; } cookie = tx->tx_submit(tx); ret = dma_submit_error(cookie); if (ret) { - DRM_ERROR("Failed to submit DMA: %d\n", ret); + drm_err(drm, "Failed to submit DMA: %d\n", ret); return; } ret = dma_sync_wait(chan, cookie); if (ret) - DRM_ERROR("Failed to wait for DMA: %d\n", ret); + drm_err(drm, "Failed to wait for DMA: %d\n", ret); } #define DSI_READ(offset) \ @@ -893,7 +894,7 @@ static void vc4_dsi_bridge_pre_enable(struct drm_bridge *bridge, ret = pm_runtime_resume_and_get(dev); if (ret) { - DRM_ERROR("Failed to runtime PM enable on DSI%d\n", dsi->variant->port); + drm_err(bridge->dev, "Failed to runtime PM enable on DSI%d\n", dsi->variant->port); return; } @@ -986,13 +987,14 @@ static void vc4_dsi_bridge_pre_enable(struct drm_bridge *bridge, ret = clk_prepare_enable(dsi->escape_clock); if (ret) { - DRM_ERROR("Failed to turn on DSI escape clock: %d\n", ret); + drm_err(bridge->dev, "Failed to turn on DSI escape clock: %d\n", + ret); return; } ret = clk_prepare_enable(dsi->pll_phy_clock); if (ret) { - DRM_ERROR("Failed to turn on DSI PLL: %d\n", ret); + drm_err(bridge->dev, "Failed to turn on DSI PLL: %d\n", ret); return; } @@ -1014,7 +1016,7 @@ static void vc4_dsi_bridge_pre_enable(struct drm_bridge *bridge, ret = clk_prepare_enable(dsi->pixel_clock); if (ret) { - DRM_ERROR("Failed to turn on DSI pixel clock: %d\n", ret); + drm_err(bridge->dev, "Failed to turn on DSI pixel clock: %d\n", ret); return; } @@ -1172,6 +1174,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, const struct mipi_dsi_msg *msg) { struct vc4_dsi *dsi = host_to_dsi(host); + struct drm_device *drm = dsi->bridge.dev; struct mipi_dsi_packet packet; u32 pkth = 0, pktc = 0; int i, ret; @@ -1303,8 +1306,8 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, DSI_RXPKT1H_BC_PARAM); if (rxlen != msg->rx_len) { - DRM_ERROR("DSI returned %db, expecting %db\n", - rxlen, (int)msg->rx_len); + drm_err(drm, "DSI returned %db, expecting %db\n", + rxlen, (int)msg->rx_len); ret = -ENXIO; goto reset_fifo_and_return; } @@ -1326,7 +1329,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_host *host, return ret; reset_fifo_and_return: - DRM_ERROR("DSI transfer failed, resetting: %d\n", ret); + drm_err(drm, "DSI transfer failed, resetting: %d\n", ret); DSI_PORT_WRITE(TXPKT1C, DSI_PORT_READ(TXPKT1C) & ~DSI_TXPKT1C_CMD_EN); udelay(1); @@ -1468,7 +1471,8 @@ static void dsi_handle_error(struct vc4_dsi *dsi, if (!(stat & bit)) return; - DRM_ERROR("DSI%d: %s error\n", dsi->variant->port, type); + drm_err(dsi->bridge.dev, "DSI%d: %s error\n", dsi->variant->port, + type); *ret = IRQ_HANDLED; } @@ -1687,7 +1691,7 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) &dsi->reg_dma_paddr, GFP_KERNEL); if (!dsi->reg_dma_mem) { - DRM_ERROR("Failed to get DMA memory\n"); + drm_err(drm, "Failed to get DMA memory\n"); return -ENOMEM; } @@ -1702,8 +1706,8 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) if (IS_ERR(dsi->reg_dma_chan)) { ret = PTR_ERR(dsi->reg_dma_chan); if (ret != -EPROBE_DEFER) - DRM_ERROR("Failed to get DMA channel: %d\n", - ret); + drm_err(drm, "Failed to get DMA channel: %d\n", + ret); return ret; } diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c index 03648f954985..24fb1b57e1dd 100644 --- a/drivers/gpu/drm/vc4/vc4_gem.c +++ b/drivers/gpu/drm/vc4/vc4_gem.c @@ -832,8 +832,8 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) */ temp = kvmalloc_array(temp_size, 1, GFP_KERNEL); if (!temp) { - DRM_ERROR("Failed to allocate storage for copying " - "in bin/render CLs.\n"); + drm_err(dev, "Failed to allocate storage for copying " + "in bin/render CLs.\n"); ret = -ENOMEM; goto fail; } @@ -866,7 +866,7 @@ vc4_get_bcl(struct drm_device *dev, struct vc4_exec_info *exec) bo = vc4_bo_create(dev, exec_size, true, VC4_BO_TYPE_BCL); if (IS_ERR(bo)) { - DRM_ERROR("Couldn't allocate BO for binning\n"); + drm_err(dev, "Couldn't allocate BO for binning\n"); ret = PTR_ERR(bo); goto fail; } @@ -1153,10 +1153,9 @@ vc4_submit_cl_ioctl(struct drm_device *dev, void *data, } exec = kcalloc(1, sizeof(*exec), GFP_KERNEL); - if (!exec) { - DRM_ERROR("malloc failure on exec struct\n"); + if (!exec) return -ENOMEM; - } + exec->dev = vc4; ret = vc4_v3d_pm_get(vc4); diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index cb424604484f..6611ab7c26a6 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -704,7 +704,7 @@ static int vc4_hdmi_write_infoframe(struct drm_connector *connector, ret = vc4_hdmi_stop_packet(vc4_hdmi, type, true); if (ret) { - DRM_ERROR("Failed to wait for infoframe to go idle: %d\n", ret); + drm_err(drm, "Failed to wait for infoframe to go idle: %d\n", ret); goto out; } @@ -740,7 +740,7 @@ static int vc4_hdmi_write_infoframe(struct drm_connector *connector, ret = wait_for((HDMI_READ(HDMI_RAM_PACKET_STATUS) & BIT(packet_id)), 100); if (ret) - DRM_ERROR("Failed to wait for infoframe to start: %d\n", ret); + drm_err(drm, "Failed to wait for infoframe to start: %d\n", ret); out: drm_dev_exit(idx); @@ -901,7 +901,7 @@ static void vc4_hdmi_encoder_post_crtc_powerdown(struct drm_encoder *encoder, ret = pm_runtime_put(&vc4_hdmi->pdev->dev); if (ret < 0) - DRM_ERROR("Failed to release power domain: %d\n", ret); + drm_err(drm, "Failed to release power domain: %d\n", ret); drm_dev_exit(idx); @@ -1443,7 +1443,7 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev); if (ret < 0) { - DRM_ERROR("Failed to retain power domain: %d\n", ret); + drm_err(drm, "Failed to retain power domain: %d\n", ret); goto err_dev_exit; } @@ -1468,19 +1468,19 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, div_u64(tmds_char_rate, 100) * 101); ret = clk_set_min_rate(vc4_hdmi->hsm_clock, hsm_rate); if (ret) { - DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); + drm_err(drm, "Failed to set HSM clock rate: %d\n", ret); goto err_put_runtime_pm; } ret = clk_set_rate(vc4_hdmi->pixel_clock, tmds_char_rate); if (ret) { - DRM_ERROR("Failed to set pixel clock rate: %d\n", ret); + drm_err(drm, "Failed to set pixel clock rate: %d\n", ret); goto err_put_runtime_pm; } ret = clk_prepare_enable(vc4_hdmi->pixel_clock); if (ret) { - DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); + drm_err(drm, "Failed to turn on pixel clock: %d\n", ret); goto err_put_runtime_pm; } @@ -1496,13 +1496,13 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder, ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate); if (ret) { - DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret); + drm_err(drm, "Failed to set pixel bvb clock rate: %d\n", ret); goto err_disable_pixel_clock; } ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock); if (ret) { - DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret); + drm_err(drm, "Failed to turn on pixel bvb clock: %d\n", ret); goto err_disable_pixel_clock; } @@ -2951,13 +2951,13 @@ static int vc4_hdmi_init_resources(struct drm_device *drm, if (IS_ERR(vc4_hdmi->pixel_clock)) { ret = PTR_ERR(vc4_hdmi->pixel_clock); if (ret != -EPROBE_DEFER) - DRM_ERROR("Failed to get pixel clock\n"); + drm_err(drm, "Failed to get pixel clock\n"); return ret; } vc4_hdmi->hsm_clock = devm_clk_get(dev, "hdmi"); if (IS_ERR(vc4_hdmi->hsm_clock)) { - DRM_ERROR("Failed to get HDMI state machine clock\n"); + drm_err(drm, "Failed to get HDMI state machine clock\n"); return PTR_ERR(vc4_hdmi->hsm_clock); } vc4_hdmi->audio_clock = vc4_hdmi->hsm_clock; @@ -3041,31 +3041,31 @@ static int vc5_hdmi_init_resources(struct drm_device *drm, vc4_hdmi->hsm_clock = devm_clk_get(dev, "hdmi"); if (IS_ERR(vc4_hdmi->hsm_clock)) { - DRM_ERROR("Failed to get HDMI state machine clock\n"); + drm_err(drm, "Failed to get HDMI state machine clock\n"); return PTR_ERR(vc4_hdmi->hsm_clock); } vc4_hdmi->pixel_bvb_clock = devm_clk_get(dev, "bvb"); if (IS_ERR(vc4_hdmi->pixel_bvb_clock)) { - DRM_ERROR("Failed to get pixel bvb clock\n"); + drm_err(drm, "Failed to get pixel bvb clock\n"); return PTR_ERR(vc4_hdmi->pixel_bvb_clock); } vc4_hdmi->audio_clock = devm_clk_get(dev, "audio"); if (IS_ERR(vc4_hdmi->audio_clock)) { - DRM_ERROR("Failed to get audio clock\n"); + drm_err(drm, "Failed to get audio clock\n"); return PTR_ERR(vc4_hdmi->audio_clock); } vc4_hdmi->cec_clock = devm_clk_get(dev, "cec"); if (IS_ERR(vc4_hdmi->cec_clock)) { - DRM_ERROR("Failed to get CEC clock\n"); + drm_err(drm, "Failed to get CEC clock\n"); return PTR_ERR(vc4_hdmi->cec_clock); } vc4_hdmi->reset = devm_reset_control_get(dev, NULL); if (IS_ERR(vc4_hdmi->reset)) { - DRM_ERROR("Failed to get HDMI reset line\n"); + drm_err(drm, "Failed to get HDMI reset line\n"); return PTR_ERR(vc4_hdmi->reset); } @@ -3221,14 +3221,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) ddc_node = of_parse_phandle(dev->of_node, "ddc", 0); if (!ddc_node) { - DRM_ERROR("Failed to find ddc node in device tree\n"); + drm_err(drm, "Failed to find ddc node in device tree\n"); return -ENODEV; } vc4_hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node); of_node_put(ddc_node); if (!vc4_hdmi->ddc) { - DRM_DEBUG("Failed to get ddc i2c adapter by node\n"); + drm_err(drm, "Failed to get ddc i2c adapter by node\n"); return -EPROBE_DEFER; } diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index 04af672caacb..2a835a5cff9d 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -191,8 +191,8 @@ static int vc4_hvs_upload_linear_kernel(struct vc4_hvs *hvs, ret = drm_mm_insert_node(&hvs->dlist_mm, space, VC4_KERNEL_DWORDS); if (ret) { - DRM_ERROR("Failed to allocate space for filter kernel: %d\n", - ret); + drm_err(&hvs->vc4->base, "Failed to allocate space for filter kernel: %d\n", + ret); return ret; } diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c index 563b3dfeb9b9..ef93d8e22a35 100644 --- a/drivers/gpu/drm/vc4/vc4_irq.c +++ b/drivers/gpu/drm/vc4/vc4_irq.c @@ -76,7 +76,7 @@ vc4_overflow_mem_work(struct work_struct *work) bin_bo_slot = vc4_v3d_get_bin_slot(vc4); if (bin_bo_slot < 0) { - DRM_ERROR("Couldn't allocate binner overflow mem\n"); + drm_err(&vc4->base, "Couldn't allocate binner overflow mem\n"); goto complete; } diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c index 04ac7805e6d5..6e566584afbf 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -471,8 +471,8 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) return ret; if (V3D_READ(V3D_IDENT0) != V3D_EXPECTED_IDENT0) { - DRM_ERROR("V3D_IDENT0 read 0x%08x instead of 0x%08x\n", - V3D_READ(V3D_IDENT0), V3D_EXPECTED_IDENT0); + drm_err(drm, "V3D_IDENT0 read 0x%08x instead of 0x%08x\n", + V3D_READ(V3D_IDENT0), V3D_EXPECTED_IDENT0); ret = -EINVAL; goto err_put_runtime_pm; } @@ -485,7 +485,7 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) ret = vc4_irq_install(drm, vc4->irq); if (ret) { - DRM_ERROR("Failed to install IRQ handler\n"); + drm_err(drm, "Failed to install IRQ handler\n"); goto err_put_runtime_pm; } diff --git a/drivers/gpu/drm/vc4/vc4_validate.c b/drivers/gpu/drm/vc4/vc4_validate.c index 7dff3ca5af6b..0c17284bf6f5 100644 --- a/drivers/gpu/drm/vc4/vc4_validate.c +++ b/drivers/gpu/drm/vc4/vc4_validate.c @@ -65,7 +65,7 @@ utile_width(int cpp) case 8: return 2; default: - DRM_ERROR("unknown cpp: %d\n", cpp); + pr_err("unknown cpp: %d\n", cpp); return 1; } } @@ -82,7 +82,7 @@ utile_height(int cpp) case 8: return 4; default: - DRM_ERROR("unknown cpp: %d\n", cpp); + pr_err("unknown cpp: %d\n", cpp); return 1; } } @@ -390,8 +390,8 @@ validate_tile_binning_config(VALIDATE_ARGS) bin_slot = vc4_v3d_get_bin_slot(vc4); if (bin_slot < 0) { if (bin_slot != -EINTR && bin_slot != -ERESTARTSYS) { - DRM_ERROR("Failed to allocate binner memory: %d\n", - bin_slot); + drm_err(dev, "Failed to allocate binner memory: %d\n", + bin_slot); } return bin_slot; } diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 070813b8aff8..eb64e881051e 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -557,7 +557,7 @@ static void vc4_vec_encoder_disable(struct drm_encoder *encoder, ret = pm_runtime_put(&vec->pdev->dev); if (ret < 0) { - DRM_ERROR("Failed to release power domain: %d\n", ret); + drm_err(drm, "Failed to release power domain: %d\n", ret); goto err_dev_exit; } @@ -591,7 +591,7 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, ret = pm_runtime_resume_and_get(&vec->pdev->dev); if (ret < 0) { - DRM_ERROR("Failed to retain power domain: %d\n", ret); + drm_err(drm, "Failed to retain power domain: %d\n", ret); goto err_dev_exit; } @@ -604,13 +604,13 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, */ ret = clk_set_rate(vec->clock, 108000000); if (ret) { - DRM_ERROR("Failed to set clock rate: %d\n", ret); + drm_err(drm, "Failed to set clock rate: %d\n", ret); goto err_put_runtime_pm; } ret = clk_prepare_enable(vec->clock); if (ret) { - DRM_ERROR("Failed to turn on core clock: %d\n", ret); + drm_err(drm, "Failed to turn on core clock: %d\n", ret); goto err_put_runtime_pm; } @@ -806,7 +806,7 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data) if (IS_ERR(vec->clock)) { ret = PTR_ERR(vec->clock); if (ret != -EPROBE_DEFER) - DRM_ERROR("Failed to get clock: %d\n", ret); + drm_err(drm, "Failed to get clock: %d\n", ret); return ret; } From patchwork Wed Aug 21 21:40:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772098 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 E9A2DC52D7C for ; Wed, 21 Aug 2024 21:43:52 +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=E5d+ydriTFmIboTE1234GNA41jHZScpZkZpdLaslxGc=; b=aFR5SRQHwcQkyyUPDdJ9/XT0PS LD81DKhp4smy+LOMrJ+6YnYtb7qlgKGd5antPSh12OGe6m40rvAnu5uNuAB3HJ7DvmUweI2+IK63+ jg1tDgoBnUl35kvr5kGdOilWwRoikL/LUJrzlmTD4AYiyh1K/QLMMjcNrHxOYHq1JMKHhNzaaRaYw v4Df/WuzdX1QV/8U0BkSSkqqCt/5dkAxu9dj2MuPKuq03M0IFdZLuWiVheXvffmF38wTNCbyAjiOq YWaDPAaLJgAp6NcKH/172kRrdTUTP7d8YTqfFpGTn0zy2tjdgfeGhMikqw+0yst3x1ooRW/Z9b4Fc 7IW9v2dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt7F-0000000ARmZ-1lH5; Wed, 21 Aug 2024 21:43:41 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt56-0000000AREV-0fyx 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=1724276468; x=1724881268; i=wahrenst@gmx.net; bh=E5d+ydriTFmIboTE1234GNA41jHZScpZkZpdLaslxGc=; 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=B0Vj6K11yfhCne6cMwHAQjUf2hLopZGDL+8VEGWEn3mmkL8ft1H6uFnmEGhuzKik 45tOVqW0XZPIIH8tVXX5S5E3viBdwaTFXLNo+4ovRosUXObBUKew9V8G/uqjZfvqf 3xSbJcAxtrZeJWoHC4VhOXKlFLt8yfZYfXkNEVdox7600sTcV/Ej0v1vfKOHNjuy8 xYkx1H4MDSapgjyU4Z9jR3pevYP9c2vRh7xFuFQPeH4e7fMoAfaijTsXVivku4ype XGcg9kitVgLCjoENdOyBymjFqh1x7cgUyDEBUm43n1/kX9g3Gn3hV7B226kKY7byw HO2VyB710D490MTd8Q== 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 1McpJg-1s7H4o0qmI-00bIZY; Wed, 21 Aug 2024 23:41:08 +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 4/9] drm/vc4: hdmi: add PM suspend/resume support Date: Wed, 21 Aug 2024 23:40:47 +0200 Message-Id: <20240821214052.6800-5-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:54aw2OGuAPBp9ClzrfrERn/WHVRUW+y6EidTMSmxvpGyCNUA3EA awuZXqRoGC/yiuv4MMmPW32zs8EWBzL/SLLnKesbTwyP1vvsGnWSC1eGmkDfWzku0Jkjsj0 iommWdZXPagNDd4DvuLaCWV4VKAl1px6m7FQfhqh32x8vGWeUVkxPbQoDzq+dXRjAry23XU GTnzMwn5txDh/jDPWq3wg== UI-OutboundReport: notjunk:1;M01:P0:0S+yclBWU4g=;DuKZVZsj9wGu0+m5Lkldz4nsRr3 DAP5UEYm6d93CCYu70QJjLTshbnkE6FTuiq8fxIM5Tn4DJp+B2EkZExaeFkp0cLQiq/i3kZb1 AhTnfQhhEVz3Etzu9gBWcFdeqRvH/n5sT/2Sx4t8rgrilqeiytBpy+M3WwiKZ07XX15VkTCwL hMw3UQi2hOO9R9pp8hV+58Yq49gfppmuK7sI/kNT+5/Mw8P5Bgvf+oEXiFYFYPH4XPutdirsa gog/0hfAn9/fN3R5hXcRl+FDH2d5of/Fh4bZdYD99Rn9sFAFNzK6J14cfOuukxCCFOwFsPbf4 Qy1zazLfCDqO7sumBnM1dAKhKPcn+bZIcbn0tCjqXgPvqr6AQDeTvf+SX/ahTwszoKjeayqdN aOEgMZNqZzJBnNMTbhlEIJn6aR6ZfsV+5Hz0hmcmZvZsnbHNsL8T9rfFyd03jzGZhhOe/qVmT I8kkjLVQfnxqsqH+dptmtCx3JEdTJfYKt5VSAAA3212hhUYwOc5ZxeIf3N0yA5oIvrVuDvGv7 zwGUPp9rfSnFn2e399jC+vtSPDJ70PizRkrF6LYRX1NuS1XjuMW0FjzaS+1CIwCoaOAhfMeCG FHt1PRrabJWSSsx0mZtZ23cfBnA1hbIm74OngWg9Gd16KhxfIjz8jRGLdiY841bR/tRnrtJe3 fTJIUk4o48HIm5l2GP6ImSvIX1xdTTIMQxIBMXLOUwjlXgcGUBn93HEakkN3A+OTYuuZvgvxI 2+Vi4IiuXeMCuIsn0cZRslAHHVhkT+RsCyppPuEzoAPfVUlmgJU0ouiU3LFsbEUDKqtxc5mmB VfGeQlt09aipOZA53ds3R2vg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144128_510282_67D4BB5E X-CRM114-Status: GOOD ( 13.03 ) 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 = { From patchwork Wed Aug 21 21:40:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772111 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 3628FC52D7C for ; Wed, 21 Aug 2024 21:45:58 +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=CYaxw6OqWnumzsOX4pTskLMeKldjXRkPxVS7XND9ynA=; b=pQqQxTEHUoFdeWoa6m2vGcph8s KUqdEhwlO/GTjiqh8EcAF852JnRl2Vxg0J5p8JsjYM+EYNNNTC78O43ageYVi3xniaCs3DOCJDLD8 zr+B/PtvG1+fVmDapN9CKAtl93KcoAY9mYR9/nMvlVGItqlVyWvQI2dmkkWaYfWhNo8UNIp3A57Ec Wt4ym/euHXZKXdEDPa3DHd5vvNxzPkgfy5dC1evQ2z/tkeVUd9l5vNDACJKq7jnFtY8bzxIU9bK05 yLHJqW6bGo7nvilJXuunkesJusO31Wiye5TY9Z6cbqF79m43mnqO7cWVGKKj2I/OB3o3c/qso2YTW Y0SROS3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt9I-0000000AS8f-452N; Wed, 21 Aug 2024 21:45:48 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt56-0000000AREn-2XkT for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 21:41:31 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724276469; x=1724881269; i=wahrenst@gmx.net; bh=CYaxw6OqWnumzsOX4pTskLMeKldjXRkPxVS7XND9ynA=; 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=Cvg0iNSD3lobwyOQRxY3291ZvZ3RzXe8nCiwTo+VaSa+C2WrqN41eduqE3ScOQq/ Soz+iMTaoNbAT+n5tia/IPtaPCi+xQxhR36xtlwq4rh3nJ8iYm2wz0hT4aT8X2Mkg ogUTSXaMQUpvRfKYTK97HMxbh0iuEq9cAIJMFb2+RGLrtWrBV+c1gknboUS2fmCHO Ba/+tmlqXlNR0VLfVGBmThLT/SiE2/toGRaajt6BhwtMRM5M969XVx4xikoVNO45f YJ+1hAfOKYp3sImcq+7hRi2bw4z/HnYYEF5ZflBT1cUZadm4VJXVisoer5L33ITEM 4Pc6c4ePXzwBVypdxA== 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 1M2O2W-1shQF919va-0034DI; Wed, 21 Aug 2024 23:41:09 +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 5/9] drm/vc4: v3d: simplify clock retrieval Date: Wed, 21 Aug 2024 23:40:48 +0200 Message-Id: <20240821214052.6800-6-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:h/VZtsIWcUY12L1wpbcwbKWJ694UX0+mLRWUIBBvEgAAesXyQrv 1s3VjliBqbjqDa7UOwwHdMamlBfrLd8f1xAnXbC8rBDV6XiJrIrMkSaY5cX6o/LXt4Kq7+R RCqB8+/HahurNItDvIwMTOy5x36m8UgUNUD2J0bPyDoI7F1jNYD1w3ozSBFpIpnOay0M26X QIJ5OdwUtJCb15T5xWk7g== UI-OutboundReport: notjunk:1;M01:P0:Fc0XG+t8WVo=;0+sC399aSpdqdN6OijPXgeXP1lM 37ojsJGp+Or4UHep3zHle090l7QrITFyo28t/VW1ePLPcOuMcNJPHBONnn3DMeZkovivi/71s xmuCe043h+oXZANUaOi9rKuMXHfpaUXfCqJjQwN5d3n0sgTiGAHLx2m7FFyDMLqEP6PR3BLBU J6cxTMM00Jex/qAqkD7cqI9ruwzt7GdFqlQIFJ3OZTJZesaJZtZYcztR63sKl7xOqUzGMY7Mu XJhjRKzPmk7KQXWAGBkWNv8TW+wCH/v7wFZkqDaM/c1+q7BNwa3ixs5+a5IuwKIL9JPZnrUBd ZXhFVY5K/viwOuSOMCVWR44YPXDdGcx3iAOmLdJpJeOTLIxcogLrulESd5aRE/WF2zQFsc3Tw Vr0m4IBxFiVS3V0MkLN5wvGMvtcWhsw2IBHmr6atzE96p23mL8LSn9FrdRdl49UPtSwT48eFr 9kQL4fQvObVhxoAsH2v0miTqqywBQxIwleOKEP/giUQ7nDyobOk4+TMy/4Th0Bu8fQOYPoH4r i3KSutvsSH7N6kb+tD2Wf1PQOk12/FRO9oUQL/hbfgzMQzDY43ieCwTgJQ6mdkZDrwHNP4rhC /l8kgE37R4POrxo5/uA8WvBYssaBtKX1Ot3pErcyOySLra+7hPwFcdD7Hq/3fDzv/2HntXw/J AiSklyGe8UK7Q5OFC27NHsEA65DLJJlHmkBKRnhvLhdaSI9HoL9NZQBpqivv7QApfoMpxIV76 2d5+fleTg3XGCcTP0cW/flpTX26aXEIgKeJY9oSYvUcMcRbG4J8SkFl66mfEDJEUtz+5KGp06 mQcgX0o1fLnCqQ1f526evBEA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144129_065153_6AC4F91F X-CRM114-Status: GOOD ( 11.65 ) 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 Common pattern of handling deferred probe can be simplified with dev_err_probe() and devm_clk_get_optional(). This results in much less code. Signed-off-by: Stefan Wahren Reviewed-by: Maíra Canal --- drivers/gpu/drm/vc4/vc4_v3d.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) -- 2.34.1 diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c index 6e566584afbf..bf5c4e36c94e 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -441,21 +441,9 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) vc4->v3d = v3d; v3d->vc4 = vc4; - v3d->clk = devm_clk_get(dev, NULL); - if (IS_ERR(v3d->clk)) { - int ret = PTR_ERR(v3d->clk); - - if (ret == -ENOENT) { - /* bcm2835 didn't have a clock reference in the DT. */ - ret = 0; - v3d->clk = NULL; - } else { - if (ret != -EPROBE_DEFER) - dev_err(dev, "Failed to get V3D clock: %d\n", - ret); - return ret; - } - } + v3d->clk = devm_clk_get_optional(dev, NULL); + if (IS_ERR(v3d->clk)) + return dev_err_probe(dev, PTR_ERR(v3d->clk), "Failed to get V3D clock\n"); ret = platform_get_irq(pdev, 0); if (ret < 0) From patchwork Wed Aug 21 21:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772112 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 18883C52D6F for ; Wed, 21 Aug 2024 21:46:46 +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=xtr9kBJY4X3MX0Mx9EKJ4hQqPNtFCg//q2jcoGycQkI=; b=2SAXpSzN474GNtsGyZecBJJVP0 YkuXPBt9Q7Dk9m6JNiFeKvptm+ENCNZfGydGHAXhfnd0y48Z48xkndCKg/XGJAtVICbUsklMSJ6fh u78tijyFAXoCKs0zT9XfZY/wtCgKZWYNfpbkBJVNITzqzBnXuekxo81+Au/Xw4Vh0n/jlXeQHikr1 xqeZSPNVoNXh0FUcNO7GWN/4m7duIhRWzEF4UNAUCbFlUSgI6gkZAJiLTHmpCyNqlDDb8Vxlc7xi6 i+VCnk/BXOBgBkNRTKwFQjCqNL0T2kqFe3bqtzNe4ls/RCzMTFPrBPxuh7ph0/+Kya0Ww+cqdoNdE ii5ojNwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt9z-0000000ASFf-3Rmv; Wed, 21 Aug 2024 21:46:31 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt58-0000000ARGM-1YQ7 for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 21:41:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724276470; x=1724881270; i=wahrenst@gmx.net; bh=xtr9kBJY4X3MX0Mx9EKJ4hQqPNtFCg//q2jcoGycQkI=; 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=Z/MX8qAZtZxMtXrj8ZQNRCPMocCvwxqyKFs7ZMt2FgG2h5/bAoOt9ITT31AArOpe Nxv32eCf4IYW2JoLIBHyqqNgE7DEClsj4subF5bQ8j4P7lPdd9gydte3yF4OcM5Ze FBEgH4UUw4er9PJTxXzhxjmx7tljCA/iDkYOjcCUbp9PmXDS16zOLK3O6eExze9P2 8IhQHqdXjQnenNoyW8Ozz4r6+3d0OVeWbZPiTpAiIqLJASK0i8tBbx8KTZ+3QEf0y Iyt/5XvRnu1UydlbRB6wNtlapW7HTaDTdnQ3238m54Rlw3qm39ZXZ5Z4fTIiuMtQu is3RtH64Nz7oDvqhCQ== 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 1MUowV-1sYKTH1bSD-00RZdv; Wed, 21 Aug 2024 23:41:10 +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 6/9] drm/vc4: v3d: add PM suspend/resume support Date: Wed, 21 Aug 2024 23:40:49 +0200 Message-Id: <20240821214052.6800-7-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:iSPaP7dVaCfkDnoT7GUAk9j0q0tyJQzM/rwNmg7Z2xfsMGZbqOo VA+mt/reSmfRFLwT7nzqjzhmpYuv2iNAFU0WrfbBRh7oygmtYRDCPwt7gzZNz6178FYqj1Z MhwPj6dN/mZ8UP96bfTEYBY5VD/DtsNRcl8lZDGyqK1i02+LbIIVb5IdZZbYqrYTNVp/pfL DwJc9SCFAdLRdZf8Ue0RA== UI-OutboundReport: notjunk:1;M01:P0:4UDfCApTLZQ=;aJrzXp9h9WhNB+elsrHTYRy3Md2 r9kE2lmHUV26gNoEIb1tt2s2fVD7YJ1Ukbh8ty+TWHFUAUetbn1/b7VgoSHIaogfuASIOD/L3 HKFJLnB0hFjf05wlawN39Z5waRP1p1s0o+BIEmXn9QUx4432EsU24dBw13sbs62BKqGxrNKcq RqxdVAFQmb+HSWbcwMj40CcWiT0ov+Cqmzza6G0ERu0skiGZYYCWTr4MGh76HPSiSBEAtcqYH 1DU+gnxHAms6+5FjFxDdXigwG6kPlqTy3pu7ghG63eU65hQH5R4bLz6V7cUoBaua4sN/gr09S YS1POifAXIafYl2zp6jYhFv7BU2/XtC3u7ziHR9xkBLgsbLl7vBpTv0Y+PaTuMJwWRvaGyDdR mzl+eas2HYBd8k0Yg39hkG0auRrZGyYrKyYlBlhG+14wHYIGnH+YeJIuKWWQv8Xcizc+meqJF GrwjfWoI1xKeSQvEoPwf08BiOWwgJJ4tBjDuDgYDvqzu7uDv33KhR2//IjATUAN0a7Zw0rUvH rxAbX4dyoXrwGHj9dO0VxzvX9VTq2SglgGDpeCDVRjTk+grVpmXxFEXomR8Z08RzLEtYosBY/ gKGlDXmj7UvWk3XskMzplcnOSIuYslJj8DTdltw6EaZctK8JDyROs13+HZbpyHqDA6T9QKa9c qeIlX1faYECptTsqdbSOnfaqSr2DLpQ8JM7PJhz0B1V11L6RV/UedmFfHR593FVUla3x54nDI 5axOARxueG0DQHPDpBa3KCIbBbKUZQAYlcMH5mS9/pDnM105mM7acw/Uw51M70xtHZ6zDQAMy cRjssMTKltIdFrd2ZuQh0EJQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144130_731608_BABB64D7 X-CRM114-Status: GOOD ( 10.77 ) 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 V3D component in order to handle suspend to idle properly. Signed-off-by: Stefan Wahren --- drivers/gpu/drm/vc4/vc4_v3d.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.34.1 diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c index bf5c4e36c94e..03c790f7ffc6 100644 --- a/drivers/gpu/drm/vc4/vc4_v3d.c +++ b/drivers/gpu/drm/vc4/vc4_v3d.c @@ -508,6 +508,8 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master, static const struct dev_pm_ops vc4_v3d_pm_ops = { SET_RUNTIME_PM_OPS(vc4_v3d_runtime_suspend, vc4_v3d_runtime_resume, NULL) + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; static const struct component_ops vc4_v3d_ops = { From patchwork Wed Aug 21 21:40:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772113 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 85817C52D6F for ; Wed, 21 Aug 2024 21:47:23 +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=77csMFJ8HMyu75s9Qzq+i8SVljZuRltVYE5H7gqE+kQ=; b=LDnkb+7YWhegxYncDZR6NzSIPP EBz09D17CAgA/gc6KTFitbl7tWQwtrT5dHdQUUD5Eub3sIlqXsP3X4NyPhqAAdHFzk0FWLHzBJVA1 RuDw9mqXJ7+f7C0+/gx74CldMFPIRYqyqZhPfkITJBNuTyoquQaW06bqMkmggJPhlnKL8a7pHLv4y zubID+Oyd18p11R+kJ9jb9qF0qSsS1hGBgH9Gs3oFOE2mQw3w5syzsUlFFuh7Bd9TbzVNJeRLaWm5 5hqy2BlTWeDPejBVpxaAU88sPLpnAkoiubjhXa1Y0YPzpiYBtoGsgPWMYvoBjaMBTIW47lJvphMf0 H4sZfwKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgtAf-0000000ASMX-3LyA; Wed, 21 Aug 2024 21:47:13 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt58-0000000ARGO-1rDQ for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 21:41:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724276471; x=1724881271; i=wahrenst@gmx.net; bh=77csMFJ8HMyu75s9Qzq+i8SVljZuRltVYE5H7gqE+kQ=; 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=KYdZ+9AeoMxp4+mmVmTdHzqqXwqy9MyDBiVhm0L7Kp7iPH2fbbRBOV605RWvrBdr gu5mcrRPWZ0pkB9I0oCxTEuKnRtfSATYeY0ntfK3fVtwNJxbH4MPDM3lhwD0/5l6Z qQw4Edm6e1cj2yjOq2AbKEOYGw8tFOZun1HQGZI6en9S8tPlAmHggcfbIHudTSdil 6js2qwuPAwUhN68g2RkNBi3HfOsRQ7cI4Xc7RtTl7XR3dIIyZ7lBZ0SR+lFX5ivUo wlmfKpxgF865ocgnGI+WXU8+HIjwlWU/gpq2J18N0sacBQfCbcY9PvX60BVr5QwvR fHZ9vwrUyapF47QmTQ== 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 1M6Ue3-1snjlW1ZZR-007lZf; Wed, 21 Aug 2024 23:41:11 +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 7/9] usb: dwc2: Refactor backup/restore of registers Date: Wed, 21 Aug 2024 23:40:50 +0200 Message-Id: <20240821214052.6800-8-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:s3fMLZTBlQ9oc/i/DUOjMtIxSdyzEVKvfPsWo7uvqhR6L28bsSr b7zQcr7QVItzC/7M7163AUPfQlp5Zm8d78wdySPktOP9dooDIkk/XB9U7W53ICxe/AzNPZm +Nn8F2B4091UGxzM11UYDa5Zne3Vjk6G73WhGbHnaGQpgfxconYAacShKb9dMvtQouCLgHv FM8VXc0kCxeq+KA3WnqQg== UI-OutboundReport: notjunk:1;M01:P0:i5iTDL/SMAQ=;nR4FHaBNECev5NyOUtlgznVbLnb 8DEru5WUjHu2kkQn93TT7uxF4+RyTexpq0bfNJOPAp9Ahz9HHy5C/2jbTXPk/yX8duK9sTQYg ioTHE3WDud8XtOfCOAScMghSXuwv12xqoXtXaNjl0GSNQqathXi9amLEd6LJAf5LIepMqcohR MBVHS2EUtbxrqNRrew2m9BnzpSCiOmOakXzrux1BvMzTc7LaBT0RC/HT+KvYb63rKl4eezbwh HC9KHz+mucdCG43QbaAB/I0DJcksVDRF7f7sZEYkAi116ZHxyt3j0V+X5HOCi59Zir3ez+w3H 6CsBjB2uxdaDmAOZ4t6mRKDYWyXLBfTf9IfeDj2NxS4SoLiFYM0ZtJQDxgJaJO4Wqie/stFTn rzy6+70XgZlW/x5XizY99Fp1Dab4GRrGrL3byqFwHgWWtgT0eJ8AdE9lfGbds/pnnXMZzQqcK R6Z7wtZbIKwhAk3yoTp38RzyjPN2lwAwasXD02zURM2yX/6vGL5nP/WwvasDi0OkKvKYdAWyz jvKz9wxOIHy6NA7bG9exPrRC8GgVDlVe/k1pEnlMIHdZFypSaMXRSSpJ//lgcgCZk1k6vDci2 gl4ElBuniXGYlLkcTDZUSYtjmvCeUcJ1x5DoWgmqx/QbvZCiCEE/9639retAxjpGXh13y+/tO T2VSL/eBRJveqjOy8AHfDZS/JFMcTrAMAaAb8gAY9+Urj+Fx6X7EfZuVzmFcfkBEkgONe4cwq 48gMd2pEB0jEqC1KyV7ZQT/+7yf0Tr+9XyLPzt7BnwMPPzOvupTDOU6dNpA+493JwlKXr95s6 WUj2yY9ZF1BIUf1+wYESXvEw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144130_833580_409B3BA1 X-CRM114-Status: GOOD ( 14.79 ) 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 DWC2 runtime PM code reuses similar patterns to backup and restore the registers. So consolidate them in USB mode specific variants. This also has the advantage it is usable for further PM improvements. Signed-off-by: Stefan Wahren --- drivers/usb/dwc2/core.h | 12 +++++ drivers/usb/dwc2/gadget.c | 101 +++++++++++++++++++------------------- drivers/usb/dwc2/hcd.c | 99 +++++++++++++++++++------------------ 3 files changed, 114 insertions(+), 98 deletions(-) -- 2.34.1 diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 2bd74f3033ed..81e8632f29ed 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -1435,6 +1435,8 @@ int dwc2_hsotg_tx_fifo_total_depth(struct dwc2_hsotg *hsotg); int dwc2_hsotg_tx_fifo_average_depth(struct dwc2_hsotg *hsotg); void dwc2_gadget_init_lpm(struct dwc2_hsotg *hsotg); void dwc2_gadget_program_ref_clk(struct dwc2_hsotg *hsotg); +int dwc2_gadget_backup_critical_registers(struct dwc2_hsotg *hsotg); +int dwc2_gadget_restore_critical_registers(struct dwc2_hsotg *hsotg); static inline void dwc2_clear_fifo_map(struct dwc2_hsotg *hsotg) { hsotg->fifo_map = 0; } #else @@ -1482,6 +1484,10 @@ static inline int dwc2_hsotg_tx_fifo_average_depth(struct dwc2_hsotg *hsotg) { return 0; } static inline void dwc2_gadget_init_lpm(struct dwc2_hsotg *hsotg) {} static inline void dwc2_gadget_program_ref_clk(struct dwc2_hsotg *hsotg) {} +static inline int dwc2_gadget_backup_critical_registers(struct dwc2_hsotg *hsotg) +{ return 0; } +static inline int dwc2_gadget_restore_critical_registers(struct dwc2_hsotg *hsotg) +{ return 0; } static inline void dwc2_clear_fifo_map(struct dwc2_hsotg *hsotg) {} #endif @@ -1505,6 +1511,8 @@ int dwc2_host_exit_partial_power_down(struct dwc2_hsotg *hsotg, void dwc2_host_enter_clock_gating(struct dwc2_hsotg *hsotg); void dwc2_host_exit_clock_gating(struct dwc2_hsotg *hsotg, int rem_wakeup); bool dwc2_host_can_poweroff_phy(struct dwc2_hsotg *dwc2); +int dwc2_host_backup_critical_registers(struct dwc2_hsotg *hsotg); +int dwc2_host_restore_critical_registers(struct dwc2_hsotg *hsotg); static inline void dwc2_host_schedule_phy_reset(struct dwc2_hsotg *hsotg) { schedule_work(&hsotg->phy_reset_work); } #else @@ -1544,6 +1552,10 @@ static inline void dwc2_host_exit_clock_gating(struct dwc2_hsotg *hsotg, int rem_wakeup) {} static inline bool dwc2_host_can_poweroff_phy(struct dwc2_hsotg *dwc2) { return false; } +static inline int dwc2_host_backup_critical_registers(struct dwc2_hsotg *hsotg) +{ return 0; } +static inline int dwc2_host_restore_critical_registers(struct dwc2_hsotg *hsotg) +{ return 0; } static inline void dwc2_host_schedule_phy_reset(struct dwc2_hsotg *hsotg) {} #endif diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index e7bf9cc635be..0bff748bcf74 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -5309,6 +5309,49 @@ void dwc2_gadget_program_ref_clk(struct dwc2_hsotg *hsotg) dev_dbg(hsotg->dev, "GREFCLK=0x%08x\n", dwc2_readl(hsotg, GREFCLK)); } +int dwc2_gadget_backup_critical_registers(struct dwc2_hsotg *hsotg) +{ + int ret; + + /* Backup all registers */ + ret = dwc2_backup_global_registers(hsotg); + if (ret) { + dev_err(hsotg->dev, "%s: failed to backup global registers\n", + __func__); + return ret; + } + + ret = dwc2_backup_device_registers(hsotg); + if (ret) { + dev_err(hsotg->dev, "%s: failed to backup device registers\n", + __func__); + return ret; + } + + return 0; +} + +int dwc2_gadget_restore_critical_registers(struct dwc2_hsotg *hsotg) +{ + int ret; + + ret = dwc2_restore_global_registers(hsotg); + if (ret) { + dev_err(hsotg->dev, "%s: failed to restore registers\n", + __func__); + return ret; + } + + ret = dwc2_restore_device_registers(hsotg, 0); + if (ret) { + dev_err(hsotg->dev, "%s: failed to restore device registers\n", + __func__); + return ret; + } + + return 0; +} + /** * dwc2_gadget_enter_hibernation() - Put controller in Hibernation. * @@ -5326,18 +5369,9 @@ int dwc2_gadget_enter_hibernation(struct dwc2_hsotg *hsotg) /* Change to L2(suspend) state */ hsotg->lx_state = DWC2_L2; dev_dbg(hsotg->dev, "Start of hibernation completed\n"); - ret = dwc2_backup_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup global registers\n", - __func__); - return ret; - } - ret = dwc2_backup_device_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup device registers\n", - __func__); + ret = dwc2_gadget_backup_critical_registers(hsotg); + if (ret) return ret; - } gpwrdn = GPWRDN_PWRDNRSTN; udelay(10); @@ -5483,20 +5517,9 @@ int dwc2_gadget_exit_hibernation(struct dwc2_hsotg *hsotg, dwc2_writel(hsotg, 0xffffffff, GINTSTS); /* Restore global registers */ - ret = dwc2_restore_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore registers\n", - __func__); - return ret; - } - - /* Restore device registers */ - ret = dwc2_restore_device_registers(hsotg, rem_wakeup); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore device registers\n", - __func__); + ret = dwc2_gadget_restore_critical_registers(hsotg); + if (ret) return ret; - } if (rem_wakeup) { mdelay(10); @@ -5530,19 +5553,9 @@ int dwc2_gadget_enter_partial_power_down(struct dwc2_hsotg *hsotg) dev_dbg(hsotg->dev, "Entering device partial power down started.\n"); /* Backup all registers */ - ret = dwc2_backup_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup global registers\n", - __func__); - return ret; - } - - ret = dwc2_backup_device_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup device registers\n", - __func__); + ret = dwc2_gadget_backup_critical_registers(hsotg); + if (ret) return ret; - } /* * Clear any pending interrupts since dwc2 will not be able to @@ -5610,21 +5623,9 @@ int dwc2_gadget_exit_partial_power_down(struct dwc2_hsotg *hsotg, udelay(100); if (restore) { - ret = dwc2_restore_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore registers\n", - __func__); - return ret; - } - /* Restore DCFG */ - dwc2_writel(hsotg, dr->dcfg, DCFG); - - ret = dwc2_restore_device_registers(hsotg, 0); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore device registers\n", - __func__); + ret = dwc2_gadget_restore_critical_registers(hsotg); + if (ret) return ret; - } } /* Set the Power-On Programming done bit */ diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c index cb54390e7de4..32fa606e5d59 100644 --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -5477,6 +5477,49 @@ int dwc2_restore_host_registers(struct dwc2_hsotg *hsotg) return 0; } +int dwc2_host_backup_critical_registers(struct dwc2_hsotg *hsotg) +{ + int ret; + + /* Backup all registers */ + ret = dwc2_backup_global_registers(hsotg); + if (ret) { + dev_err(hsotg->dev, "%s: failed to backup global registers\n", + __func__); + return ret; + } + + ret = dwc2_backup_host_registers(hsotg); + if (ret) { + dev_err(hsotg->dev, "%s: failed to backup host registers\n", + __func__); + return ret; + } + + return 0; +} + +int dwc2_host_restore_critical_registers(struct dwc2_hsotg *hsotg) +{ + int ret; + + ret = dwc2_restore_global_registers(hsotg); + if (ret) { + dev_err(hsotg->dev, "%s: failed to restore registers\n", + __func__); + return ret; + } + + ret = dwc2_restore_host_registers(hsotg); + if (ret) { + dev_err(hsotg->dev, "%s: failed to restore host registers\n", + __func__); + return ret; + } + + return 0; +} + /** * dwc2_host_enter_hibernation() - Put controller in Hibernation. * @@ -5492,18 +5535,9 @@ int dwc2_host_enter_hibernation(struct dwc2_hsotg *hsotg) u32 gpwrdn; dev_dbg(hsotg->dev, "Preparing host for hibernation\n"); - ret = dwc2_backup_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup global registers\n", - __func__); - return ret; - } - ret = dwc2_backup_host_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup host registers\n", - __func__); + ret = dwc2_host_backup_critical_registers(hsotg); + if (ret) return ret; - } /* Enter USB Suspend Mode */ hprt0 = dwc2_readl(hsotg, HPRT0); @@ -5697,20 +5731,9 @@ int dwc2_host_exit_hibernation(struct dwc2_hsotg *hsotg, int rem_wakeup, dwc2_writel(hsotg, 0xffffffff, GINTSTS); /* Restore global registers */ - ret = dwc2_restore_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore registers\n", - __func__); + ret = dwc2_host_restore_critical_registers(hsotg); + if (ret) return ret; - } - - /* Restore host registers */ - ret = dwc2_restore_host_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore host registers\n", - __func__); - return ret; - } if (rem_wakeup) { dwc2_hcd_rem_wakeup(hsotg); @@ -5777,19 +5800,9 @@ int dwc2_host_enter_partial_power_down(struct dwc2_hsotg *hsotg) dev_warn(hsotg->dev, "Suspend wasn't generated\n"); /* Backup all registers */ - ret = dwc2_backup_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup global registers\n", - __func__); - return ret; - } - - ret = dwc2_backup_host_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to backup host registers\n", - __func__); + ret = dwc2_host_backup_critical_registers(hsotg); + if (ret) return ret; - } /* * Clear any pending interrupts since dwc2 will not be able to @@ -5858,19 +5871,9 @@ int dwc2_host_exit_partial_power_down(struct dwc2_hsotg *hsotg, udelay(100); if (restore) { - ret = dwc2_restore_global_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore registers\n", - __func__); - return ret; - } - - ret = dwc2_restore_host_registers(hsotg); - if (ret) { - dev_err(hsotg->dev, "%s: failed to restore host registers\n", - __func__); + ret = dwc2_host_restore_critical_registers(hsotg); + if (ret) return ret; - } } /* Drive resume signaling and exit suspend mode on the port. */ From patchwork Wed Aug 21 21:40:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772114 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 3E56BC52D6F for ; Wed, 21 Aug 2024 21:48:07 +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=9GWd0CDe/k2CUFdixtyjcH7jeuIirHODxoQWdavAcRk=; b=SOJGFHKON0mFzOlTyKEuAM7fsx yKOF5PGtKJ68b6JQavQBnMlDBvuzMkrhjZQB6KCfpelCRvcZzVkCcGMoEYoNFogBtIVEPqpgsmxvJ qumnOF8WStYhbSIWa2VoQDcHYtXssDWIAxu4Squ+qJpOMlXmGKRWonogXJwCbOiaaCDfVHlFG25U0 m+VcoTfdGvmnZ5bXMev+R0kLkyVBLX5il+S3hyVfxWBmIMrT+bh1HR7LD5FavnT3qdONz49Y9lDb0 ymzYaupWVtVK+WUC9/jwJfmvUdx1kmbbjrGBiDCuv0tINwJMQqEVzIujF2P/37zUQ+N7jckc4injs Fy7y0Jtw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgtBL-0000000AST2-1jHc; Wed, 21 Aug 2024 21:47:55 +0000 Received: from mout.gmx.net ([212.227.15.19]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgt59-0000000ARGv-2QVB for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 21:41:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724276472; x=1724881272; i=wahrenst@gmx.net; bh=9GWd0CDe/k2CUFdixtyjcH7jeuIirHODxoQWdavAcRk=; 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=NshBRw3TDEyl3VKqKrXuPhfv/CrBnboNCdcUVvAFb8EXqXUscz/3McrYlVDs4SET 7MtUrX1i+Q9FxbTW4SEB7YI95TCLiOcdaOIlFHOwbsfF/swq69jGd8b9AfLj8xI4p /NzN/KOQO8g4xtTCU/YHPchAMHGW+jN/L9kcgBI5u8pwSBbJ3YFaJZnXovPRcr2YG HH6LjzNIAAq5eNs3tZ9kVtA+1KFZ8BnJxhwt5N3nAz2qQk8bCSnfArGwZc6AXi57B MqZuQMp6f/JZdrCyAFKbpGZGQiVfWjE2I1WR2piKXMVSAtt9hhZIKfyCrHvxsUsSD CrVHiDs30j20tSdjkw== 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 1MmlT2-1sF0Iw1o7q-00ixXE; Wed, 21 Aug 2024 23:41:12 +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 RFC 8/9] usb: dwc2: Implement recovery after PM domain off Date: Wed, 21 Aug 2024 23:40:51 +0200 Message-Id: <20240821214052.6800-9-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:6GhQJP0mhRKQTTBEbTOBSW1NEgbWA/13VOs3a68rCTmoqSj4WBe rn5I6PYYiZk4a/yOwbon7thCpQ3BnZo+EVl62AjhyLdlh78JMKryErHj1aqdOeQvAkl3YAf PB0ilN5Rlu1RMLx63tw2utDkuhqtjFmAC4fBlPTNFe8xnIZjbqZocR0OaBWUnm6fHFjYKAV yxXhFWTcS1HvPGBG7ViXw== UI-OutboundReport: notjunk:1;M01:P0:w/kI+/BAp9k=;m4OZVQZJvj3E/pqkWti+4ZncyUq 8wcSVEa6OtFdaJaTpDRZcg1U92SO+nnfSnA7baxfR7YR0HrCUPem3fC/fhG859nto0YTrDMqN xRgdt6yYn92HcCHLUoA7HPp/SoQPi2S1wAygTDEeUyl/IhNmfOaYSWgWTNDKaCVe7ss9jQ6NG TUo4AFz4RK0BUZRTnB38L72VSocPV2CAtXHsOsoZr/9BmMZdtFqLb83CIs0WWuv8v2NRR7NPv 1mJfI1R6rlM3Vd9wUexpeVUNS4IqXk7yxDkPRRMzGaNvpEUsIBlDPxAKLlBKjnlSEXpeVPNdX s/LMdyvcV5CQ2EszrHQgWMYjOPv5BZl7xFuXXnGfg0jfZM7H+4RJtoMx+ysB2SO/jyGESFOk0 Tr71QiNAIQg+fGqvZWerd7Me7ygRrYF0aXedc/cwuiIpadCsg++63bjoOJOGMDY7aj4CAJB65 Xe43nZZd8xfQ0ZIyEW9N1RH+JblsMqRh/RNLqw8T9apWdzGE9ABMsTnILsPByPgN6LJ4J4b8v Fr1NnGuaLd2X89L0mEQWuGSuQgv01jVU/CXjksPxkw+hg6n2kkA9W/ArN0sCOiAVfvBPTeVHp ABWlC6VcbLj5ZJmqXmrjMSFZ/V7+kXoXwuaErbWFao/P3uCro3CP4naVa+Myq6YdMZ8J+bwHm F49mxNz2I0ranYqOuu/r2Cp7D9pHtjn6KZwHNVwnBltSd0N9+dzu5l+YZqEHRGsH9zubWCf9M 8xxcaSa2yiHeksjb7VinxovWymu63mQcXkWakUbvji11BIQWXOn4Z61jsgU93OzB5dtfQvoNz qnR+tUwHZtsroFihMJ55pblQ== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_144131_989945_58B0FB8A X-CRM114-Status: GOOD ( 19.63 ) 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 According to the dt-bindings there are some platforms, which have a dedicated USB power domain for DWC2 IP core supply. If the power domain is switched off during system suspend then all USB register will lose their settings. Use GUSBCFG_TOUTCAL as a canary to detect that the power domain has been powered off during suspend. Since the GOTGCTL_CURMODE_HOST doesn't match on all platform with the current mode, additionally backup GINTSTS. This works reliable to decide which registers should be restored. Signed-off-by: Stefan Wahren Reviewed-by: Douglas Anderson --- drivers/usb/dwc2/core.c | 1 + drivers/usb/dwc2/core.h | 2 ++ drivers/usb/dwc2/platform.c | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) Hi, would be nice to get some feedback about the approach and test results on other DWC2 platforms. -- 2.34.1 diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c index 9919ab725d54..c3d24312db0f 100644 --- a/drivers/usb/dwc2/core.c +++ b/drivers/usb/dwc2/core.c @@ -43,6 +43,7 @@ int dwc2_backup_global_registers(struct dwc2_hsotg *hsotg) /* Backup global regs */ gr = &hsotg->gr_backup; + gr->gintsts = dwc2_readl(hsotg, GINTSTS); gr->gotgctl = dwc2_readl(hsotg, GOTGCTL); gr->gintmsk = dwc2_readl(hsotg, GINTMSK); gr->gahbcfg = dwc2_readl(hsotg, GAHBCFG); diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h index 81e8632f29ed..e65a74853bb0 100644 --- a/drivers/usb/dwc2/core.h +++ b/drivers/usb/dwc2/core.h @@ -667,6 +667,7 @@ struct dwc2_hw_params { /** * struct dwc2_gregs_backup - Holds global registers state before * entering partial power down + * @gintsts: Backup of GINTSTS register * @gotgctl: Backup of GOTGCTL register * @gintmsk: Backup of GINTMSK register * @gahbcfg: Backup of GAHBCFG register @@ -683,6 +684,7 @@ struct dwc2_hw_params { * @valid: True if registers values backuped. */ struct dwc2_gregs_backup { + u32 gintsts; u32 gotgctl; u32 gintmsk; u32 gahbcfg; diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c index 7b84416dfc2b..39e9064b6cfe 100644 --- a/drivers/usb/dwc2/platform.c +++ b/drivers/usb/dwc2/platform.c @@ -683,6 +683,14 @@ static int __maybe_unused dwc2_suspend(struct device *dev) regulator_disable(dwc2->usb33d); } + if (is_device_mode) + ret = dwc2_gadget_backup_critical_registers(dwc2); + else + ret = dwc2_host_backup_critical_registers(dwc2); + + if (ret) + return ret; + if (dwc2->ll_hw_enabled && (is_device_mode || dwc2_host_can_poweroff_phy(dwc2))) { ret = __dwc2_lowlevel_hw_disable(dwc2); @@ -692,6 +700,24 @@ static int __maybe_unused dwc2_suspend(struct device *dev) return ret; } +static int dwc2_restore_critical_registers(struct dwc2_hsotg *hsotg) +{ + struct dwc2_gregs_backup *gr; + + gr = &hsotg->gr_backup; + + if (!gr->valid) { + dev_err(hsotg->dev, "%s: no registers to restore\n", + __func__); + return -EINVAL; + } + + if (gr->gintsts & GINTSTS_CURMODE_HOST) + return dwc2_host_restore_critical_registers(hsotg); + + return dwc2_gadget_restore_critical_registers(hsotg); +} + static int __maybe_unused dwc2_resume(struct device *dev) { struct dwc2_hsotg *dwc2 = dev_get_drvdata(dev); @@ -704,6 +730,18 @@ static int __maybe_unused dwc2_resume(struct device *dev) } dwc2->phy_off_for_suspend = false; + /* + * During suspend it's possible that the power domain for the + * DWC2 controller is disabled and all register values get lost. + * In case the GUSBCFG register is not initialized, it's clear the + * registers must be restored. + */ + if (!(dwc2_readl(dwc2, GUSBCFG) & GUSBCFG_TOUTCAL_MASK)) { + ret = dwc2_restore_critical_registers(dwc2); + if (ret) + return ret; + } + if (dwc2->params.activate_stm_id_vb_detection) { unsigned long flags; u32 ggpio, gotgctl; From patchwork Wed Aug 21 22:36:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13772199 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 4B9BBC52D7C for ; Wed, 21 Aug 2024 22:38:22 +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=EIb/0BVQLAIWTGsSf2exEUrI6S97uVc10LsFQOB7HdM=; b=2V2lFCTDV/Ib35r/bXRFEGlCPN BkjFrbdg8b9EulXKyCSilcwJL+RW1aXGRNnXUPyRViA8xFs7dEGUY8omBoL0NbmV+xGfrufoikZaH JTP29tYxhbYqzelzRQGLY59g7vOghxpmughlUwaQu8pz9vjt0I0cLrOqloDKiqJFEco66palsMQ4L WsP3T/vj5ak5CSYkxN1tFUSOv4BPdaA21njH60zF6f/Yx+3BLTV52gaoYM2hh/vQQkqVW6LGoCP76 5tXvc+hYRQ1IIZynXIm7Oy4cmSI7HFt3mP85SH3s/VwnYMnohUTMgdRWHFRbdBiQ4gdG+csptGKV9 oSOJ1kzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgtxx-0000000AZ7v-11V9; Wed, 21 Aug 2024 22:38:09 +0000 Received: from mout.gmx.net ([212.227.17.21]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgtwu-0000000AZ4T-12Oj for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 22:37:25 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1724279797; x=1724884597; i=wahrenst@gmx.net; bh=EIb/0BVQLAIWTGsSf2exEUrI6S97uVc10LsFQOB7HdM=; 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=JHkqdqGRqxXptrhoBHbrJVGrueYDkdRTkXvvvI/0tqRxGBuzKR5I2iP3ur6Z7vR8 iFCmwl7Df0pmL3/wU0joN7sbefZk02nRgok7bLuWlCg7Q8sXnty3eVMWIrJqVuY11 u2qc9c8Ssl+V/fLMgrk4Q1FtcnkyHJQz4eDETWwom4GGAWXXbN02IUtQ6f85XMnwh x3v1JJi+dgi/mtVTcdCFiK6fo7d7ajKzUE3EK7m+3UOCc8ncwdtEvKfxSTgD6+ZG1 B3BiMQq94ZTH4XmZNEv1+8PW8xHfipr5Nh+0jkqABL3Rh3AVbN9lDQwzAn8h5yWXa 7Nlhen3VGExLj3wbCQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from stefanw-SCHENKER ([37.4.248.43]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mt757-1rsdbg2LZB-00wVwf; Thu, 22 Aug 2024 00:36:37 +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 9/9] ARM: bcm2835_defconfig: Enable SUSPEND Date: Thu, 22 Aug 2024 00:36:29 +0200 Message-Id: <20240821223629.10705-1-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:gQN251ySqY5cRStUBE3mudZO0tnWy/NNvjYZYSjAaFKeYHdSO59 8ddPx7Fzew9NTHP7BngfDEPdSCG+ic1IXU/viHfItdUeFF8+9srqpPxS9xyuy0hs6swPDXp Rc0xAbsIhmnPfOHmG3fPjXsDewlYgPtaFSXG1d2kz+eCavIGrLdTIo4nYR9PgajRBisxZ4g KHkvqUDcVG2Ku4gckOwWg== UI-OutboundReport: notjunk:1;M01:P0:hlhASlEjUh4=;dOqaNRRLVUaN8ZDiJ6dGymnW7X2 3cw4kKjsrj2JcyUVRiBrPgEcltGWM2C9MG6vYdUgWFZWAjZrdPvovgjnwKDZB6dVmM/IYIysU 4OJGj6Oo0GSk6iIj8vFqBNShLe/b2FBCtW6vLks6hHW9KtlD7HTuaZJXQDva8opyukUNm9HwF lboiCVSKGlPViAIvD45p4z6jvtn42gcRQTfCL/5YUk1x6tl2OWIy/dm/aUT+AwBMjpD6fOmPw sngKt0SDvNQewOFrN0WsoB4ZBoGUfzFfPwgL7eqoU4FrmV+czd17SIoJpEVf6QHCquBLS9pUD 2hdE3iApQOxWlj5WNFFVjK36fnrk6AsOXDQuTBFDgFw3/r02GVWUaWBkdmTgKYs92bm2ThqJs l8a0hzqlrvl9+9OTWx+S4qsQoBgYpznZ7vo9UW8zZeYcdyyMSiqAZ4E5Y/fuwTp04p0lQjOqi Qb721hWY8pQECRFrF/jmH8HxOC5rE1FH3vGO4l8Lx0v9RbuP0GXr5Jmynw3ne3G3P5NTgzv1m X7ZfqC/1p49/x4F6AWwJTOh/Cz3GbLzJGc6TDssV0ZHa2lzx1tJDB7XG5UfmUOAs7LvCdDugx XW4jZ/w4fm5ItWtc2ojhTTenJJil27LsehaKlyUYEVwzRZHiNgnNQ/iFcMc6p8/PJGrekbRTY B5YY0WyKTa7Wwv5c6v3r1HjYtWyTD7nnxBgBNwOYcguJFpyExsjqQCEICMcihKUIISzsk2SjN muJHpFZDy2tEJKZYgxicFHYOwDzNpJmrAZmbx53KkKtR8B1VHvMv8BWxFG2l+c5vSgSgcM2Rd uZCWzUOhOHw/Ob+gCv81XUpA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_153704_711384_E1EC6868 X-CRM114-Status: UNSURE ( 9.90 ) X-CRM114-Notice: Please train this message. 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 the Raspberry Pi supports Suspend-To-Idle now, this option should be enabled. This should make power management testing easier. Signed-off-by: Stefan Wahren Reviewed-by: Florian Fainelli --- arch/arm/configs/bcm2835_defconfig | 2 -- 1 file changed, 2 deletions(-) -- 2.34.1 diff --git a/arch/arm/configs/bcm2835_defconfig b/arch/arm/configs/bcm2835_defconfig index b5f0bd8dd536..97632dee1ab3 100644 --- a/arch/arm/configs/bcm2835_defconfig +++ b/arch/arm/configs/bcm2835_defconfig @@ -38,8 +38,6 @@ CONFIG_CPU_FREQ_GOV_ONDEMAND=y CONFIG_CPUFREQ_DT=y CONFIG_ARM_RASPBERRYPI_CPUFREQ=y CONFIG_VFP=y -# CONFIG_SUSPEND is not set -CONFIG_PM=y CONFIG_JUMP_LABEL=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y