Lines Matching +full:0 +full:v
60 return 0; in bq24190_register_reset()
73 uint8_t v; in bq24190_charger_get_charge_type() local
78 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_POC, &v); in bq24190_charger_get_charge_type()
83 v = FIELD_GET(BQ24190_REG_POC_CHG_CONFIG_MASK, v); in bq24190_charger_get_charge_type()
85 if (!v) { in bq24190_charger_get_charge_type()
88 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_CCC, &v); in bq24190_charger_get_charge_type()
93 v = FIELD_GET(BQ24190_REG_CCC_FORCE_20PCT_MASK, v); in bq24190_charger_get_charge_type()
95 if (v) { in bq24190_charger_get_charge_type()
102 return 0; in bq24190_charger_get_charge_type()
108 uint8_t v; in bq24190_charger_get_health() local
111 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_F, &v); in bq24190_charger_get_health()
116 if (v & BQ24190_REG_F_NTC_FAULT_MASK) { in bq24190_charger_get_health()
117 switch (v >> BQ24190_REG_F_NTC_FAULT_SHIFT & 0x7) { in bq24190_charger_get_health()
131 } else if (v & BQ24190_REG_F_BAT_FAULT_MASK) { in bq24190_charger_get_health()
133 } else if (v & BQ24190_REG_F_CHRG_FAULT_MASK) { in bq24190_charger_get_health()
134 switch (v >> BQ24190_REG_F_CHRG_FAULT_SHIFT & 0x3) { in bq24190_charger_get_health()
154 } else if (v & BQ24190_REG_F_BOOST_FAULT_MASK) { in bq24190_charger_get_health()
166 return 0; in bq24190_charger_get_health()
195 return 0; in bq24190_charger_get_online()
244 return 0; in bq24190_charger_get_status()
252 uint8_t v; in bq24190_charger_get_constant_charge_current() local
255 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_CCC, &v); in bq24190_charger_get_constant_charge_current()
260 frc_20pct = v & BQ24190_REG_CCC_FORCE_20PCT_MASK; in bq24190_charger_get_constant_charge_current()
262 v = FIELD_GET(BQ24190_REG_CCC_ICHG_MASK, v); in bq24190_charger_get_constant_charge_current()
264 *current_ua = (v * BQ24190_REG_CCC_ICHG_STEP_UA) + BQ24190_REG_CCC_ICHG_OFFSET_UA; in bq24190_charger_get_constant_charge_current()
270 return 0; in bq24190_charger_get_constant_charge_current()
277 uint8_t v; in bq24190_charger_get_precharge_current() local
280 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_CCC, &v); in bq24190_charger_get_precharge_current()
285 frc_20pct = v & BQ24190_REG_CCC_FORCE_20PCT_MASK; in bq24190_charger_get_precharge_current()
287 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_PCTCC, &v); in bq24190_charger_get_precharge_current()
292 v = FIELD_GET(BQ24190_REG_PCTCC_IPRECHG_MASK, v); in bq24190_charger_get_precharge_current()
294 *current_ua = (v * BQ24190_REG_PCTCC_IPRECHG_STEP_UA) + BQ24190_REG_PCTCC_IPRECHG_OFFSET_UA; in bq24190_charger_get_precharge_current()
300 return 0; in bq24190_charger_get_precharge_current()
306 uint8_t v; in bq24190_charger_get_charge_term_current() local
309 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_PCTCC, &v); in bq24190_charger_get_charge_term_current()
314 v = FIELD_GET(BQ24190_REG_PCTCC_ITERM_MASK, v); in bq24190_charger_get_charge_term_current()
316 *current_ua = (v * BQ24190_REG_PCTCC_ITERM_STEP_UA) + BQ24190_REG_PCTCC_ITERM_OFFSET_UA; in bq24190_charger_get_charge_term_current()
318 return 0; in bq24190_charger_get_charge_term_current()
324 uint8_t v; in bq24190_get_constant_charge_voltage() local
327 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_CVC, &v); in bq24190_get_constant_charge_voltage()
328 if (ret < 0) { in bq24190_get_constant_charge_voltage()
332 v = FIELD_GET(BQ24190_REG_CVC_VREG_MASK, v); in bq24190_get_constant_charge_voltage()
334 *voltage_uv = (v * BQ24190_REG_CVC_VREG_STEP_UV) + BQ24190_REG_CVC_VREG_OFFSET_UV; in bq24190_get_constant_charge_voltage()
336 return 0; in bq24190_get_constant_charge_voltage()
342 uint8_t v; in bq24190_set_constant_charge_current() local
345 ret = i2c_reg_read_byte_dt(&config->i2c, BQ24190_REG_CCC, &v); in bq24190_set_constant_charge_current()
346 if (ret < 0) { in bq24190_set_constant_charge_current()
350 v &= BQ24190_REG_CCC_FORCE_20PCT_MASK; in bq24190_set_constant_charge_current()
352 if (v) { in bq24190_set_constant_charge_current()
358 v = (current_ua - BQ24190_REG_CCC_ICHG_OFFSET_UA) / BQ24190_REG_CCC_ICHG_STEP_UA; in bq24190_set_constant_charge_current()
360 v = FIELD_PREP(BQ24190_REG_CCC_ICHG_MASK, v); in bq24190_set_constant_charge_current()
362 return i2c_reg_update_byte_dt(&config->i2c, BQ24190_REG_CCC, BQ24190_REG_CCC_ICHG_MASK, v); in bq24190_set_constant_charge_current()
368 uint8_t v; in bq24190_set_constant_charge_voltage() local
372 v = (voltage_uv - BQ24190_REG_CVC_VREG_OFFSET_UV) / BQ24190_REG_CVC_VREG_STEP_UV; in bq24190_set_constant_charge_voltage()
374 v = FIELD_PREP(BQ24190_REG_CVC_VREG_MASK, v); in bq24190_set_constant_charge_voltage()
376 return i2c_reg_update_byte_dt(&config->i2c, BQ24190_REG_CVC, BQ24190_REG_CVC_VREG_MASK, v); in bq24190_set_constant_charge_voltage()
388 if (ret < 0) { in bq24190_set_config()
444 return gpio_pin_set_dt(&config->ce_gpio, 0); in bq24190_charge_enable()
471 LOG_ERR("Error unknown model: 0x%02x\n", val); in bq24190_init()
481 if (ret < 0) { in bq24190_init()