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: [PATCHv2] bq27x00_battery: Add support for BQ27425 chip
Date: Fri, 22 Jun 2012 09:10:47 +0200 [thread overview]
Message-ID: <4FE41A77.40103@metafoo.de> (raw)
In-Reply-To: <1340035678-2195-1-git-send-email-saranya.gopal@intel.com>
On 06/18/2012 06:07 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 v1:
> Remove the additional Kconfig entry
> Add a second power_supply_property array for bq27425
> and assign the appropriate array at run-time based
> on battery type.
> Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
Looks mostly good. Two comments inline.
> ---
> drivers/power/bq27x00_battery.c | 99 +++++++++++++++++++++++++++++++--------
> 1 files changed, 79 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
> index f5d6d37..58775ea 100644
> --- a/drivers/power/bq27x00_battery.c
> +++ b/drivers/power/bq27x00_battery.c
> @@ -22,6 +22,7 @@
> * Datasheets:
> * http://focus.ti.com/docs/prod/folders/print/bq27000.html
> * http://focus.ti.com/docs/prod/folders/print/bq27500.html
> + * http://www.ti.com/product/bq27425-g1
> */
>
> #include <linux/module.h>
> @@ -67,6 +68,14 @@
> #define BQ27500_FLAG_SOC1 BIT(2) /* State-of-Charge threshold 1 */
> #define BQ27500_FLAG_FC BIT(9)
>
> +#define BQ27425_REG_TEMP 0x02
> +#define BQ27425_REG_VOLT 0x04
> +#define BQ27425_REG_FLAGS 0x06
> +#define BQ27425_REG_NAC 0x08
> +#define BQ27425_REG_FCC 0x0E
> +#define BQ27425_REG_AI 0x10
> +#define BQ27425_REG_SOC 0x1C
It looks as if all these register addresses (with the exception of REG_SOC)
are the same as the BQ27X00 register address minus 4.
What do you think about applying this offset in bq27x00_read? This would
safe us a lot of these
if (di->chip == BQ27425)
curr = bq27x00_read(di, BQ27425_REG_..., false);
else
curr = bq27x00_read(di, BQ27x00_REG_..., false);
> [...]
>
> - if (di->chip == BQ27500)
> + if (di->chip == BQ27500 || di->chip == BQ27425)
Maybe it makes sense to put this check in a small helper function, this will
make it less noisy to add another chip with a similar register layout.
> [...]
prev parent reply other threads:[~2012-06-22 7:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 16:07 [PATCHv2] bq27x00_battery: Add support for BQ27425 chip Saranya Gopal
2012-06-22 7:10 ` 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=4FE41A77.40103@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.