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

Commit 9f95ba07 authored by Nicholas Troast's avatar Nicholas Troast Committed by Abhijeet Dharmapurikar
Browse files

qpnp-smb2: expose parallel slave percentage via battery psy



Expose the parallel distribution percentage and allow it to be
modified.

Change-Id: I0c9221c6a748aff5e8fbe889316f729155eded3e
Signed-off-by: default avatarNicholas Troast <ntroast@codeaurora.org>
Signed-off-by: default avatarAbhijeet Dharmapurikar <adharmap@codeaurora.org>
parent 7aefaf59
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -640,6 +640,7 @@ static enum power_supply_property smb2_batt_props[] = {
	POWER_SUPPLY_PROP_STEP_CHARGING_STEP,
	POWER_SUPPLY_PROP_CHARGE_DONE,
	POWER_SUPPLY_PROP_PARALLEL_DISABLE,
	POWER_SUPPLY_PROP_PARALLEL_PERCENT,
};

static int smb2_batt_get_prop(struct power_supply *psy,
@@ -704,6 +705,9 @@ static int smb2_batt_get_prop(struct power_supply *psy,
		val->intval = get_client_vote(chg->pl_disable_votable,
					      USER_VOTER);
		break;
	case POWER_SUPPLY_PROP_PARALLEL_PERCENT:
		val->intval = chg->pl.slave_pct;
		break;
	default:
		pr_err("batt power supply prop %d not supported\n", psp);
		return -EINVAL;
@@ -737,6 +741,12 @@ static int smb2_batt_set_prop(struct power_supply *psy,
	case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
		vote(chg->pl_disable_votable, USER_VOTER, (bool)val->intval, 0);
		break;
	case POWER_SUPPLY_PROP_PARALLEL_PERCENT:
		if (val->intval < 0 || val->intval > 100)
			return -EINVAL;
		chg->pl.slave_pct = val->intval;
		rerun_election(chg->fcc_votable);
		break;
	default:
		rc = -EINVAL;
	}
@@ -752,6 +762,7 @@ static int smb2_batt_prop_is_writeable(struct power_supply *psy,
	case POWER_SUPPLY_PROP_SYSTEM_TEMP_LEVEL:
	case POWER_SUPPLY_PROP_CAPACITY:
	case POWER_SUPPLY_PROP_PARALLEL_DISABLE:
	case POWER_SUPPLY_PROP_PARALLEL_PERCENT:
		return 1;
	default:
		break;