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

Commit f78b91da authored by Guru Das Srinagesh's avatar Guru Das Srinagesh
Browse files

power_supply: Add TYPEC_SRC_RP property



Add property POWER_SUPPLY_PROP_TYPEC_SRC_RP to return the Rp
currently configured for the charger while in Type-C Source
mode.

Also add enum listing the set of all valid Rp values.

CRs-Fixed: 2283665
Change-Id: I234a9095192ccfefbfc3c38cf6c07861bd7e2316
Signed-off-by: default avatarGuru Das Srinagesh <gurus@codeaurora.org>
parent 20768179
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@ static const char * const power_supply_usbc_pr_text[] = {
	"none", "dual power role", "sink", "source"
};

static const char * const power_supply_typec_src_rp_text[] = {
	"Rp-Default", "Rp-1.5A", "Rp-3A"
};

static ssize_t power_supply_show_property(struct device *dev,
					  struct device_attribute *attr,
					  char *buf) {
@@ -141,6 +145,9 @@ static ssize_t power_supply_show_property(struct device *dev,
	else if (off == POWER_SUPPLY_PROP_TYPEC_POWER_ROLE)
		return scnprintf(buf, PAGE_SIZE, "%s\n",
			       power_supply_usbc_pr_text[value.intval]);
	else if (off == POWER_SUPPLY_PROP_TYPEC_SRC_RP)
		return scnprintf(buf, PAGE_SIZE, "%s\n",
			       power_supply_typec_src_rp_text[value.intval]);
	else if (off == POWER_SUPPLY_PROP_DIE_HEALTH)
		return scnprintf(buf, PAGE_SIZE, "%s\n",
			       power_supply_health_text[value.intval]);
@@ -334,6 +341,7 @@ static struct device_attribute power_supply_attrs[] = {
	POWER_SUPPLY_ATTR(typec_mode),
	POWER_SUPPLY_ATTR(typec_cc_orientation),
	POWER_SUPPLY_ATTR(typec_power_role),
	POWER_SUPPLY_ATTR(typec_src_rp),
	POWER_SUPPLY_ATTR(pd_allowed),
	POWER_SUPPLY_ATTR(pd_active),
	POWER_SUPPLY_ATTR(pd_in_hard_reset),
+7 −0
Original line number Diff line number Diff line
@@ -267,6 +267,7 @@ enum power_supply_property {
	POWER_SUPPLY_PROP_TYPEC_MODE,
	POWER_SUPPLY_PROP_TYPEC_CC_ORIENTATION, /* 0: N/C, 1: CC1, 2: CC2 */
	POWER_SUPPLY_PROP_TYPEC_POWER_ROLE,
	POWER_SUPPLY_PROP_TYPEC_SRC_RP,
	POWER_SUPPLY_PROP_PD_ALLOWED,
	POWER_SUPPLY_PROP_PD_ACTIVE,
	POWER_SUPPLY_PROP_PD_IN_HARD_RESET,
@@ -359,6 +360,12 @@ enum power_supply_typec_mode {
	POWER_SUPPLY_TYPEC_NON_COMPLIANT,
};

enum power_supply_typec_src_rp {
	POWER_SUPPLY_TYPEC_SRC_RP_STD,
	POWER_SUPPLY_TYPEC_SRC_RP_1P5A,
	POWER_SUPPLY_TYPEC_SRC_RP_3A
};

enum power_supply_typec_power_role {
	POWER_SUPPLY_TYPEC_PR_NONE,		/* CC lines in high-Z */
	POWER_SUPPLY_TYPEC_PR_DUAL,