I'm porting bq27220 driver (bq27xxx_battery.c)
https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/power/supply/bq27xxx_battery.c?h=ti-linux-4.9.y
But I cannot found about NAC(
Nominal Available Capacity
) definition
in BQ27220 specs.
Some sample code as below:
BQ27XXX_REG_NAC, /* Nominal Available Capacity */
/*
* Return the battery Nominal available capacity in µAh
* Or < 0 if something fails.
*/
static inline int bq27xxx_battery_read_nac(struct bq27xxx_device_info *di)
{
int flags;
if (di->chip == BQ27000 || di->chip == BQ27010) {
flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, true);
if (flags >= 0 && (flags & BQ27000_FLAG_CI))
return -ENODATA;
}
return bq27xxx_battery_read_charge(di, BQ27XXX_REG_NAC);
}
case POWER_SUPPLY_PROP_CHARGE_NOW:
ret = bq27xxx_simple_value(bq27xxx_battery_read_nac(di), val);