From: Andreas Kemnade <andreas@kemnade.info>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: lee.jones@linaro.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, b.galvani@gmail.com, phh@phh.me,
letux-kernel@openphoenux.org
Subject: Re: [PATCH 1/2] power: supply: Add support for RN5T618/RC5T619 charger and fuel gauge
Date: Wed, 26 Aug 2020 20:28:34 +0200 [thread overview]
Message-ID: <20200826202834.42b1673f@aktux> (raw)
In-Reply-To: <20200826174817.vhus3j4i4t7u7jc4@earth.universe>
On Wed, 26 Aug 2020 19:48:17 +0200
Sebastian Reichel <sebastian.reichel@collabora.com> wrote:
> Hi,
>
> Driver looks mostly good.
>
> On Sat, Aug 15, 2020 at 06:56:09PM +0200, Andreas Kemnade wrote:
> > [...]
> > +static int rn5t618_battery_current_now(struct rn5t618_power_info *info,
> > + union power_supply_propval *val)
> > +{
> > + u16 res;
> > + int ret;
> > +
> > + ret = rn5t618_battery_read_doublereg(info, RN5T618_CC_AVEREG1, &res);
> > + if (ret)
> > + return ret;
> > +
> > + val->intval = res;
> > + /* 2's complement */
> > + if (val->intval & (1 << 13))
> > + val->intval = val->intval - (1 << 14);
> > +
> > + /* negate current to be positive when discharging */
> > + val->intval *= -1000;
>
> mh, the sign is not documented (which should be fixed). At least
> sbs-battery does it the other way around (negative current when
> discharging, positive otherwise). Some drivers do not support
> signed current and always report positive values (e.g. ACPI driver).
>
> What did you use as reference for swapping the sign?
>
Well, I have searched for documentation, found nothing and used the
bq27xxx driver as reference which I am used to from the GTA04/GTA02,
so things behave equal. That are the devices where a was most
intensively looking at those values.
I thought that there would be some unwritten rule about that.
Regards,
Andreas
next prev parent reply other threads:[~2020-08-26 18:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-15 16:56 [PATCH 0/2] power: supply: RN5T618/RC5T619 Andreas Kemnade
2020-08-15 16:56 ` [PATCH 1/2] power: supply: Add support for RN5T618/RC5T619 charger and fuel gauge Andreas Kemnade
2020-08-26 17:48 ` Sebastian Reichel
2020-08-26 18:28 ` Andreas Kemnade [this message]
2020-08-26 21:59 ` Sebastian Reichel
2020-08-27 5:10 ` Andreas Kemnade
2020-08-15 16:56 ` [PATCH 2/2] mfd: rn5t618: Add a power supply subdevice Andreas Kemnade
2020-08-19 10:52 ` Lee Jones
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=20200826202834.42b1673f@aktux \
--to=andreas@kemnade.info \
--cc=b.galvani@gmail.com \
--cc=lee.jones@linaro.org \
--cc=letux-kernel@openphoenux.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=phh@phh.me \
--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