linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Henrik Grimler <henrik@grimler.se>,
	m.szyprowski@samsung.com, krzysztof.kozlowski@canonical.com,
	sebastian.krzyszkowiak@puri.sm, linux-pm@vger.kernel.org,
	linux-samsung-soc@vger.kernel.org,
	~postmarketos/upstreaming@lists.sr.ht, stable@vger.kernel.org,
	Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Subject: Re: [PATCH v2 1/2] power: supply: max17042_battery: use VFSOC for capacity when no rsns
Date: Sat, 2 Oct 2021 17:53:39 +0200	[thread overview]
Message-ID: <20211002155339.u33vym7gp5kchwrz@earth.universe> (raw)
In-Reply-To: <be608922-ef03-da35-c65c-575f301b596b@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2258 bytes --]

Hi,

On Wed, Sep 29, 2021 at 09:43:25PM +0200, Hans de Goede wrote:
> On 9/29/21 8:14 PM, Henrik Grimler wrote:
> > On Galaxy S3 (i9300/i9305), which has the max17047 fuel gauge and no
> > current sense resistor (rsns), the RepSOC register does not provide an
> > accurate state of charge value. The reported value is wrong, and does
> > not change over time. VFSOC however, which uses the voltage fuel gauge
> > to determine the state of charge, always shows an accurate value.
> > 
> > For devices without current sense, VFSOC is already used for the
> > soc-alert (0x0003 is written to MiscCFG register), so with this change
> > the source of the alert and the PROP_CAPACITY value match.
> > 
> > Fixes: 359ab9f5b154 ("power_supply: Add MAX17042 Fuel Gauge Driver")
> > Cc: <stable@vger.kernel.org>
> > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> > Suggested-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
> > Signed-off-by: Henrik Grimler <henrik@grimler.se>
> > ---
> > Changes in v2:
> > Re-write commit message to highlight that VFSOC is already used for
> > alert, after Krzysztof's comments
> 
> Thanks, both patches looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> for the series.

Thanks, both queued.

-- Sebastian

> 
> 
> Regards,
> 
> Hans
> 
> 
> > ---
> >  drivers/power/supply/max17042_battery.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/power/supply/max17042_battery.c b/drivers/power/supply/max17042_battery.c
> > index 8dffae76b6a3..5809ba997093 100644
> > --- a/drivers/power/supply/max17042_battery.c
> > +++ b/drivers/power/supply/max17042_battery.c
> > @@ -313,7 +313,10 @@ static int max17042_get_property(struct power_supply *psy,
> >  		val->intval = data * 625 / 8;
> >  		break;
> >  	case POWER_SUPPLY_PROP_CAPACITY:
> > -		ret = regmap_read(map, MAX17042_RepSOC, &data);
> > +		if (chip->pdata->enable_current_sense)
> > +			ret = regmap_read(map, MAX17042_RepSOC, &data);
> > +		else
> > +			ret = regmap_read(map, MAX17042_VFSOC, &data);
> >  		if (ret < 0)
> >  			return ret;
> >  
> > 
> > base-commit: 5816b3e6577eaa676ceb00a848f0fd65fe2adc29
> > 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2021-10-02 15:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29 18:14 [PATCH v2 1/2] power: supply: max17042_battery: use VFSOC for capacity when no rsns Henrik Grimler
2021-09-29 18:14 ` [PATCH v2 2/2] power: supply: max17042_battery: fix typo in MAX17042_IAvg_empty Henrik Grimler
2021-09-30 11:42   ` Krzysztof Kozlowski
2021-09-29 19:43 ` [PATCH v2 1/2] power: supply: max17042_battery: use VFSOC for capacity when no rsns Hans de Goede
2021-10-02 15:53   ` Sebastian Reichel [this message]

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=20211002155339.u33vym7gp5kchwrz@earth.universe \
    --to=sebastian.reichel@collabora.com \
    --cc=hdegoede@redhat.com \
    --cc=henrik@grimler.se \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=sebastian.krzyszkowiak@puri.sm \
    --cc=stable@vger.kernel.org \
    --cc=wolfgit@wiedmeyer.de \
    --cc=~postmarketos/upstreaming@lists.sr.ht \
    /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;
as well as URLs for NNTP newsgroup(s).