charging: Default using HW ILIM for bq25890 and SC89890

Default charging reg ILIM is enable , but There is no HW ILIM R in Rhode5G.
Could Disable HW ILIM by reg BQ2589X_ENILIM_DISABLE and DTS . 
refer to : https://gerrit.mot.com/#/c/2204336/

Change-Id: I9aef32c86bddedb1672ea34918cd643871fd4abc
Reviewed-on: https://gerrit.mot.com/2202328
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Submit-Approved: Jira Key
This commit is contained in:
wingte52 2022-02-26 10:54:28 +08:00 • committed by huanghe
commit 2259d0dd3e

View file

@ -107,6 +107,7 @@ struct bq2589x_config {
bool enable_term;
bool enable_ico;
bool use_absolute_vindpm;
bool disable_ilim;
int charge_voltage;
int charge_current;
@ -930,36 +931,6 @@ static int bq2589x_get_vindpm_volt(struct bq2589x *bq)
}
}
static int bq2589x_loop_compensation(struct bq2589x *bq)
{
int ret;
ret = bq2589x_write_byte(bq, 0x7E, 0x48);
ret |= bq2589x_write_byte(bq, 0x7E, 0x54);
ret |= bq2589x_write_byte(bq, 0x7E, 0x53);
ret |= bq2589x_write_byte(bq, 0x7E, 0x39);
ret |= bq2589x_write_byte(bq, 0x90, 0x62);
ret |= bq2589x_write_byte(bq, 0x7D, 0x48);
ret |= bq2589x_write_byte(bq, 0x7D, 0x54);
ret |= bq2589x_write_byte(bq, 0x7D, 0x53);
ret |= bq2589x_write_byte(bq, 0x7D, 0x38);
ret |= bq2589x_write_byte(bq, 0x82, 0xE4);
ret |= bq2589x_write_byte(bq, 0x85, 0x00);
ret |= bq2589x_enable_term(bq, false);
ret |= bq2589x_update_bits(bq, BQ2589X_REG_00, BQ2589X_ENILIM_MASK,
BQ2589X_ENILIM_DISABLE << BQ2589X_ENILIM_SHIFT);
ret |= bq2589x_write_byte(bq, 0x7E, 0x48);
ret |= bq2589x_write_byte(bq, 0x7E, 0x54);
ret |= bq2589x_write_byte(bq, 0x7E, 0x53);
ret |= bq2589x_write_byte(bq, 0x7E, 0x39);
ret |= bq2589x_write_byte(bq, 0x7D, 0x48);
ret |= bq2589x_write_byte(bq, 0x7D, 0x54);
ret |= bq2589x_write_byte(bq, 0x7D, 0x53);
ret |= bq2589x_write_byte(bq, 0x7D, 0x38);
return ret;
}
static int bq2589x_sync_state(struct bq2589x *bq, struct bq2589x_state *state)
{
u8 chrg_stat, volt_stat, fault;
@ -1079,12 +1050,13 @@ static int bq2589x_init_device(struct bq2589x *bq)
}
/*common initialization*/
if (bq->part_no == SC89890H) {
ret = bq2589x_loop_compensation(bq);
if (bq->cfg.disable_ilim) {
ret = bq2589x_update_bits(bq, BQ2589X_REG_00, BQ2589X_ENILIM_MASK,
BQ2589X_ENILIM_DISABLE << BQ2589X_ENILIM_SHIFT);
if (ret < 0) {
dev_err(bq->dev, "%s:Failed to initialize all loop compensation:%d\n", __func__, ret);
dev_err(bq->dev, "%s:Failed to operate EN_LIM for ENLIM_DISABLE:%d\n", __func__, ret);
} else {
dev_err(bq->dev, "%s:sucess to initialize all loop compensation:%d\n", __func__, ret);
dev_err(bq->dev, "%s:Success to operate EN_LIM for ENLIM_DISABLE:%d\n", __func__, ret);
}
}
@ -1442,6 +1414,7 @@ static int bq2589x_parse_dt(struct device *dev, struct bq2589x *bq)
bq->cfg.enable_auto_dpdm = of_property_read_bool(np, "ti,bq2589x,enable-auto-dpdm");
bq->cfg.enable_term = of_property_read_bool(np, "ti,bq2589x,enable-termination");
bq->cfg.enable_ico = of_property_read_bool(np, "ti,bq2589x,enable-ico");
bq->cfg.disable_ilim = of_property_read_bool(np, "ti,bq2589x,disable-ilim");
bq->cfg.use_absolute_vindpm = of_property_read_bool(np, "ti,bq2589x,use-absolute-vindpm");
ret = of_property_read_u32(np, "ti,bq2589x,charge-voltage",&bq->cfg.charge_voltage);