Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242598
b: refs/heads/master
c: 909a78b
h: refs/heads/master
v: v3
  • Loading branch information
Benson Leung authored and Anton Vorontsov committed Mar 16, 2011
1 parent d3f2a9b commit d73aada
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a7d9ace4eb3a6a3c3fcb12fb05510c1893808263
refs/heads/master: 909a78b320b31ca9709d7ea5f602ec1bd2015192
18 changes: 12 additions & 6 deletions trunk/drivers/power/bq20z75.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,15 @@ static void bq20z75_unit_adjustment(struct i2c_client *client,
{
#define BASE_UNIT_CONVERSION 1000
#define BATTERY_MODE_CAP_MULT_WATT (10 * BASE_UNIT_CONVERSION)
#define TIME_UNIT_CONVERSION 600
#define TEMP_KELVIN_TO_CELCIUS 2731
#define TIME_UNIT_CONVERSION 60
#define TEMP_KELVIN_TO_CELSIUS 2731
switch (psp) {
case POWER_SUPPLY_PROP_ENERGY_NOW:
case POWER_SUPPLY_PROP_ENERGY_FULL:
case POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN:
/* bq20z75 provides energy in units of 10mWh.
* Convert to µWh
*/
val->intval *= BATTERY_MODE_CAP_MULT_WATT;
break;

Expand All @@ -337,14 +340,17 @@ static void bq20z75_unit_adjustment(struct i2c_client *client,
break;

case POWER_SUPPLY_PROP_TEMP:
/* bq20z75 provides battery tempreture in 0.1°K
* so convert it to 0.1°C */
val->intval -= TEMP_KELVIN_TO_CELCIUS;
val->intval *= 10;
/* bq20z75 provides battery temperature in 0.1K
* so convert it to 0.1°C
*/
val->intval -= TEMP_KELVIN_TO_CELSIUS;
break;

case POWER_SUPPLY_PROP_TIME_TO_EMPTY_AVG:
case POWER_SUPPLY_PROP_TIME_TO_FULL_AVG:
/* bq20z75 provides time to empty and time to full in minutes.
* Convert to seconds
*/
val->intval *= TIME_UNIT_CONVERSION;
break;

Expand Down

0 comments on commit d73aada

Please sign in to comment.