mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] extcon: Add EXTCON_BATTERY type for battery presence
@ 2023-01-10  2:36 andrew lien/WHQ/Wistron
  2023-01-10 13:39 ` Chanwoo Choi
  0 siblings, 1 reply; 4+ messages in thread
From: andrew lien/WHQ/Wistron @ 2023-01-10  2:36 UTC (permalink / raw)
  To: myungjoo.ham; +Cc: cw00.choi, linux-kernel, andrew lien/WHQ/Wistron

This information can be useful to device that support battery swap,
for example allowing them to indicate that a battery is present or not,
so provide a standard way to report it to userspace.

Signed-off-by: andrew lien/WHQ/Wistron <andrew_lien@wistron.com>
---
 drivers/extcon/extcon.c | 5 +++++
 include/linux/extcon.h  | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
index b4df4372f097..6c47d23244c3 100644
--- a/drivers/extcon/extcon.c
+++ b/drivers/extcon/extcon.c
@@ -184,6 +184,11 @@ static const struct __extcon_info {
 		.id = EXTCON_MECHANICAL,
 		.name = "MECHANICAL",
 	},
+	[EXTCON_BATTERY] = {
+		.type = EXTCON_TYPE_MISC,
+		.id = EXTCON_BATTERY,
+		.name = "BATTERY",
+	},
 
 	{ /* sentinel */ }
 };
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index b0b4abb018ee..88210b481b6c 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -81,8 +81,9 @@
 #define EXTCON_DOCK		60
 #define EXTCON_JIG		61
 #define EXTCON_MECHANICAL	62
+#define EXTCON_BATTERY		63
 
-#define EXTCON_NUM		63
+#define EXTCON_NUM		64
 
 /*
  * Define the properties of supported external connectors.
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] extcon: Add EXTCON_BATTERY type for battery presence
  2023-01-10  2:36 [PATCH] extcon: Add EXTCON_BATTERY type for battery presence andrew lien/WHQ/Wistron
@ 2023-01-10 13:39 ` Chanwoo Choi
  2023-01-11  9:00   ` Andrew Lien/WHQ/Wistron
  0 siblings, 1 reply; 4+ messages in thread
From: Chanwoo Choi @ 2023-01-10 13:39 UTC (permalink / raw)
  To: andrew lien/WHQ/Wistron, myungjoo.ham; +Cc: cw00.choi, linux-kernel

On 23. 1. 10. 11:36, andrew lien/WHQ/Wistron wrote:
> This information can be useful to device that support battery swap,
> for example allowing them to indicate that a battery is present or not,
> so provide a standard way to report it to userspace.
> 
> Signed-off-by: andrew lien/WHQ/Wistron <andrew_lien@wistron.com>
> ---
>  drivers/extcon/extcon.c | 5 +++++
>  include/linux/extcon.h  | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index b4df4372f097..6c47d23244c3 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -184,6 +184,11 @@ static const struct __extcon_info {
>  		.id = EXTCON_MECHANICAL,
>  		.name = "MECHANICAL",
>  	},
> +	[EXTCON_BATTERY] = {
> +		.type = EXTCON_TYPE_MISC,
> +		.id = EXTCON_BATTERY,
> +		.name = "BATTERY",
> +	},
>  
>  	{ /* sentinel */ }
>  };
> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
> index b0b4abb018ee..88210b481b6c 100644
> --- a/include/linux/extcon.h
> +++ b/include/linux/extcon.h
> @@ -81,8 +81,9 @@
>  #define EXTCON_DOCK		60
>  #define EXTCON_JIG		61
>  #define EXTCON_MECHANICAL	62
> +#define EXTCON_BATTERY		63
>  
> -#define EXTCON_NUM		63
> +#define EXTCON_NUM		64
>  
>  /*
>   * Define the properties of supported external connectors.

Actually, battery is not external connector. The power_supply
subsystem already provided the POWER_SUPPLY_PROP_PRESENT
for the battery present. You have to develop the power_supply device driver
and then use power_supply_changed() to send the uevent to user-space.

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] extcon: Add EXTCON_BATTERY type for battery presence
  2023-01-10 13:39 ` Chanwoo Choi
@ 2023-01-11  9:00   ` Andrew Lien/WHQ/Wistron
  2023-01-30 14:17     ` Chanwoo Choi
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lien/WHQ/Wistron @ 2023-01-11  9:00 UTC (permalink / raw)
  To: Chanwoo Choi, myungjoo.ham; +Cc: cw00.choi, linux-kernel

Sorry I didn't describe it in detail enough

we have a standalone driver to do battery detection, this driver is separate from power_supply device driver
and not just report uevet to userspace, we also need a method to notify other kernel driver "battery removal event"
it will be better if using same battery detection driver to support different platform charger driver.

by the way, swappable battery usually have 4 pin connector (power / ground / ID / THERMAL)
you can find some phone that support battery swap feature (like Samsung xcover 6 pro)

-----Original Message-----
From: Chanwoo Choi <cwchoi00@gmail.com> 
Sent: Tuesday, January 10, 2023 9:40 PM
To: Andrew Lien/WHQ/Wistron <Andrew_Lien@wistron.com>; myungjoo.ham@samsung.com
Cc: cw00.choi@samsung.com; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] extcon: Add EXTCON_BATTERY type for battery presence

