Commit Graph

163 Commits

Author SHA1 Message Date
Linus Torvalds 02e7cce2bc Merge git://git.infradead.org/users/cbou/battery-2.6.35
* git://git.infradead.org/users/cbou/battery-2.6.35:
  ds2782_battery: Rename get_current to fix build failure / name conflict
2010-07-27 09:22:55 -07:00
Linus Torvalds 19f0f0af09 Merge git://git.infradead.org/users/cbou/battery-2.6.35
* git://git.infradead.org/users/cbou/battery-2.6.35:
  ds2782_battery: Fix ds2782_get_capacity return value
2010-07-20 08:22:15 -07:00
Ryan Mallon 2d31757c87 ds2782_battery: Fix ds2782_get_capacity return value
The ds2782_get_capacity function should return 0 on success, not the
capacity value.

Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-06-21 19:13:36 +04:00
Peter Huewe eb9650d6d9 ds2782_battery: Rename get_current to fix build failure / name conflict
This patch changes the name of get_current function pointer to
get_battery_current to resolve a name conflict with the get_current
macro defined in current.h.

This conflict resulted in a build-failure[1] for the sh4 arch
allyesconfig:

  drivers/power/ds2782_battery.c:216:48: error: macro "get_current"
  passed 2 arguments, but takes just

This patch fixes the issue. To be consistent the other function pointers
(_voltage,_capacity) were renamed too.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Acked-by: Ryan Mallon <ryan@bluewatersys.com>
Acked-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-06-14 19:33:22 +04:00
Marek Vasut 56b925fccc [ARM] pxa/z2: fix missing include in battery driver
Remove redundant includes and add slab.h to fix problem with building.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2010-06-13 23:55:13 +08:00
Wolfram Sang fbae3fb154 i2c: Remove all i2c_set_clientdata(client, NULL) in drivers
I2C drivers can use the clientdata-pointer to point to private data. As I2C
devices are not really unregistered, but merely detached from their driver, it
used to be the drivers obligation to clear this pointer during remove() or a
failed probe(). As a couple of drivers forgot to do this, it was agreed that it
was cleaner if the i2c-core does this clearance when appropriate, as there is
no guarantee for the lifetime of the clientdata-pointer after remove() anyhow.
This feature was added to the core with commit
e4a7b9b04d to fix the faulty drivers.

As there is no need anymore to clear the clientdata-pointer, remove all current
occurrences in the drivers to simplify the code and prevent confusion.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Richard Purdie <rpurdie@linux.intel.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
2010-06-03 11:33:58 +02:00
Linus Torvalds 4961ab934a Merge git://git.infradead.org/battery-2.6
* git://git.infradead.org/battery-2.6:
  power_supply: Fix regression for 'type' property
2010-05-25 08:16:34 -07:00
Daniel Mack bbabb158f0 power_supply: Fix regression for 'type' property
Commit 5f487cd34f (power_supply: Use
attribute groups) causes a regression the power supply core does not
export the 'type' attribute anymore.

POWER_SUPPLY_PROP_TYPE is handled by the power supply core without the
low-level driver, so power_supply_attr_is_visible() must always return
the entry as readable.

Reported-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Daniel Mack <daniel@caiaq.de>
Tested-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-05-25 13:52:58 +04:00
Linus Torvalds 15953654cc Merge git://git.infradead.org/battery-2.6
* git://git.infradead.org/battery-2.6:
  ds2760_battery: Document ABI change
  ds2760_battery: Make charge_now and charge_full writeable
  power_supply: Add support for writeable properties
  power_supply: Use attribute groups
  power_supply: Add test_power driver
  tosa_battery: Fix build error due to direct driver_data usage
  wm97xx_battery: Quieten sparse warning (bat_set_pdata not declared)
  ds2782_battery: Get rid of magic numbers in driver_data
  ds2782_battery: Add support for ds2786 battery gas gauge
  pda_power: Add function callbacks for suspend and resume
  wm831x_power: Use genirq
  Driver for Zipit Z2 battery chip
  ds2782_battery: Fix clientdata on removal
