From mboxrd@z Thu Jan 1 00:00:00 1970 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 2F579CAC5B5 for ; Sun, 28 Sep 2025 18:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hREKR+kneOv1E0FIfA+fX4hV9CjLfcA6K4yjKF/Aqfs=; b=3v6rL4dOWxLf69 mgdy8tfT7466KzT8/xvA5URCVbqbPtBM07TGKll87coc8cTWQQFrqTSqJzoLy/75s8zPz9S+RnQYm DA0d7Vtm6v37J/mZOppYjrOtzgs3k1sMQCppzEhq/VLvWzIcfZ/MLKALhS6m0Ri6A6GSjODDMvIoE ++UwVCgYL7K9iBZTLS4I9TJl6IIDUuCD3gFI7J1lfCvwZXqM0xbH9NWDVbr6ufjrh0dd10UNxCrLy 3JyOg7z9hcyuxT59bF9k8g5BcTFq1yuzmoN79T4STM0cax206h0MqRDPgARyzqn5X5Vfb0BY2b/g2 5IqjwTqctYO3af1LRSSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v2vi2-0000000H0yd-3rwj; Sun, 28 Sep 2025 18:01:18 +0000 Received: from hall.aurel32.net ([2001:bc8:30d7:100::1]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v2vhz-0000000H0wo-3kQE for linux-riscv@lists.infradead.org; Sun, 28 Sep 2025 18:01:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=aurel32.net ; s=202004.hall; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Content-Transfer-Encoding:From:Reply-To: Subject:Content-ID:Content-Description:X-Debbugs-Cc; bh=p3zwPG2lHdfGT54vRdWzMiWo1GIY+4oyV83lYkTPCSg=; b=txCqod+7lxWDuX9hd4gJshx+rB jLCDSApN3cGlTlr2qpYvhamL3LoECi5F4cqyj44c0gAV+ltxFnBfm0iBvhqi5/cdl5uJ0m9sc995z GwWM8UZJRcGEQjAKV9dRXFf+ZHJWRIx9utw47og7Y0P1a5ZjlasCEtL1/RXjkOUPRaElOwzNSTKVJ XBs6/TeBl3YOETm0A/qiP94hRqi3vLR+NcWeMBdzddiGk5T8/e1cSJrshXG8eoiv/sjFGHtaK6VR8 mLE8Ki8VcsL+syGhf3f2lX7mikw5EsBY1OS3NdMTLpbf2Cp02CQL8iSYRsOeGmlv4h4gv5ZEClUOI YINvYD3Q==; Received: from [2a01:e34:ec5d:a741:1ee1:92ff:feb4:5ec0] (helo=ohm.rr44.fr) by hall.aurel32.net with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1v2vhm-001XtX-0B; Sun, 28 Sep 2025 20:01:02 +0200 Date: Sun, 28 Sep 2025 20:01:01 +0200 From: Aurelien Jarno To: Yixun Lan Cc: linux-kernel@vger.kernel.org, Lee Jones , Sebastian Reichel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , "open list:SYSTEM RESET/SHUTDOWN DRIVERS" , "open list:RISC-V SPACEMIT SoC Support" , "open list:RISC-V SPACEMIT SoC Support" Subject: Re: [PATCH 1/2] driver: reset: spacemit-p1: add driver for poweroff/reboot Message-ID: Mail-Followup-To: Yixun Lan , linux-kernel@vger.kernel.org, Lee Jones , Sebastian Reichel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , "open list:SYSTEM RESET/SHUTDOWN DRIVERS" , "open list:RISC-V SPACEMIT SoC Support" , "open list:RISC-V SPACEMIT SoC Support" References: <20250927220824.1267318-1-aurelien@aurel32.net> <20250927220824.1267318-2-aurelien@aurel32.net> <20250928000255-GYA1342640@gentoo.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20250928000255-GYA1342640@gentoo.org> User-Agent: Mutt/2.2.13 (2024-03-09) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250928_110116_359954_61D45341 X-CRM114-Status: GOOD ( 21.41 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Hi Yixun, On 2025-09-28 08:02, Yixun Lan wrote: > Hi Aurelien, > > On 00:07 Sun 28 Sep , Aurelien Jarno wrote: > > This driver implements poweroff/reboot support for the SpacemiT P1 PMIC > > chip, which is commonly paired with the SpacemiT K1 SoC. > > > > The SpacemiT P1 support is implemented as a MFD driver, so the access is > > done directly through the regmap interface. Reboot or poweroff is > > triggered by setting a specific bit in a control register, which is > > automatically cleared by the hardware afterwards. > > > > Signed-off-by: Aurelien Jarno > > --- > > drivers/power/reset/Kconfig | 9 +++ > > drivers/power/reset/Makefile | 1 + > > drivers/power/reset/spacemit-p1-reboot.c | 88 ++++++++++++++++++++++++ > > 3 files changed, 98 insertions(+) > > create mode 100644 drivers/power/reset/spacemit-p1-reboot.c > > > > diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig > > index 77ea3129c7080..5afef049760d6 100644 > > --- a/drivers/power/reset/Kconfig > > +++ b/drivers/power/reset/Kconfig > [snip].. > > + > > +static int spacemit_p1_reboot_probe(struct platform_device *pdev) > > +{ > > + struct device *dev = &pdev->dev; > > + struct regmap *regmap; > > + int ret; > > + > > + regmap = dev_get_regmap(dev->parent, NULL); > > + if (!regmap) > > + return -ENODEV; > > + > > + ret = devm_register_power_off_handler(dev, &spacemit_p1_pwroff_handler, regmap); > > + if (ret) { > > + dev_err(dev, "Failed to register power off handler: %d\n", ret); > > + return ret; > suggest to simplify with dev_err_probe(), which will save few lines > > + } > > + > > + ret = devm_register_restart_handler(dev, spacemit_p1_restart_handler, regmap); > > + if (ret) { > > + dev_err(dev, "Failed to register restart handler: %d\n", ret); > > + return ret; > ditto Thanks for the hint, that'll be in the next version. Regards Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B aurelien@aurel32.net http://aurel32.net _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv