Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1065580pxj; Fri, 4 Jun 2021 05:22:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJfbncAHWq80cxxCn/h/yQl7mZCwHIZZf1oE6audrChK4ZdeHUM5u02abJ1CRTZ8BWuDlT X-Received: by 2002:a05:6402:35c4:: with SMTP id z4mr4338099edc.362.1622809339888; Fri, 04 Jun 2021 05:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622809339; cv=none; d=google.com; s=arc-20160816; b=FeQtY3+fyRLbb2u4ivx88larfhDyknLe4z0x3bJzoPCx8F2CPBKVyQ849jPBZIR/Um niPhCbJc3t0Ihl1bHtPUaF8FIR45V7d2h5Z1H89xtIPGjUOXbcULlFD9PK8PLcCN1MTo iI/GVeyOC8mkfu2uodPbBuHHuj95vW3liyFCJU/QgiYxpRVzWpS+OOZi3yUEB1nK7Dhj vhtbZebCsOB/Hq5uIcTfr9PRiteKTtAZ/zFdHkT5qDO4z2QzonFRXVUYzY4f1BTkdsAJ uz0ggElCt2n1lCqQ1yD5QMHrX53J7oJf2zP4yipDNo8uWPtbsAbLDCr5RTu/+yEezKQ1 uQgw== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=48KVTg0lbXeEAwhOUdvdb816VV3wqy1Nd6nSNLoqjXU=; b=NOMt/erBwmbtDILlEvtXUbRiPNLgpignc3f55EJP3FlxCKqsiP5RNwRrvZlGbWkMnP dqg29Rr/5H/o/TLlCNYRoc6rbdyypT1gBnbgLi/1ydJKdaxrpxBih0ipw6eO5BAJB8AW od4FqpXY+a8lvPsLDTymgf6sO/NR2zq3eOH4kbFZRMLrb7d+a4xjsw8oao3G1tk4wGpb X7wi7J/S70vuRAGqdOCXpZJ6yLbrgD2R/G2Z/DaNQgnT3BgSCmYdavmp5+wEH+7gjDf8 LY4WdrxKkCD7b7bHdOMSqezqEXuMxm327guTruta+y82pA+hYZB5AxsS25vv7AzZ631+ 411g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si4548169ejj.214.2021.06.04.05.21.47; Fri, 04 Jun 2021 05:22:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230039AbhFDMWf (ORCPT + 99 others); Fri, 4 Jun 2021 08:22:35 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:34804 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbhFDMWe (ORCPT ); Fri, 4 Jun 2021 08:22:34 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id 4940B1F415FC Received: by earth.universe (Postfix, from userid 1000) id 4A8433C0C95; Fri, 4 Jun 2021 14:20:45 +0200 (CEST) Date: Fri, 4 Jun 2021 14:20:45 +0200 From: Sebastian Reichel To: Hermann Lauer Cc: Chen-Yu Tsai , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] power: supply: axp20x_battery: implement writeable status to enable/disable battery charging Message-ID: <20210604122045.itugfiivy5il5bkz@earth.universe> References: <20210421090354.GF19953@lemon.iwr.uni-heidelberg.de> <20210505112902.GC5302@lemon.iwr.uni-heidelberg.de> <20210510131804.GP11983@lemon.iwr.uni-heidelberg.de> <20210512105856.GA15727@lemon.iwr.uni-heidelberg.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fwpzoq2jvtqjw6gp" Content-Disposition: inline In-Reply-To: <20210512105856.GA15727@lemon.iwr.uni-heidelberg.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --fwpzoq2jvtqjw6gp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Wed, May 12, 2021 at 12:58:56PM +0200, Hermann Lauer wrote: > Allow disabling and reenabling battery charging of an axp209 PMIC through= a > writable status property. With the current driver code charging is always= on. >=20 > This works on the axp209 of Banana {Pi M1+,Pro} and should work on all AX= P chips. >=20 > Signed-off-by: Hermann.Lauer@uni-heidelberg.de > --- Thanks, queued. -- Sebastian > v2: add fallthrough and improve commit message (thanks to Maxime and Chen= Yu) > v3: fix fallthrough usage >=20 > Thanks to ChenYu for the idea and greetings > Hermann >=20 > drivers/power/supply/axp20x_battery.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply= /axp20x_battery.c > --- a/drivers/power/supply/axp20x_battery.c > +++ b/drivers/power/supply/axp20x_battery.c > @@ -40,6 +40,7 @@ > #define AXP209_FG_PERCENT GENMASK(6, 0) > #define AXP22X_FG_VALID BIT(7) > =20 > +#define AXP20X_CHRG_CTRL1_ENABLE BIT(7) > #define AXP20X_CHRG_CTRL1_TGT_VOLT GENMASK(6, 5) > #define AXP20X_CHRG_CTRL1_TGT_4_1V (0 << 5) > #define AXP20X_CHRG_CTRL1_TGT_4_15V (1 << 5) > @@ -468,7 +469,18 @@ > case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX: > return axp20x_set_max_constant_charge_current(axp20x_batt, > val->intval); > + case POWER_SUPPLY_PROP_STATUS: > + switch (val->intval) { > + case POWER_SUPPLY_STATUS_CHARGING: > + return regmap_update_bits(axp20x_batt->regmap, AXP20X_CHRG_CTRL1, > + AXP20X_CHRG_CTRL1_ENABLE, AXP20X_CHRG_CTRL1_ENABLE); > =20 > + case POWER_SUPPLY_STATUS_DISCHARGING: > + case POWER_SUPPLY_STATUS_NOT_CHARGING: > + return regmap_update_bits(axp20x_batt->regmap, AXP20X_CHRG_CTRL1, > + AXP20X_CHRG_CTRL1_ENABLE, 0); > + } > + fallthrough; > default: > return -EINVAL; > } > @@ -491,7 +503,8 @@ > static int axp20x_battery_prop_writeable(struct power_supply *psy, > enum power_supply_property psp) > { > - return psp =3D=3D POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN || > + return psp =3D=3D POWER_SUPPLY_PROP_STATUS || > + psp =3D=3D POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN || > psp =3D=3D POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN || > psp =3D=3D POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT || > psp =3D=3D POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX; --fwpzoq2jvtqjw6gp Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAmC6GpQACgkQ2O7X88g7 +prBhBAAj2NlkEeOOAOh6GLN3xrV4Sx2+H5w/kwXzxSghPjMIq0WyICTLoORnuPw iwTSVWg7sCOgKKCE10LDwyhKkkuhVBz/Y8NyWnv9MitmIDk0eXwquBvswjtL+pqv yceOGUEA0+FwV2YVkZjQa+TasIdBKo9Zk2sbiHZ/3QFi1H/9k5RXjrYTxOxrSZsr zNMckIN5ZaUnxmwwAZWMCa6urjsMM0+5XsjOiAGbCwgZwsnSeOeBLwaQFqWXrIKS g0Jg1uEyb0C62FZhtbBEIj2GMF8nTg/hFQiLRHC+xSnxV+v5m/2OGMyySfGiCN4M nj1ZzMtYozFYYdEVB3lht+w633WDmmZw4tLxvt80hF9x4RdFYcqxk8fJxwjvKLnq eRq1WLgwQTQFK3fSJceLt6gtnCijo2F95Cob8Ene1EnSHrrez9szZTobn5FHw/oA x4lvXqLa+InfCDLlK0KQC4DJo32mfho27P+r0RJL1fExdsvV8CJTxNNMeKxIjEQo evbAOiSZOd5P91wWPna11/5cHybdnFIVRC7SdAVt2TddDfddTeaUX0ZLTmd/Z8vP DvjUmR2ZoGnkooURBJ1q4c5C5L1LDyuK6fTJbSZecDnVKu9sWhIPbQbtFwqHPGbo MzU2IeigOgWMsttKwYsL2R1FuuTAdGfviVnRL2Kev+x076bZEY4= =Ffeg -----END PGP SIGNATURE----- --fwpzoq2jvtqjw6gp--