2010-05-24 08:00:13 -07:00
Chris Wright 2c3c8bea60 sysfs: add struct file* to bin_attr callbacks
This allows bin_attr->read,write,mmap callbacks to check file specific data
(such as inode owner) as part of any privilege validation.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2010-05-21 09:37:31 -07:00
Daniel Mack bd52ca555e ds2760_battery: Make charge_now and charge_full writeable
For userspace tools and daemons, it might be necessary to adjust
the charge_now and charge_full properties of the ds2760 battery monitor,
for example for unavoidable corrections due to aging batteries.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Matt Reimer <mreimer@vpop.net>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Tejun Heo <tj@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>
Cc: Len Brown <len.brown@intel.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-05-19 12:14:42 +04:00
Daniel Mack 0011d2d4a5 power_supply: Add support for writeable properties
This patch adds support for writeable power supply properties and
exposes them as writeable to sysfs.

A power supply implementation must implement two new function calls in
order to use that feature:

  int set_property(struct power_supply *psy,
                   enum power_supply_property psp,
                   const union power_supply_propval *val);

  int property_is_writeable(struct power_supply *psy,
                            enum power_supply_property psp);

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Alexey Starikovskiy <astarikovskiy@suse.de>
Cc: Len Brown <len.brown@intel.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Matt Reimer <mreimer@vpop.net>
Cc: Evgeniy Polyakov <zbr@ioremap.net>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-05-19 12:14:42 +04:00
Anton Vorontsov 5f487cd34f power_supply: Use attribute groups
This fixes a race between power supply device and initial
attributes creation, plus makes it possible to implement
writable properties.

[Daniel Mack - removed superflous return statement
 and dropped .mode attribute from POWER_SUPPLY_ATTR]

Suggested-by: Greg KH <gregkh@suse.de>
Suggested-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Tested-by: Daniel Mack <daniel@caiaq.de>
2010-05-19 12:14:28 +04:00
Anton Vorontsov a1e50fd445 power_supply: Add test_power driver
Just a handy driver that is used for testing purposes.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-05-18 19:58:56 +04:00
Dmitry Eremin-Solenikov 06b9e650ce tosa_battery: Fix build error due to direct driver_data usage
The driver isn't buildable since 2.6.32 (i.e. commit b4028437
"Driver core: move dev_get/set_drvdata to drivers/base/dd.c"):

  CC      tosa_battery.o
tosa_battery.c: In function 'tosa_read_bat':
tosa_battery.c:64: error: 'struct device' has no member named 'driver_data'
tosa_battery.c: In function 'tosa_read_temp':
tosa_battery.c:84: error: 'struct device' has no member named 'driver_data'

Nowadays we must not access driver_data directly, use dev_get_drvdata()
instead.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-05-03 00:02:56 +04:00
Anton Vorontsov b1458fb57d wm97xx_battery: Quieten sparse warning (bat_set_pdata not declared)
This patch fixes following sparse warning:

drivers/power/wm97xx_battery.c:311:6: warning: symbol 'wm97xx_bat_set_pdata' was not declared. Should it be static?

Note that we can't just include linux/wm97xx_batt.h because the header
is deprecated, and so this pops up:

In file included from drivers/power/wm97xx_battery.c:22:
include/linux/wm97xx_batt.h:6: warning: #warning This file will be removed soon, use wm97xx.h instead!

