Skip to content

Commit

Permalink
power_supply: bq27x00: fix voltage and current units
Browse files Browse the repository at this point in the history
The chip returns voltage and current in mV and mA, but
power supply class uses uV and uA, so add missing conversion.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
  • Loading branch information
Grazvydas Ignotas authored and Anton Vorontsov committed Feb 27, 2010
1 parent 4e924a8 commit afbc74f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/power/bq27x00_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static int bq27x00_battery_voltage(struct bq27x00_device_info *di)
return ret;
}

return volt;
return volt * 1000;
}

/*
Expand Down Expand Up @@ -156,11 +156,11 @@ static int bq27x00_battery_current(struct bq27x00_device_info *di)
}
if (flags & BQ27000_FLAG_CHGS) {
dev_dbg(di->dev, "negative current!\n");
return -curr;
curr = -curr;
}
}

return curr;
return curr * 1000;
}

/*
Expand Down

0 comments on commit afbc74f

Please sign in to comment.