aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/max17042_battery.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-01-04Merge branch 'power-supply-scope' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xenAnton Vorontsov1-0/+1
2011-11-26max17042_battery: Fix error handlingRamakrishna Pallala1-27/+58
In max17042_get_property(...), the values returned by max17042_read_reg are directly assigned to the variables, even if the read results in an error. This patch checks for the return code from max17042_read_reg and exits the function if there is any error. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-10-31drivers/power: Add module.h to the actual modules in drivers/powerPaul Gortmaker1-0/+1
The module.h header is no longer going to be implicitly present everywhere. So real modular users need to call out its use explicitly in advance. [v2: add new users reported by Randy Dunlap <rdunlap@xenotime.net>] Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-08-19max17042_battery: Bugfix of incorrect voltage register value interpretationMyungJoo Ham1-4/+4
The calculation had error in getting voltage values from MAX17042 registers. The least bit denotes 78.125uV (625/8). Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Philip Rakity <prakity@marvell.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-08-19max17042_battery: Do not lose accuracy calculating current_nowPhilip Rakity1-2/+1
PROP_CURRENT_NOW value is first divided then multiplied up causing a lose of accuracy. Use the same method as PROP_CURRENT_AVG to do the calculation. Signed-off-by: Philip Rakity <prakity@marvell.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-08-19max17042_battery: Divide by 0 crash because r_sns init too latePhilip Rakity1-3/+3
On MMP2 brownstone divide by 0 error since probe sets r_sns after calling power_supply_register. Move the code up a few lines. r_sns comes from the platform data. PROP_CURRENT_AVG and PROP_CURRENT divide the result by r_sns. Signed-off-by: Philip Rakity <prakity@marvell.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-07-08power_supply: MAX17042: Support additional propertiesDonggeun Kim1-68/+105
This patch supports additional properties (PRESENT, CYCLE_COUNT, VOLTAGE_MAX, VOLTAGE_MIN_DESIGN, CURRENT_NOW, CURRENT_AVG, CHARGE_FULL, and TEMP). Plus, initialization code for registers is added. Signed-off-by: Donggeun Kim <dg77.kim@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: KyungMin Park <kyungmin.park@samsung.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-07-08max17042_battery: Remove obsolete cleanup for clientdataWolfram Sang1-2/+0
A few new i2c-drivers came into the kernel which clear the clientdata-pointer on exit or error. This is obsolete meanwhile, the core will do it. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2011-01-14power_supply: Add MAX17042 Fuel Gauge DriverMyungJoo Ham1-0/+239
The MAX17042 is a fuel gauge with an I2C interface for lithium-ion betteries. Unlike its predecessor MAX17040, MAX17042 uses 16bit registers. Besides, MAX17042 has much more features than MAX17040; e.g., a thermistor, current and current accumulation measurement, battery internal resistance estimate, average values of measurement, and others. This patch implements a driver for MAX17042. In this initial release, we have implemented the most basic features of a fuel gauge: measure the battery capacity and voltage. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>