Since wm97xx_bat_set_pdata() is also deprecated (in favour of pdata
passed via AC97 bus), just workaround the issue by declaring the
function in wm97xx_battery.c.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-05-02 23:58:30 +04:00
Anton Vorontsov ab6cc8f9b7 ds2782_battery: Get rid of magic numbers in driver_data
Constructions like 'if (id->driver_data == 1)' look quite weird.
This patch introduces 'enum ds278x_num_id', which makes things
much more understandable, i.e. 'if (id->driver_data == DS2786)'.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Mike Rapoport <mike@compulab.co.il>
2010-05-02 23:41:53 +04:00
Yulia Vilensky 9b9ade6b61 ds2782_battery: Add support for ds2786 battery gas gauge
Signed-off-by: Yulia Vilensky <vilensky@compulab.co.il>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-04-26 22:03:42 +04:00
Anton Vorontsov 8ef1bb5392 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 2010-04-26 21:56:19 +04:00
Daniel Mack a3bcbbee83 pda_power: Add function callbacks for suspend and resume
Add function prototypes for power management events so they can be
handled and used by platform implementations.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Dmitry Baryshkov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-04-16 19:14:34 +04:00
Mark Brown b5874f33bb wm831x_power: Use genirq
Since the WM831x core has been converted to use genirq for the
interrupt controller there is no longer any need for chip specific
wrappers for IRQ operations. Convert to use genirq directly.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-04-06 20:51:09 +04:00
Marek Vasut e3e8d1c93f Driver for Zipit Z2 battery chip
This patch adds driver for Zipit Z2 battery chip called AER915. No
details are known about the chip. The chip is available through I2C bus
at address 0x55 and it's register 0x02 contains battery voltage.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-04-06 20:35:58 +04:00
Wolfram Sang a009d29ea1 ds2782_battery: Fix clientdata on removal
Probably due to a copy & paste bug, clientdata was set again to the data
structure (which is freed immediately afterwards) when it should be
NULLed. Just remove the calls as the i2c-core does this automatically
now.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Cc: Ryan Mallon <ryan@bluewatersys.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-04-06 20:07:05 +04:00
Tejun Heo 5a0e3ad6af include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files.  percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed.  Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability.  As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

  http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
  only the necessary includes are there.  ie. if only gfp is used,
  gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
  blocks and try to put the new include such that its order conforms
  to its surrounding.  It's put in the include block which contains
  core kernel includes, in the same order that the rest are ordered -
  alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
  doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
  because the file doesn't have fitting include block), it prints out
  an error message indicating which .h file needs to be added to the
  file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
   over 4000 files, deleting around 700 includes and adding ~480 gfp.h
   and ~3000 slab.h inclusions.  The script emitted errors for ~400
   files.

2. Each error was manually checked.  Some didn't need the inclusion,
   some needed manual addition while adding it to implementation .h or
   embedding .c file was more appropriate for others.  This step added
   inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
   from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
   e.g. lib/decompress_*.c used malloc/free() wrappers around slab
   APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
   editing them as sprinkling gfp.h and slab.h inclusions around .h
   files could easily lead to inclusion dependency hell.  Most gfp.h
   inclusion directives were ignored as stuff from gfp.h was usually
   wildly available and often used in preprocessor macros.  Each
   slab.h inclusion directive was examined and added manually as
   necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
   were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
   distributed build env didn't work with gcov compiles) and a few
   more options had to be turned off depending on archs to make things
   build (like ipr on powerpc/64 which failed due to missing writeq).

   * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
   * powerpc and powerpc64 SMP allmodconfig
   * sparc and sparc64 SMP allmodconfig
   * ia64 SMP allmodconfig
   * s390 SMP allmodconfig
   * alpha SMP allmodconfig
   * um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
   a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-30 22:02:32 +09:00
