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

Commit 6c128a45 authored by Anirudh Ghayal's avatar Anirudh Ghayal
Browse files

power: smb1351-charger: Increase the HVDCP detection delay



With HVDCP 3.0 enabled SMB1351 needs additional delay to detect
the adapter type, so increase the detection delay to 3.5 seconds.
While at it, force HVDCP 2.0 only if we detect a DCP adapter.

CRs-Fixed: 1033609
Change-Id: Ibc9b5bc1be5edc6d0e23ed6184b0ac4d075f0719
Signed-off-by: default avatarAnirudh Ghayal <aghayal@codeaurora.org>
parent 0cf3124f
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -2911,7 +2911,7 @@ end:
	smb1351_relax(&chip->smb1351_ws, HVDCP_DETECT);
}

#define HVDCP_NOTIFY_MS 2500
#define HVDCP_NOTIFY_MS 3500
static int smb1351_apsd_complete_handler(struct smb1351_charger *chip,
						u8 status)
{
@@ -2943,6 +2943,7 @@ static int smb1351_apsd_complete_handler(struct smb1351_charger *chip,
		 * If defined force hvdcp 2p0 property,
		 * we force to hvdcp 2p0 in the APSD handler.
		 */
		if (type == POWER_SUPPLY_TYPE_USB_DCP) {
			if (chip->force_hvdcp_2p0) {
				pr_debug("Force set to HVDCP 2.0 mode\n");
				smb1351_masked_write(chip, VARIOUS_FUNC_3_REG,
@@ -2951,13 +2952,14 @@ static int smb1351_apsd_complete_handler(struct smb1351_charger *chip,
						CMD_FORCE_HVDCP_2P0_BIT,
						CMD_FORCE_HVDCP_2P0_BIT);
				type = POWER_SUPPLY_TYPE_USB_HVDCP;
		} else if (type == POWER_SUPPLY_TYPE_USB_DCP) {
			} else {
				pr_debug("schedule hvdcp detection worker\n");
			smb1351_stay_awake(&chip->smb1351_ws, HVDCP_DETECT);
				smb1351_stay_awake(&chip->smb1351_ws,
							HVDCP_DETECT);
				schedule_delayed_work(&chip->hvdcp_det_work,
					msecs_to_jiffies(HVDCP_NOTIFY_MS));
			}

		}
		power_supply_set_supply_type(chip->usb_psy, type);
		/*
		 * SMB is now done sampling the D+/D- lines,