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

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

Merge "qpnp-smb2: Support faking input current limited state" into msm-4.9

parents b517b345 2ec2a790
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1170,6 +1170,9 @@ static int smb2_batt_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_DP_DM:
		rc = smblib_dp_dm(chg, val->intval);
		break;
	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED:
		rc = smblib_set_prop_input_current_limited(chg, val);
		break;
	default:
		rc = -EINVAL;
	}
@@ -1187,6 +1190,7 @@ static int smb2_batt_prop_is_writeable(struct power_supply *psy,
	case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
	case POWER_SUPPLY_PROP_DP_DM:
	case POWER_SUPPLY_PROP_RERUN_AICL:
	case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMITED:
		return 1;
	default:
		break;
+13 −0
Original line number Diff line number Diff line
@@ -1713,6 +1713,11 @@ int smblib_get_prop_input_current_limited(struct smb_charger *chg,
	u8 stat;
	int rc;

	if (chg->fake_input_current_limited >= 0) {
		val->intval = chg->fake_input_current_limited;
		return 0;
	}

	rc = smblib_read(chg, AICL_STATUS_REG, &stat);
	if (rc < 0) {
		smblib_err(chg, "Couldn't read AICL_STATUS rc=%d\n", rc);
@@ -1904,6 +1909,13 @@ int smblib_set_prop_charge_qnovo_enable(struct smb_charger *chg,
	return rc;
}

int smblib_set_prop_input_current_limited(struct smb_charger *chg,
				const union power_supply_propval *val)
{
	chg->fake_input_current_limited = val->intval;
	return 0;
}

int smblib_rerun_aicl(struct smb_charger *chg)
{
	int rc, settled_icl_ua;
@@ -4481,6 +4493,7 @@ int smblib_init(struct smb_charger *chg)
	INIT_DELAYED_WORK(&chg->pl_enable_work, smblib_pl_enable_work);
	INIT_WORK(&chg->legacy_detection_work, smblib_legacy_detection_work);
	chg->fake_capacity = -EINVAL;
	chg->fake_input_current_limited = -EINVAL;

	switch (chg->mode) {
	case PARALLEL_MASTER:
+3 −0
Original line number Diff line number Diff line
@@ -318,6 +318,7 @@ struct smb_charger {
	bool			typec_present;
	u8			typec_status[5];
	bool			typec_legacy_valid;
	int			fake_input_current_limited;

	/* workaround flag */
	u32			wa_flags;
@@ -423,6 +424,8 @@ int smblib_set_prop_batt_capacity(struct smb_charger *chg,
				const union power_supply_propval *val);
int smblib_set_prop_system_temp_level(struct smb_charger *chg,
				const union power_supply_propval *val);
int smblib_set_prop_input_current_limited(struct smb_charger *chg,
				const union power_supply_propval *val);

int smblib_get_prop_dc_present(struct smb_charger *chg,
				union power_supply_propval *val);