浏览代码

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.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Grazvydas Ignotas 15 年之前
父节点
当前提交
afbc74fdc5
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      drivers/power/bq27x00_battery.c

+ 3 - 3
drivers/power/bq27x00_battery.c

@@ -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;
 }
 
 /*