Skip to contentSkip to conversation

power: supply: core: add quick charge type property

PATCH Superseded Qiwu Huang 2 participants 10 messages Jul 13, 2020 – Jul 14, 2020 3 messages not in the archive Power supply

v2 of 10 Superseded Latest is v10 →

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Qiwu Huang

author
#1 lore raw

PATCH v2 1/5 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. UI will show different
animation effect for different quick charge type.

---
 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 216d61a22f1e..d3169d47e359 100644
@@ -708,3 +708,13 @@ 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.
+
+		Access: Read-Only
+		Valid values: Reported as integer
+
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 +1 -0
index ac1345a48ad0..3fe7e9ef2f0f 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 {
Signature · 1 line
2.27.0
#2 lore raw
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 | 10 ++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 12 insertions(+)

What changed from v1 of this patch? SHouldn't that always be below the --- line?

Quoted 6 lines
Documentation/ABI/testing/sysfs-class-power +0 -0
index 216d61a22f1e..d3169d47e359 100644

Documentation/ABI/testing/sysfs-class-power Description: · line 716

Quoted 9 lines
Documentation/ABI/testing/sysfs-class-power +6 -0
@@ -708,3 +708,13 @@ 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.

What are the allowed types here? Shouldn't that also be an enumerated type with a predefined string?

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CAPtXDt2ALhYRTTn7m6Jb3k+339VC84YUDC7V=Yb7-a+DpvuVtg@mail.gmail.com

#4 lore raw

A: http://en.wikipedia.org/wiki/Top_post
Q: Were do I find info about this thing called top-posting?
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

Quoted 1 line · ivan

I think we should add an enumederated for this

What is "this"?

Quoted 28 lines

for example

abi document

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.

power_supply.h

Quoted 8 lines

enum power_supply_quick_charge_type {
QUICK_CHARGE_NORMAL = 0,
QUICK_CHARGE_FAST,
QUICK_CHARGE_FLASH,
QUICK_CHARGE_TURBE,
QUICK_CHARGE_SUPER,
QUICK_CHARGE_MAX,
};

That seems like a good change, why not do this? :)

thanks,

greg k-h

author
#5 lore raw

PATCH v2 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 | 11 +++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-class-power +11 -0
index d3169d47e359..cd07d3f4e8b1 100644
@@ -718,3 +718,14 @@ Contact:	Fei Jiang <[email protected]>
 		Access: Read-Only
 		Valid values: Reported as integer
 
