Skip to contentSkip to conversation

power: supply: core: add quick charge type property

PATCH Superseded Qiwu Huang 2 participants 7 messages Jul 15, 2020 1 message not in the archive Power supply

v3 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Qiwu Huang

author
#1 lore raw

PATCH v3 1/5 power: supply: core: add quick charge type property

In reply to a message not in the archive

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power. UI will show different
animation effect for different quick charge type.

---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                | 10 ++++++++++
 3 files changed, 32 insertions(+)
Documentation/ABI/testing/sysfs-class-power +21 -0
index 216d61a22f1e..dd3773dcf16a 100644
@@ -708,3 +708,24 @@ Description:
 
 		Access: Read
 		Valid values: 1-31
+
+What:		/sys/class/power_supply/<supply_name>/quick_charge_type
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+		Description:
+		Reports the kind of quick charge type based on different adapter power.
+		Different quick charge type represent different charging power.
+		QUICK_CHARGE_NORMAL : Charging Power <= 10W
+		QUICK_CHARGE_FAST : 10W < Charging Power <= 20W
+		QUICK_CHARGE_FLASH : 20W < Charging Power <= 30W
+		QUICK_CHARGE_TURBE : 30W < Charging Power <= 50W
+		QUICK_CHARGE_SUPER : Charging Power > 50W
+
+		Access: Read-Only
+		Valid values:
+			0: QUICK_CHARGE_NORMAL,
+			1: QUICK_CHARGE_FAST,
+			2: QUICK_CHARGE_FLASH,
+			3: QUICK_CHARGE_TURBE,
+			4: QUICK_CHARGE_SUPER.
+
drivers/power/supply/power_supply_sysfs.c +1 -0
index bc79560229b5..9554d7907373 100644
@@ -206,6 +206,7 @@ static struct power_supply_attr power_supply_attrs[] = {
 	POWER_SUPPLY_ATTR(MODEL_NAME),
 	POWER_SUPPLY_ATTR(MANUFACTURER),
 	POWER_SUPPLY_ATTR(SERIAL_NUMBER),
+	POWER_SUPPLY_ATTR(QUICK_CHARGE_TYPE),
 };
 
 static struct attribute *