On 23. 1. 10. 11:36, andrew lien/WHQ/Wistron wrote:
> This information can be useful to device that support battery swap, 
> for example allowing them to indicate that a battery is present or 
> not, so provide a standard way to report it to userspace.
> 
> Signed-off-by: andrew lien/WHQ/Wistron <andrew_lien@wistron.com>
> ---
>  drivers/extcon/extcon.c | 5 +++++
>  include/linux/extcon.h  | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 
> b4df4372f097..6c47d23244c3 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -184,6 +184,11 @@ static const struct __extcon_info {
>  		.id = EXTCON_MECHANICAL,
>  		.name = "MECHANICAL",
>  	},
> +	[EXTCON_BATTERY] = {
> +		.type = EXTCON_TYPE_MISC,
> +		.id = EXTCON_BATTERY,
> +		.name = "BATTERY",
> +	},
>  
>  	{ /* sentinel */ }
>  };
> diff --git a/include/linux/extcon.h b/include/linux/extcon.h index 
> b0b4abb018ee..88210b481b6c 100644
> --- a/include/linux/extcon.h
> +++ b/include/linux/extcon.h
> @@ -81,8 +81,9 @@
>  #define EXTCON_DOCK		60
>  #define EXTCON_JIG		61
>  #define EXTCON_MECHANICAL	62
> +#define EXTCON_BATTERY		63
>  
> -#define EXTCON_NUM		63
> +#define EXTCON_NUM		64
>  
>  /*
>   * Define the properties of supported external connectors.

Actually, battery is not external connector. The power_supply subsystem already provided the POWER_SUPPLY_PROP_PRESENT for the battery present. You have to develop the power_supply device driver and then use power_supply_changed() to send the uevent to user-space.

--
Best Regards,
Samsung Electronics
Chanwoo Choi


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] extcon: Add EXTCON_BATTERY type for battery presence
  2023-01-11  9:00   ` Andrew Lien/WHQ/Wistron
@ 2023-01-30 14:17     ` Chanwoo Choi
  0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2023-01-30 14:17 UTC (permalink / raw)
  To: Andrew Lien/WHQ/Wistron, myungjoo.ham; +Cc: cw00.choi, linux-kernel

On 23. 1. 11. 18:00, Andrew Lien/WHQ/Wistron wrote:
> Sorry I didn't describe it in detail enough
> 
> we have a standalone driver to do battery detection, this driver is separate from power_supply device driver
> and not just report uevet to userspace, we also need a method to notify other kernel driver "battery removal event"

As I commented, it is not good to detect the battery status by extcon
which only handle the external connector.
It means that you just try to use extcon subsystem to support 'publisher - subscriber'.


> it will be better if using same battery detection driver to support different platform charger driver.
> 
> by the way, swappable battery usually have 4 pin connector (power / ground / ID / THERMAL)
> you can find some phone that support battery swap feature (like Samsung xcover 6 pro)
> 
> -----Original Message-----
> From: Chanwoo Choi <cwchoi00@gmail.com> 
> Sent: Tuesday, January 10, 2023 9:40 PM
> To: Andrew Lien/WHQ/Wistron <Andrew_Lien@wistron.com>; myungjoo.ham@samsung.com
> Cc: cw00.choi@samsung.com; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] extcon: Add EXTCON_BATTERY type for battery presence
> 
> On 23. 1. 10. 11:36, andrew lien/WHQ/Wistron wrote:
>> This information can be useful to device that support battery swap, 
>> for example allowing them to indicate that a battery is present or 
>> not, so provide a standard way to report it to userspace.
>>
>> Signed-off-by: andrew lien/WHQ/Wistron <andrew_lien@wistron.com>
>> ---
>>  drivers/extcon/extcon.c | 5 +++++
>>  include/linux/extcon.h  | 3 ++-
>>  2 files changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c index 
>> b4df4372f097..6c47d23244c3 100644
>> --- a/drivers/extcon/extcon.c
>> +++ b/drivers/extcon/extcon.c
>> @@ -184,6 +184,11 @@ static const struct __extcon_info {
>>  		.id = EXTCON_MECHANICAL,
>>  		.name = "MECHANICAL",
>>  	},
>> +	[EXTCON_BATTERY] = {
>> +		.type = EXTCON_TYPE_MISC,
>> +		.id = EXTCON_BATTERY,
>> +		.name = "BATTERY",
>> +	},
>>  
>>  	{ /* sentinel */ }
>>  };
>> diff --git a/include/linux/extcon.h b/include/linux/extcon.h index 
>> b0b4abb018ee..88210b481b6c 100644
>> --- a/include/linux/extcon.h
>> +++ b/include/linux/extcon.h
>> @@ -81,8 +81,9 @@
>>  #define EXTCON_DOCK		60
>>  #define EXTCON_JIG		61
>>  #define EXTCON_MECHANICAL	62
>> +#define EXTCON_BATTERY		63
>>  
>> -#define EXTCON_NUM		63
>> +#define EXTCON_NUM		64
>>  
>>  /*
>>   * Define the properties of supported external connectors.
> 
> Actually, battery is not external connector. The power_supply subsystem already provided the POWER_SUPPLY_PROP_PRESENT for the battery present. You have to develop the power_supply device driver and then use power_supply_changed() to send the uevent to user-space.
> 
> --
> Best Regards,
> Samsung Electronics
> Chanwoo Choi
> 
> 
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------
> This email contains confidential or legally privileged information and is for the sole use of its intended recipient.
> Any unauthorized review, use, copying or distribution of this email or the content of this email is strictly prohibited.
> If you are not the intended recipient, you may reply to the sender and should delete this e-mail immediately.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------

-- 
Best Regards,
Samsung Electronics
Chanwoo Choi


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-30 14:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-10  2:36 [PATCH] extcon: Add EXTCON_BATTERY type for battery presence andrew lien/WHQ/Wistron
2023-01-10 13:39 ` Chanwoo Choi
2023-01-11  9:00   ` Andrew Lien/WHQ/Wistron
2023-01-30 14:17     ` Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®