From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
Anton Vorontsov <anton@enomsg.org>
Cc: linux-kernel@vger.kernel.org, "Pali Rohár" <pali.rohar@gmail.com>,
"David Woodhouse" <dwmw2@infradead.org>
Subject: Re: [PATCH] bq2415x_charger: fix max battery regulation voltage
Date: Wed, 16 Oct 2013 16:09:40 +0200 [thread overview]
Message-ID: <525E9E24.3090401@free-electrons.com> (raw)
In-Reply-To: <1381932511-31719-1-git-send-email-alexandre.belloni@free-electrons.com>
Hi,
I forgot to add this is a v2 and I just added a comment.
On 16/10/2013 16:08, Alexandre Belloni wrote:
> As per the datasheets, maximum battery regulation voltage is 4440mV.
>
> The formula is (voltage - offset) / step, so the maximum value is:
> (4440 - 3500) / 20 = 47
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/power/bq2415x_charger.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/bq2415x_charger.c b/drivers/power/bq2415x_charger.c
> index 0727f92..df893dd 100644
> --- a/drivers/power/bq2415x_charger.c
> +++ b/drivers/power/bq2415x_charger.c
> @@ -605,9 +605,13 @@ static int bq2415x_set_battery_regulation_voltage(struct bq2415x_device *bq,
> {
> int val = (mV/10 - 350) / 2;
>
> + /*
> + * According to datasheet, maximum battery regulation voltage is
> + * 4440mV which is b101111 = 47.
> + */
> if (val < 0)
> val = 0;
> - else if (val > 94) /* FIXME: Max is 94 or 122 ? Set max value ? */
> + else if (val > 47)
> return -EINVAL;
>
> return bq2415x_i2c_write_mask(bq, BQ2415X_REG_VOLTAGE, val,
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2013-10-16 14:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 14:08 Alexandre Belloni
2013-10-16 14:09 ` Alexandre Belloni [this message]
2013-10-25 23:25 ` Anton Vorontsov
-- strict thread matches above, loose matches on Subject: below --
2013-10-02 10:24 Alexandre Belloni
2013-10-15 13:56 ` Pali Rohár
2013-10-15 14:54 ` Alexandre Belloni
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=525E9E24.3090401@free-electrons.com \
--to=alexandre.belloni@free-electrons.com \
--cc=anton@enomsg.org \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pali.rohar@gmail.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
Powered by JetHome