diff mbox series

[v2,1/5] power: supply: core: add quick charge type property

Message ID 38b7b1dc10cf608faceae923374791a52a450919.1594612572.git.huangqiwu@xiaomi.com (mailing list archive)
State Not Applicable, archived
Headers show
Series [v2,1/5] power: supply: core: add quick charge type property | expand

Commit Message

Qiwu Huang July 13, 2020, 4:03 a.m. UTC
From: Qiwu Huang <huangqiwu@xiaomi.com>

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

Signed-off-by: Qiwu Huang <huangqiwu@xiaomi.com>
---
 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(+)

Comments

Greg Kroah-Hartman July 13, 2020, 8:41 a.m. UTC | #1
On Mon, Jul 13, 2020 at 12:03:36PM +0800, Qiwu Huang wrote:
> From: Qiwu Huang <huangqiwu@xiaomi.com>
> 
> Reports the kind of quick charge type based on
> different adapter power. UI will show different
> animation effect for different quick charge type.
> 
> Signed-off-by: Qiwu Huang <huangqiwu@xiaomi.com>
> ---
>  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?


> 
> diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power
> index 216d61a22f1e..d3169d47e359 100644
> --- a/Documentation/ABI/testing/sysfs-class-power
> +++ b/Documentation/ABI/testing/sysfs-class-power
> @@ -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 <jiangfei1@xiaomi.com>
> +		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
Greg Kroah-Hartman July 14, 2020, 7:37 a.m. UTC | #2
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

On Tue, Jul 14, 2020 at 03:31:52PM +0800, ivan wrote:
> I think we should add an enumederated for this

What is "this"?

> 
> for example
> 
> abi document
> 
> What: /sys/class/power_supply/<supply_name>/quick_charge_type
> Date: Jul 2020
> Contact: Fei Jiang <jiangfei1@xiaomi.com>
> 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
> 
> 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
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-class-power b/Documentation/ABI/testing/sysfs-class-power
index 216d61a22f1e..d3169d47e359 100644
--- a/Documentation/ABI/testing/sysfs-class-power
+++ b/Documentation/ABI/testing/sysfs-class-power
@@ -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 <jiangfei1@xiaomi.com>
+		Description:
+		Reports the kind of quick charge type based on different adapter power.
+
+		Access: Read-Only
+		Valid values: Reported as integer
+
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c
index bc79560229b5..9554d7907373 100644
--- a/drivers/power/supply/power_supply_sysfs.c
+++ b/drivers/power/supply/power_supply_sysfs.c
@@ -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 *
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index ac1345a48ad0..3fe7e9ef2f0f 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -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 {