aboutsummaryrefslogtreecommitdiff
path: root/drivers/power/abx500_chargalg.c
AgeCommit message (Collapse)Author
2013-06-06ab8500_bm: Remove unnecessary platform_set_drvdata()Jingoo Han
The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-07abx500-chargalg: Add charging current step interfaceLee Jones
To prevent overheating, provide differnt steps of charging current interface to allow thermal mitigation. This will provide possibility to reduce gradually the charging current. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07abx500-chargalg: Use module_platform_driver() rathersrinidhi kasagar
deprecate some boilerplate code by using module_platform_driver helper macro. No functional changes. Signed-off-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-chargalg: Use hrtimerLee Jones
Timers used for charging safety and maintenance must work even when CPU power has collapsed. By using hrtimers with the realtime clock the system is able to trigger an alarm that wakes-up the CPU and makes it possible to handle events. Allow a little slack time of 5 minutes for the hrtimers to allow CPU to be woken-up in a more optimal power saving way. A 5 minute delay to time-out timers relative to hours does not impact on safety. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07abx500-chargalg: Prevent the watchdog from being kicked twiceLee Jones
Charging watchdog kicker work-thread gets started twice causing 'failed to kick watchdog' message after removing charger and when re-inserting charger. This patch removes the superfluous start of watchdog kicker-thread. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Add usb power path supportLee Jones
AB8540 supports power path function in USB charging mode for fast power up with dead and weak battery, and it could extend the battery age. When USB charging starts, if the Vbattrue is below than SW cut off voltage, power path and pre-charge should be enabled. If Vbattrue is higher than SW cut off voltage, power path and pre-charge should be disabled. This is to make sure full current to battery charge. At the end of charge, power path should be enable again to reduce charging the battery again. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Charge only mode fixes for the ab9540Lee Jones
Fix for charging not getting enabled in charge only mode by external charger. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Quick re-attach charging behaviourLee Jones
Due to a bug in some AB8500 ASICs charger removal cannot always be detected if the removal and reinsertion is done to close in time. This patch detects above described case and handles the situation so that charging will be kept turned on. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07abx500-chargalg: Store the AB8500 MFD parent device for platform differentiationLee Jones
Any platform can be dynamically probed for model and version number provided the AB8500 MFD parent device pointer is available. This patch obtains that pointer and stores it in a locally controlled struct for later use. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-23abx500-chargalg: Add new sysfs interface to get current charge statusLee Jones
Allow a user to check on AB8500 charging status from debugfs. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-23pm2301: Update watchdog for pm2xxx supportLoic Pallardy
AB and PMxxx doesn't have same watchdog refresh period. Add watchdog to refresh period parameters in x500 charger structure, this should kick watchdog every 30sec. The AC charging should also kick both pm2xxx and the AB charger watchdog. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> Signed-off-by: Loic Pallardy <loic.pallardy@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Michel JAOUEN <michel.jaouen@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-01-23ab8500-chargalg: Only root should have write permission on sysfs fileLee Jones
Only root should have write permission on sysfs file ab8500_chargalg/chargalg. Cc: stable@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-23ab8500-chargalg: Update battery health on safety timer expLee Jones
When the charging safety timer elapses, the battery health is shown as "Good". This is misleading and also makes it difficult to distinguish issues relating to discharging despite the fact that the charger is still connected. When in actual fact a safety timer elapse is an indication of a fault in the battery. Here we make this clearer by reporting POWER_SUPPLY_HEALTH_UNSPEC_FAILURE instead. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-23ab8500-charger: Kick watchdogLee Jones
Kicks the watchdog so charging will not stop. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-15ab8500_bm: Recharge condition not optimal for batteryMarcus Cooper
Today the battery recharge is determined with a voltage threshold. This voltage threshold is only valid when the battery is relaxed. In charging algorithm the voltage read is the loaded battery voltage and no compensation is done to get the relaxed voltage. When maintenance charging is not selected, this makes the recharging condition to almost immediately activate when there is a discharge present on the battery. Depending on which vendor the battery comes from this behavior can wear out the battery much faster than normal. The fuelgauge driver is responsible to monitor the actual battery capacity and is able to estimate the remaining capacity. It is better to use the remaining capacity as a limit to determine when battery should be recharged. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-05Merge branch 'for-anton' of git://git.linaro.org/people/ljones/linux-3.0-ux500Anton Vorontsov
2012-12-11Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linuxAnton Vorontsov
The merge is merely to fix conflicts before sending a pull request. Conflicts: drivers/power/ab8500_btemp.c drivers/power/ab8500_charger.c drivers/power/ab8500_fg.c drivers/power/abx500_chargalg.c drivers/power/max8925_power.c Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-12-11abx500_chargalg: Reorder obtainment of platform specific battery management dataLee Jones
Now that we always pass platform specific battery management data through platform_data instead of obtaining it via different means depending the way be boot the system (DT or ATAGs); we need to re-jiggle the way we acquire it in the driver start-up functions. Now it is wrong for it to be missing, but we still allow Device Tree code to fiddle with it once we've confirmed it's there. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2012-12-11ab8500_bm: Always send platform specific battery information via pdataLee Jones
Currently the AB8500 battery management subsystem receives platform specific information via two different means depending on how the platform is booted. If DT is not enabled, a reference to a *_bm_data data structure containing each platform specific attribute is passed though platform_data. However, if DT is enabled, then platform_data is empty and the reference is gained though a DT specific probe function. There are two issues here 1) the same reference is being collected each time and 2) the DT way doesn't allow any provisions to select different platform specific attributes, which kind of defeats the object. Cc: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2012-12-11ab8500_bm: Rename battery management platform data to something more logicalLee Jones
The platform specific battery management configuration data structure is currently called 'bat' short for 'battery'; however, it contains information for all components of the battery management group, rather than information pertaining to the battery itself - there are other structures for that. So, in keeping with its structure namesake 'abx500_bm_data', we rename it to 'bm' here. Using similar logic, we're also renaming 'bmdevs_of_probe' to the more device specific 'ab8500_bm_of_probe'. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2012-11-28power: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28power: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28power: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Anton Vorontsov <cbou@mail.ru> Cc: David Woodhouse <dwmw2@infradead.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-18ab8500: Add devicetree support for chargalgRajanikanth H.V
This patch adds device tree support for charging algorithm driver Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-11-18ab8500: Add devicetree support for fuelgaugeRajanikanth H.V
- This patch adds device tree support for fuelgauge driver - optimize bm devices platform_data usage and of_probe(...) Note: of_probe() routine for battery managed devices is made common across all bm drivers. - test status: - interrupt numbers assigned differs between legacy and FDT mode. Signed-off-by: Rajanikanth H.V <rajanikanth.hv@stericsson.com> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-21workqueue: make deferrable delayed_work initializer names consistentTejun Heo
Initalizers for deferrable delayed_work are confused. * __DEFERRED_WORK_INITIALIZER() * DECLARE_DEFERRED_WORK() * INIT_DELAYED_WORK_DEFERRABLE() Rename them to * __DEFERRABLE_WORK_INITIALIZER() * DECLARE_DEFERRABLE_WORK() * INIT_DEFERRABLE_WORK() This patch doesn't cause any functional changes. Signed-off-by: Tejun Heo <tj@kernel.org>
2012-03-26ab8500: Turn unneeded global symbols into local onesAnton Vorontsov
The patch fixes the following sparse warning: drivers/power/ab8500_charger.c:1619:6: warning: symbol 'ab8500_charger_detect_usb_type_work' was not declared. Should it be static? drivers/power/abx500_chargalg.c:1709:24: warning: symbol 'abx500_chargalg_sysfs_ops' was not declared. Should it be static? drivers/power/ab8500_fg.c:2328:24: warning: symbol 'ab8500_fg_sysfs_ops' was not declared. Should it be static? Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26abx500-chargalg: Add abx500 charging algorithmArun Murthy
This is a charging algorithm driver for abx500 variants. It is the central entity for battery driver and is responsible for charging and monitoring the battery driver. It is a hardware independant driver and also monitors other abx500 power supply devices. Signed-off-by: Arun Murthy <arun.murthy@stericsson.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>