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

Commit 9d9beb51 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "smb-lib: add support of DP/DM pulsing for fix 5V, 9V and 12V"

parents cba461bf f63b903b
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -2009,6 +2009,18 @@ static int smblib_dm_pulse(struct smb_charger *chg)
	return rc;
}

static int smblib_force_vbus_voltage(struct smb_charger *chg, u8 val)
{
	int rc;

	rc = smblib_masked_write(chg, CMD_HVDCP_2_REG, val, val);
	if (rc < 0)
		smblib_err(chg, "Couldn't write to CMD_HVDCP_2_REG rc=%d\n",
				rc);

	return rc;
}

int smblib_dp_dm(struct smb_charger *chg, int val)
{
	int target_icl_ua, rc = 0;
@@ -2060,6 +2072,21 @@ int smblib_dp_dm(struct smb_charger *chg, int val)
		smblib_dbg(chg, PR_PARALLEL, "ICL DOWN ICL=%d reduction=%d\n",
				target_icl_ua, chg->usb_icl_delta_ua);
		break;
	case POWER_SUPPLY_DP_DM_FORCE_5V:
		rc = smblib_force_vbus_voltage(chg, FORCE_5V_BIT);
		if (rc < 0)
			pr_err("Failed to force 5V\n");
		break;
	case POWER_SUPPLY_DP_DM_FORCE_9V:
		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:
		rc = smblib_force_vbus_voltage(chg, FORCE_12V_BIT);
		if (rc < 0)
			pr_err("Failed to force 12V\n");
		break;
	case POWER_SUPPLY_DP_DM_ICL_UP:
	default:
		break;
+3 −0
Original line number Diff line number Diff line
@@ -103,6 +103,9 @@ enum {
	POWER_SUPPLY_DP_DM_HVDCP3_SUPPORTED = 10,
	POWER_SUPPLY_DP_DM_ICL_DOWN = 11,
	POWER_SUPPLY_DP_DM_ICL_UP = 12,
	POWER_SUPPLY_DP_DM_FORCE_5V = 13,
	POWER_SUPPLY_DP_DM_FORCE_9V = 14,
	POWER_SUPPLY_DP_DM_FORCE_12V = 15,
};

enum {