Lines Matching +full:fuel +full:- +full:gauge

1 // SPDX-License-Identifier: GPL-2.0+
62 return -1; in fg_write_and_verify()
85 if (!rewrite_count--) { in por_fuelgauge_init()
111 if (!check_count--) { in por_fuelgauge_init()
140 if (!lock_count--) { in por_fuelgauge_init()
189 debug("%s: model init status: %s\n", p->name, status_msg); in por_fuelgauge_init()
195 struct power_battery *pb = bat->pbat; in power_update_battery()
200 puts("Can't find max17042 fuel gauge\n"); in power_update_battery()
201 return -ENODEV; in power_update_battery()
205 pb->bat->state_of_chrg = (val >> 8); in power_update_battery()
209 pb->bat->voltage_uV = ((val & 0xFFUL) >> 3) + ((val & 0xFF00) >> 3); in power_update_battery()
210 pb->bat->voltage_uV = (pb->bat->voltage_uV * 625); in power_update_battery()
213 pb->bat->capacity = val >> 2; in power_update_battery()
220 struct power_battery *pb = bat->pbat; in power_check_battery()
225 puts("Can't find max17042 fuel gauge\n"); in power_check_battery()
226 return -ENODEV; in power_check_battery()
236 pb->bat->version = val; in power_check_battery()
239 debug("fg ver: 0x%x\n", pb->bat->version); in power_check_battery()
241 pb->bat->state_of_chrg); in power_check_battery()
244 pb->bat->voltage_uV / 1000000, in power_check_battery()
245 pb->bat->voltage_uV % 1000000, in power_check_battery()
246 pb->bat->capacity); in power_check_battery()
248 if (pb->bat->voltage_uV > 3850000) in power_check_battery()
249 pb->bat->state = EXT_SOURCE; in power_check_battery()
250 else if (pb->bat->voltage_uV < 3600000 || pb->bat->state_of_chrg < 5) in power_check_battery()
251 pb->bat->state = CHARGE; in power_check_battery()
253 pb->bat->state = NORMAL; in power_check_battery()
270 return -ENOMEM; in power_fg_init()
273 debug("Board Fuel Gauge init\n"); in power_fg_init()
275 p->name = name; in power_fg_init()
276 p->interface = PMIC_I2C; in power_fg_init()
277 p->number_of_regs = FG_NUM_OF_REGS; in power_fg_init()
278 p->hw.i2c.addr = MAX17042_I2C_ADDR; in power_fg_init()
279 p->hw.i2c.tx_num = 2; in power_fg_init()
280 p->sensor_byte_order = PMIC_SENSOR_BYTE_ORDER_BIG; in power_fg_init()
281 p->bus = bus; in power_fg_init()
283 p->fg = &power_fg_ops; in power_fg_init()