summaryrefslogtreecommitdiff
path: root/drivers/power
AgeCommit message (Collapse)AuthorFilesLines
2013-04-01max17040_battery: Use dev_pm_opsLars-Peter Clausen1-9/+11
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks. Cc: Minkyu Kang <mk7.kang@samsung.com> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Minkyu Kang <mk7.kang@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-04-01ds2782_battery: Use dev_pm_opsLars-Peter Clausen1-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>
2013-04-01sbs-battery: Use of_match_ptr() macroSachin Kamat1-2/+2
This eliminates having an #ifdef returning NULL for the case when OF is disabled. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31Merge branch 'vexpress' of ↵Anton Vorontsov3-1/+155
git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64 From Catalin Marinas <catalin.marinas@arm.com>: "... move the vexpress poweroff/restart code from arch/arm to driver/power/reset so that the code can be reused in arm64."
2013-03-21arm: vexpress: Decouple vexpress-poweroff implementation from machine_descCatalin Marinas1-2/+7
This patch adds the pm_power_off and arm_pm_restart variable settings to the vexpress-poweroff.c driver to decouple it from the machine_desc definition. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Pawel Moll <pawel.moll@arm.com>
2013-03-21arm: vexpress: Move the poweroff/restart code to drivers/power/resetCatalin Marinas3-1/+150
This patch moves the arch/arm/mach-vexpress/reset.c functionality to drivers/platform/reset/ and adds the necessary Kconfig wiring. Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Pawel Moll <pawel.moll@arm.com>
2013-03-19s3c-adc-battery: Fix possible NULL pointer dereferenceSyam Sidhardhan1-2/+5
Check for (bat == NULL) has to be done before accessing bat Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-19test_power: Fix a bug in setting module parameter valuesAndrey Gelman1-10/+21
When the kernel loads a module, module params are processed prior to calling module_init. As a result, setting module param value should not have side effects, at least as long as the module has not been initialized. Signed-off-by: Andrey Gelman <andreyg@compulab.co.il> Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-19power_supply: Add support for tps65090-chargerRhyland Klein3-0/+323
This patch adds support for the tps65090 charger driver. This driver is responsible for controlling the charger aspect of the tps65090 mfd. Currently, this mainly consists of turning on and off the charger, but some features of the charger can be supported through this driver including: - Enable Auto Recharge based on Battery voltage - Fast Charge Safety Timer - Maximum battery discharge current - Maximum battery adapter current - Enable External Charge - Disable charging termination based on low charger current (supported) Once the driver is accepted, later patches can add support for the features above which are not yet supported. Based on work by: Syed Rafiuddin <srafiuddin@nvidia.com> Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Rhyland Klein <rklein@nvidia.com> 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-fg: Change current calculationlme004371-4/+4
This patch updates the gas gauge constant for electric current calculation according to hardware specification. Signed-off-by: Benoit GAUTHIER <benoit.gauthier-xsig@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Tested-by: Benoit GAUTHIER <benoit.gauthier-xsig@stericsson.com>
2013-03-07abx500-chargalg: Add charging current step interfaceLee Jones1-76/+155
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-07pm2301-charger: Reference put missing after accessRupesh Kumar1-0/+4
Added missing pm_runtime_put_sync in read & write. Signed-off-by: Rupesh Kumar <rupesh.kumar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Sandeep TRIPATHY <sandeep.tripathy@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
2013-03-07pm2301-charger: Wake device on register accessRupesh Kumar1-16/+6
When USB Dedicated or Standard host chargers are plugged into the device, chargealg attempts to disable the PM2301 AC charger, However, disabling PM2301 was failing because of it being in runtime suepend mode & LPN pin being low. Signed-off-by: Rupesh Kumar <rupesh.kumar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
2013-03-07ab8500-bm: Trivially fix up some incorrect and out-of-date commentsMarcus Cooper2-4/+4
Some of the comments in the ab8500 drivers reflect the behaviour of the original device. As this driver now supports newer devices then these comments are now redundant. Also some IRQ comments are incorrect. Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com> Tested-by: Rabin VINCENT <rabin.vincent@stericsson.com>
2013-03-07pm2301-charger: Charging LED control for pm2301Rupesh Kumar1-4/+0
The LED Indicator feature allows indicating through a led when the PM2301 battery charging is active. SW shall not disable this LED. Signed-off-by: Rupesh Kumar <rupesh.kumar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
2013-03-07pm2301-charger: lpn pin used only in C2C boardslme004371-34/+32
This patch restricts use of LPN pin to C2C boards to avoid conflict on HSI for GPIO 60 use. Signed-off-by: Benoit GAUTHIER <benoit.gauthier-xsig@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Mustapha BEN-ZOUBEIR <mustapha.ben.zoubeir-xsig@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Tested-by: Benoit GAUTHIER <benoit.gauthier-xsig@stericsson.com>
2013-03-07ab8500-charger: Remove duplicate codeLee Jones2-9/+0
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07abx500-chargalg: Use module_platform_driver() rathersrinidhi kasagar1-12/+1
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-07pm2301-charger: Removed unused code from PM2301 driverRupesh Kumar2-27/+0
Some of the headers and defines accrued over time are no longer in use. Let's take the opportunity to remove a few of them. Signed-off-by: Rupesh Kumar <rupesh.kumar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
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-07pm2301-charger: Add pm_runtime_resume & pm_runtime_suspendLee Jones1-0/+68
To optimize the current consumption we use pm_runtime autosuspend functions which execute the pm_runtime_suspend after a delay of inactivity on the other hand we use pm_runtime_resume every time we receive an interruption to wake up the pm2301. Signed-off-by: M BenZoubeir <mustapha.ben.zoubeir-xsig@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
2013-03-07pm2301-charger: Adjust interrupt handler behaviorM BenZoubeir1-21/+24
Signed-off-by: M BenZoubeir <mustapha.ben.zoubeir-xsig@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Philippe LANGLAIS <philippe.langlais@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-chargalg: Use hrtimerLee Jones1-39/+52
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 Jones1-6/+0
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-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 Jones3-168/+235
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-btemp: Defer btemp filtering while initialisingRupesh Kumar1-3/+3
Due to btemp filtering enabled during init, temp values reported to charge algorithm driver started from 0. As a result,charge algorithm was going into wrong state and charging was stopped. Signed-off-by: Rupesh Kumar <rupesh.kumar@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: Philippe LANGLAIS <philippe.langlais@stericsson.com>
2013-03-07ab8500-bm: Add usb power path supportLee Jones2-0/+143
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 ↵Marcus Cooper3-12/+4
Mgnt 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-fg: Allow capacity to raise from 1% when chargingHakan Berg1-4/+2
When battery capacity was going below 1% fg is not supposed to report 0% unless we've got the LOW_BAT IRQ, no matter what the FG-algorithm says. This made fg get stuck at 1% if charger is connected when capacity is 1%. Signed-off-by: Hakan BERG <hakan.berg@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
2013-03-07ab8500-btemp: Filter btemp readingsHakan Berg1-6/+21
Battery tempreature readings sometimes fail and results in a value far from recent values. This patch adds a software filter that disposes such readings, by allowing direct updates on temperature only if two samples result in the same temperature. Else only allow 1 degree change from previous reported value in the direction of the new measurement. Signed-off-by: Hakan Berg <hakan.berg@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: Rabin VINCENT <rabin.vincent@stericsson.com>
2013-03-07pm2301-charger: Wake system when ext charger is plugged-inRupesh Kumar1-1/+16
When in suspend state, upon plug-in of external AC charger the device needs to wake-up and charging operation started. Signed-off-by: Rupesh Kumar <rupesh.kumar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
2013-03-07pm2301-charger: Die temp thermal protectionRupesh Kumar1-1/+21
This patch adds support for die temperature thermal protection in pm2301 driver. Signed-off-by: Rupesh Kumar <rupesh.kumar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Hakan BERG <hakan.berg@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@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-07pm2301-charger: Resolve I2C detection problem on ab9540Mustapha Ben Zoubeir1-9/+26
Signed-off-by: Mustapha Ben Zoubeir <mustapha.ben.zoubeir-nonst@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Tested-by: Olivier CLERGEAUD <olivier.clergeaud@stericsson.com>
2013-03-07pm2301-charger: Force main charger detectPer Forlin1-0/+2
Force main charger detect in turn on status. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com> Signed-off-by: Per Forlin <per.forlin@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Tested-by: Philippe LANGLAIS <philippe.langlais@stericsson.com>
2013-03-07ab8500-bm: Charge only mode fixes for the ab9540Lee Jones3-0/+63
Fix for charging not getting enabled in charge only mode by external charger. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07pm2301-charger: Support for over voltage protection on the ab9540Rupesh Kumar2-14/+37
Added support for main charger over voltage protection. Signed-off-by: Rupesh Kumar <rupesh.kumar@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Philippe LANGLAIS <philippe.langlais@stericsson.com> Tested-by: Michel JAOUEN <michel.jaouen@stericsson.com>
2013-03-07ab8500-bm: Quick re-attach charging behaviourLee Jones2-2/+136
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-03-07ab8500-fg: Report unscaled capacityMartin Bergstrom1-3/+1
Unscaled capacity should be reported for POWER_SUPPLY_PROP_CAPACITY. Signed-off-by: Martin Bergstrom <martin.bergstrom@stericsson.com> Signed-off-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com> Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-03-07ab8500-fg: Add power cut feature for ab8505 and ab8540Lee Jones2-0/+479
Add support for a power cut feature which allows user to configure when ab8505 and ab8540 based platforms should shut down system due to low battery. Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07abx500-chargalg: Store the AB8500 MFD parent device for platform differentiationLee Jones1-1/+4
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-03-07pm2301-charger: Enable SW EOC control on the ab9540Rajkumar Kasirajan1-5/+43
End of charging is managed by SW. Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@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-03-07pm2301_charger: Remove __exit, __init and __devexit_p()Lee Jones1-3/+3
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-02-28power: convert to idr_alloc()Tejun Heo3-21/+8
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>