Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47caa04c authored by zhanghangzhou's avatar zhanghangzhou Committed by lio.chen
Browse files

Charger: Fixed the charging type detection error caused by USB disconnection.

Change-Id: I79a9e8641b336964e02c4bce7e850b0b87f9c77e
parent 3c9e30be
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -152,7 +152,7 @@ enum mt6375_chg_reg_field {
	/* MT6375_REG_CHG_HD_TOP1 */
	F_FORCE_VBUS_SINK,
	/* MT6375_REG_BC12_FUNC */
	F_DCDT_SEL, F_SPEC_TA_EN, F_BC12_EN,
	F_BC12_VBUS_EN_OPT, F_DCDT_SEL, F_SPEC_TA_EN, F_BC12_EN,
	/* MT6375_REG_BC12_STAT */
	F_PORT_STAT,
	/* MT6375_REG_DPDM_CTRL1 */
@@ -455,6 +455,7 @@ static const struct mt6375_chg_field mt6375_chg_fields[F_MAX] = {
	MT6375_CHG_FIELD(F_IRCMP_R, MT6375_REG_BAT_COMP, 4, 6),
	MT6375_CHG_FIELD_RANGE(F_IC_STAT, MT6375_REG_CHG_STAT, 0, 3, false),
	MT6375_CHG_FIELD(F_FORCE_VBUS_SINK, MT6375_REG_CHG_HD_TOP1, 6, 6),
	MT6375_CHG_FIELD(F_BC12_VBUS_EN_OPT, MT6375_REG_BC12_FUNC, 2, 2),
	MT6375_CHG_FIELD(F_DCDT_SEL, MT6375_REG_BC12_FUNC, 4, 5),
	MT6375_CHG_FIELD(F_SPEC_TA_EN, MT6375_REG_BC12_FUNC, 6, 6),
	MT6375_CHG_FIELD(F_BC12_EN, MT6375_REG_BC12_FUNC, 7, 7),
@@ -3168,6 +3169,12 @@ static int mt6375_chg_init_setting(struct mt6375_chg_data *ddata)
		return ret;
	}

	ret = mt6375_chg_field_set(ddata, F_BC12_VBUS_EN_OPT, 1);
	if (ret < 0) {
		dev_err(ddata->dev, "failed to enable BC12_VBUS_EN_OPT\n");
		return ret;
	}

	/* set aicr = 200mA in 1:META_BOOT 5:ADVMETA_BOOT */
	if (pdata->boot_mode == 1 || pdata->boot_mode == 5) {
		ret = mt6375_chg_field_set(ddata, F_IAICR, 200);