summaryrefslogtreecommitdiffstats
path: root/drivers/power/ds2782_battery.c
Commit message (Collapse)AuthorAgeFilesLines
* ds2782_battery: Use dev_pm_opsLars-Peter Clausen2013-03-311-12/+11
| | | | | | | | Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks. Cc: Evgeny Romanov <romanov@neurosoft.ru> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* power: convert to idr_alloc()Tejun Heo2013-02-271-7/+2
| | | | | | | | | | Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ds2782_battery: Add power_supply_changed() calls for proper uevent supportEvgeny Romanov2013-02-021-0/+69
| | | | | | | | | | This patch affects on Android battery indicator. Battery driver should send uevent message when battery status changes in order to get Android battery level dynamically updated. Delayed work was added to periodically check battery status and capacity. Signed-off-by: Evgeny Romanov <romanov@neurosoft.ru> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* ds2782_battery: Fix signedness bug in ds278x_read_reg16()Dan Carpenter2012-11-181-2/+2
| | | | | | | | We need to check for negative values before doing the swab16() for the error handling to work. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
* power_supply: Convert i2c drivers to module_i2c_driverAxel Lin2012-03-261-12/+1
| | | | | | | | | | | | | | | Factor out some boilerplate code for i2c driver registration into module_i2c_driver. Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Woogyom Kim <milo.kim@ti.com> Cc: Daniel Jeong <daniel.jeong@ti.com> Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Peter Edwards <sweetlilmre@gmail.com> Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com> Acked-by: Rhyland Klein <rklein@nvidia.com> Acked-by: Ryan Mallon <rmallon@gmail.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
* Change Ryan Mallon's email address across the kernelRyan Mallon2011-06-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I no longer work at Bluewater Systems. Update my email address accordingly. I have deleted my email address from C files rather than change it. This was suggested by several people, since the commit from my new email address will cause scripts/get_maintainer.pl to function properly. I have not added the .mailmap entry as suggested by Joe because I think it is no longer necessary if I touch all the files which had my name in them. Signed-off-by: Ryan Mallon <rmallon@gmail.com> Cc: Andre Renaud <andre@bluewatersys.com> Cc: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Russell King <linux@arm.linux.org.uk> Cc: Nicolas Ferre <nicolas.ferre@atmel.com> Cc: Andrew Victor <avictor.za@gmail.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Anton Vorontsov <cbou@mail.ru> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Liam Girdwood <lrg@ti.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Joe Perches <joe@perches.com> Cc: Jesper Juhl <jj@chaosbits.net> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: trivial@kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* ds2782_battery: Add MODULE_DEVICE_TABLEAxel Lin2011-03-011-0/+1
| | | | | | | | | | | The device table is required to load modules based on modaliases. After adding the MODULE_DEVICE_TABLE, below entries will be added to modules.alias: alias i2c:ds2786 ds2782_battery alias i2c:ds2782 ds2782_battery Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* ds2782_battery: Fix unitsRyan Mallon2010-10-061-6/+6
| | | | | | | | | | | | | Correct the unit names in the ds2782 battery driver. Changes voltage_uA to voltage_uV and capacity_uA to capacity. Signed-off-by: Ryan Mallon <ryan@bluewatersys.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Ben Hutchings <ben@decadent.org.uk> Cc: Yulia Vilensky <vilensky@compulab.co.il> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* Merge git://git.infradead.org/users/cbou/battery-2.6.35Linus Torvalds2010-07-271-15/+14
|\ | | | | | | | | * git://git.infradead.org/users/cbou/battery-2.6.35: ds2782_battery: Rename get_current to fix build failure / name conflict
| * ds2782_battery: Rename get_current to fix build failure / name conflictPeter Huewe2010-06-141-15/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the name of get_current function pointer to get_battery_current to resolve a name conflict with the get_current macro defined in current.h. This conflict resulted in a build-failure[1] for the sh4 arch allyesconfig: drivers/power/ds2782_battery.c:216:48: error: macro "get_current" passed 2 arguments, but takes just This patch fixes the issue. To be consistent the other function pointers (_voltage,_capacity) were renamed too. Signed-off-by: Peter Huewe <peterhuewe@gmx.de> Acked-by: Ryan Mallon <ryan@bluewatersys.com> Acked-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* | ds2782_battery: Fix ds2782_get_capacity return valueRyan Mallon2010-06-211-1/+1
|/ | | | | | | | The ds2782_get_capacity function should return 0 on success, not the capacity value. Signed-off-by: Ryan Mallon <ryan@bluewatersys.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* ds2782_battery: Get rid of magic numbers in driver_dataAnton Vorontsov2010-05-021-6/+11
| | | | | | | | | Constructions like 'if (id->driver_data == 1)' look quite weird. This patch introduces 'enum ds278x_num_id', which makes things much more understandable, i.e. 'if (id->driver_data == DS2786)'. Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com> Acked-by: Mike Rapoport <mike@compulab.co.il>
* ds2782_battery: Add support for ds2786 battery gas gaugeYulia Vilensky2010-04-261-48/+136
| | | | | | Signed-off-by: Yulia Vilensky <vilensky@compulab.co.il> Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* Merge branch 'master' of ↵Anton Vorontsov2010-04-261-0/+1
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
| * include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* | ds2782_battery: Fix clientdata on removalWolfram Sang2010-04-061-3/+0
|/ | | | | | | | | | | | | Probably due to a copy & paste bug, clientdata was set again to the data structure (which is freed immediately afterwards) when it should be NULLed. Just remove the calls as the i2c-core does this automatically now. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Ryan Mallon <ryan@bluewatersys.com> Cc: Hans Verkuil <hverkuil@xs4all.nl> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* Add ds2782 battery gas gauge driverRyan Mallon2009-07-011-0/+330
This patch adds a driver for ds2782 battery devices. Signed-off-by: Ryan Mallon <ryan@bluewatersys.com> Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
OpenPOWER on IntegriCloud