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

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

Merge "power: supply: Add support to report QC3+ adapter power rating"

parents cee0efef e033d878
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -839,6 +839,7 @@ static enum power_supply_property smb5_usb_props[] = {
	POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
	POWER_SUPPLY_PROP_SCOPE,
	POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
	POWER_SUPPLY_PROP_POWER_NOW,
};

static int smb5_usb_get_prop(struct power_supply *psy,
@@ -884,6 +885,13 @@ static int smb5_usb_get_prop(struct power_supply *psy,
		val->intval = get_client_vote(chg->usb_icl_votable,
					      USB_PSY_VOTER);
		break;
	case POWER_SUPPLY_PROP_POWER_NOW:
		/* Show power rating for QC3+ adapter. */
		if (chg->real_charger_type == QTI_POWER_SUPPLY_TYPE_USB_HVDCP_3P5)
			val->intval = chg->qc3p5_detected_mw;
		else
			rc = -ENODATA;
		break;
	default:
		pr_err("get prop %d is not supported in usb\n", psp);
		rc = -EINVAL;
@@ -910,6 +918,9 @@ static int smb5_usb_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
		rc = smblib_set_prop_sdp_current_max(chg, val->intval);
		break;
	case POWER_SUPPLY_PROP_POWER_NOW:
			chg->qc3p5_detected_mw = val->intval;
		break;
	default:
		pr_err("Set prop %d is not supported in usb psy\n",
				psp);
@@ -925,6 +936,7 @@ static int smb5_usb_prop_is_writeable(struct power_supply *psy,
{
	switch (psp) {
	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
	case POWER_SUPPLY_PROP_POWER_NOW:
		return 1;
	default:
		break;
+2 −0
Original line number Diff line number Diff line
@@ -1355,6 +1355,7 @@ static void smblib_uusb_removal(struct smb_charger *chg)
	}

	chg->qc3p5_detected = false;
	chg->qc3p5_detected_mw = 0;
	smblib_update_usb_type(chg);
}

@@ -6329,6 +6330,7 @@ static void typec_src_removal(struct smb_charger *chg)
			"Couldn't disable secondary charger rc=%d\n", rc);

	chg->qc3p5_detected = false;
	chg->qc3p5_detected_mw = 0;
	typec_src_fault_condition_cfg(chg, false);
	smblib_hvdcp_detect_try_enable(chg, false);
	smblib_update_usb_type(chg);
+1 −0
Original line number Diff line number Diff line
@@ -593,6 +593,7 @@ struct smb_charger {
	bool			dpdm_enabled;
	bool			apsd_ext_timeout;
	bool			qc3p5_detected;
	int			qc3p5_detected_mw;

	/* workaround flag */
	int		real_charger_type;