From patchwork Sun Jul 28 11:41:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Wahren X-Patchwork-Id: 13743894 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 E08A0C3DA64 for ; Sun, 28 Jul 2024 11:47:14 +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=MUjx857aVJb3m/BIq/jv+muXKfBK4aj/UlImOJhlQl0=; b=n8wrWb+D46QtP64FcxdCQALblV AjkNIAVyxzUiL+kUn1sXRVe9OjJ3n51Iim3DwgBW60h4lS+gX2jfcXH/hCypDOSI8k0FiiiCUOtz8 sJgVAJ4aZMJ7lfjfqzjvqevPvQSI4RyC3VST4BwqmUVR/qV/c4yKJYmGKVWSkZXqDPvwEYyLw4f/m Ox68qb+7mdwy0yjSNO4IAybP81oRf98/7rOmwWKLw0t4n+YyEMrEUa0RkdpspxK0+sn3LytsU6rE4 EgrQJ9/TcWu9ZxEMDg9v291RbFmnalA6gThuAkcr+Xozf1Ywnh8M738Q4MdQVUVpEdRkwNArGQ8M+ t7EtFW7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sY2Mh-00000008OH9-42OQ; Sun, 28 Jul 2024 11:47:04 +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 1sY2MH-00000008OB8-2LXO for linux-arm-kernel@lists.infradead.org; Sun, 28 Jul 2024 11:46:39 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1722167177; x=1722771977; i=wahrenst@gmx.net; bh=MUjx857aVJb3m/BIq/jv+muXKfBK4aj/UlImOJhlQl0=; 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=mR3VAOxXChhr2y7LUN+ckfBTyxpKYXrD+ni2xc2ekwneT+3Nxrve25RRfRAQseNg iUxkajNMtobvAhjbZJ1avjqGnNz0V8sd4ruz/mucpDTeIIpWKEZ9PfK95sWEbM+Jh bXWfezMbI1klArtufPyqG8jrw5q0GQXMJGDl6378a7zyyydP14l5iQoKJAjz4YTGu fZH+0veWGv+PdlBFltGuMwkxMpIPp1X6HFqd3yp+sxUlyVSpMlEe+XWnhiV30ZHEX uKvcTyoNeEF1qcFnyNPoSrgJ8YrGHsJvT+54b1fHQtrU4xWVy4bm/Ot4szevozmEl XpOTbWm1eTzML45r6A== 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 1MmULr-1rqPsW0GtF-00dMDw; Sun, 28 Jul 2024 13:46:17 +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 04/16] pmdomain: raspberrypi-power: Add logging to rpi_firmware_set_power Date: Sun, 28 Jul 2024 13:41:48 +0200 Message-Id: <20240728114200.75559-5-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:4Eq85eFpyWQtoeOdYaR/mTT65Ogz1QD7be1K3QBHel9skaxonHe OTAXpGmln6oRRCUb9/Rjlq7p4feQmQFbl/SAJNdc6K3tBfH/XwL5ySYhaCKHVJ8AMka+AEC naQazZaWITnN7A+4GI63w6/SbHKS+wDSJIyDfA+yD6aBDfPaPGJzhTyiTMuWA4FtsIBZsI4 wk5HudZs94o39xgwnJGjA== UI-OutboundReport: notjunk:1;M01:P0:03uvZQHg528=;rz4aTT//fenmms3Woof0gGSTyw+ lUV/3KaQ/BCAmeLvITzlwih6WwNbnrcURhbeg4m5FWFK2r6jDeedK9NBm3xZ/XGX3FIl8VS1D mrGK8YDTI1IGBE4pvS7kGT5U0WimMZiFIoKqyp0Z00slHWDIjE8Ze+MJoH7Spm5Ms/r0fXcZM njL62H6glutmu73XxUXlygIHZ5Nce3blNtbeK8uWtrkIx2e8StH0bSqFVGpoxmBZ4k5XLBbOS aiD96Py/08eaEmpcqj7DAxWB0KGepe3cwQrDUh70IC7xmqmfi07vNtb1pv/Pfrh8KRiqgLnLO n1HfV7C2zZzxocir3JTxbBiRIELTDi7yV5Z2HKpHbb2uCRLjypFi0iAqYlMuAvDLDKgFJ8ng3 In1BfsCXLUodpIXQz0MoO5Aeox1SQ58C+cyKk7pBQV32iIZWtET/OK8zZxYiDHXXzvz/h6HY3 9yEA8LpP0IukjoVdd9hAGjzDLvXI8YZ5dWL5OHVSOyywPJwgRTuZ91av9AJCQClXp0KHfwMtZ /FPHJy9UTtdRf6hls9swB3PZPRltlLoxijv4xnPGgYhGJU31d+WozfpGMZsCI2xmwLlmbv57S B7mfxwkQd/fTc4j9/wHGjIBemKIS+G2yxIYFv3ebtTWwZGrlnyAvInGQMCCLH3+7kFBOejscA AvfEfw7SmEYERxHS4uRAfqCeV0UwXOgsb/HqKRdnfjJyDzprpf0a/qlXGGiDnOm63T7SPizDV Y4QorlDonW3GAamN3z5HYbnOF9c+P3Gy23RND8UT+gVc7qtzMA0yHhx22uyuFlG8OB1pCRItU wyj+ZF+XipA3X6ye5dQDm2mg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240728_044637_890670_B3986EF6 X-CRM114-Status: GOOD ( 13.89 ) 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 Raspberry Pi power driver heavily relies on the logging of the underlying firmware driver. This results in disadvantages like unspecific error messages or limited debugging options. So implement the logging for the most important function rpi_firmware_set_power. Signed-off-by: Stefan Wahren --- drivers/pmdomain/bcm/raspberrypi-power.c | 34 ++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) -- 2.34.1 diff --git a/drivers/pmdomain/bcm/raspberrypi-power.c b/drivers/pmdomain/bcm/raspberrypi-power.c index 39d9a52200c3..fadedfc9c645 100644 --- a/drivers/pmdomain/bcm/raspberrypi-power.c +++ b/drivers/pmdomain/bcm/raspberrypi-power.c @@ -48,33 +48,39 @@ struct rpi_power_domain_packet { * Asks the firmware to enable or disable power on a specific power * domain. */ -static int rpi_firmware_set_power(struct rpi_power_domain *rpi_domain, bool on) +static int rpi_firmware_set_power(struct generic_pm_domain *domain, bool on) { + struct rpi_power_domain *rpi_domain = + container_of(domain, struct rpi_power_domain, base); + bool old_interface = rpi_domain->old_interface; struct rpi_power_domain_packet packet; + int ret; packet.domain = rpi_domain->domain; packet.state = on; - return rpi_firmware_property(rpi_domain->fw, - rpi_domain->old_interface ? - RPI_FIRMWARE_SET_POWER_STATE : - RPI_FIRMWARE_SET_DOMAIN_STATE, - &packet, sizeof(packet)); + + ret = rpi_firmware_property(rpi_domain->fw, old_interface ? + RPI_FIRMWARE_SET_POWER_STATE : + RPI_FIRMWARE_SET_DOMAIN_STATE, + &packet, sizeof(packet)); + if (ret) + dev_err(&domain->dev, "Failed to set %s to %u (%d)\n", + old_interface ? "power" : "domain", on, ret); + else + dev_dbg(&domain->dev, "Set %s to %u\n", + old_interface ? "power" : "domain", on); + + return ret; } static int rpi_domain_off(struct generic_pm_domain *domain) { - struct rpi_power_domain *rpi_domain = - container_of(domain, struct rpi_power_domain, base); - - return rpi_firmware_set_power(rpi_domain, false); + return rpi_firmware_set_power(domain, false); } static int rpi_domain_on(struct generic_pm_domain *domain) { - struct rpi_power_domain *rpi_domain = - container_of(domain, struct rpi_power_domain, base); - - return rpi_firmware_set_power(rpi_domain, true); + return rpi_firmware_set_power(domain, true); } static void rpi_common_init_power_domain(struct rpi_power_domains *rpi_domains,