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 2A5F8C52D7D for ; Sat, 17 Aug 2024 10:01: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: Content-Type:MIME-Version:References:In-Reply-To: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=vaYN01J0gA/DrH0E26j++er53QqJvdQGcVePIF0PVnw=; b=TUYCdPJEEN2wgNK1UzY5QTACtt Pbpya8PPFiWQFMA3BWyLBD9i6WSxa6HaoU9U3kcjHmur7EVU0OWAgORIuaRoSIj4SBd4TUMFounVH +YnPDAmzuKcezjkUZQJJfuv5MIBudSGCu2soOdJU6+M1dLvpZny7m4wG+2YXVzmQR/Uznt59Q3VPo wkgjYBIBfGC63QCCKVY4dFn3j1GhvicnZbjnkcljjy94nCXCKMKgQrRPRXiEvI4DuP/KHy/+dEGLl 6TBng9hYkRE1MVU/NNUGgK83EIyoMB0ZuCrJQgpmt9SAXiijw7kd6IWZESlr0cZnR8u/L+Qm5+lgx 7ileti5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfGEs-0000000F39B-0Bsi; Sat, 17 Aug 2024 10:00:50 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfGED-0000000F34N-0wJu for linux-arm-kernel@lists.infradead.org; Sat, 17 Aug 2024 10:00:10 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id B64DCCE0FFC; Sat, 17 Aug 2024 10:00:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DE02C116B1; Sat, 17 Aug 2024 09:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1723888799; bh=0I3Z/JX3w1vF12YT4+Xa5zhTim9q0NldcHx2aPBgh7o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=og6DfgjCAkZEmiH7KS3to4FVpEC+zIkQb88SO5OmOuYYzGVRKAo/pTrQF0nwOyida OwV0u9Imi5vpqhNaLrzNfoMgl2JxZsQe5oIjdkF6IcizZHF3+cyvvvLCFvFlBRyrpd yNjtBvVmk5Dxk95VvEmBmFhCt4RnLG4OjsI2B/+R/UZuCRpYTdm6YiZ88wGlQrFyft wWDdNK/8JVAOIX57axEMlCpFh89FOOPzRsd27jgZtEU2+1wAfoqwZRvZdsp1NAu+PP uppHaqFdiopgxWjkrCUDOyDHA6hhTvtnfcetLIaz6Ib67QRDHasYePVnReoWTcQQFh V2/ZRB6Tewmzw== Date: Sat, 17 Aug 2024 10:59:49 +0100 From: Jonathan Cameron To: Chris Morgan Cc: linux-sunxi@lists.linux.dev, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, quentin.schulz@free-electrons.com, mripard@kernel.org, tgamblin@baylibre.com, aidanmacdonald.0x0@gmail.com, u.kleine-koenig@pengutronix.de, lee@kernel.org, samuel@sholland.org, jernej.skrabec@gmail.com, sre@kernel.org, wens@csie.org, conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org, lars@metafoo.de, Chris Morgan , Philippe Simons Subject: Re: [PATCH V2 14/15] power: supply: axp20x_battery: add support for AXP717 Message-ID: <20240817105949.2a091d13@jic23-huawei> In-Reply-To: <66bd1ddf.ca0a0220.13e5d4.8871@mx.google.com> References: <20240802192026.446344-1-macroalpha82@gmail.com> <20240802192026.446344-15-macroalpha82@gmail.com> <20240803121044.20481897@jic23-huawei> <66bd1ddf.ca0a0220.13e5d4.8871@mx.google.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240817_030009_645293_B72CAABC X-CRM114-Status: GOOD ( 27.15 ) 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 On Wed, 14 Aug 2024 16:13:01 -0500 Chris Morgan wrote: > On Sat, Aug 03, 2024 at 12:10:44PM +0100, Jonathan Cameron wrote: > > On Fri, 2 Aug 2024 14:20:25 -0500 > > Chris Morgan wrote: > > > > > From: Chris Morgan > > > > > > Add support for the AXP717 PMIC battery charger. The AXP717 differs > > > greatly from existing AXP battery chargers in that it cannot measure > > > the discharge current. The datasheet does not document the current > > > value's offset or scale, so the POWER_SUPPLY_PROP_CURRENT_NOW is left > > > unscaled. > > > > > > Tested-by: Philippe Simons > > > Signed-off-by: Chris Morgan > > Hi. > > > > A few drive by comments, > > > > Jonathan > > > > > --- > > > drivers/power/supply/axp20x_battery.c | 444 ++++++++++++++++++++++++++ > > > 1 file changed, 444 insertions(+) > > > > > > diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c > > > index c903c588b361..53af4ad0549d 100644 > > > --- a/drivers/power/supply/axp20x_battery.c > > > +++ b/drivers/power/supply/axp20x_battery.c > > > @@ -32,9 +32,19 @@ > > > #include > > > > > > #define AXP20X_PWR_STATUS_BAT_CHARGING BIT(2) > > > +#define AXP717_PWR_STATUS_MASK GENMASK(6, 5) > > > +#define AXP717_PWR_STATUS_BAT_STANDBY (0 << 5) > > > +#define AXP717_PWR_STATUS_BAT_CHRG (1 << 5) > > > +#define AXP717_PWR_STATUS_BAT_DISCHRG (2 << 5) > > > > Fine to match local style in this patch, but just thought I'd > > comment that this driver would probably be more readable with > > use of FIELD_PREP and changing convention to not shift the defined > > values for contents of each field. > > > > To change to that it would either need to be before this patch, > > or done as a follow up. > > I'll take your other comments and apply them, but if it's okay with > you I'll opt to not use FIELD_PREP/FIELD_GET for the moment, so the > style remains the same. I will make sure to use those macros for > other drivers I'm working on though as they seem handy. That's fine, though if you are in a position to test, it would be good to follow up with a tidy up of this driver as that style is much more compact and helps with maintenance longer term. Jonathan