Skip to contentSkip to conversation

add some power supply properties about wireless/wired charging

PATCH Superseded Qiwu Huang 3 participants 13 messages Aug 14, 2020 – Aug 25, 2020

Subsystems (2)

v8 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

Qiwu Huang

author
#0 lore raw

v8 cover add some power supply properties about wireless/wired charging

From: Qiwu Huang <[email protected]>

This patchset aims to provide power supply properties about wireless/wired charging. "quick_charge_type" reports different types of quick charge based on the charging power; "tx_adapter" shows" the type of wireless charging adapter; "signal_strength" shows the coupling level between TX and RX; "reverse_chg_mode" provides the interface of enabling/disabling wireless reverse charging.

Changes in v8
- Add quick charge type driver in qcom_smbb suggested by GregKH

Changes in v7
- Fix PATCH version error in 0/X email

Changes in v6
- Replace "phones" with "devices" suggested by GregKH
- Add permission statement for "reverse_chg_mode"
- Update description for "reverse_chg_mode" in ABI suggested by GregKH
- Update description for "PING phase" in ABI suggested by GregKH

Changes in v5
- Add details in 0/X email

Changes in v4
- Exclude the patch of "power: supply: supply battery soc with decimal form"
- Fix some typo

Changes in v3
- Add enumederated for quick charge type
- Add enumederated for tx adapter type
- Update the return type and description in ABI

Changes in v2
- modify to capital letters for "power_supply_attrs"
- Update the return type and description in ABI
Qiwu Huang (4):
power: supply: core: add quick charge type property
power: supply: core: add wireless charger adapter type property
power: supply: core: add wireless signal strength property
power: supply: core: property to control reverse charge

 Documentation/ABI/testing/sysfs-class-power | 85 +++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  4 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++
 include/linux/power_supply.h                | 35 +++++++++
 4 files changed, 175 insertions(+)
Signature · 1 line
2.28.0
author
#1 lore raw

PATCH v8 1/4 power: supply: core: add quick charge type property

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 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 *
drivers/power/supply/qcom_smbb.c +51 -0

69 lines not on this page · raw message

