[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <525E9E24.3090401@free-electrons.com>
Date: Wed, 16 Oct 2013 16:09:40 +0200
From: Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To: Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
Anton Vorontsov <anton@...msg.org>
CC: linux-kernel@...r.kernel.org,
Pali Rohár <pali.rohar@...il.com>,
David Woodhouse <dwmw2@...radead.org>
Subject: Re: [PATCH] bq2415x_charger: fix max battery regulation voltage
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@...e-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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists