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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFB91C433EF for ; Mon, 25 Oct 2021 00:39:10 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5339860238 for ; Mon, 25 Oct 2021 00:39:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5339860238 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 4EA5483458; Mon, 25 Oct 2021 02:39:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9CA31815CE; Mon, 25 Oct 2021 02:39:02 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 3A86283521 for ; Mon, 25 Oct 2021 02:38:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=andre.przywara@arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AB50FD6E; Sun, 24 Oct 2021 17:38:55 -0700 (PDT) Received: from slackpad.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 50C243F70D; Sun, 24 Oct 2021 17:38:54 -0700 (PDT) Date: Mon, 25 Oct 2021 01:38:50 +0100 From: Andre Przywara To: Samuel Holland Cc: u-boot@lists.denx.de, Jaehoon Chung , Jagan Teki , Igor Opaniuk , Jernej Skrabec , Stephan Gerhold , Tim Harvey Subject: Re: [PATCH 4/4] power: pmic: axp: Implement poweroff via sysreset Message-ID: <20211025013850.425a5848@slackpad.fritz.box> In-Reply-To: <20210822231807.3330-5-samuel@sholland.org> References: <20210822231807.3330-1-samuel@sholland.org> <20210822231807.3330-5-samuel@sholland.org> Organization: Arm Ltd. X-Mailer: Claws Mail 3.17.1 (GTK+ 2.24.31; x86_64-slackware-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Sun, 22 Aug 2021 18:18:06 -0500 Samuel Holland wrote: Hi Samuel, > The AXP PMICs have the ability to power off the system. The existing > code for this is duplicated for each PMIC variant, and uses the legacy > non-DM "pmic_bus" interface. When SYSRESET is enabled, this can all be > replaced with a sysreset device using the DM_PMIC interface. > > Since the trigger bit is the same on all PMIC variants, use the register > definitions from the oldest supported PMIC. > > Signed-off-by: Samuel Holland This looks alright, but doesn't apply anymore, since you removed axp_pmic_bind() in v2 of the DM_I2C series. Can you rebase this series (or just 4/4) on top of master? I will take the first three patches anyway, they apply cleanly. Thanks, Andre > --- > > drivers/power/pmic/Kconfig | 2 ++ > drivers/power/pmic/axp.c | 36 ++++++++++++++++++++++++++++++++++++ > 2 files changed, 38 insertions(+) > > diff --git a/drivers/power/pmic/Kconfig b/drivers/power/pmic/Kconfig > index 6a3e82e1be7..983fe135157 100644 > --- a/drivers/power/pmic/Kconfig > +++ b/drivers/power/pmic/Kconfig > @@ -60,6 +60,8 @@ config PMIC_ACT8846 > config PMIC_AXP > bool "Enable Driver Model for X-Powers AXP PMICs" > depends on DM_I2C > + select SYSRESET_CMD_POWEROFF if SYSRESET && CMD_POWEROFF > + imply CMD_POWEROFF if SYSRESET > help > This config enables driver-model PMIC uclass features for > X-Powers AXP152, AXP2xx, and AXP8xx PMICs. > diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c > index 7720e1afd9b..0f2b24a8b5f 100644 > --- a/drivers/power/pmic/axp.c > +++ b/drivers/power/pmic/axp.c > @@ -1,8 +1,37 @@ > // SPDX-License-Identifier: GPL-2.0+ > > +#include > #include > +#include > #include > #include > +#include > + > +#if CONFIG_IS_ENABLED(SYSRESET) > +static int axp_sysreset_request(struct udevice *dev, enum sysreset_t type) > +{ > + int ret; > + > + if (type != SYSRESET_POWER_OFF) > + return -EPROTONOSUPPORT; > + > + ret = pmic_clrsetbits(dev->parent, AXP152_SHUTDOWN, 0, AXP152_POWEROFF); > + if (ret < 0) > + return ret; > + > + return -EINPROGRESS; > +} > + > +static struct sysreset_ops axp_sysreset_ops = { > + .request = axp_sysreset_request, > +}; > + > +U_BOOT_DRIVER(axp_sysreset) = { > + .name = "axp_sysreset", > + .id = UCLASS_SYSRESET, > + .ops = &axp_sysreset_ops, > +}; > +#endif > > static int axp_pmic_reg_count(struct udevice *dev) > { > @@ -24,6 +53,13 @@ static int axp_pmic_bind(struct udevice *dev) > if (ret) > return ret; > > + if (CONFIG_IS_ENABLED(SYSRESET)) { > + ret = device_bind_driver_to_node(dev, "axp_sysreset", "axp_sysreset", > + dev_ofnode(dev), NULL); > + if (ret) > + return ret; > + } > + > return 0; > } >