Re: [PATCH v2 5/6] max17042: Fix value scaling for VCELL and avgVCELL
From: MyungJoo Ham
Date: Sun Dec 11 2011 - 21:18:25 EST
> From: Bruce Robertson <bruce.e.robertson@xxxxxxxxx>
>
> 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 <bruce.e.robertson@xxxxxxxxx>
> Signed-off-by: Dirk Brandewie <dirk.brandewie@xxxxxxxxx>
Acked-by: MyungJoo Ham <myungjoo.ham@xxxxxxxxxxx>
> ---
> drivers/power/max17042_battery.c | 8 ++++++--
> 1 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/max17042_battery.c b/drivers/power/max17042_battery.c
> index 001eca1..80a6ee7 100644
> --- a/drivers/power/max17042_battery.c
> +++ b/drivers/power/max17042_battery.c
> @@ -148,11 +148,15 @@ static int max17042_get_property(struct power_supply *psy,
> break;
> case POWER_SUPPLY_PROP_VOLTAGE_NOW:
> val->intval = max17042_read_reg(chip->client,
> - MAX17042_VCELL) * 83; /* 1000 / 12 = 83 */
> + MAX17042_VCELL);
> + val->intval >>= 3;
> + val->intval *= 625; /* Units of LSB = 625 uV */
> break;
> case POWER_SUPPLY_PROP_VOLTAGE_AVG:
> val->intval = max17042_read_reg(chip->client,
> - MAX17042_AvgVCELL) * 83;
> + MAX17042_AvgVCELL);
> + val->intval >>= 3;
> + val->intval *= 625; /* Units of LSB = 625 uV */
> break;
> case POWER_SUPPLY_PROP_CAPACITY:
> val->intval = max17042_read_reg(chip->client,
> --
> 1.7.7.3
>
?移»®&Þ~º&¶¬–+-깁負¥Šw®왢쎉喝méb욎dz받–)í끾èw*jgП¨¶‰šŽ듶¢j/곴äz받–듺2듷솳鈺Ú&¢)傘«a뛴®G«앶h®æj:+v돣Šwè녪¥>W슧違iÛaxPjØm¶ŸÿÃ-»+껠dš_