diff options
author | Jonghwa Lee <jonghwa3.lee@samsung.com> | 2014-10-23 12:05:17 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-18 12:01:03 +0900 |
commit | 0d0c07dc48a84ffd7d821f47d8a703c003d407d3 (patch) | |
tree | f7f45dd5c45a7030ade351cda63b1e5b4e598f93 | |
parent | 3d720fc80afe332f78df507127629f86285a2d92 (diff) | |
download | linux-3.10-0d0c07dc48a84ffd7d821f47d8a703c003d407d3.tar.gz linux-3.10-0d0c07dc48a84ffd7d821f47d8a703c003d407d3.tar.bz2 linux-3.10-0d0c07dc48a84ffd7d821f47d8a703c003d407d3.zip |
power: max17040: WA: Add flag 'using_19_bits' to determine SoC in double.
No information about actual meaning of using 19 bits, it's just copied
from vendor's code. However, It is clear that it represents doubled SoC
if the chip is marked with 'using 19 bits'. Rinato needs to half the SoC
register's value to get correct one.
Change-Id: I0d873de3e7671c2494955735364934156ab756d9
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
-rw-r--r-- | drivers/power/max17040_battery.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/power/max17040_battery.c b/drivers/power/max17040_battery.c index f8115b80ee2..8a098f54523 100644 --- a/drivers/power/max17040_battery.c +++ b/drivers/power/max17040_battery.c @@ -51,6 +51,9 @@ struct max17040_chip { int soc; /* State Of Charge */ int status; + + /* If true, SoC's shown in double */ + bool using_19_bits; }; static void max17040_reset(struct i2c_client *client) @@ -101,6 +104,15 @@ static void max17040_get_soc(struct i2c_client *client) soc = (msb * 100) + (lsb * 100 / 256); soc /= 10; + /* FIXME: + * No information about actual meaning of using 19 bits, + * it's just copied from vendor's code. + * However, It is clear that it represents doubled SoC + * if the chip is marked with 'using 19 bits'. + */ + if (chip->using_19_bits) + soc /= 2; + max17040_get_scaled_capacity(&soc); /* capacity should be between 0% and 100% * (0.1% degree) @@ -207,6 +219,11 @@ static int max17040_probe(struct i2c_client *client, return -EINVAL; } + /* A flag for value of SoC in double or not */ + if (client->dev.of_node) + chip->using_19_bits = of_property_read_bool(client->dev.of_node, + "using-19-bits"); + chip->pdata = client->dev.platform_data; if (!chip->pdata) { |