Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1894799pxj; Sun, 9 May 2021 08:12:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxylOluK+o5hdaEw6hRLGf+g/0iHqdIWg1vj3drx1vmTe67Z5OGeumeUCQPfNVnretxE1Ew X-Received: by 2002:a17:906:414d:: with SMTP id l13mr21070934ejk.527.1620573153532; Sun, 09 May 2021 08:12:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620573153; cv=none; d=google.com; s=arc-20160816; b=emOrGTlRTxRVQTrIeNt/QhXLP7w8he4tQYQgBITgcY+6/mAMkmCAdyefCM4mpJsQRC L3CkkJKQQVRYTbA7fJkj3xarQdfnlcSfiX+obD4/XoCoicMpOxQvoX5/BEYOr4srHekb PoqlRn7EAlOXAcZzuqk++AmM8gWCimQn7BKWlhhwNkg5pxNV4jlI9r0aUjTVOR/7AFQv pRC7yW8JmoZ/bY82xV1popQYvlzjgtiDPo1Nqw8Ryw2hQQudSn5b04QWOv0o4Ir2VPUg 2NRDwbrOInMRoGsomlt483sSES1v92GFCiDlNpx8QzT3Xs14j9Ogdy4ZxtPc5I5SW8v7 duaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:reply-to :in-reply-to:references:mime-version; bh=OQjw04OJR2D4IqoTtXU0N4drQxCgCETBxjmIRrkObds=; b=DFRvO1v0BlMS/RFsvKhj1DadEoGkj4CT/nQcR7jgWeyUnXhw6cCwnVa890UAHyVl/y 9azjLbTocACzCjuTMr3ZUEdU7Vb+YOPeJI+GFIbdnOJq15bW9jqFttA/RntUjRrxze0a /fwEOeQL5QOEMpClRjJ350HJFlUOzOdSRlCz7cFiVvysLdbBvouEgkGClnwqTt9ni3hM xooHweYwk4TJO218Hk0hPgYB9TqINjtM0ZZxzOB+7bzuPD1TsZ2pn1i3NcPgTFPnFWtB MqNVxfeZ+FnC21LHSCq/Pl5zqejDVlU1MTcEk/CwWb2ngapdhQOjYVmP9ato/JhGt2H0 0D2A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j8si14062781ejk.38.2021.05.09.08.12.09; Sun, 09 May 2021 08:12:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229673AbhEIPHP (ORCPT + 99 others); Sun, 9 May 2021 11:07:15 -0400 Received: from mail-lj1-f176.google.com ([209.85.208.176]:38631 "EHLO mail-lj1-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhEIPHN (ORCPT ); Sun, 9 May 2021 11:07:13 -0400 Received: by mail-lj1-f176.google.com with SMTP id v6so17651370ljj.5; Sun, 09 May 2021 08:06:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=OQjw04OJR2D4IqoTtXU0N4drQxCgCETBxjmIRrkObds=; b=fIAMHNKevosjt4dyL6cre+Vvd7IaA4cO2h09izNbUpQsgQaDhdPnWQQWv++HJvkxoL tA3XZkSJ3d1zSVLjINfCcZ4ckt2cj2apFElL7Zt4oOCdJxPgZnwfkd8bwTHynw9gBE/W NV4Q+eaB+3BIGf7uShoSFLErEnCJQcX3NtGkah6sH31SSN84nZmngmfM1bTdkDTM80Tt pJmaevRqFFZvifI6NioIWDM9oucTyk+yyni1alfX9IqCe6Wf/YRrvWNFYMgw9K6BVaiE N8zAFhzK4FAl/3SOjWwRMs+lQIiSxNewD/QhZZEXz6TzicqIEl3lhjKwyLns6tJ5AAWD TEbw== X-Gm-Message-State: AOAM530TyT9Vp/dNeC5IWhS2okJuaagGH4LH+fUAL7y7nw3mCOGcwFTg tBzEINDPw0kWEYPZsayGSPxRTmu7hJ/Ttg== X-Received: by 2002:a2e:8756:: with SMTP id q22mr16773180ljj.414.1620572769323; Sun, 09 May 2021 08:06:09 -0700 (PDT) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id v14sm1938381lfo.76.2021.05.09.08.06.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 May 2021 08:06:08 -0700 (PDT) Received: by mail-lj1-f175.google.com with SMTP id b7so17637121ljr.4; Sun, 09 May 2021 08:06:08 -0700 (PDT) X-Received: by 2002:a2e:9810:: with SMTP id a16mr17138024ljj.78.1620572768750; Sun, 09 May 2021 08:06:08 -0700 (PDT) MIME-Version: 1.0 References: <20210421090354.GF19953@lemon.iwr.uni-heidelberg.de> <20210505112902.GC5302@lemon.iwr.uni-heidelberg.de> In-Reply-To: <20210505112902.GC5302@lemon.iwr.uni-heidelberg.de> Reply-To: wens@csie.org From: Chen-Yu Tsai Date: Sun, 9 May 2021 23:05:56 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] power: supply: axp20x_battery: implement writeable status to enable/disable battery charging To: Hermann.Lauer@uni-heidelberg.de Cc: Sebastian Reichel , "open list:THERMAL" , linux-kernel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, May 5, 2021 at 7:29 PM wrote: > > Dear Maintainers, > > this patch allows enabling/disabling charging for the axp209 PMIC through a > writeable status property. ^ writable > > This works on the axp209 of Banana {Pi M1+,Pro}. I have no access to > the other chips the driver deals with. This should work on all the AXP chips, as it's the same bit that controls the charger on all of them. > Thanks to ChenYu for the idea and greetings > Hermann > > Signed-off-by: Hermann.Lauer@uni-heidelberg.de The patch itself looks good, but your commit message needs a bit of cleanup. Your commit message should only include details about the patch, especially why the patch was done, which is kind of missing. "What" was done is already obvious when looking at the body of the patch. Any pleasantries and other comments addressed to maintainers should be included after the "---" so as not to be included in git history. Thanks ChenYu > --- > drivers/power/supply/axp20x_battery.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > 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) > > +#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,17 @@ > 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); > > + 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); > + } > default: > return -EINVAL; > } > @@ -491,7 +502,8 @@ > static int axp20x_battery_prop_writeable(struct power_supply *psy, > enum power_supply_property psp) > { > - return psp == POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN || > + return psp == POWER_SUPPLY_PROP_STATUS || > + psp == POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN || > psp == POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN || > psp == POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT || > psp == POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX;