Charger/bq25890: force 5V/2A charging

Disable ILIM pin from register and force 5V/2A.

Change-Id: I5b21a5fc69373eeb4a9764782c4cab39820b1a1c
Reviewed-on: https://gerrit.mot.com/2075287
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
gongsc1 2021-09-24 10:08:29 +08:00 • committed by Shicheng Gong
commit 584d7edf7d

View file

@ -1399,8 +1399,19 @@ static bq2589x_reuqest_dpdm(struct bq2589x *bq, bool enable)
return ret;
}
void bq2589x_disable_ilim(struct bq2589x *bq)
{
int ret;
dev_info(bq->dev, "%s:disable EN ILIM pin\n", __func__);
ret = bq2589x_update_bits(bq, BQ2589X_REG_00, BQ2589X_ENILIM_MASK,
BQ2589X_ENILIM_DISABLE << BQ2589X_ENILIM_SHIFT);
if (ret < 0)
dev_err(bq->dev, "fail to disable EN ILIM pin ret=%d\n", ret);
}
void bq2589x_enable_ilim(struct bq2589x *bq)
{
{
int ret;
dev_info(bq->dev, "%s:re-enable ILIM pin\n", __func__);
@ -1561,6 +1572,15 @@ static void bq2589x_adapter_in_workfunc(struct work_struct *work)
schedule_delayed_work(&bq->ico_work, 0);
}
//MMI_STOPSHIP PMIC: force 5V 2A charging
ret = bq2589x_set_input_current_limit(bq, 2400);
if (ret < 0)
dev_err(bq->dev, "%s:Failed to set force current %d\n", __func__, ret);
ret = bq2589x_set_chargevoltage(bq, 4450);
if (ret < 0) {
dev_err(bq->dev, "%s:Failed to set charge voltage 4.45V:%d\n", __func__, ret);
}
dev_info(bq->dev, "%s:current charger type is %d and set input current limist is %d mA\n", __func__, bq->real_charger_type, current_limit);
if (bq->cfg.use_absolute_vindpm)
bq2589x_adjust_absolute_vindpm(bq);
@ -1884,6 +1904,9 @@ static int bq2589x_charger_probe(struct i2c_client *client,
if (ret)
goto err_0;
/*MMI_STOPSHIP PMIC:add disable ILIM pin because of hw is not ready */
bq2589x_disable_ilim(bq);
INIT_WORK(&bq->irq_work, bq2589x_charger_irq_workfunc);
INIT_WORK(&bq->adapter_in_work, bq2589x_adapter_in_workfunc);
INIT_WORK(&bq->adapter_out_work, bq2589x_adapter_out_workfunc);