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

Commit 1c360c80 authored by Ashay Jaiswal's avatar Ashay Jaiswal
Browse files

power: smb2: fix QC2 adapter collapse



Some QC2 adapters might collapse when next higher voltage is
requested, fix this by lowering ICL before forcing next voltage
level and removing the vote once adapter moves to next voltage(this
ensures h/w AICL will find appropriate ICL for the higher voltage).

Change-Id: I888e30e0bf8638b770068fe5a314bc91de992db4
Signed-off-by: default avatarAshay Jaiswal <ashayj@codeaurora.org>
parent d4dd9e52
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -688,6 +688,7 @@ static void smblib_uusb_removal(struct smb_charger *chg)
	vote(chg->pl_enable_votable_indirect, USBIN_V_VOTER, false, 0);
	vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0);
	vote(chg->usb_icl_votable, USBIN_USBIN_BOOST_VOTER, false, 0);
	vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);

	cancel_delayed_work_sync(&chg->hvdcp_detect_work);

@@ -2245,11 +2246,15 @@ int smblib_dp_dm(struct smb_charger *chg, int val)
			pr_err("Failed to force 5V\n");
		break;
	case POWER_SUPPLY_DP_DM_FORCE_9V:
		/* Force 1A ICL before requesting higher voltage */
		vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, true, 1000000);
		rc = smblib_force_vbus_voltage(chg, FORCE_9V_BIT);
		if (rc < 0)
			pr_err("Failed to force 9V\n");
		break;
	case POWER_SUPPLY_DP_DM_FORCE_12V:
		/* Force 1A ICL before requesting higher voltage */
		vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, true, 1000000);
		rc = smblib_force_vbus_voltage(chg, FORCE_12V_BIT);
		if (rc < 0)
			pr_err("Failed to force 12V\n");
@@ -3607,10 +3612,12 @@ static void smblib_hvdcp_adaptive_voltage_change(struct smb_charger *chg)
		case QC_9V_BIT:
			smblib_set_opt_freq_buck(chg,
					chg->chg_freq.freq_9V);
			vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);
			break;
		case QC_12V_BIT:
			smblib_set_opt_freq_buck(chg,
					chg->chg_freq.freq_12V);
			vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);
			break;
		default:
			smblib_set_opt_freq_buck(chg,
@@ -4133,6 +4140,7 @@ static void smblib_handle_typec_removal(struct smb_charger *chg)
	vote(chg->usb_icl_votable, SW_QC3_VOTER, false, 0);
	vote(chg->usb_icl_votable, OTG_VOTER, false, 0);
	vote(chg->usb_icl_votable, CTM_VOTER, false, 0);
	vote(chg->usb_icl_votable, HVDCP2_ICL_VOTER, false, 0);

	/* reset hvdcp voters */
	vote(chg->hvdcp_disable_votable_indirect, VBUS_CC_SHORT_VOTER, true, 0);
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ enum print_reason {
#define PL_FCC_LOW_VOTER		"PL_FCC_LOW_VOTER"
#define WBC_VOTER			"WBC_VOTER"
#define MOISTURE_VOTER			"MOISTURE_VOTER"
#define HVDCP2_ICL_VOTER		"HVDCP2_ICL_VOTER"

#define VCONN_MAX_ATTEMPTS	3
#define OTG_MAX_ATTEMPTS	3