diff --git a/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.c b/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.c index ecc22af29d20..04555257149a 100644 --- a/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.c +++ b/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.c @@ -86,14 +86,16 @@ int mmi_regmap_update_bits(struct sgm4154x_device *sgm, unsigned int reg, { int retry_count = 0; - while (sgm->sgm4154x_suspend_flag && retry_count < WAIT_I2C_COUNT) { - retry_count ++; - dev_err(sgm->dev, "wait system resume when I2C write, count %d\n", retry_count); - msleep(WAIT_I2C_TIME); - } + if (!sgm->i2c_err_wa_dis) { + while (sgm->sgm4154x_suspend_flag && retry_count < WAIT_I2C_COUNT) { + retry_count ++; + dev_err(sgm->dev, "wait system resume when I2C write, count %d\n", retry_count); + msleep(WAIT_I2C_TIME); + } - if (retry_count >= WAIT_I2C_COUNT) - return -EBUSY; + if (retry_count >= WAIT_I2C_COUNT) + return -EBUSY; + } return regmap_update_bits(sgm->regmap, reg, mask, val); } @@ -102,14 +104,16 @@ int mmi_regmap_read(struct sgm4154x_device *sgm, unsigned int reg, unsigned int { int retry_count = 0; - while (sgm->sgm4154x_suspend_flag && retry_count < WAIT_I2C_COUNT) { - retry_count ++; - dev_err(sgm->dev, "wait system resume when I2C read, count %d\n", retry_count); - msleep(WAIT_I2C_TIME); - } + if (!sgm->i2c_err_wa_dis) { + while (sgm->sgm4154x_suspend_flag && retry_count < WAIT_I2C_COUNT) { + retry_count ++; + dev_err(sgm->dev, "wait system resume when I2C read, count %d\n", retry_count); + msleep(WAIT_I2C_TIME); + } - if (retry_count >= WAIT_I2C_COUNT) - return -EBUSY; + if (retry_count >= WAIT_I2C_COUNT) + return -EBUSY; + } return regmap_read(sgm->regmap, reg, val); } @@ -2515,6 +2519,8 @@ static int sgm4154x_parse_dt(struct sgm4154x_device *sgm) dev_info(sgm->dev, "mmi,wls-max-icl = %d\n",sgm->wls_max_icl); + sgm->i2c_err_wa_dis = of_property_read_bool(sgm->dev->of_node, "mmi,i2c-err-wa-dis"); + #if 0 ret = device_property_read_u32(sgm->dev, "watchdog-timer", &sgm->watchdog_timer); diff --git a/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.h b/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.h index cd5681340703..608ae39ef89d 100644 --- a/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.h +++ b/drivers/power/sgm4154x_chg_mmi/sgm4154x_charger.h @@ -384,6 +384,8 @@ struct sgm4154x_device { /*wls output en/dis control*/ int wls_en_gpio; int wls_max_icl; + + bool i2c_err_wa_dis; }; #ifdef CONFIG_MMI_QC3P_WT6670_DETECTED