RE: [RFC/PATCH] BQ27000/BQ27200 battery monitoring driver for OMAP34xx

2008-04-29 Thread Madhusudhan Chikkature Rajashekar
 

 -Original Message-
 From: Felipe Balbi [mailto:[EMAIL PROTECTED] 
 Sent: Monday, April 28, 2008 5:17 PM
 To: Madhusudhan Chikkature Rajashekar
 Cc: Tony Lindgren; linux-omap@vger.kernel.org
 Subject: RE: [RFC/PATCH] BQ27000/BQ27200 battery monitoring 
 driver for OMAP34xx
 
 
 
 On Mon, 28 Apr 2008 17:11:51 +0530, Madhusudhan Chikkature 
 Rajashekar
 [EMAIL PROTECTED] wrote:
  Hi Felipe,
  
  Thanks for the comments. I will fix them and resend the patch.
  
  Please note my view on the below point.
  
   -pdev = platform_device_alloc(omap-bq2700-battery, id);
   +pdev = platform_device_alloc(bq27000-bat, id);
 
  do you really need to change the name here?
  It seems that this change doesn't belong to this patch.
  
  I will make this as a separate patch.As BQ27000 chip is not omap
 specific,
  I guess the above name is not correct. Hence I intend to make that
 change.
 
 Ok, works for me :-)
 
 I guess bq2700-battery is ok, just remove omap- from the 
 previous name??
Yes. I will correct the name and resend the patch. I will send this one as a 
separate patch and followed by it will
be the battery driver patch.

 
 
 -- 
 Best Regards,
 
 Felipe Balbi
 http://felipebalbi.com
 [EMAIL PROTECTED]
 
 

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [RFC/PATCH] BQ27000/BQ27200 battery monitoring driver for OMAP34xx

2008-04-28 Thread Felipe Balbi


On Mon, 28 Apr 2008 17:11:51 +0530, Madhusudhan Chikkature Rajashekar
[EMAIL PROTECTED] wrote:
 Hi Felipe,
 
 Thanks for the comments. I will fix them and resend the patch.
 
 Please note my view on the below point.
 
  -  pdev = platform_device_alloc(omap-bq2700-battery, id);
  +  pdev = platform_device_alloc(bq27000-bat, id);

 do you really need to change the name here?
 It seems that this change doesn't belong to this patch.
 
 I will make this as a separate patch.As BQ27000 chip is not omap
specific,
 I guess the above name is not correct. Hence I intend to make that
change.

Ok, works for me :-)

I guess bq2700-battery is ok, just remove omap- from the previous name??


-- 
Best Regards,

Felipe Balbi
http://felipebalbi.com
[EMAIL PROTECTED]

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC/PATCH] BQ27000/BQ27200 battery monitoring driver for OMAP34xx

2008-04-25 Thread Felipe Balbi
Some cosmetic comments below



On Fri, 25 Apr 2008 15:01:34 +0530, Madhusudhan Chikkature Rajashekar
[EMAIL PROTECTED] wrote:
 This patch provides the battery monitoring driver to monitor batteries
with
 BQ27000(HDQ) or BQ27200(i2C) chips.
 On omap 3430 sdp BQ27000 battery is tested through the HDQ interface
which
 uses the earlier posted HDQ and BQ slave drivers.
 The BQ27200 support is an extension to the BQ27000 driver as the register
 set between BQ27000 and BQ27200 is the same.
 
 Thanks to Klaus.K Pedersen and Mikko Ylinen for the suggestions to add
 support for BQ27200 chip as part of
 this driver.
 
 
 Signed-off-by: Madhusudhan Chikkature[EMAIL PROTECTED]
 
 ---
  drivers/power/Kconfig   |   21 +
  drivers/power/Makefile  |1
  drivers/power/bq27x00_battery.c |  556
 
  drivers/w1/slaves/w1_bq27000.c  |2
  4 files changed, 579 insertions(+), 1 deletion(-)
 
 Index: linux-omap-2.6/drivers/power/bq27x00_battery.c
 ===
 --- /dev/null 1970-01-01 00:00:00.0 +
 +++ linux-omap-2.6/drivers/power/bq27x00_battery.c2008-04-24
 10:50:53.631358952 +0530
 @@ -0,0 +1,556 @@
 +/*
 + * linux/drivers/power/bq27x00_battery.c
 + *
 + * BQ27000/BQ27200 battery driver
 + *
 + * Copyright (C) 2008 Texas Instruments, Inc.
 + *
 + * Author: Texas Instruments
 + *
 + * This package is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + *
 + * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
 + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
 + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 + *
 + */
 +#include linux/module.h
 +#include linux/param.h
 +#include linux/jiffies.h
 +#include linux/workqueue.h
 +#include linux/delay.h
 +#include linux/platform_device.h
 +#include linux/power_supply.h
 +
 +#if defined(CONFIG_BATTERY_BQ27000)

