Commit Graph

43 Commits

Author SHA1 Message Date
Wolfram Sang 16735d022f tree-wide: use reinit_completion instead of INIT_COMPLETION
Use this new function to make code more comprehensible, since we are
reinitialzing the completion, not initializing.

[akpm@linux-foundation.org: linux-next resyncs]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org> (personally at LCE13)
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-11-15 09:32:21 +09:00
Jingoo Han 4b43eb67ae power_supply: Replace strict_strtoul() with kstrtoul()
The usage of strict_strtoul() is not preferred, because strict_strtoul()
is obsolete. Thus, kstrtoul() should be used.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-06-06 17:35:38 -07:00
Jingoo Han ddeeb8f973 ab8500_bm: Remove unnecessary platform_set_drvdata()
The driver core clears the driver data to NULL after device_release or on
probe failure, since commit 0998d06310
(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-06-06 17:13:09 -07:00
Hongbo Zhang 2c89940786 ab8500_{bmdata,fg}: Add const attributes to some data arrays
This patch adds const attributes to AB8500 power and temperature related
read-only data arrays.

Signed-off-by: Hongbo Zhang <hongbo.zhang@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-04-16 17:34:36 -07: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
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
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
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
Martin Bergstrom e82c5bdbf3 ab8500-fg: Report unscaled capacity
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-07 12:35:36 +08:00
Lee Jones 93ff722e88 ab8500-fg: Add power cut feature for ab8505 and ab8540
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-07 12:35:36 +08:00
Rajkumar Kasirajan 1a793a1089 ab8500-fg: Use correct battery charge full design
If battery is not identified while fg probe, mah_max_design gets
initialized with unknown battery's charge full design. Reinitialize
mah_max_design if battery is identified after fg probe.

Signed-off-by: Rajkumar Kasirajan <rajkumar.kasirajan@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Vijaya Kumar K-1 <vijay.kilari@stericsson.com>
Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com>
Reviewed-by: Olivier CLERGEAUD <olivier.clergeaud@stericsson.com>
Reviewed-by: Arun MURTHY <arun.murthy@stericsson.com>
Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com>
Tested-by: Rupesh KUMAR <rupesh.kumar@stericsson.com>
Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-01-23 14:39:20 +00:00
Jonas Aaberg 53ef1f590d ab8500-bm: Flush all work queues before suspending
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-23 14:39:18 +00:00
Martin Bergström ffaa39d9ed ab8500-fg: Go to INIT_RECOVERY when charger removed
When the charger is removed we need to go to INIT_RECOVERY
state instead of directly to RECOVERY state.

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>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Tested-by: Jonas ABERG <jonas.aberg@stericsson.com>
2013-01-23 14:39:17 +00:00
Hakan Berg 75f2a219ff ab8500-fg: Adjust for RF bursts voltage drops
Changed conditions for restarting low battery measurements counter
and adjusted the interval between measurements to avoid RF burst
induced voltage drops, and to shorten time to decide to shut down.

Signed-off-by: Hakan Berg <hakan.berg@stericsson.com>
Signed-off-by: Martin Bergstrom <martin.bergstrom@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Reviewed-by: Marcus COOPER <marcus.xm.cooper@stericsson.com>
2013-01-23 11:33:03 +00:00
Lee Jones 41ce25657b ab8500_fg: Remove pointless round_jiffies() call
As HZ is a full-second, there is little point in rounding it.
Let's save a few cycles by using HZ directly.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15 17:44:46 -08:00
Paer-Olof Haakansson f902dadc12 ab8500_fg: Overflow in current calculation
When calculating the average current the nominator will
overflow when the charging current is high.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Henrik Sölver <henrik.solver@stericsson.com>
Reviewed-by: Par-Olof HAKANSSON <par-olof.hakansson@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Tested-by: Par-Olof HAKANSSON <par-olof.hakansson@stericsson.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15 17:44:44 -08:00
Hakan Berg 8bcf3b39a8 ab8500_fg: Added support for BATT_OVV
Add support for the battery over-voltage situation

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Hakan Berg <hakan.berg@stericsson.com>
Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15 17:44:38 -08:00
pender01 6eaf8740da ab8500_fg: Round capacity output
Round the capacity values for better enduser experience.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: pender01 <peter.enderborg@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Tested-by: Marcus COOPER <marcus.xm.cooper@stericsson.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15 17:44:34 -08:00
Rickard Andersson 129d583b44 ab8500_fg: Balance IRQ enable
In case of time out error IRQ needs to be disabled
otherwise we will get unbalanced enable/disable pairs.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Rickard Andersson <rickard.andersson@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15 17:44:26 -08:00
Marcus Cooper ea40240178 ab8500_bm: Recharge condition not optimal for battery
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-15 17:43:46 -08:00
Jonas Aaberg 9a0bd070fd ab8500_fg: Replace msleep() with usleep_range() for greater accuracy
Doing so provides a greater degree of accuracy when dealing with
time-frames between 1us and 20ms. msleep() is only accurate for
wake-ups greater than 20ms.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Jonas ABERG <jonas.aberg@stericsson.com>
Reviewed-by: Johan BJORNSTEDT <johan.bjornstedt@stericsson.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15 17:35:19 -08:00
Johan Bjornstedt 3988a4df34 ab8500_bm: Skip first CCEOC irq for instant current
When enabling the CCEOC irq we might get false interrupt
from ab8500-driver due to the latched value will be saved
and interpreted as an IRQ when enabled

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Johan Bjornstedt <johan.bjornstedt@stericsson.com>
Signed-off-by: Henrik Solver <henrik.solver@stericsson.com>
Reviewed-by: Karl KOMIEROWSKI <karl.komierowski@stericsson.com>
Signed-off-by: Anton Vorontsov <anton@enomsg.org>
2013-01-15 17:10:17 -08:00
Anton Vorontsov 240fbe2347 Merge branch 'for-anton' of git://git.linaro.org/people/ljones/linux-3.0-ux500 2013-01-05 17:14:22 -08:00
Anton Vorontsov 76d8a23b12 Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
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-11 22:15:57 -08:00
Lee Jones 195c1c660c ab8500_fg: Reorder obtainment of platform specific battery management data
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-11 08:43:55 +00:00
Lee Jones 23a04f9f40 ab8500_bm: Always send platform specific battery information via pdata
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-11 08:43:54 +00:00
Lee Jones b0284de05e ab8500_bm: Rename battery management platform data to something more logical
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-11 08:43:53 +00:00
Kalle Komierowski e32ad07cea ab8500_fg: Don't clear the CCMuxOffset bit
The CCMuxOffset bit is not kept set. This will force the
columb counter of the AB8500 to use the measure offset
calibration. This should increase the accuracy of the fuel
gauge.

Signed-off-by: Kalle Komierowski <karl.komierowski@stericsson.com>
Signed-off-by: Marcus Cooper <marcus.xm.cooper@stericsson.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
2012-12-11 08:43:52 +00:00
Bill Pemberton 415ec69fb1 power: remove use of __devexit
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-28 11:43:22 -08:00
Bill Pemberton c8afa6406e power: remove use of __devinit
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-28 11:43:22 -08:00
Bill Pemberton 28ea73f4c6 power: remove use of __devexit_p
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-28 11:43:22 -08:00
Rajanikanth H.V e0f1abeba5 ab8500: Add devicetree support for fuelgauge
- 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-11-18 19:37:04 -08:00
Linus Torvalds e665faa424 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.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iQIcBAABAgAGBQJQbjMFAAoJEGgI9fZJve1bR6gP/2Ri0etCU5zQMmbsFv5wxwHT
 BNgqFYoLmtxAJm7afM/9Qo2GxSam/Gi6vW6jfYxVOEDt9hJ5zaaJBxM4XmKEBShR
 PYlV9u45jGUCIHJXoi8DTND9Swz0VfVve9UtK5fVdXr73fYFemP8U86alI1MBL5Q
 8U3F0V8rObjGKWZrzN4BreB8bfbZYQCUafpoGS1ids3Uwm38d4tDb/jx8guSV24D
 LEhXy9unV9NdPExRn1FWFAgqjtgnnBv5SmpCBd6VwKNmpOgVB+H0CjOaOPzMgd+0
 X6dpJQtbjGZOhHhkcAoWsXYgxS8WMtTqlSjHSgswJJ/fdjv8YJoT7ncyu5wItY1x
 cN5NRBKVpnHv+fkQDE4xVWzEOH68lK8RoGksay0gvTJj3MQWwOpOANGHbsnMG6rj
 GBzQ7pyMbDTK7n1oynvmSskF4BdvYHM+Ns7vPUOAzoduKrOnhPVDpk3rLSFZxQNO
 RoqXbnNYqg4qROB9z8Drs95WD59fKjNTlfFr1moR2sr4wncEJiFduMz4dCOs7nq7
 ahZxd95a2Bb6LbcN244+loGBXmx6KD6BurrDc3yTM3hl+oVx+MecVv9uoKvKlz4y
 YPh9XrdCSfj9Ms7TOqW8XPDl/ZREswaCIer7x8XsL+K42fYkPKlrO3OUMHIbh+3e
 rfkFPAR55bLcmtiaahp3
 =LkdH
 -----END PGP SIGNATURE-----

Merge tag 'for-v3.7' of git://git.infradead.org/battery-2.6

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-10-07 17:29:24 +09:00
Julia Lawall d2941651d7 ab8500_fg: Fix error return code
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-22 18:48:01 -07:00
Tejun Heo 203b42f731 workqueue: make deferrable delayed_work initializer names consistent
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-08-21 13:18:23 -07:00
Lee Jones 2aac3de19b ab8500: Clean up probe routines
These patches clean up some ugliness and brings the variable
initialisation formatting more into line with other drivers.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05 04:55:50 -07:00
Linus Walleij 5f98eb393c ab8500_fg: Harden platform data check
If no platform data at all is supplied the driver crashes,
extend the checks to be more careful so we can compile in the
driver and boot also without platform data present.

Acked-by: Arun Murthy <arun.murthy@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05 03:59:56 -07:00
Anton Vorontsov 5ae2b822e4 ab8500_fg: Fix some build warnings on x86_64
Noticed the following warnings:

  CC      drivers/power/ab8500_fg.o
drivers/power/ab8500_fg.c: In function 'charge_full_store':
drivers/power/ab8500_fg.c:2258:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'ssize_t' [-Wformat]
drivers/power/ab8500_fg.c: In function ‘charge_now_store’:
drivers/power/ab8500_fg.c:2280:2: warning: format '%d' expects argument of type 'int', but argument 4 has type 'ssize_t' [-Wformat]

This patch fixes the issues.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:41:26 +04:00
Anton Vorontsov 64eb9b02bf ab8500: Turn unneeded global symbols into local ones
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-26 20:41:14 +04:00
Anton Vorontsov 0fff22ee79 ab8500_fg: Fix copy-paste error
ab8500_fg_discharge_state_to() function should accept
'enum ab8500_fg_discharge_state' argument, not
'enum ab8500_fg_charge_state'.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:41:12 +04:00
Anton Vorontsov c34a61b4e7 ab8500_fg: Get rid of 'struct battery_type'
The struct is duplicated, plus causes the following flood:

  CC      drivers/power/ab8500_fg.o
ab8500_fg.c: In function ‘ab8500_fg_get_ext_psy_data’:
b8500_fg.c:2081:8: warning: assignment from incompatible pointer type [enabled by default]

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:41:11 +04:00
Anton Vorontsov 450ceb2b23 ab8500_fg: Get rid of 'struct v_to_cap'
The struct is duplicated, plus when used it causes the following
warnings:

  CHECK   drivers/power/ab8500_fg.c
ab8500_fg.c:818:13: warning: incorrect type in assignment (different base types)
ab8500_fg.c:818:13:    expected struct v_to_cap *tbl
ab8500_fg.c:818:13:    got struct abx500_v_to_cap *const v_to_cap_tbl
  CC      drivers/power/ab8500_fg.o
ab8500_fg.c: In function 'ab8500_fg_volt_to_capacity':
ab8500_fg.c:818:6: warning: assignment from incompatible pointer type [enabled by default]

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:41:10 +04:00
Arun Murthy 13151631b5 ab8500-fg: A8500 fuel gauge driver
This driver is responsible for provide battery parameters to user space via
sysfs by registers to power supply class. It uses fuel gauge and gpadc driver
in obtaining the battery parameters. These battery properties are used by
abx500 charging algorithm driver to monitor the battery.

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>
2012-03-26 20:41:05 +04:00