charger: bq25180: reuse bq25180_set_charge_current for the initial set

Reuse bq25180_set_charge_current for the initial setting of the charging
current.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
This commit is contained in:
Fabio Baltieri 2024-01-05 20:49:42 +00:00 committed by Maureen Helm
parent 13a357b019
commit 63cdde10d3

View file

@ -188,13 +188,7 @@ static int bq25180_init(const struct device *dev)
}
if (cfg->initial_current_microamp > 0) {
ret = bq25180_ma_to_ichg(cfg->initial_current_microamp / 1000, &val);
if (ret < 0) {
return ret;
}
ret = i2c_reg_update_byte_dt(&cfg->i2c, BQ25180_ICHG_CTRL,
BQ25180_ICHG_MSK, val);
bq25180_set_charge_current(dev, cfg->initial_current_microamp);
if (ret < 0) {
return ret;
}