diff --git a/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c b/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c index 9122bf11a9ec..f8695f5a58f4 100644 --- a/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c +++ b/drivers/power/bq2589x_chg_mmi/bq2589x_charger.c @@ -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);