+===== Wireless Charger Properties =====
+What:		/sys/class/power_supply/<supply_name>/tx_adapter
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+Description:
+		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.
+
+		Access: Read-Only
+		Valid values: Reported as integer
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 +1 -0
index 3fe7e9ef2f0f..2de9a4c93723 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 {
Signature · 1 line
2.27.0
#6 lore raw

Re: [PATCH v2 2/5] power: supply: core: add wireless charger adapter type property

Quoted 19 lines · Qiwu Huang

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 | 11 +++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-class-power +0 -0
index d3169d47e359..cd07d3f4e8b1 100644
@@ -718,3 +718,14 @@ Contact:	Fei Jiang <[email protected]>
 		Access: Read-Only

Documentation/ABI/testing/sysfs-class-power Contact: Fei Jiang <[email protected]> · line 728

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-power +8 -0
 		Valid values: Reported as integer
 
+===== Wireless Charger Properties =====
+What:		/sys/class/power_supply/<supply_name>/tx_adapter
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+Description:
+		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.

Same question as before, what are the allowed types here?

Documentation/ABI/testing/sysfs-class-power Contact: Fei Jiang <[email protected]> · line 731

Quoted 3 lines
Documentation/ABI/testing/sysfs-class-power +3 -0
+
+		Access: Read-Only
+		Valid values: Reported as integer

What integer maps to what values?

thanks,

greg k-h

A message that is not in the archive (sent off-list or not yet received): CAPtXDt3kX0=MNXUjDfKr0EgmTxejctdoSoDWUY561gfT6CAr1Q@mail.gmail.com

#8 lore raw

Re: [PATCH v2 2/5] power: supply: core: add wireless charger adapter type property

Quoted 1 line · ivan

same as before, we should add it

Please do.

author
#9 lore raw

PATCH v2 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 | 11 +++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  1 +
 include/linux/power_supply.h                |  1 +
 3 files changed, 13 insertions(+)
Documentation/ABI/testing/sysfs-class-power +11 -0
index cd07d3f4e8b1..f10780be2732 100644
@@ -729,3 +729,14 @@ Description:
 
 		Access: Read-Only
 		Valid values: Reported as integer
+
+What:		/sys/class/power_supply/<supply_name>/signal_strength
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+Description:
+		Reports wireless signal strength.The value show degree of coupling.
+		Unit is KHZ,the "value" means the working frequency of receiver
+		chip of wireless charging.
+
+		Access: Read-Only
+		Valid values: Reported as integer
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 2de9a4c93723..397fb8e96b03 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
#10 lore raw

PATCH v2 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 f10780be2732..f4234ba1684a 100644
@@ -740,3 +740,15 @@ Description:
 
 		Access: Read-Only
 		Valid values: Reported as integer
+
+What:		/sys/class/power_supply/<supply_name>/reverse_chg_mode
+Date:		Jul 2020
+Contact:	Fei Jiang <[email protected]>
+Description:
+		The property supply interface to control wireless
+		reverse charge mode.
+
+		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 397fb8e96b03..319bf6456867 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
#11 lore raw

PATCH v2 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 | 20 ++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  2 ++
 include/linux/power_supply.h                |  2 ++
 3 files changed, 24 insertions(+)
Documentation/ABI/testing/sysfs-class-power +20 -0
index f4234ba1684a..bcc8ccad8163 100644
@@ -349,6 +349,26 @@ 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.
+		soc_decimal is the start decimal part of battery soc.
+
+		Access: Read
+		Valid values: 0 - 100
+
+What:		/sys/class/power_supply/<supply_name>/soc_decimal_rate,
+Date:		Jul 2020
+Contact:	[email protected]
+Description:
+		Broadcast battery soc with decimal form.
+		soc_decimal_rate is the decimal part of battery soc update freqency.
+
+		Access: Read
+		Valid values: 0 - 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 319bf6456867..d1aa5497938e 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
#12 lore raw

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

Quoted 24 lines · Qiwu Huang

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 | 20 ++++++++++++++++++++
 drivers/power/supply/power_supply_sysfs.c   |  2 ++
 include/linux/power_supply.h                |  2 ++
 3 files changed, 24 insertions(+)
Documentation/ABI/testing/sysfs-class-power +0 -0
index f4234ba1684a..bcc8ccad8163 100644
@@ -349,6 +349,26 @@ Description:
 		Access: Read
 		Valid values: Represented in microvolts

Documentation/ABI/testing/sysfs-class-power Description: · line 360

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-power +9 -0
 
+What:		/sys/class/power_supply/<supply_name>/soc_decimal,
+Date:		Jul 2020
+Contact:	[email protected]
+Description:
+		Broadcast battery soc with decimal form.
+		soc_decimal is the start decimal part of battery soc.
+
+		Access: Read
+		Valid values: 0 - 100

How can "100" be a valid decimal form here if this is a percent?

Documentation/ABI/testing/sysfs-class-power Description: · line 370

Quoted 10 lines
Documentation/ABI/testing/sysfs-class-power +10 -0
+
+What:		/sys/class/power_supply/<supply_name>/soc_decimal_rate,
+Date:		Jul 2020
+Contact:	[email protected]
+Description:
+		Broadcast battery soc with decimal form.
+		soc_decimal_rate is the decimal part of battery soc update freqency.
+
+		Access: Read
+		Valid values: 0 - 100

I think you need to document this a lot better as I still don't really understand what this is for or how to use it or report it.

And what does "soc" mean here?

thanks,

greg k-h