linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali.rohar@gmail.com>
To: Liu Xiang <liu.xiang6@zte.com.cn>
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	sre@kernel.org, afd@ti.com
Subject: Re: [PATCH] power: supply: bq27xxx: Add bq27411 support
Date: Tue, 30 Jan 2018 19:52:37 +0100	[thread overview]
Message-ID: <20180130185237.mguuclb4t5th7fcq@pali> (raw)
In-Reply-To: <1517063136-23210-1-git-send-email-liu.xiang6@zte.com.cn>

[-- 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 --]

      reply	other threads:[~2018-01-30 18:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-27 14:25 [PATCH] power: supply: bq27xxx: Add bq27411 support Liu Xiang
2018-01-30 18:52 ` Pali Rohár [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180130185237.mguuclb4t5th7fcq@pali \
    --to=pali.rohar@gmail.com \
    --cc=afd@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=liu.xiang6@zte.com.cn \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).