Linux Power Management development
 help / color / mirror / Atom feed
From: Michael Heinemann <posted@heine.so>
To: Phil Reid <preid@electromag.com.au>, linux-pm@vger.kernel.org
Cc: sre@kernel.org
Subject: Re: [PATCH v2 3/3] power: supply: sbs-battery: Add delay when changing capacity mode bit
Date: Tue, 11 Jul 2017 13:31:16 +0200	[thread overview]
Message-ID: <79941e55f3f273a1cf796deb945f5e95@heine.so> (raw)
In-Reply-To: <1499766223-130934-4-git-send-email-preid@electromag.com.au>

On 2017-07-11 11:43, Phil Reid wrote:
> At least with the Inspired Energy compatible batteries a delay is 
> required
> after setting the capacity mode bit from amp to watts or the reverse.
> Setting the bit and then immediately pooling the status register 
> results
> in an unknown error being returned in the register. Add the delay 
> results
> in and ok status being return. This was also seen when reading the 
> charge
> and energy registers where the wrong value was returned for the 
> requested
> mode.
> 
> Signed-off-by: Phil Reid <preid@electromag.com.au>

Tested-by: Michael Heinemann <committed@heine.so>

> ---
>  drivers/power/supply/sbs-battery.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/power/supply/sbs-battery.c
> b/drivers/power/supply/sbs-battery.c
> index 4594ed1..3473b45 100644
> --- a/drivers/power/supply/sbs-battery.c
> +++ b/drivers/power/supply/sbs-battery.c
> @@ -14,6 +14,7 @@
>   * more details.
>   */
> 
> +#include <linux/delay.h>
>  #include <linux/err.h>
>  #include <linux/gpio/consumer.h>
>  #include <linux/i2c.h>
> @@ -511,6 +512,8 @@ static enum sbs_battery_mode
> sbs_set_battery_mode(struct i2c_client *client,
>  	if (ret < 0)
>  		return ret;
> 
> +	usleep_range(1000, 2000);
> +
>  	return original_val & BATTERY_MODE_MASK;
>  }

  reply	other threads:[~2017-07-11 11:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-11  9:43 [PATCH v2 0/3] power: supply: sbs-battery: Add delay when changing capacity mode Phil Reid
2017-07-11  9:43 ` [PATCH v2 1/3] power: supply: sbs-battery: Remove FSF mailing address from comments Phil Reid
2017-07-11  9:43 ` [PATCH v2 2/3] power: supply: sbs-battery: sort includes Phil Reid
2017-07-11  9:43 ` [PATCH v2 3/3] power: supply: sbs-battery: Add delay when changing capacity mode bit Phil Reid
2017-07-11 11:31   ` Michael Heinemann [this message]
2017-07-19  2:16     ` Phil Reid
2017-07-25  9:32 ` [PATCH v2 0/3] power: supply: sbs-battery: Add delay when changing capacity mode Sebastian Reichel

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=79941e55f3f273a1cf796deb945f5e95@heine.so \
    --to=posted@heine.so \
    --cc=linux-pm@vger.kernel.org \
    --cc=preid@electromag.com.au \
    --cc=sre@kernel.org \
    /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