From: Hermes Zhang <Hermes.Zhang@axis.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: kernel <kernel@axis.com>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Hermes Zhang <Hermes.Zhang@axis.com>
Subject: Re: [PATCH] power: supply: bq256xx: Remove init ichg/vbat with max value
Date: Wed, 30 Nov 2022 09:27:42 +0000 [thread overview]
Message-ID: <60ca0aa6-508a-4350-f892-98d1368e3783@axis.com> (raw)
In-Reply-To: <20221129152715.4hwtobuv57hrndzu@mercury.elektranox.org>
Hi,
在 2022/11/29 23:27, Sebastian Reichel 写道:
> Hi,
>
> On Tue, Nov 29, 2022 at 05:01:12PM +0800, Hermes Zhang wrote:
>> Init the ichg and vbat reg with max value is not good. First the chip
>> already has a default value for ichg and vbat (small value). Init these
>> two reg with max value will result an unsafe case (e.g. battery is over
>> charging in a hot environment) if no user space change them later.
>>
>> Signed-off-by: Hermes Zhang <chenhuiz@axis.com>
>> ---
> It's the driver's task to setup safe initial maximum values.
> Pre-kernel values may or may not be safe if you consider things
> like kexec. If you get unsafe values programmed, then fix the
> values instead.
>
> -- Sebastian
The constant_charge_current_max_ua is either from dts or default value
for each chip in the code, but I guess I could ot change them because it
has their own meaning (it will be used to check if the setting is valid
or not). Do you mean I can set some other value here instead of
constant_xxx_max?
Best Regards,
Hermes
>> drivers/power/supply/bq256xx_charger.c | 10 ----------
>> 1 file changed, 10 deletions(-)
>>
>> diff --git a/drivers/power/supply/bq256xx_charger.c b/drivers/power/supply/bq256xx_charger.c
>> index 01ad84fd147c..d1aa92c10c22 100644
>> --- a/drivers/power/supply/bq256xx_charger.c
>> +++ b/drivers/power/supply/bq256xx_charger.c
>> @@ -1562,21 +1562,11 @@ static int bq256xx_hw_init(struct bq256xx_device *bq)
>> if (ret)
>> return ret;
>>
>> - ret = bq->chip_info->bq256xx_set_ichg(bq,
>> - bat_info->constant_charge_current_max_ua);
>> - if (ret)
>> - return ret;
>> -
>> ret = bq->chip_info->bq256xx_set_iprechg(bq,
>> bat_info->precharge_current_ua);
>> if (ret)
>> return ret;
>>
>> - ret = bq->chip_info->bq256xx_set_vbatreg(bq,
>> - bat_info->constant_charge_voltage_max_uv);
>> - if (ret)
>> - return ret;
>> -
>> ret = bq->chip_info->bq256xx_set_iterm(bq,
>> bat_info->charge_term_current_ua);
>> if (ret)
>> --
>> 2.30.2
>>
next prev parent reply other threads:[~2022-11-30 9:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 9:01 [PATCH] power: supply: bq256xx: Remove init ichg/vbat with max value Hermes Zhang
2022-11-29 15:27 ` Sebastian Reichel
2022-11-30 9:27 ` Hermes Zhang [this message]
2022-12-03 1:03 ` Sebastian Reichel
[not found] ` <cf37715e-8bff-b38c-cee9-fdcc3b1d3a6b@axis.com>
2022-12-05 21:21 ` Sebastian Reichel
2022-12-07 2:53 ` Hermes Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=60ca0aa6-508a-4350-f892-98d1368e3783@axis.com \
--to=hermes.zhang@axis.com \
--cc=kernel@axis.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sebastian.reichel@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox