提交 e59ec4a1 编写于 作者: P Pali Rohár 提交者: Anton Vorontsov

bq27x00_battery: Fixup nominal available capacity reporting

We should not not report nominal available capacity if battery is not
calibrated, as we don't want to represent bogus values in the sysfs and
confuse userland.
Signed-off-by: NPali Rohár <pali.rohar@gmail.com>
Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
上级 6c47a3e0
......@@ -230,6 +230,14 @@ static int bq27x00_battery_read_charge(struct bq27x00_device_info *di, u8 reg)
*/
static inline int bq27x00_battery_read_nac(struct bq27x00_device_info *di)
{
int flags;
bool is_bq27500 = di->chip == BQ27500;
bool is_higher = bq27xxx_is_chip_version_higher(di);
flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500);
if (flags >= 0 && !is_higher && (flags & BQ27000_FLAG_CI))
return -ENODATA;
return bq27x00_battery_read_charge(di, BQ27x00_REG_NAC);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册