Here use ifdef

 +#define BATTERY_BQ27000

there's no need to add this one as you can use the Kconfig option

 +#include ../w1/w1.h
 +#endif
 +#if defined(CONFIG_BATTERY_BQ27200)
 +#define BATTERY_BQ27200
 +#include linux/i2c.h
 +#endif
 +
 +#define BQ27x00_REG_TEMP 0x06
 +#define BQ27x00_REG_VOLT 0x08
 +#define BQ27x00_REG_RSOC 0x0B /* Relative State-of-Charge */
 +#define BQ27x00_REG_AI   0x14
 +#define BQ27x00_REG_FLAGS0x0A
 +#define HIGH_BYTE(A) ((A)  8)
 +
 +#if defined(BATTERY_BQ27000)
 +extern int w1_bq27000_read(struct device *dev, u8 reg);
 +#endif
 +
 +struct bq27x00_device_info;
 +struct bq27x00_access_methods {
 + int (*read)(u8 reg, int *rt_value, int b_single,
 + struct bq27x00_device_info *di);
 +};
 +
 +struct bq27x00_device_info {
 + struct device   *dev;
 +#if defined(BATTERY_BQ27000)

#ifdef CONFIG_BATERRY_BQ27000

 + struct device   *w1_dev;
 +#endif
 +#if defined(BATTERY_BQ27200)

#ifdef CONFIG_BATTERY_BQ27200

 + struct i2c_client *client;
 +#endif
 + unsigned long   update_time;
 + int voltage_uV;
 + int current_uA;
 + int temp_C;
 + int charge_rsoc;
 + struct bq27x00_access_methods   *bus;
 + struct power_supply bat;
 + struct delayed_work monitor_work;
 +};
 +
 +static unsigned int cache_time = 6;
 +module_param(cache_time, uint, 0644);
 +MODULE_PARM_DESC(cache_time, cache time in milliseconds);
 +
 +static enum power_supply_property bq27x00_battery_props[] = {
 + POWER_SUPPLY_PROP_PRESENT,
 + POWER_SUPPLY_PROP_VOLTAGE_NOW,
 + POWER_SUPPLY_PROP_CURRENT_NOW,
 + POWER_SUPPLY_PROP_CHARGE_NOW,
 + POWER_SUPPLY_PROP_CAPACITY,
 + POWER_SUPPLY_PROP_TEMP,
 +};
 +
 +static int bq27x00_read(u8 reg, int *rt_value, int b_single,
 + struct bq27x00_device_info *di);
 +
 +#if defined(BATTERY_BQ27000)
 +static int bq27000_battery_probe(struct platform_device *dev);
 +static int bq27000_battery_remove(struct platform_device *dev);
 +#ifdef CONFIG_PM
 +static int bq27000_battery_suspend(struct platform_device *dev,
 + pm_message_t state);
 +static int bq27000_battery_resume(struct platform_device *dev);
 +#endif
 +
 +static struct platform_driver bq27000_battery_driver = {
 + .probe = bq27000_battery_probe,
 + .remove = bq27000_battery_remove,
 +#ifdef CONFIG_PM
 + .suspend = bq27000_battery_suspend,
 + .resume = bq27000_battery_resume,
 +#endif
 + .driver = {
 + .name = bq27000-bat,
 + },
 +};
 +#endif
 +
 +#if defined(BATTERY_BQ27200)
 +static int bq27200_battery_probe(struct i2c_client *client);
 +static int bq27200_battery_remove(struct i2c_client *client);
 +static int bq27200_battery_suspend(struct i2c_client *client,
 +