summaryrefslogtreecommitdiffstats
path: root/drivers/power/bq2415x_charger.c
Commit message (Collapse)AuthorAgeFilesLines
* bq2415x_charger: Fix Atomic Sleep BugSebastian Reichel2014-07-181-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move sysfs_notify and i2c_transfer calls from bq2415x_notifier_call to bq2415x_timer_work to avoid sleeping in atomic context. This fixes the following bug: [ 7.667449] Workqueue: events power_supply_changed_work [ 7.673034] [<c0015c28>] (unwind_backtrace+0x0/0xe0) from [<c0011e1c>] (show_stack+0x10/0x14) [ 7.682098] [<c0011e1c>] (show_stack+0x10/0x14) from [<c052cdd0>] (dump_stack+0x78/0xac) [ 7.690704] [<c052cdd0>] (dump_stack+0x78/0xac) from [<c052a044>] (__schedule_bug+0x48/0x60) [ 7.699645] [<c052a044>] (__schedule_bug+0x48/0x60) from [<c053071c>] (__schedule+0x74/0x638) [ 7.708618] [<c053071c>] (__schedule+0x74/0x638) from [<c05301fc>] (schedule_timeout+0x1dc/0x24c) [ 7.718017] [<c05301fc>] (schedule_timeout+0x1dc/0x24c) from [<c05316ec>] (wait_for_common+0x138/0x17c) [ 7.727966] [<c05316ec>] (wait_for_common+0x138/0x17c) from [<c0362a70>] (omap_i2c_xfer+0x340/0x4a0) [ 7.737640] [<c0362a70>] (omap_i2c_xfer+0x340/0x4a0) from [<c035d928>] (__i2c_transfer+0x40/0x74) [ 7.747039] [<c035d928>] (__i2c_transfer+0x40/0x74) from [<c035e22c>] (i2c_transfer+0x6c/0x90) [ 7.756195] [<c035e22c>] (i2c_transfer+0x6c/0x90) from [<c037ad24>] (bq2415x_i2c_write+0x48/0x78) [ 7.765563] [<c037ad24>] (bq2415x_i2c_write+0x48/0x78) from [<c037ae60>] (bq2415x_set_weak_battery_voltage+0x4c/0x50) [ 7.776824] [<c037ae60>] (bq2415x_set_weak_battery_voltage+0x4c/0x50) from [<c037bce8>] (bq2415x_set_mode+0xdc/0x14c) [ 7.788085] [<c037bce8>] (bq2415x_set_mode+0xdc/0x14c) from [<c037bfb8>] (bq2415x_notifier_call+0xa8/0xb4) [ 7.798309] [<c037bfb8>] (bq2415x_notifier_call+0xa8/0xb4) from [<c005f228>] (notifier_call_chain+0x38/0x68) [ 7.808715] [<c005f228>] (notifier_call_chain+0x38/0x68) from [<c005f284>] (__atomic_notifier_call_chain+0x2c/0x3c) [ 7.819732] [<c005f284>] (__atomic_notifier_call_chain+0x2c/0x3c) from [<c005f2a8>] (atomic_notifier_call_chain+0x14/0x18) [ 7.831420] [<c005f2a8>] (atomic_notifier_call_chain+0x14/0x18) from [<c0378078>] (power_supply_changed_work+0x6c/0xb8) [ 7.842864] [<c0378078>] (power_supply_changed_work+0x6c/0xb8) from [<c00556c0>] (process_one_work+0x248/0x440) [ 7.853546] [<c00556c0>] (process_one_work+0x248/0x440) from [<c0055d6c>] (worker_thread+0x208/0x350) [ 7.863372] [<c0055d6c>] (worker_thread+0x208/0x350) from [<c005b0ac>] (kthread+0xc8/0xdc) [ 7.872131] [<c005b0ac>] (kthread+0xc8/0xdc) from [<c000e138>] (ret_from_fork+0x14/0x3c) Fixes: 32260308b4ca ("bq2415x_charger: Use power_supply notifier for automode") Cc: <stable@vger.kernel.org> Signed-off-by: Sebastian Reichel <sre@kernel.org>
* bq2415x_charger: Add DT supportSebastian Reichel2013-12-231-20/+52
| | | | | | | | This adds DT support to the bq2415x driver. Signed-off-by: Sebastian Reichel <sre@debian.org> Reviewed-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* bq2415x_charger: Use power_supply notifier for automodePali Rohár2013-12-231-17/+60
| | | | | | | | | | | | This patch removing set_mode_hook function from board data and replacing it with new string variable of notifier power supply device. After this change it is possible to add DT support because driver does not need specific board function anymore. Only static data and name of power supply device is required. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Reviewed-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* bq2415x_charger: Fix max battery regulation voltageAlexandre Belloni2013-10-251-1/+5
| | | | | | | | | | | As per the datasheets, maximum battery regulation voltage is 4440mV. The formula is (voltage - offset) / step, so the maximum value is: (4440 - 3500) / 20 = 47 Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Thanks-to: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* power: convert to idr_alloc()Tejun Heo2013-02-271-8/+3
| | | | | | | | | | 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>
* bq2415x_charger: Add support for offline and 100mA modePali Rohár2013-02-161-7/+18
| | | | | | | | | | | * Renamed mode BQ2415X_MODE_NONE to BQ2415X_MODE_OFF because this mode turning chaging completly off * Added new mode BQ2415X_MODE_NONE which enable charging with maximal current limit 100mA (this is minimal safe value for bq2415x chips) Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* bq2415x_charger: Use devm_kzalloc()Sachin Kamat2013-01-051-9/+6
| | | | | | | | devm_kzalloc is device managed and makes error handling and code cleanup a bit simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* bq2415x_charger: Use module_i2c_driverSachin Kamat2013-01-051-12/+1
| | | | | | | | module_i2c_driver() makes the code simpler by eliminating module_init and module_exit calls. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* bq2415x_charger: Remove unneeded version.h inclusionSachin Kamat2013-01-051-1/+0
| | | | | | | <linux/version.h> is not required here. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
* bq2415x_charger: Fix style issuesAnton Vorontsov2012-11-181-121/+147
| | | | | | | | I hate doing these style fixups myself, but I also hate inconsitent code. Normally I just ask to resubmit the patch with the issues fixed, but N900 is special: I have a selfish interest in it. :) Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
* power_supply: Add bq2415x charger driverPali Rohár2012-11-181-0/+1644
The bq2415x charger driver is needed for example on Nokia N900 for charging battery. Driver is part of open source project to replace proprietary battery management. Signed-off-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>