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

Commit 1086876c 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: add the PARALLEL_DISABLE property to usb psy"

parents 4d332ce4 7d74a7b9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -269,6 +269,7 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(pd_active),
	POWER_SUPPLY_ATTR(charger_temp),
	POWER_SUPPLY_ATTR(charger_temp_max),
	POWER_SUPPLY_ATTR(parallel_disable),
	/* Local extensions of type int64_t */
	POWER_SUPPLY_ATTR(charge_counter_ext),
	/* Properties of type `const char *' */
+9 −0
Original line number Diff line number Diff line
@@ -342,6 +342,7 @@ static enum power_supply_property smb2_usb_props[] = {
	POWER_SUPPLY_PROP_PD_ACTIVE,
	POWER_SUPPLY_PROP_INPUT_CURRENT_SETTLED,
	POWER_SUPPLY_PROP_INPUT_CURRENT_NOW,
	POWER_SUPPLY_PROP_PARALLEL_DISABLE,
};

static int smb2_usb_get_prop(struct power_supply *psy,
@@ -404,6 +405,10 @@ static int smb2_usb_get_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_INPUT_CURRENT_NOW:
		rc = smblib_get_prop_usb_current_now(chg, val);
		break;
	case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
		val->intval = get_client_vote(chg->pl_disable_votable,
					      USER_VOTER);
		break;
	default:
		pr_err("get prop %d is not supported\n", psp);
		rc = -EINVAL;
@@ -448,6 +453,9 @@ static int smb2_usb_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_PD_ACTIVE:
		rc = smblib_set_prop_pd_active(chg, val);
		break;
	case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
		vote(chg->pl_disable_votable, USER_VOTER, (bool)val->intval, 0);
		break;
	default:
		pr_err("set prop %d is not supported\n", psp);
		rc = -EINVAL;
@@ -462,6 +470,7 @@ static int smb2_usb_prop_is_writeable(struct power_supply *psy,
{
	switch (psp) {
	case POWER_SUPPLY_PROP_TYPEC_POWER_ROLE:
	case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
		return 1;
	default:
		break;
+11 −2
Original line number Diff line number Diff line
@@ -48,8 +48,8 @@ static struct smb_params v1_params = {
		.name	= "fast charge current",
		.reg	= FAST_CHARGE_CURRENT_CFG_REG,
		.min_u	= 0,
		.max_u	= 5000000,
		.step_u	= 50000,
		.max_u	= 4500000,
		.step_u	= 25000,
	},
	.fv		= {
		.name	= "float voltage",
@@ -1125,6 +1125,15 @@ static int smb138x_slave_probe(struct smb138x *chip)
		return rc;
	}

	/* enable parallel current sensing */
	rc = smblib_masked_write(chg, CFG_REG,
				 VCHG_EN_CFG_BIT, VCHG_EN_CFG_BIT);
	if (rc < 0) {
		dev_err(chg->dev, "Couldn't enable parallel current sensing rc=%d\n",
			rc);
		return rc;
	}

	/* keep at the end of probe, ready to serve before notifying others */
	rc = smb138x_init_parallel_psy(chip);
	if (rc < 0) {
+1 −0
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@ enum power_supply_property {
	POWER_SUPPLY_PROP_PD_ACTIVE,
	POWER_SUPPLY_PROP_CHARGER_TEMP,
	POWER_SUPPLY_PROP_CHARGER_TEMP_MAX,
	POWER_SUPPLY_PROP_PARALLEL_DISABLE,
	/* Local extensions of type int64_t */
	POWER_SUPPLY_PROP_CHARGE_COUNTER_EXT,
	/* Properties of type `const char *' */