Len Brown ec28dcc6b4 Merge branches 'battery-2.6.34', 'bugzilla-10805', 'bugzilla-14668', 'bugzilla-531916-power-state', 'ht-warn-2.6.34', 'pnp', 'processor-rename', 'sony-2.6.34', 'suse-bugzilla-531547', 'tz-check', 'video' and 'misc-2.6.34' into release 2010-03-14 21:30:17 -04:00
Haojian Zhuang 28db38888b power_supply: Enable power supply of max8925
MAX8925 is a PMIC that contains charger component

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-03-07 22:17:17 +01:00
Mark Brown 59f25070df mfd: Update WM8350 drivers for changed interrupt numbers
The headphone detect and charger are using the IRQ numbers so need
to take account of irq_base with the genirq conversion. I obviously
picked the wrong system for initial testing.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-03-07 22:16:58 +01:00
Mark Brown f99344fc69 mfd: Add a data argument to the WM8350 IRQ free function
To better match genirq.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-03-07 22:16:56 +01:00
Grazvydas Ignotas afbc74fdc5 power_supply: bq27x00: fix voltage and current units
The chip returns voltage and current in mV and mA, but
power supply class uses uV and uA, so add missing conversion.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-02-27 18:09:24 +03:00
Grazvydas Ignotas 4e924a814a power_supply: bq27x00: add status and time properties
The BQ27x00 series of chips can report time-to-empty and
time-to-full, so let's add corresponding properties.
Also report charge status based on status flag register.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-02-27 18:09:23 +03:00
Grazvydas Ignotas e20908d95e power_supply: bq27x00: add BQ27500 support
BQ27500 is newer fuel gauge chip from TI with slightly changed
register layout and some different register semantics. Add new i2c
ID for it and handle differences where needed. Also rename bq27200
functions to bq27x00, as they are no longer bq27200 specific.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-02-16 21:26:52 +03:00
Grazvydas Ignotas b4de360815 power_supply: bq27x00: fix temperature conversion
The power supply class requires tenths of degree Celsius.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-02-16 21:26:46 +03:00
Grazvydas Ignotas ba96f8717e power_supply: bq27x00: remove unused struct fields
These are probably leftover from old TI code.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-02-16 21:26:37 +03:00
Grazvydas Ignotas 97f70c23a1 power_supply: bq27x00: remove double endian swap
The bq27x00 registers are little endian, so just read them as such
and don't do double endian swap on LE machines.

This also gets rid of strange looking shift that was done after
reading 8bit register because endian swap in bq27x00_read() was
messing it up.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Rodolfo Giometti <giometti@linux.it>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-02-16 21:26:14 +03:00
Stefan Weil 5324dc0e38 da9030_battery: fix spelling in comment
platfrom -> platform
monotor -> monitor

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Cc: Anton Vorontsov <cbouatmailru@gmail.com>
Acked-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2010-02-03 01:51:18 +03:00
Mark Brown f8d94eb77e wm97xx_battery: Clean up some warnings
Staticise work_lock (nothing outside the driver has any reason to
see it) and specify dev when requesting the charger IRQ (since that's
what we pass in when we free it).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2010-01-29 17:02:13 +03:00
Mark Brown 12b336a8b4 wm97xx_battery: Handle missing platform data gracefully
Don't unconditionally dereference the WM97xx core platform data since
it may not be present, causing an oops.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2010-01-29 17:00:18 +03:00
Alexey Starikovskiy c955fe8e0b POWER: Add support for cycle_count
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
2010-01-15 16:59:21 -05:00
Thomas Champagne d54e7929d8 pmu_battery: Fix battery full reporting
Prior to this patch, pmu_battery was unable to report battery full
status. This patch fixes the issue by adding a proper handling code
into pmu_bat_get_property(): if we're on AC and the battery isn't
charging, then the battery is considered full.

Signed-off-by: Thomas Champagne <lafeuil@gmail.com>
Acked-By: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-12-18 03:51:29 +03:00
Linus Torvalds 48e902f0a3 Merge git://git.infradead.org/battery-2.6
* git://git.infradead.org/battery-2.6:
  power_supply_sysfs: Handle -ENODATA in a special way
  wm831x_backup: Remove unused variables
  gta02: Set pcf50633 charger_reference_current_ma
  pcf50633: Query charger status directly
  pcf50633: Properly reenable charging when the supply conditions change
  pcf50633: Get rid of charging restart software auto-triggering
  pcf50633: introduces battery charging current control
  pcf50633: Add ac power supply class to the charger
  wm831x: Factor out WM831x backup battery charger
