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

Commit 15ac1fdc authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: smb5-lib: Fix SBUx resistance measurement in moisture detection"

parents 3a7f1f37 a04d652b
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -4927,6 +4927,7 @@ irqreturn_t typec_attach_detach_irq_handler(int irq, void *data)
	}

	if (stat & TYPEC_ATTACH_DETACH_STATE_BIT) {
		cancel_delayed_work_sync(&chg->lpd_detach_work);
		chg->lpd_stage = LPD_STAGE_FLOAT_CANCEL;
		cancel_delayed_work_sync(&chg->lpd_ra_open_work);
		vote(chg->awake_votable, LPD_VOTER, false, 0);
@@ -4971,7 +4972,7 @@ irqreturn_t typec_attach_detach_irq_handler(int irq, void *data)

		if (chg->lpd_stage == LPD_STAGE_FLOAT_CANCEL)
			schedule_delayed_work(&chg->lpd_detach_work,
					msecs_to_jiffies(100));
					msecs_to_jiffies(1000));
	}

	power_supply_changed(chg->usb_psy);
@@ -5664,16 +5665,9 @@ static void smblib_lpd_ra_open_work(struct work_struct *work)
		goto out;
	}

	/* Wait 1.5ms to read src status */
	/* Wait 1.5ms to get SBUx ready */
	usleep_range(1500, 1510);

	rc = smblib_read(chg, TYPE_C_SRC_STATUS_REG, &stat);
	if (rc < 0) {
		smblib_err(chg, "Couldn't read TYPE_C_SRC_STATUS_REG rc=%d\n",
				rc);
		goto out;
	}

	if (smblib_rsbux_low(chg, RSBU_K_300K_UV)) {
		/* Moisture detected, enable sink only mode */
		pval.intval = POWER_SUPPLY_TYPEC_PR_SINK;