Commit graph

738 commits

Author SHA1 Message Date
Jingoo Han
f3f66b3ea4 max8903_charger: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:25:38 -07:00
Jingoo Han
d4a20f57d3 max8997_charger: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:25:36 -07:00
Jingoo Han
acfbf47a90 max8998_charger: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:25:34 -07:00
Jingoo Han
c09dd7daba pcf50633-charger: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:25:32 -07:00
Jingoo Han
b852ac51e2 rx51_battery: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:25:30 -07:00
Jingoo Han
3f8060a5fe 88pm860x_charger: Drop kfree of devm_kzalloc'd data
The devm_kzalloc function allocates memory that is released automatically,
when a driver detaches. Thus, there is no reason to explicitly call kfree
in probe or remove functions.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:25:17 -07:00
Jingoo Han
f11d018fd6 wm831x_backup: Use devm_kzalloc()
Use devm_kzalloc() to make cleanup paths more simple.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:24:37 -07:00
Rhyland Klein
594f8f888d tps65090: Setup compatible property for dt
Setup the compatible property so that when this device is registered
through device tree, it can match the expected compatiblity string used in
the tps65090 driver.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:15:47 -07:00
Jingoo Han
4420dc2000 twl4030_charger: Use module_platform_driver_probe()
This patch uses module_platform_driver_probe() macro which makes the code
smaller and simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:04:20 -07:00
Lars-Peter Clausen
9c1d1af0cf sbs-battery: Use dev_pm_ops
Use dev_pm_ops instead of the deprecated legacy suspend/resume callbacks.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-03-31 23:01:17 -07:00
Lars-Peter Clausen
43cf454aba max17040_battery: Use dev_pm_ops
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-03-31 23:01:15 -07:00
Lars-Peter Clausen
cc6616f690 ds2782_battery: Use dev_pm_ops
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-03-31 23:01:10 -07:00
Sachin Kamat
075ed03ce6 sbs-battery: Use of_match_ptr() macro
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-31 20:37:26 -07:00
Anton Vorontsov
18bc4e79fd Merge branch 'vexpress' of 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-30 15:47:40 -07:00
Catalin Marinas
65deb78285 arm: vexpress: Decouple vexpress-poweroff implementation from machine_desc
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-21 15:17:40 +00:00
Catalin Marinas
2655f51d0a arm: vexpress: Move the poweroff/restart code to drivers/power/reset
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-21 15:17:39 +00:00
Syam Sidhardhan
c6cc9fc9d4 s3c-adc-battery: Fix possible NULL pointer dereference
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-18 19:43:03 -07:00
Andrey Gelman
9239ebcffb test_power: Fix a bug in setting module parameter values
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-18 19:27:31 -07:00
Rhyland Klein
6f8da5df8c power_supply: Add support for tps65090-charger
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-18 19:20:05 -07:00
Lee Jones
b09f86dbfc ab8500-charger: Do not use [delayed_]work_pending()
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-07 12:35:59 +08:00
lme00437
0577610e0e ab8500-fg: Change current calculation
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-07 12:35:59 +08:00
Lee Jones
4d3b4aa58a abx500-chargalg: Add charging current step interface
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-07 12:35:58 +08:00
Rupesh Kumar
9b7f50e3ea pm2301-charger: Reference put missing after access
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-07 12:35:57 +08:00
Rupesh Kumar
b64f51c4ad pm2301-charger: Wake device on register access
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-07 12:35:57 +08:00
Marcus Cooper
7a2cf9bacf ab8500-bm: Trivially fix up some incorrect and out-of-date comments
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-07 12:35:56 +08:00
Rupesh Kumar
0f80ba6318 pm2301-charger: Charging LED control for pm2301
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-07 12:35:55 +08:00
lme00437
a21e22f2f3 pm2301-charger: lpn pin used only in C2C boards
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-07 12:35:55 +08:00
Lee Jones
3c01b3676f ab8500-charger: Remove duplicate code
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07 12:35:54 +08:00
srinidhi kasagar
1ee26af028 abx500-chargalg: Use module_platform_driver() rather
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-07 12:35:53 +08:00
Rupesh Kumar
f70dfdec99 pm2301-charger: Removed unused code from PM2301 driver
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-07 12:35:53 +08:00
Rabin Vincent
261c5136fa ab8500-charger: Run detect workaround only on AB8500
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-07 12:35:52 +08:00
Lee Jones
aee2b8468c pm2301-charger: Add pm_runtime_resume & pm_runtime_suspend
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-07 12:35:51 +08:00
M BenZoubeir
f4095a0f06 pm2301-charger: Adjust interrupt handler behavior
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-07 12:35:51 +08:00
Marcus Cooper
b3ea5f451e ab8500-charger: Add UsbLineCtrl2 reference
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-07 12:35:50 +08:00
Lee Jones
257107ae6b ab8500-chargalg: Use hrtimer
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-07 12:35:49 +08:00
Lee Jones
eaded808c9 abx500-chargalg: Prevent the watchdog from being kicked twice
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-07 12:35:49 +08:00
Marcus Cooper
88efdb8022 ab8500-charger: Use USBLink1Status Register
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-07 12:35:48 +08:00
Lee Jones
861a30da53 ab8500-bm: Add support for the new ab8540 platform
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-07 12:35:48 +08:00
Rupesh Kumar
2c4c40ac00 ab8500-btemp: Defer btemp filtering while initialising
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-07 12:35:47 +08:00
Lee Jones
db43e6c473 ab8500-bm: Add usb power path support
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-07 12:35:46 +08:00
Marcus Cooper
405fea1c66 pm2301-charger: Always compile the PM2301 Charger driver with AB8500 Battery 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-07 12:35:46 +08:00
Hakan Berg
d4337660d0 ab8500-charger: Add AB8505_USB_LINK_STATUS
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-07 12:35:45 +08:00
Hakan Berg
642776182c ab8500-fg: Allow capacity to raise from 1% when charging
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-07 12:35:44 +08:00
Hakan Berg
908fe8d6a5 ab8500-btemp: Filter btemp readings
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-07 12:35:44 +08:00
Rupesh Kumar
d4f510f6c3 pm2301-charger: Wake system when ext charger is plugged-in
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-07 12:35:43 +08:00
Rupesh Kumar
da9e83d496 pm2301-charger: Die temp thermal protection
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-07 12:35:42 +08:00
Lee Jones
f7470b5d24 ab8500_charger: Prevent auto drop of VBUS
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-07 12:35:42 +08:00
Mustapha Ben Zoubeir
49fddeec9f pm2301-charger: Resolve I2C detection problem on ab9540
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-07 12:35:41 +08:00
Per Forlin
54fbbb6242 pm2301-charger: Force main charger detect
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-07 12:35:40 +08:00
Lee Jones
8891716e24 ab8500-bm: Charge only mode fixes for the ab9540
Fix for charging not getting enabled in charge only mode by
external charger.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
2013-03-07 12:35:40 +08:00