2009-12-15 08:59:33 -08:00
Alexey Dobriyan 471452104b const: constify remaining dev_pm_ops
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-12-15 08:53:25 -08:00
Mark Brown 6a6127462e mfd: Mask and unmask wm8350 IRQs on request and free
Bring the WM8350 IRQ API more in line with the generic IRQ API by
masking and unmasking interrupts as they are requested and freed.
This is mostly just a case of deleting the mask and unmask calls
from the individual drivers.

The RTC driver is changed to mask the periodic IRQ after requesting
it rather than only unmasking the alarm IRQ. If the periodic IRQ
fires in the period where it is reqested then there will be a
spurious notification but there should be no serious consequences
from this.

The CODEC drive is changed to explicitly disable headphone jack
detection prior to requesting the IRQs. This will avoid the IRQ
firing with no jack set up.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2009-12-13 19:21:40 +01:00
Mark Brown 5a65edbc12 mfd: Convert wm8350 IRQ handlers to irq_handler_t
This is done as simple code transformation, the semantics of the
IRQ API provided by the core are are still very different to those
of genirq (mainly with regard to masking).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2009-12-13 19:21:39 +01:00
Lars-Peter Clausen 68d641efd8 mfd: Fix memleak in pcf50633_client_dev_register
Since platform_device_add_data copies the passed data, the allocated
subdev_pdata is never freed. A simple fix would be to either free subdev_pdata
or put it onto the stack. But since the pcf50633 child devices can rely on
beeing children of the pcf50633 core device it's much more elegant to get access
to pcf50633 core structure through that link. This allows to get completly rid
of pcf5033_subdev_pdata.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2009-12-13 19:21:17 +01:00
Anton Vorontsov 9d233e8bb9 power_supply_sysfs: Handle -ENODATA in a special way
There are cases when some device can not report any meaningful value,
e.g. TWL4030 charger can report voltage only when charging is
active.

In these cases drivers will return -ENODATA, and we shouldn't flood
kernel log with error messages.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2009-12-03 00:38:06 +03:00
Thomas Kunze f1fce597e6 collie: add battery driver
This driver is based on tosa_battery.c.
2009-11-27 21:07:23 +01:00
Alan Cox 0e19dbb73e wm831x_backup: Remove unused variables
Signed-off-by: Alan Cox <alan@linux.intel.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-11-17 19:16:38 +03:00
Paul Fertser c329795052 pcf50633: Query charger status directly
Current scheme is fragile and is likely to go off sync, especially on
batfull->adapter charging automatic MBC transition.

Query the status bit every time we need it instead.

We need to export another function to query for USB presence because
we can't read anything from PCF50633 (via I2C) inside irq context and
that is needed by usb gadgets.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-11-16 03:32:09 +03:00
Paul Fertser 1282b35a1e pcf50633: Properly reenable charging when the supply conditions change
If chgmod == BATFULL, setting chgena has no effect. Datasheet says we
need to set resume instead but when autoresume is used resume doesn't
work. Clear and set chgena instead.

This enables a user to force charging by re-plugging USB even when the
charger entered Battery Full mode, might be handy before a long trip.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-11-16 03:31:40 +03:00
Paul Fertser e98c73a24f pcf50633: Get rid of charging restart software auto-triggering
After reaching Battery Full condition MBC state machine switches back
into charging mode when the battery voltage falls below 96% of a
battery float voltage. The voltage drop in Li-Ion batteries is
marginal (1-2%) till about 80% of its capacity - which means, after a
BATFULL, charging won't be restarted until 75-80%.

That is a desired behaviour recommended by battery manufacturers,
don't mess with it.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-11-16 03:31:17 +03:00