add MAX17040 Fuel Gauge driver
PATCH v3 1/1 add MAX17040 Fuel Gauge driver
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
--- drivers/power/Kconfig | 8 + drivers/power/Makefile | 3 +- drivers/power/max17040_battery.c | 306 ++++++++++++++++++++++++++++++++++++++ include/linux/max17040_battery.h | 19 +++ 4 files changed, 335 insertions(+), 1 deletions(-) create mode 100644 drivers/power/max17040_battery.c create mode 100644 include/linux/max17040_battery.h
drivers/power/Kconfig +8 -0
@@ -88,4 +88,12 @@ config CHARGER_PCF50633 help Say Y to include support for NXP PCF50633 Main Battery Charger. +config BATTERY_MAX17040 + tristate "Maxim MAX17040 Fuel Gauge" + depends on I2C + help + MAX17040 is fuel-gauge systems for lithium-ion (Li+) batteries + in handheld and portable equipment. The MAX17040 is configured + to operate with a single lithium cell + endif # POWER_SUPPLY
drivers/power/Makefile +2 -1
@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o -obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.o +obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o
drivers/power/max17040_battery.c new file +306 -0
306 lines not on this page · raw message
include/linux/max17040_battery.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (C) 2009 Samsung Electronics +* Minkyu Kang <[email protected]> +* +* This program 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. +*/ + +#ifndef __MAX17040_BATTERY_H_ +#define __MAX17040_BATTERY_H_ + +struct max17040_platform_data { +int (*battery_online)(void ); +int (*charger_online)(void ); +int (*charger_enable)(void ); +}; + +#endif
Signature · 1 line
1.5.4.3
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 12 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +0
-0@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.oobj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
drivers/power/Makefile +1
-1-obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.o
Are we following any alphabetical order in this Makefile?
Quoted 7 lines
drivers/power/Makefile +7
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0;
drivers/power/Makefile
Quoted 10 lines
drivers/power/Makefile +10
-0+} + +static int max17040_resume(struct i2c_client *client) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +
Please add #ifdef CONFIG_PM around suspend resume functions.
Signature · 3 lines
---Trilok Soni http://triloksoni.wordpress.com http://www.linkedin.com/in/triloksoni
Dear Trilok Soni,
Thanks for review
Quoted 9 lines
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
Quoted 15 lines
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 12 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +1
-1@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o -obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.oAre we following any alphabetical order in this
Makefile?
I'm not sure either. :(
I just grouping with batteries.
Quoted 11 lines
Quoted 11 lines
drivers/power/Makefile +11
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0; +} + +static int max17040_resume(struct i2c_client *client) +{
Quoted 9 lines
drivers/power/Makefile
Quoted 6 lines
drivers/power/Makefile +6
-0+ struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +Please add #ifdef
CONFIG_PMaround suspend resume functions.
Ok, I will.
Thanks
---
from, prom.
Quoted 13 lines · Minkyu Kang
Dear Trilok Soni,
Thanks for review
Quoted 9 lines
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +0
-1--- a/drivers/power/MakefileQuoted 8 lines
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 8 lines
+++ b/drivers/power/Makefile
drivers/power/Makefile +1
-1@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o -obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.o
There is a typo: "))" should be just ")". I fixed this.
I also fixed "‘max17040_set_rcomp’ defined but not used" warning (just removed this function).
Quoted 5 lines
Quoted 2 lines
Are we following any alphabetical order in this
Makefile?I'm not sure either. :(
I just grouping with batteries.
It's fine as is. I always wonder when somebody try to sort things alphabetically. Humans should not bother with sorting, that's what computers are for! ;-)
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
drivers/power/Makefile +11
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0; +} + +static int max17040_resume(struct i2c_client *client) +{Quoted 9 lines
drivers/power/Makefile
Quoted 6 lines
drivers/power/Makefile +6
-0+ struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +Please add #ifdef
CONFIG_PMaround suspend resume functions.
Quoted 1 line
Ok, I will.
Just did it myself, and queued this patch for 2.6.31.
Thanks!
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
Dear, Anton Vorontsov
2009/6/9 Anton Vorontsov <[email protected]>:
Quoted 29 lines · Minkyu Kang
Quoted 13 lines
Dear Trilok Soni,
Thanks for review
Quoted 9 lines
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +0
-1--- a/drivers/power/MakefileQuoted 8 lines
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 8 lines
+++ b/drivers/power/Makefile
drivers/power/Makefile +0
-0@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.oobj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
drivers/power/Makefile +1
-1-obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.oThere is a typo: "))" should be just ")". I fixed this.
Quoted 2 lines
I also fixed "‘max17040_set_rcomp’ defined but not used" warning (just removed this function).
I missed it. thanks.
Quoted 31 lines
Quoted 5 lines
Quoted 2 lines
Are we following any alphabetical order in this
Makefile?I'm not sure either. :(
I just grouping with batteries.It's fine as is. I always wonder when somebody try to sort things alphabetically. Humans should not bother with sorting, that's what computers are for! ;-)
Quoted 21 lines
Quoted 20 lines
Quoted 7 lines
drivers/power/Makefile +7
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0;drivers/power/Makefile
Quoted 10 lines
drivers/power/Makefile +10
-0+} + +static int max17040_resume(struct i2c_client *client) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +Please add #ifdef
CONFIG_PMaround suspend resume functions.
Quoted 6 lines
Quoted 1 line
Ok, I will.
Just did it myself, and queued this patch for 2.6.31.
Thanks!
Ok, I appreciate your help.
Many Thanks :)
Signature · 2 lines
from. prom. promsoft.net
Dear, Anton Vorontsov
2009/6/9 Anton Vorontsov <[email protected]>:
Quoted 29 lines · Minkyu Kang
Quoted 13 lines
Dear Trilok Soni,
Thanks for review
Quoted 9 lines
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +0
-1--- a/drivers/power/MakefileQuoted 8 lines
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 8 lines
+++ b/drivers/power/Makefile
drivers/power/Makefile +0
-0@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.oobj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
drivers/power/Makefile +1
-1-obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.oThere is a typo: "))" should be just ")". I fixed this.
Quoted 2 lines
I also fixed "‘max17040_set_rcomp’ defined but not used" warning (just removed this function).
I missed it. thanks.
Quoted 31 lines
Quoted 5 lines
Quoted 2 lines
Are we following any alphabetical order in this
Makefile?I'm not sure either. :(
I just grouping with batteries.It's fine as is. I always wonder when somebody try to sort things alphabetically. Humans should not bother with sorting, that's what computers are for! ;-)
Quoted 21 lines
Quoted 20 lines
Quoted 7 lines
drivers/power/Makefile +7
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0;drivers/power/Makefile
Quoted 10 lines
drivers/power/Makefile +10
-0+} + +static int max17040_resume(struct i2c_client *client) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +Please add #ifdef
CONFIG_PMaround suspend resume functions.
Quoted 6 lines
Quoted 1 line
Ok, I will.
Just did it myself, and queued this patch for 2.6.31.
Thanks!
Ok, I appreciate your help.
Many Thanks :)
Signature · 2 lines
from. prom. promsoft.net
Quoted 13 lines · Minkyu Kang
Dear Trilok Soni,
Thanks for review
Quoted 9 lines
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +0
-1--- a/drivers/power/MakefileQuoted 8 lines
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 8 lines
+++ b/drivers/power/Makefile
drivers/power/Makefile +1
-1@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o -obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.o
There is a typo: "))" should be just ")". I fixed this.
I also fixed "‘max17040_set_rcomp’ defined but not used" warning (just removed this function).
Quoted 5 lines
Quoted 2 lines
Are we following any alphabetical order in this
Makefile?I'm not sure either. :(
I just grouping with batteries.
It's fine as is. I always wonder when somebody try to sort things alphabetically. Humans should not bother with sorting, that's what computers are for! ;-)
Quoted 21 lines
Quoted 11 lines
Quoted 11 lines
drivers/power/Makefile +11
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0; +} + +static int max17040_resume(struct i2c_client *client) +{Quoted 9 lines
drivers/power/Makefile
Quoted 6 lines
drivers/power/Makefile +6
-0+ struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +Please add #ifdef
CONFIG_PMaround suspend resume functions.
Quoted 1 line
Ok, I will.
Just did it myself, and queued this patch for 2.6.31.
Thanks!
Signature · 7 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2 _______________________________________________ linux-pm mailing list [email protected] https://lists.linux-foundation.org/mailman/listinfo/linux-pm
Dear Trilok Soni,
Thanks for review
Quoted 9 lines
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
Quoted 15 lines
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 12 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +1
-1@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o -obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.oAre we following any alphabetical order in this
Makefile?
I'm not sure either. :(
I just grouping with batteries.
Quoted 11 lines
Quoted 11 lines
drivers/power/Makefile +11
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0; +} + +static int max17040_resume(struct i2c_client *client) +{
Quoted 9 lines
drivers/power/Makefile
Quoted 6 lines
drivers/power/Makefile +6
-0+ struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +Please add #ifdef
CONFIG_PMaround suspend resume functions.
Ok, I will.
Thanks
---
from, prom.
Hi Minkyu Kang,
Quoted 3 lines · Minkyu Kang
The MAX17040 is a I2C interfaced Fuel Gauge systems for lithium-ion batteries This patch adds support the MAX17040 Fuel Gauge
Thanks for making change. Some more comments.
drivers/power/Makefile obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o · line 28
Quoted 12 lines
endif #
POWER_SUPPLYdrivers/power/Makefile +0
-0@@ -25,4 +25,5 @@ obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.oobj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
drivers/power/Makefile +1
-1-obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o +obj-$(CONFIG_BATTERY_MAX17040)) += max17040_battery.o
Are we following any alphabetical order in this Makefile?
Quoted 7 lines
drivers/power/Makefile +7
-0+static int max17040_suspend(struct i2c_client *client, + pm_message_t state) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + cancel_delayed_work(&chip->work); + return 0;
drivers/power/Makefile
Quoted 10 lines
drivers/power/Makefile +10
-0+} + +static int max17040_resume(struct i2c_client *client) +{ + struct max17040_chip *chip = i2c_get_clientdata(client); + + schedule_delayed_work(&chip->work, MAX17040_DELAY); + return 0; +} +
Please add #ifdef CONFIG_PM around suspend resume functions.
Signature · 3 lines
---Trilok Soni http://triloksoni.wordpress.com http://www.linkedin.com/in/triloksoni