include/linux/power_supply.h +10 -0
index ac1345a48ad0..f35c661a2544 100644
@@ -167,6 +167,7 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_MODEL_NAME,
 	POWER_SUPPLY_PROP_MANUFACTURER,
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
+	POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE,
 };
 
 enum power_supply_type {
@@ -197,6 +198,15 @@ enum power_supply_usb_type {
 	POWER_SUPPLY_USB_TYPE_APPLE_BRICK_ID,	/* Apple Charging Method */
 };
 
+enum power_supply_quick_charge_type {
+	QUICK_CHARGE_NORMAL = 0,		/* Charging Power <= 10W */
+	QUICK_CHARGE_FAST,			/* 10W < Charging Power <= 20W */
+	QUICK_CHARGE_FLASH,			/* 20W < Charging Power <= 30W */
+	QUICK_CHARGE_TURBE,			/* 30W < Charging Power <= 50W */
+	QUICK_CHARGE_SUPER,			/* Charging Power > 50W */
+	QUICK_CHARGE_MAX,
+};
+
 enum power_supply_notifier_events {
 	PSY_EVENT_PROP_CHANGED,
 };
Signature · 1 line
2.27.0
author
#3 lore raw

PATCH v3 2/5 power: supply: core: add wireless charger adapter type property

In reply to a message not in the archive

From: Qiwu Huang <[email protected]>

Reports what type of wireless adapter connection is currently active forthe supply.
for example it can show if ADAPTER_PD capable source is attached.

---
 Documentation/ABI/testing/sysfs-class-power | 28 +++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                | 19 ++++++++++++++
 3 files changed, 48 insertions(+)
Documentation/ABI/testing/sysfs-class-power +28 -0
index dd3773dcf16a..03ab449fae8a 100644
@@ -729,3 +729,31 @@ Contact:	Fei Jiang <[email protected]>
 			3: QUICK_CHARGE_TURBE,
 			4: QUICK_CHARGE_SUPER.
 
+===== Wireless Charger Properties =====
+What:		/sys/class/power_supply/<supply_name>/tx_adapter
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+Description:
+		Reports the type of wireless adapter connection is currently active for
+		the supply, for example it can show if ADAPTER_PD capable source
+		is attached. Expect common wireless adapter type, also increase by
+		some vendor private adapter type(ex. ADAPTER_PD_40W).
+
+		Access: Read-Only
+		Valid values:
+			0: ADAPTER_NONE,
+			1: ADAPTER_SDP,
+			2: ADAPTER_DCP,
+			3: ADAPTER_CDP,
+			4: ADAPTER_OCP,
+			5: ADAPTER_QC2,
+			6: ADAPTER_QC3,
+			7: ADAPTER_PD,
+			8: ADAPTER_AUTH_FAILED,
+			9: ADAPTER_PRIVATE_QC3,
+			10: ADAPTER_PRIVATE_PD,
+			11: ADAPTER_CAR_POWER,
+			12: ADAPTER_PRIVATE_PD_40W,
+			13: ADAPTER_VOICE_BOX,
+			14: ADAPTER_PRIVATE_PD_50W.
+
drivers/power/supply/power_supply_sysfs.c +1 -0
index 9554d7907373..f2458e21d02b 100644
@@ -207,6 +207,7 @@ static struct power_supply_attr power_supply_attrs[] = {
 	POWER_SUPPLY_ATTR(MANUFACTURER),
 	POWER_SUPPLY_ATTR(SERIAL_NUMBER),
 	POWER_SUPPLY_ATTR(QUICK_CHARGE_TYPE),
+	POWER_SUPPLY_ATTR(TX_ADAPTER),
 };
 
 static struct attribute *
include/linux/power_supply.h +19 -0
index f35c661a2544..0bbdec1630a4 100644
@@ -168,6 +168,7 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_MANUFACTURER,
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
 	POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE,
+	POWER_SUPPLY_PROP_TX_ADAPTER,
 };
 
 enum power_supply_type {
@@ -207,6 +208,24 @@ enum power_supply_quick_charge_type {
 	QUICK_CHARGE_MAX,
 };
 
+enum power_supply_tx_adapter_type {
+	ADAPTER_NONE = 0,			/* Nothing Attached */
+	ADAPTER_SDP,				/* Standard Downstream Port */
+	ADAPTER_CDP,				/* Charging Downstream Port */
+	ADAPTER_DCP,				/* Dedicated Charging Port */
+	ADAPTER_OCP,				/* Other Charging Port */
+	ADAPTER_QC2,				/* Qualcomm Charge 2.0 */
+	ADAPTER_QC3,				/* Qualcomm Charge 3.0 */
+	ADAPTER_PD,				/* Power Delivery Port */
+	ADAPTER_AUTH_FAILED,			/* Authenticated Failed Adapter */
+	ADAPTER_PRIVATE_QC3,			/* Qualcomm Charge 3.0 with Private Protocol */
+	ADAPTER_PRIVATE_PD,			/* PD Adapter with Private Protocol */
+	ADAPTER_CAR_POWER,			/* Wireless Car Charger */
+	ADAPTER_PRIVATE_PD_40W,			/* 40W PD Adapter with Private Protocol */
+	ADAPTER_VOICE_BOX,			/* Voice Box which Support Wireless Charger */
+	ADAPTER_PRIVATE_PD_50W,			/* 50W PD Adapter with Private Protocol */
+};
+
 enum power_supply_notifier_events {
 	PSY_EVENT_PROP_CHANGED,
 };
Signature · 1 line
2.27.0
author
#4 lore raw

PATCH v3 3/5 power: supply: core: add wireless signal strength property

In reply to a message not in the archive

From: Qiwu Huang <[email protected]>

reports wireless signal strength.
The value show degree of coupling between tx and rx.

---
 Documentation/ABI/testing/sysfs-class-power | 10 ++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 12 insertions(+)
Documentation/ABI/testing/sysfs-class-power +10 -0
index 03ab449fae8a..75ec7de2fe78 100644
@@ -757,3 +757,13 @@ Description:
 			13: ADAPTER_VOICE_BOX,
 			14: ADAPTER_PRIVATE_PD_50W.
 
+What:		/sys/class/power_supply/<supply_name>/signal_strength
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+Description:
+		In PING phase, RX transmits a signal strength packet as the first
+		communication packet to instruct the base to keep power signal on.
+		The value reports wireless signal strength and show degree of coupling.
+
+		Access: Read-Only
+		Valid values: 0 - 100
drivers/power/supply/power_supply_sysfs.c +1 -0
index f2458e21d02b..e420a453095e 100644
@@ -208,6 +208,7 @@ static struct power_supply_attr power_supply_attrs[] = {
 	POWER_SUPPLY_ATTR(SERIAL_NUMBER),
 	POWER_SUPPLY_ATTR(QUICK_CHARGE_TYPE),
 	POWER_SUPPLY_ATTR(TX_ADAPTER),
+	POWER_SUPPLY_ATTR(SIGNAL_STRENGTH),
 };
 
 static struct attribute *
include/linux/power_supply.h +1 -0
index 0bbdec1630a4..346c6c9c0737 100644
@@ -169,6 +169,7 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_SERIAL_NUMBER,
 	POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE,
 	POWER_SUPPLY_PROP_TX_ADAPTER,
+	POWER_SUPPLY_PROP_SIGNAL_STRENGTH,
 };
 
 enum power_supply_type {
Signature · 1 line
2.27.0
author
#5 lore raw

PATCH v3 4/5 power: supply: core: property to control reverse charge

In reply to a message not in the archive

From: Qiwu Huang <[email protected]>

Interface to control wireless reverse charge.
Supply reverse charge function when enabled.

---
 Documentation/ABI/testing/sysfs-class-power | 12 ++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 14 insertions(+)
Documentation/ABI/testing/sysfs-class-power +12 -0
index 75ec7de2fe78..54647d6995d3 100644
@@ -767,3 +767,15 @@ Description:
 
 		Access: Read-Only
 		Valid values: 0 - 100
+
+What:		/sys/class/power_supply/<supply_name>/reverse_chg_mode
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+Description:
+		Some phones support wireless reverse charge function which charge other phones.
+		The property supply interface to control wireless reverse charge.
+		If enabled, start TX mode and detect RX. Disabled when timeout or manual setting.
+
+		Valid values:
+		- 1: enabled
+		- 0: disabled
drivers/power/supply/power_supply_sysfs.c +1 -0
index e420a453095e..81916b6b6ccf 100644
@@ -209,6 +209,7 @@ static struct power_supply_attr power_supply_attrs[] = {
 	POWER_SUPPLY_ATTR(QUICK_CHARGE_TYPE),
 	POWER_SUPPLY_ATTR(TX_ADAPTER),
 	POWER_SUPPLY_ATTR(SIGNAL_STRENGTH),
+	POWER_SUPPLY_ATTR(REVERSE_CHG_MODE),
 };
 
 static struct attribute *
include/linux/power_supply.h +1 -0
index 346c6c9c0737..a87ae1fff8d1 100644
@@ -170,6 +170,7 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_QUICK_CHARGE_TYPE,
 	POWER_SUPPLY_PROP_TX_ADAPTER,
 	POWER_SUPPLY_PROP_SIGNAL_STRENGTH,
+	POWER_SUPPLY_PROP_REVERSE_CHG_MODE,
 };
 
 enum power_supply_type {
Signature · 1 line
2.27.0
author
#6 lore raw

PATCH v3 5/5 power: supply: core: supply battery soc with decimal form

In reply to a message not in the archive

From: Qiwu Huang <[email protected]>

Broadcast battery soc with decimal form. soc_decimal is the decimal part of battery soc. soc_decimal_rate is update frequency of decimal part of battery soc.
We want to report such as 0.01 to 99.99% to user space to improve user experience when do very quick charging.

---
 Documentation/ABI/testing/sysfs-class-power | 25 +++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  2 ++
 include/linux/power_supply.h                |  2 ++
 3 files changed, 29 insertions(+)
Documentation/ABI/testing/sysfs-class-power +25 -0
index 54647d6995d3..5e0bba3e1930 100644
@@ -349,6 +349,31 @@ Description:
 		Access: Read
 		Valid values: Represented in microvolts
 
+What:		/sys/class/power_supply/<supply_name>/soc_decimal,
+Date:		Jul 2020
+Contact:	[email protected]
+Description:
+		Broadcast battery soc with decimal form.Battery soc(0 - 100 percent)
+		is fine grain representation of battery capacity.
+		soc_decimal is the start decimal part of battery soc.
+		For example, soc_decimal value is 30 for 80.30%.
+
+		Access: Read
+		Valid values: 0 - 99
+
+What:		/sys/class/power_supply/<supply_name>/soc_decimal_rate,
+Date:		Jul 2020
+Contact:	[email protected]
+Description:
+		Broadcast battery soc with decimal form.Battery soc(0 - 100 percent)
+		is fine grain representation of battery capacity.
+		soc_decimal_rate is update rate for decimal part of battery soc.
+		The value is depend on charging power. Soc decimal change faster
+		with larger charging power.
+
+		Access: Read
+		Valid values: 1 - 100
+
 ===== USB Properties =====
 
 What: 		/sys/class/power_supply/<supply_name>/current_avg
drivers/power/supply/power_supply_sysfs.c +2 -0
index 81916b6b6ccf..a837addb4f21 100644
@@ -210,6 +210,8 @@ static struct power_supply_attr power_supply_attrs[] = {
 	POWER_SUPPLY_ATTR(TX_ADAPTER),
 	POWER_SUPPLY_ATTR(SIGNAL_STRENGTH),
 	POWER_SUPPLY_ATTR(REVERSE_CHG_MODE),
+	POWER_SUPPLY_ATTR(SOC_DECIMAL),
+	POWER_SUPPLY_ATTR(SOC_DECIMAL_RATE),
 };
 
 static struct attribute *
include/linux/power_supply.h +2 -0
index a87ae1fff8d1..71e7c8010bde 100644
@@ -171,6 +171,8 @@ enum power_supply_property {
 	POWER_SUPPLY_PROP_TX_ADAPTER,
 	POWER_SUPPLY_PROP_SIGNAL_STRENGTH,
 	POWER_SUPPLY_PROP_REVERSE_CHG_MODE,
+	POWER_SUPPLY_PROP_SOC_DECIMAL,
+	POWER_SUPPLY_PROP_SOC_DECIMAL_RATE,
 };
 
 enum power_supply_type {
Signature · 1 line
2.27.0
#2 lore raw
In reply to Qiwu Huang
Quoted 6 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power. UI will show different
animation effect for different quick charge type.

Quoted 6 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                | 10 ++++++++++
 3 files changed, 32 insertions(+)

What changed in any of these patches from the previous versions? Always list that below the --- line, like the documentation asks you to do.

And where is the 0/5 email for this series?

Please fix up and resend as a new version.

thanks,

greg k-h

#7 lore raw

Re: [PATCH v3 5/5] power: supply: core: supply battery soc with decimal form

In reply to Qiwu Huang
Quoted 3 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Broadcast battery soc with decimal form.

What does "soc" mean?

Quoted 6 lines

soc_decimal is the decimal part of battery soc. soc_decimal_rate is update frequency of decimal part of battery soc.
We want to report such as 0.01 to 99.99% to user space to improve user experience when do very quick charging.

You can wrap your lines a bit longer, 72 columns is usually the normal spot :)

thanks,

greg k-h