linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] power: supply: bq27xxx: Add bq27411 support
@ 2018-01-27 14:25 Liu Xiang
  2018-01-30 18:52 ` Pali Rohár
  0 siblings, 1 reply; 2+ messages in thread
From: Liu Xiang @ 2018-01-27 14:25 UTC (permalink / raw)
  To: linux-pm; +Cc: linux-kernel, sre, pali.rohar, afd, Liu Xiang

According to the datasheet, bq27411 is similar to bq27421.

Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn>
---
 drivers/power/supply/bq27xxx_battery.c | 14 ++++++++++++++
 include/linux/power/bq27xxx_battery.h  |  3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
index 51f0961..2de378a 100644
--- a/drivers/power/supply/bq27xxx_battery.c
+++ b/drivers/power/supply/bq27xxx_battery.c
@@ -410,6 +410,7 @@ enum bq27xxx_reg_index {
 #define bq27425_regs bq27421_regs
 #define bq27441_regs bq27421_regs
 #define bq27621_regs bq27421_regs
+#define bq27411_regs bq27421_regs
 
 static enum power_supply_property bq27000_props[] = {
 	POWER_SUPPLY_PROP_STATUS,
@@ -633,6 +634,7 @@ enum bq27xxx_reg_index {
 #define bq27425_props bq27421_props
 #define bq27441_props bq27421_props
 #define bq27621_props bq27421_props
+#define bq27411_props bq27421_props
 
 struct bq27xxx_dm_reg {
 	u8 subclass_id;
@@ -716,6 +718,17 @@ enum bq27xxx_dm_reg_id {
 #define bq27621_dm_regs 0
 #endif
 
+#if 0 /* not yet tested */
+static struct bq27xxx_dm_reg bq27411_dm_regs[] = {
+	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 82, 10, 2,    0, 32767 },
+	[BQ27XXX_DM_DESIGN_ENERGY]     = { 82, 12, 2,    0, 32767 },
+	[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2800,  3700 },
+};
+#else
+#define bq27411_dm_regs 0
+#endif
+
+
 #define BQ27XXX_O_ZERO	0x00000001
 #define BQ27XXX_O_OTDC	0x00000002
 #define BQ27XXX_O_UTOT  0x00000004
@@ -762,6 +775,7 @@ enum bq27xxx_dm_reg_id {
 	[BQ27425]   = BQ27XXX_DATA(bq27425,   0x04143672, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP),
 	[BQ27441]   = BQ27XXX_DATA(bq27441,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
 	[BQ27621]   = BQ27XXX_DATA(bq27621,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
+	[BQ27411]   = BQ27XXX_DATA(bq27411,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
 };
 
 static DEFINE_MUTEX(bq27xxx_list_lock);
diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
index e6187f5..5f48eb0 100644
--- a/include/linux/power/bq27xxx_battery.h
+++ b/include/linux/power/bq27xxx_battery.h
@@ -23,10 +23,11 @@ enum bq27xxx_chip {
 	BQ27546,
 	BQ27742,
 	BQ27545, /* bq27545 */
-	BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
+	BQ27421, /* bq27421, bq27425, bq27441, bq27621, bq27411 */
 	BQ27425,
 	BQ27441,
 	BQ27621,
+	BQ27411,
 };
 
 struct bq27xxx_device_info;
-- 
1.9.1

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

* Re: [PATCH] power: supply: bq27xxx: Add bq27411 support
  2018-01-27 14:25 [PATCH] power: supply: bq27xxx: Add bq27411 support Liu Xiang
@ 2018-01-30 18:52 ` Pali Rohár
  0 siblings, 0 replies; 2+ messages in thread
From: Pali Rohár @ 2018-01-30 18:52 UTC (permalink / raw)
  To: Liu Xiang; +Cc: linux-pm, linux-kernel, sre, afd

[-- Attachment #1: Type: text/plain, Size: 2885 bytes --]

On Saturday 27 January 2018 22:25:36 Liu Xiang wrote:
> According to the datasheet, bq27411 is similar to bq27421.
> 
> Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn>
> ---
>  drivers/power/supply/bq27xxx_battery.c | 14 ++++++++++++++
>  include/linux/power/bq27xxx_battery.h  |  3 ++-
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index 51f0961..2de378a 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -410,6 +410,7 @@ enum bq27xxx_reg_index {
>  #define bq27425_regs bq27421_regs
>  #define bq27441_regs bq27421_regs
>  #define bq27621_regs bq27421_regs
> +#define bq27411_regs bq27421_regs
>  
>  static enum power_supply_property bq27000_props[] = {
>  	POWER_SUPPLY_PROP_STATUS,
> @@ -633,6 +634,7 @@ enum bq27xxx_reg_index {
>  #define bq27425_props bq27421_props
>  #define bq27441_props bq27421_props
>  #define bq27621_props bq27421_props
> +#define bq27411_props bq27421_props
>  
>  struct bq27xxx_dm_reg {
>  	u8 subclass_id;
> @@ -716,6 +718,17 @@ enum bq27xxx_dm_reg_id {
>  #define bq27621_dm_regs 0
>  #endif
>  
> +#if 0 /* not yet tested */
> +static struct bq27xxx_dm_reg bq27411_dm_regs[] = {
> +	[BQ27XXX_DM_DESIGN_CAPACITY]   = { 82, 10, 2,    0, 32767 },
> +	[BQ27XXX_DM_DESIGN_ENERGY]     = { 82, 12, 2,    0, 32767 },
> +	[BQ27XXX_DM_TERMINATE_VOLTAGE] = { 82, 16, 2, 2800,  3700 },
> +};
> +#else
> +#define bq27411_dm_regs 0
> +#endif

Can you test it?

I do not think it is a good idea to add dead code into mainline kernel.

> +
> +
>  #define BQ27XXX_O_ZERO	0x00000001
>  #define BQ27XXX_O_OTDC	0x00000002
>  #define BQ27XXX_O_UTOT  0x00000004
> @@ -762,6 +775,7 @@ enum bq27xxx_dm_reg_id {
>  	[BQ27425]   = BQ27XXX_DATA(bq27425,   0x04143672, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP),
>  	[BQ27441]   = BQ27XXX_DATA(bq27441,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
>  	[BQ27621]   = BQ27XXX_DATA(bq27621,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
> +	[BQ27411]   = BQ27XXX_DATA(bq27411,   0x80008000, BQ27XXX_O_UTOT | BQ27XXX_O_CFGUP | BQ27XXX_O_RAM),
>  };
>  
>  static DEFINE_MUTEX(bq27xxx_list_lock);
> diff --git a/include/linux/power/bq27xxx_battery.h b/include/linux/power/bq27xxx_battery.h
> index e6187f5..5f48eb0 100644
> --- a/include/linux/power/bq27xxx_battery.h
> +++ b/include/linux/power/bq27xxx_battery.h
> @@ -23,10 +23,11 @@ enum bq27xxx_chip {
>  	BQ27546,
>  	BQ27742,
>  	BQ27545, /* bq27545 */
> -	BQ27421, /* bq27421, bq27425, bq27441, bq27621 */
> +	BQ27421, /* bq27421, bq27425, bq27441, bq27621, bq27411 */
>  	BQ27425,
>  	BQ27441,
>  	BQ27621,
> +	BQ27411,
>  };
>  
>  struct bq27xxx_device_info;

-- 
Pali Rohár
pali.rohar@gmail.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-27 14:25 [PATCH] power: supply: bq27xxx: Add bq27411 support Liu Xiang
2018-01-30 18:52 ` Pali Rohár

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).