Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1806671rdb; Thu, 7 Dec 2023 09:12:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFD3WXE+965lijkDyeA94TWhMDehRq+i3LdmNVkOwrNo8vXybrKk6CmJoxFFUAnv/OCT3Jw X-Received: by 2002:a05:6358:e49f:b0:16f:eb57:af02 with SMTP id by31-20020a056358e49f00b0016feb57af02mr3702969rwb.16.1701969143499; Thu, 07 Dec 2023 09:12:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701969143; cv=none; d=google.com; s=arc-20160816; b=yePdtQ0z188ORrJBxytIk+1PykgdhqG6R44ONdetfpQWiatBo+GMqua8Q8QnzCwam7 vHeUsUilYzpTJUg0gtAmAgBxWXGzN/etoBEYfo5n6SUMTyym7LFrzP5ceJwlv2CSoGeF 3jjdykAmVslRIlcggH+k+8NKgjz4hDe1Dk0hpEALELtZBqVGCDlrduUmM35LocM95dFy MzMo+x6m9vFNoWwlqJlwxlyECRYvcuvD2cVV+PRXMkPaLNL8sVgJTLIiS37MHv7VsSe6 vZI2cMG6M+jkweIi1KUAW5Jri1lxybeZy27+iM8lEe3SiMgl+xFLHIPdHcJjbJPMBp0K sEUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Faq46p/ypUTpJ5/HxFw9w+qrQNDJDsvHMbItldI1/0M=; fh=L0O6eQBSkhYHSHh9NxoYRmJHCbVZzu1+iu4y+dZosWM=; b=GDeA7YShwd7LS5ZBD5ctCBxCUGLIRX7KvA8fsZ5I+CPaYmbCccj26pJDb8heKCD8qj o4kde03YZk4k7Sx1qkzPMY1RpzxAgz5jrmVJNfQtEesXMpf7Bd2yCofJpKD8+g2ZFqXg wN4XUe6vRNhH8NQL40YmkvCs/LNP7FCZV3K/ei5So2VlEX7dRWqPl19GIG8S2fA/NkQV MY0dtdouFTOph5vOkKYVIoTegegTANk+Tj3LNbvX9sYuPyQj1X6x1BoiIz2knxm5dtYM maDdcO9n8K2fs5nRm4DmHrvi9/K2fnFDLsuC4sB5t+OMEGzc7230VJqncF9NVTY1YYIE OrOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bXlGR5U8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id e5-20020a654785000000b005c1cd597808si3056pgs.692.2023.12.07.09.12.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 09:12:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bXlGR5U8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BF40B822B73B; Thu, 7 Dec 2023 09:12:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235208AbjLGRLz (ORCPT + 99 others); Thu, 7 Dec 2023 12:11:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjLGRLy (ORCPT ); Thu, 7 Dec 2023 12:11:54 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE48B170C for ; Thu, 7 Dec 2023 09:12:00 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78BA1C433C8; Thu, 7 Dec 2023 17:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701969120; bh=IyPtYmm7UMjttoaV79y97U5M1AiSkAlE5kldVFOD7Qs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bXlGR5U81hQG84IDZlqVXL/s9801dWDL095ZFx6khDpmnlS5vYR0mLR2RERobBupI p9x5SnV/kz9Fw1lJKA0DyAUQ4IeqAuOADwtARkANfI2BYoJcYrMOAfBxh6XR27g5kM Fg+7+O28Z7VuCtlEpxBjUjrTMWP84oeOU1Ft82B8km0jwLcwcy9mrEKa5BDbWXnKKA tmF05vs6YzrD/YswILYhOCbjQcdoPYTM9orr8IpctqwFS8bpJ4tShbyHF1uNLdXU03 irtTIXv/nz8xPwyPUfRkSTHWgS8sxDM/VOxzqq/TKJWZLNsOKN4v8iwN6aYNFurntD R/slSm6O/emCA== Date: Thu, 7 Dec 2023 17:11:55 +0000 From: Lee Jones To: Andreas Kemnade Cc: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, bcousson@baylibre.com, tony@atomide.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: Re: [PATCH v3 2/6] twl-core: add power off implementation for twl603x Message-ID: <20231207171155.GG111411@google.com> References: <20231203222903.343711-1-andreas@kemnade.info> <20231203222903.343711-3-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231203222903.343711-3-andreas@kemnade.info> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 09:12:13 -0800 (PST) On Sun, 03 Dec 2023, Andreas Kemnade wrote: > If the system-power-controller property is there, enable power off. > Implementation is based on a Linux v3.0 vendor kernel. > > Signed-off-by: Andreas Kemnade > --- > drivers/mfd/twl-core.c | 28 ++++++++++++++++++++++++++++ > include/linux/mfd/twl.h | 1 + > 2 files changed, 29 insertions(+) > > diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c > index 6e384a79e3418..f3982d18008d1 100644 > --- a/drivers/mfd/twl-core.c > +++ b/drivers/mfd/twl-core.c > @@ -124,6 +124,11 @@ > #define TWL6030_BASEADD_RSV 0x0000 > #define TWL6030_BASEADD_ZERO 0x0000 > > +/* some fields in TWL6030_PHOENIX_DEV_ON */ My preference is for proper grammar in comments please. "Some" What is TWL6030_PHOENIX_DEV_ON? A register? > +#define TWL6030_APP_DEVOFF BIT(0) > +#define TWL6030_CON_DEVOFF BIT(1) > +#define TWL6030_MOD_DEVOFF BIT(2) > + > /* Few power values */ > #define R_CFG_BOOT 0x05 > > @@ -687,6 +692,20 @@ static void twl_remove(struct i2c_client *client) > twl_priv->ready = false; > } > > +static void twl6030_power_off(void) > +{ > + int err; > + u8 val; > + > + err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &val, TWL6030_PHOENIX_DEV_ON); > + if (err) > + return; > + > + val |= TWL6030_APP_DEVOFF | TWL6030_CON_DEVOFF | TWL6030_MOD_DEVOFF; > + twl_i2c_write_u8(TWL_MODULE_PM_MASTER, val, TWL6030_PHOENIX_DEV_ON); > +} > + > + > static struct of_dev_auxdata twl_auxdata_lookup[] = { > OF_DEV_AUXDATA("ti,twl4030-gpio", 0, "twl4030-gpio", NULL), > { /* sentinel */ }, > @@ -852,6 +871,15 @@ twl_probe(struct i2c_client *client) > goto free; > } > > + if (twl_class_is_6030()) { Is this check required? > + if (of_device_is_system_power_controller(node)) { Shouldn't this cover it? > + if (!pm_power_off) > + pm_power_off = twl6030_power_off; > + else > + dev_warn(&client->dev, "Poweroff callback already assigned\n"); Can this happen? Why would anyone care if it did? > + } > + } > + > status = of_platform_populate(node, NULL, twl_auxdata_lookup, > &client->dev); > > diff --git a/include/linux/mfd/twl.h b/include/linux/mfd/twl.h > index c062d91a67d92..85dc406173dba 100644 > --- a/include/linux/mfd/twl.h > +++ b/include/linux/mfd/twl.h > @@ -461,6 +461,7 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot) > > #define TWL4030_PM_MASTER_GLOBAL_TST 0xb6 > > +#define TWL6030_PHOENIX_DEV_ON 0x06 > /*----------------------------------------------------------------------*/ > > /* Power bus message definitions */ > -- > 2.39.2 > -- Lee Jones [李琼斯]