Skip to contentSkip to conversation

power_supply: bq27x00: fix voltage and current units

PATCH Applied Grazvydas Ignotas 2 participants 2 messages Feb 27, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 power_supply: bq27x00: fix voltage and current units

The chip returns voltage and current in mV and mA, but power supply class uses uV and uA, so add missing conversion.

---
 drivers/power/bq27x00_battery.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/power/bq27x00_battery.c +3 -3
index 5d940fa..bece33e 100644
@@ -125,7 +125,7 @@ static int bq27x00_battery_voltage(struct bq27x00_device_info *di)
 		return ret;
 	}
 
-	return volt;
+	return volt * 1000;
 }
 
 /*
@@ -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;
 }
 
 /*
Signature · 1 line
1.6.3.3