public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Saranya Gopal <saranya.gopal@intel.com>
Cc: cbou@mail.ru, dwmw2@infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCHv3] bq27x00_battery: Add support for BQ27425 chip
Date: Mon, 02 Jul 2012 18:03:50 +0200	[thread overview]
Message-ID: <4FF1C666.40106@metafoo.de> (raw)
In-Reply-To: <1341075374-31704-1-git-send-email-saranya.gopal@intel.com>

On 06/30/2012 06:56 PM, Saranya Gopal wrote:
> This patch adds support for BQ27425 (TI) chip. This chip is same as
> BQ27500 with few registers removed and register address map changed.
> The data sheet for this chip is publicly available at
>  http://www.ti.com/product/bq27425-g1
> 
> Changes since v2:
>         Remove register address definitions of bq27425 and
>           use register address offset instead.
>         Add a small helper function to decide if the chip version
>           is higher than bq27200 to make it less noisy
>           to add another chip with similar register layout.
> 
> Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>

Looks good to me.

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>

Two minor suggestions though:

>[...]
>  
>  #include <linux/module.h>
> @@ -67,6 +68,10 @@
>  #define BQ27500_FLAG_SOC1		BIT(2) /* State-of-Charge threshold 1 */
>  #define BQ27500_FLAG_FC			BIT(9)
>  
> +/* bq27425 register addresses are same as bq27x00 addresses minus 4 */
> +#define BQ27425_REG_OFFSET		0x04
> +#define BQ27425_REG_SOC			0x1C
> +

I'd have added the offset to REG_SOC here, ...

> @@ -150,6 +183,9 @@ static int bq27x00_battery_read_rsoc(struct
bq27x00_device_info *di)
>
>  	if (di->chip == BQ27500)
>  		rsoc = bq27x00_read(di, BQ27500_REG_SOC, false);
> +	else if (di->chip == BQ27425)
> +		rsoc = bq27x00_read(di, BQ27425_REG_SOC+BQ27425_REG_OFFSET,
> +								false);

... instead of here.

>  /*
> + * Higher versions of the chip like BQ27425 and BQ27500
> + * differ from BQ27000 and BQ27200 in calculation of certain
> + * parameters. Hence we need to check for the chip type.
> + */
> +static bool is_chip_version_higher(struct bq27x00_device_info *di)

Maybe a prefix for the function is not such a bad idea, e.g. bq27xxx_...

> +{
> +	if (di->chip == BQ27425 || di->chip == BQ27500)
> +		return true;
> +	return false;
> +}
> +

      reply	other threads:[~2012-07-02 16:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-30 16:56 [PATCHv3] bq27x00_battery: Add support for BQ27425 chip Saranya Gopal
2012-07-02 16:03 ` Lars-Peter Clausen [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=4FF1C666.40106@metafoo.de \
    --to=lars@metafoo.de \
    --cc=cbou@mail.ru \
    --cc=dwmw2@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=saranya.gopal@intel.com \
    /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