include/linux/power_supply.h +14 -0
index ac1345a48ad0..bd99658c05be 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 {
@@ -182,6 +183,10 @@ enum power_supply_type {
 	POWER_SUPPLY_TYPE_USB_PD,		/* Power Delivery Port */
 	POWER_SUPPLY_TYPE_USB_PD_DRP,		/* PD Dual Role Port */
 	POWER_SUPPLY_TYPE_APPLE_BRICK_ID,	/* Apple Charging Method */
+	POWER_SUPPLY_TYPE_USB_HVDCP,		/* High Voltage DCP */
+	POWER_SUPPLY_TYPE_USB_HVDCP_3,		/* Efficient High Voltage DCP */
+	POWER_SUPPLY_TYPE_USB_HVDCP_3P5,	/* Efficient High Voltage DCP */
+	POWER_SUPPLY_TYPE_USB_FLOAT,		/* Floating charger */
 };
 
 enum power_supply_usb_type {
@@ -197,6 +202,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.28.0
#2 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Quoted 5 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 insertions(+)

You should also submit your driver that uses these new attributes at the same time. What happened to that request? Otherwise no one really knows how these are being used, or if they even are used by anyone.

thanks,

greg k-h

author
#3 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Quoted 15 lines · Greg KH
Quoted 5 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 insertions(+)
Quoted 4 lines

You should also submit your driver that uses these new attributes at the same time. What happened to that request? Otherwise no one really knows how these are being used, or if they even are used by anyone.

I don't think I can submit the whole driver because our drivers are divided into three parts, the first part is in ADSP, the second part is in kernel and the third part is in Android Hal.This is the second part.

Quoted 3 lines

thanks,

greg k-h

Signature · 3 lines
Thanks

Qiwu
#4 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Quoted 21 lines · Qiwu Huang
Quoted 15 lines · Greg KH
Quoted 5 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 insertions(+)
Quoted 4 lines

You should also submit your driver that uses these new attributes at the same time. What happened to that request? Otherwise no one really knows how these are being used, or if they even are used by anyone.

Quoted 4 lines

I don't think I can submit the whole driver because our drivers are divided into three parts, the first part is in ADSP, the second part is in kernel and the third part is in Android Hal.This is the second part.

WHat is "ADSP"?

Just submit your kernel driver code, that's all we care about here. Userspace code is not anything we can do anything with :)

thanks,

greg k-h

author
#5 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Quoted 23 lines · Greg KH
Quoted 21 lines · Qiwu Huang
Quoted 19 lines · Greg KH
Quoted 5 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 insertions(+)

You should also submit your driver that uses these new attributes at the same time. What happened to that request? Otherwise no one really knows how these are being used, or if they even are used by anyone.

Quoted 6 lines
Quoted 4 lines

I don't think I can submit the whole driver because our drivers are divided into three parts, the first part is in ADSP, the second part is in kernel and the third part is in Android Hal.This is the second part.

WHat is "ADSP"?

ADSP: advanced digital signal processor

Quoted 3 lines

Just submit your kernel driver code, that's all we care about here. Userspace code is not anything we can do anything with :)

If we ported the full driver, we would break the existing driver structure because we would introduce more Qualcomm code. I think that's an unreasonable change.

Quoted 4 lines

thanks,

greg k-h

Signature · 3 lines
Thanks

Qiwu
#6 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Quoted 24 lines · Qiwu Huang
Quoted 23 lines · Greg KH
Quoted 21 lines · Qiwu Huang
Quoted 19 lines · Greg KH
Quoted 5 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 insertions(+)

You should also submit your driver that uses these new attributes at the same time. What happened to that request? Otherwise no one really knows how these are being used, or if they even are used by anyone.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I don't think I can submit the whole driver because our drivers are divided into three parts, the first part is in ADSP, the second part is in kernel and the third part is in Android Hal.This is the second part.

WHat is "ADSP"?

ADSP: advanced digital signal processor

Ok, then just send the kernel driver.

Quoted 6 lines
Quoted 2 lines

Just submit your kernel driver code, that's all we care about here. Userspace code is not anything we can do anything with :)

If we ported the full driver, we would break the existing driver structure because we would introduce more Qualcomm code. I think that's an unreasonable change.

That doesn't make much sense. You have a working driver for these apis, just submit it for inclusion, it should never break any existing drivers, otherwise your code wouldn't work either.

thanks,

greg k-h

author
#7 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Quoted 40 lines · Greg KH
Quoted 24 lines · Qiwu Huang
Quoted 23 lines · Greg KH
Quoted 21 lines · Qiwu Huang
Quoted 19 lines · Greg KH
Quoted 5 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 insertions(+)

You should also submit your driver that uses these new attributes at the same time. What happened to that request? Otherwise no one really knows how these are being used, or if they even are used by anyone.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I don't think I can submit the whole driver because our drivers are divided into three parts, the first part is in ADSP, the second part is in kernel and the third part is in Android Hal.This is the second part.

WHat is "ADSP"?

ADSP: advanced digital signal processor

Ok, then just send the kernel driver.

Quoted 3 lines
Quoted 2 lines

Just submit your kernel driver code, that's all we care about here. Userspace code is not anything we can do anything with :)

Quoted 7 lines
Quoted 3 lines

If we ported the full driver, we would break the existing driver structure because we would introduce more Qualcomm code. I think that's an unreasonable change.

That doesn't make much sense. You have a working driver for these apis, just submit it for inclusion, it should never break any existing drivers, otherwise your code wouldn't work either.

We're an Android device, we're working on a Qualcomm based code, and from the current code tree, the current code tree is missing the QTI Charger code

Quoted 4 lines

thanks,

greg k-h

Signature · 3 lines
Thanks

Qiwu
#8 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Quoted 45 lines · Qiwu Huang
Quoted 44 lines · Greg KH
Quoted 24 lines · Qiwu Huang
Quoted 23 lines · Greg KH
Quoted 21 lines · Qiwu Huang
Quoted 19 lines · Greg KH
Quoted 5 lines · Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports the kind of quick charge type based on
different adapter power.

Quoted 7 lines
---
 Documentation/ABI/testing/sysfs-class-power | 21 +++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 drivers/power/supply/qcom_smbb.c            | 51 +++++++++++++++++++++
 include/linux/power_supply.h                | 14 ++++++
 4 files changed, 87 insertions(+)

You should also submit your driver that uses these new attributes at the same time. What happened to that request? Otherwise no one really knows how these are being used, or if they even are used by anyone.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

I don't think I can submit the whole driver because our drivers are divided into three parts, the first part is in ADSP, the second part is in kernel and the third part is in Android Hal.This is the second part.

WHat is "ADSP"?

ADSP: advanced digital signal processor

Ok, then just send the kernel driver.

Quoted 6 lines
Quoted 2 lines

Just submit your kernel driver code, that's all we care about here. Userspace code is not anything we can do anything with :)

If we ported the full driver, we would break the existing driver structure because we would introduce more Qualcomm code. I think that's an unreasonable change.

Quoted 7 lines
Quoted 3 lines

That doesn't make much sense. You have a working driver for these apis, just submit it for inclusion, it should never break any existing drivers, otherwise your code wouldn't work either.

We're an Android device, we're working on a Qualcomm based code, and from the current code tree, the current code tree is missing the QTI Charger code

I don't know what that means, sorry. Just submit your driver, and any needed dependencies as well. There's no other way to evaluate this api addition without that, right?

thanks,

greg k-h

#9 lore raw

Re: [PATCH v8 1/4] power: supply: core: add quick charge type property

Hi!

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines

If we ported the full driver, we would break the existing driver structure because we would introduce more Qualcomm code. I think that's an unreasonable change.

That doesn't make much sense. You have a working driver for these apis, just submit it for inclusion, it should never break any existing drivers, otherwise your code wouldn't work either.

Quoted 7 lines
Quoted 3 lines

We're an Android device, we're working on a Qualcomm based code, and from the current code tree, the current code tree is missing the QTI Charger code

I don't know what that means, sorry. Just submit your driver, and any needed dependencies as well. There's no other way to evaluate this api addition without that, right?

Actually, there's a way to evaluate the API without the driver... if the API is pretty obviously unacceptable.

Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
author
#10 lore raw

PATCH v8 2/4 power: supply: core: add wireless charger adapter type property

In reply to Qiwu Huang

From: Qiwu Huang <[email protected]>

Reports what type of wireless adapter connection is currently active for the 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 bd99658c05be..00254e096a4a 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 {
@@ -211,6 +212,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.28.0
author
#11 lore raw

PATCH v8 3/4 power: supply: core: add wireless signal strength property

In reply to Qiwu Huang

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 | 22 +++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 24 insertions(+)
Documentation/ABI/testing/sysfs-class-power +22 -0
index 03ab449fae8a..4459b720feb2 100644
@@ -757,3 +757,25 @@ 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.
+
+		The Qi Wireless Power Transfer System is published by the
+		Wireless Power Consortium.The ping phase is the necessary stage
+		for matching transmitter and receiver. In this phase,the Power
+		Transmitter executes a Digital Ping, and listens for a response.
+		If the Power Transmitter discovers a Power Receiver, the Power
+		Transmitter may extend the Digital Ping,i.e. maintain the Power
+		Signal at the level of the Digital Ping. This causes the system
+		to proceed to the identification & configuration phase. If the
+		Power Transmitter does not extend the Digital Ping, the system
+		shall revert to the selection phase.
+
+		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 00254e096a4a..747338118fa1 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.28.0
author
#12 lore raw

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

In reply to Qiwu Huang

From: Qiwu Huang <[email protected]>

Interface to control wireless reverse charge.

---
 Documentation/ABI/testing/sysfs-class-power | 14 ++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 16 insertions(+)
Documentation/ABI/testing/sysfs-class-power +14 -0
index 4459b720feb2..8840fdf483a7 100644
@@ -779,3 +779,17 @@ 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 devices support wireless reverse charge function which
+		charge other devices.The property provider interface to
+		enable/disable wireless reverse charge.If enabled, start TX
+		mode and detect RX. Disabled when timeout or manual setting.
+
+		Access: Read, Write
+		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 747338118fa1..988d3f05ea1c 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.28.0