mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: 함명주 <myungjoo.ham@samsung.com>
To: bruce robertson <bruce.e.robertson@intel.com>,
	Anton Vorontsov <cbouatmailru@gmail.com>
Cc: "dirk.brandewie@gmail.com" <dirk.brandewie@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	박경민 <kyungmin.park@samsung.com>,
	"Jason.Wortham@maxim-ic.com" <Jason.Wortham@maxim-ic.com>
Subject: Re: Re: [PATCH 4/5] max17042: Fix value scaling for VCELL and avgVCELL
Date: Wed, 14 Mar 2012 02:05:29 +0000 (GMT)	[thread overview]
Message-ID: <1210375.125631331690727274.JavaMail.weblogic@epml04> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2760 bytes --]

bruce robertson<bruce.e.robertson@intel.com>, 2012-03-14 06:00 (GMT+09:00)
> 
> Anton Vorontsov writes:
> 
> > On Tue, Jan 24, 2012 at 09:26:07AM -0800, dirk.brandewie@gmail.com wrote:
> >> From: Bruce Robertson 
> >> 
> >> The bottom three bits of the register are don't care bits.  The LSB
> >> value is 625 uV.  Adjust the returned values appropriately
> >> 
> >> Signed-off-by: Bruce Robertson 
> >> Signed-off-by: Dirk Brandewie 
> >> Acked-by: MyungJoo Ham 
> >
> > I guess this was fixed long ago by the following patch:
> >
> > commit cf7a8c03db792894f436db5f3ffc44d947b9b068
> > Author: MyungJoo Ham 
> > Date:   Wed Aug 17 10:18:34 2011 +0900
> >
> >     max17042_battery: Bugfix of incorrect voltage register value interpretation
> >
> >     The calculation had error in getting voltage values from
> >     MAX17042 registers. The least bit denotes 78.125uV (625/8).
> 
> The multipliers I see in the patch are 83 making the voltages somewhat
> high and the low 3 bits are not masked off. I'm probably misreading the code.

The patch, commit cf7a8c03db, uses 78.125uV/bit, not 83uV/bit. The code before that patch uses 83uV/bit.

$ git show cf7a8c03db792894f436db5f3ffc44d947b9b068
[...]
diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
index 61fb6d7..a6dc9c7 100644
--- a/drivers/power/max17042_battery.c
+++ b/drivers/power/max17042_battery.c
@@ -111,12 +111,12 @@ static int max17042_get_property(struct power_supply *psy,
                val->intval *= 10000; /* Units of LSB = 10mV */
                break;
        case POWER_SUPPLY_PROP_VOLTAGE_NOW:
-               val->intval = max17042_read_reg(chip->client,
-                               MAX17042_VCELL) * 83; /* 1000 / 12 = 83 */
+               val->intval = max17042_read_reg(chip->client, MAX17042_VCELL)
+                           * 625 / 8;
                break;
        case POWER_SUPPLY_PROP_VOLTAGE_AVG:
-               val->intval = max17042_read_reg(chip->client,
-                               MAX17042_AvgVCELL) * 83;
+               val->intval = max17042_read_reg(chip->client, MAX17042_AvgVCELL)
+                           * 625 / 8;
                break;
        case POWER_SUPPLY_PROP_CAPACITY:
                val->intval = max17042_read_reg(chip->client,


> 
> >
> >     Signed-off-by: MyungJoo Ham 
> >     Signed-off-by: Philip Rakity 
> >     Signed-off-by: Kyungmin Park 
> >     Signed-off-by: Anton Vorontsov 
> >
> > Thanks,
> 
> 
> 


--
MyungJoo Ham (ÇÔ¸íÁÖ), PHD
System S/W Lab, S/W Platform Team, Software Center
Samsung Electronics
Cell: +82-10-6714-2858

ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

                 reply	other threads:[~2012-03-14  2:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1210375.125631331690727274.JavaMail.weblogic@epml04 \
    --to=myungjoo.ham@samsung.com \
    --cc=Jason.Wortham@maxim-ic.com \
    --cc=bruce.e.robertson@intel.com \
    --cc=cbouatmailru@gmail.com \
    --cc=dirk.brandewie@gmail.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.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

Powered by JetHome