aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/ab8500_charger.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-10-20power: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2013-10-25ab8500-charger: Remove redundant breakSachin Kamat1-1/+0
Each of the if-else blocks has a break statement. Remove the additional one which is unreachable. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-10-25ab8500-charger: Check return value of regulator_enableSachin Kamat1-4/+12
Check the return value of regulator_enable to silence the following type of warnings: drivers/power/ab8500_charger.c:1390:20: warning: ignoring return value of ‘regulator_enable’, declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-08-27ab8500-charger: We print an unintended error messageDan Carpenter1-0/+1
There is a missing break statement here, so we print an error message that the USB type is invalid. The original code still works fine though except for the error message. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-06ab8500_bm: Remove unnecessary platform_set_drvdata()Jingoo Han1-2/+0
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-07ab8500-charger: Do not use [delayed_]work_pending()Lee Jones1-13/+6
There's no need to test whether a (delayed) work item is pending before queueing, flushing or cancelling it. Most uses are unnecessary and quite a few of them are buggy. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-charger: Remove duplicate codeLee Jones1-8/+0
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-charger: Run detect workaround only on AB8500Rabin Vincent1-8/+13
Only AB8500 has this hardware bug, so these works only need to be run there. Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Martin SJOBLOM <martin.w.sjoblom@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-03-07ab8500-charger: Add UsbLineCtrl2 referenceMarcus Cooper1-4/+7
When the state of USB Charge detection is changed then the calls use a define for another register in other bank. This change creates a new define for the correct register and removes the magic numbers that are present. Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-03-07ab8500-charger: Use USBLink1Status RegisterMarcus Cooper1-5/+16
The newer AB's such as the AB8505, AB9540 etc include a USBLink1 Status register which detects a larger range of external devices. This should be used instead of the USBLine Status register. Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Yang QU <yang.qu@stericsson.com>
2013-03-07ab8500-bm: Add support for the new ab8540 platformLee Jones1-158/+112
Provide AB8540 platform specific information required to run the Battery Management subsystem on AB8540 based devices. For this to happen we see the introduction of separate platform specific data structures and a means in which to process them. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Add usb power path supportLee Jones1-0/+81
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-07pm2301-charger: Always compile the PM2301 Charger driver with AB8500 Battery MgntMarcus Cooper1-3/+3
The PM2301 Charger should always be available when using the AB8500 Battery Management system, we're ensuring this will be the case. Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com>
2013-03-07ab8500-charger: Add AB8505_USB_LINK_STATUSHakan Berg1-8/+35
The AB8505 does not have the same address for USB link-status as has ab8500. Add AB8505_USB_LINK_STATUS and code to switch to correct constant. Signed-off-by: Hakan Berg <hakan.berg@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com>
2013-03-07ab8500_charger: Prevent auto drop of VBUSLee Jones1-49/+120
Do not set higher current in stepping functionality if VBUS is dropping. After VBUS has dropped try to set current once again. If dropping again then we have found the maximum capability of the charger. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-bm: Charge only mode fixes for the ab9540Lee Jones1-0/+42
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 Jones1-2/+103
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-07ab8500-charger: Trivial coding style changesLee Jones1-6/+6
Enforce the white space character after 'if'. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07ab8500-charger: Add backup battery charge voltages on the ab8540Yang QU1-2/+17
Add 2.7v, 2.9v, 3.0v, 3.2v and 3.3v charging voltages for backup battery. Before that only 2.5v, 2.6v, 2.8v, 3.1v were available. Signed-off-by: Yang QU <yang.qu@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Maxime COQUELIN <maxime.coquelin@stericsson.com> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Tested-by: Xiao Mei ZHANG <xiaomei.zhang@stericsson.com>
2013-01-23u8500-charger: Delay for USB enumerationPaer-Olof Haakansson1-107/+325
If charging is started before USB enumeration of an Accessory Charger Adapter has finished, the AB8500 will generate a VBUS_ERROR. This in turn results in timeouts and delays the enumeration with around 15 seconds. This patch delays the charging and then ramps currents slowly to avoid VBUS errors. The delay allows the enumeration to have finished before charging is turned on. Signed-off-by: Martin Sjoblom <martin.w.sjoblom@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-01-23ab8500-bm: Remove individual [charger|btemp|fg|chargalg] pdata structuresLee Jones1-2/+2
None of the aforementioned components have their own dedicated platform data structures anymore. Instead they have all been merged into one big Battery Management container. Let's remove them and place all the nice newly added attributes into the core container. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-01-23ab8500-charger: Do not touch VBUSOVV bitsJonas Aaberg1-6/+16
Do not touch the VBUSOVV in USBCHTRL2 when running on AB8505. Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Tested-by: Mian Yousaf KAUKAB <mian.yousaf.kaukab@stericsson.com>
2013-01-23ab8500-bm: Flush all work queues before suspendingJonas Aaberg1-0/+11
Flush all workqueues at suspend time to avoid suspending during work. Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com>
2013-01-23ab8500-charger: Add support for autopower on AB8505 and AB9540Nicolas Guion1-17/+35
Accessing autopower register fails on the AB8505 and ab9540 as the fallback software control register has moved. Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Mattias WALLIN <mattias.wallin@stericsson.com> Reviewed-by: Nicolas GUION <nicolas.guion@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-01-23abx500-chargalg: Add new sysfs interface to get current charge statusLee Jones1-0/+3
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 Pallardy1-0/+6
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-charger: AB workaround for invalid chargerHenrik Sölver1-4/+55
AB8500 refuses to start charging when some types of non standard chargers are connected. This change force the AB to start charging. Signed-off-by: Henrik Sölver <henrik.solver@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Yvan FILLION <yvan.fillion@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Tested-by: Yvan FILLION <yvan.fillion@stericsson.com>
2013-01-23pm2301: Provide u9540 support for the pm2301 chargerMichel JAOUEN1-13/+23
AC charger driver for the DB9540 based platforms. 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> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com>
2013-01-15ab8500_charger: Adds support for legacy USB chargersMarcus Cooper1-16/+63
A Legacy USB charger should be handled directly by the charger driver. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_charger: Remove unused definesMarcus Cooper1-5/+0
Cleanup of the ab8500_charger driver. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_bm: Adds support for Car/Travel AdaptersHakan Berg1-24/+68
The Travel and Carkit adapter should be handled directly by the charger driver. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_charger: Handle gpadc errorsJonas Aaberg1-4/+18
Gracefully handle gpadc conversion errors. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Reviewed-by: Johan BJORNSTEDT <johan.bjornstedt@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_charger: Detect charger removalLee Jones1-1/+141
Add two new work queues to provide USB and AC charger disconnect detection. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15ab8500_charger: Rename the power_loss functionPaer-Olof Haakansson1-12/+11
Rename the ab8500_power_loss_handling function to a more descriptive name ab8500_enable_disable_sw_fallback Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Robert Marklund <robert.marklund@stericsson.com> Reviewed-by: Par-Olof HAKANSSON <par-olof.hakansson@stericsson.com> Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com> Tested-by: Par-Olof HAKANSSON <par-olof.hakansson@stericsson.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-05ab8500_charger: Use devm_regulator_get APISachin Kamat1-8/+3
devm_regulator_get() is device managed and makes error handling and code cleanup simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: Arun Murthy <arun.murthy@stericsson.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> 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 Vorontsov1-64/+158
2012-12-11Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linuxAnton Vorontsov1-3/+3
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-11ab8500_charger: Reorder obtainment of platform specific battery management dataLee Jones1-16/+15
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 Jones1-1/+1
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 Jones1-12/+12
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-12-11ab8500_charger: Charger current step-up/downJohan Bjornstedt1-40/+135
There is no state machine in the AB to step up/down the charger current to avoid dips and spikes on VBUS and VBAT when charging is started. Instead this is implemented in SW. Signed-off-by: Johan Bjornstedt <johan.bjornstedt@stericsson.com> Signed-off-by: Mattias Wallin <mattias.wallin@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com>
2012-11-28power: remove use of __devexitBill Pemberton1-1/+1
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 Pemberton1-1/+1
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 Pemberton1-1/+1
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 chargerRajanikanth H.V1-29/+45
This patch adds device tree support for ab8500-charger 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.V1-12/+4
- 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-10-07Merge tag 'for-v3.7' of git://git.infradead.org/battery-2.6Linus Torvalds1-0/+1
Pull battery updates from Anton Vorontsov: "1. New drivers: - Marvell 88pm860x charger and battery drivers; - Texas Instruments LP8788 charger driver; 2. Two new power supply properties: whether a battery is authentic, and chargers' maximal currents and voltages; 3. A lot of TI LP8727 Charger cleanups; 4. New features for Charger Manager, mainly now we can disable specific regulators; 5. Random fixes and cleanups for other drivers." Fix up trivial conflicts in <linux/mfd/88pm860x.h> * tag 'for-v3.7' of git://git.infradead.org/battery-2.6: (52 commits) pda_power: Remove ac_draw_failed goto and label charger-manager: Add support sysfs entry for charger charger-manager: Support limit of maximum possible charger-manager: Check fully charged state of battery periodically lp8727_charger: More pure cosmetic improvements lp8727_charger: Fix checkpatch warning lp8727_charger: Add description in the private data lp8727_charger: Fix a typo - chg_parm to chg_param lp8727_charger: Make some cosmetic changes in lp8727_delayed_func() lp8727_charger: Clean up lp8727_charger_changed() lp8727_charger: Return if the battery is discharging lp8727_charger: Make lp8727_charger_get_propery() simpler lp8727_charger: Make lp8727_ctrl_switch() inline lp8727_charger: Make lp8727_init_device() shorter lp8727_charger: Clean up lp8727_is_charger_attached() lp8727_charger: Use specific definition lp8727_charger: Clean up lp8727 definitions lp8727_charger: Use the definition rather than enum lp8727_charger: Fix code for getting battery temp lp8727_charger: Clear interrrupts at inital time ...
2012-08-22ab8500_charger: Fix error return codeJulia Lawall1-0/+1
Initialize return variable before exiting on an error path. A simplified version of the semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> ( if@p1 (\(ret < 0\|ret != 0\)) { ... return ret; } | ret@p1 = 0 ) ... when != ret = e1 when != &ret *if(...) { ... when != ret = e2 when forall return ret; } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-21workqueue: make deferrable delayed_work initializer names consistentTejun Heo1-4/+4
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-07-02usb: phy: fix return value check of usb_get_phyKishon Vijay Abraham I1-1/+1
usb_get_phy will return -ENODEV if it's not able to find the phy. Hence fixed all the callers of usb_get_phy to check for this error condition instead of relying on a non-zero value as success condition. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com>