Commit graph

253 commits

Author SHA1 Message Date
Heikki Krogerus e1a85694e0 isp1704_charger: Detect charger after probe
If the device is booted up with cable connected, or the
module is loaded after plugging in the cable, the
notification has come and gone, so not relying on it at
probe time. Instead this checks the VBUS level manually
after probe.

Signed-off-by: Heikki Krogerus <heikki.krogerus@nokia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-11-18 16:56:21 +03:00
Heikki Krogerus a4607d9f5c isp1704_charger: Set isp->dev before anything needs it
isp1704_test_ulpi() is the first place that needs isp->dev
member, so it must be set before calling the function.

Signed-off-by: Heikki Krogerus <heikki.krogerus@nokia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-11-18 16:56:20 +03:00
Heikki Krogerus bac43b2050 isp1704_charger: Detect HUB/Host chargers
To avoid breaking high speed chirp handshaking with CDP
chargers, no more then 500mA should be drawn. To make sure
of this, utilizing current_max property. After the device
has enumerated, it's safe to draw the maximum 1800mA as
defined in the Battery Charging Specification. This can be
also used with normal USB connection if the controller sends
ENUMERATED notification with the milliamps as data.

From now on the online property indicates VBUS, present
property if there is a charger and current_max the milliamps
possible to draw from VBUS.

Signed-off-by: Heikki Krogerus <heikki.krogerus@nokia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-11-18 16:56:19 +03:00
Ameya Palande 746d8fb8c6 isp1704_charger: Correct length for storing model
Model should have room to accommodate the trailing null byte,
"isp170[4|7]\0".

Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
Acked-by: Heikki Krogerus <heikki.krogerus@nokia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-11-18 16:56:18 +03:00
Lars-Peter Clausen 5070437cd9 power_supply: Add gpio charger driver
This patch adds a simple driver for chargers indicating their online
status through a GPIO pin.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-11-18 16:56:17 +03:00
Lars-Peter Clausen 8ec98fe0b4 jz4740-battery: Protect against concurrent battery readings
We can not handle more then one ADC request at a time to the battery.
The patch adds a mutex around the ADC read code to ensure this.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: stable@kernel.org
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-11-18 16:56:16 +03:00
Sven Neumann 86af95039b ds2760_battery: Fix calculation of time_to_empty_now
A check against division by zero was modified in commit b0525b48.
Since this change time_to_empty_now is always reported as zero
while the battery is discharging and as a negative value while
the battery is charging. This is because current is negative while
the battery is discharging.

Fix the check introduced by commit b0525b48 so that time_to_empty_now
is reported correctly during discharge and as zero while charging.

Signed-off-by: Sven Neumann <s.neumann@raumfeld.com>
Acked-by: Daniel Mack <daniel@caiaq.de>
Cc: stable@kernel.org [2.6.32..2.6.36]
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-11-18 16:56:15 +03:00
Uwe Kleine-König b595076a18 tree-wide: fix comment/printk typos
"gadget", "through", "command", "maintain", "maintain", "controller", "address",
"between", "initiali[zs]e", "instead", "function", "select", "already",
"equal", "access", "management", "hierarchy", "registration", "interest",
"relative", "memory", "offset", "already",

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2010-11-01 15:38:34 -04:00
Samuel Ortiz 0f48285755 power: Revert "power_supply: Mark twl4030_charger as broken"
The missing definitions are now in.

This reverts commit 23886839a7.

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2010-10-29 00:30:44 +02:00
Anton Vorontsov 23886839a7 power_supply: Mark twl4030_charger as broken
The driver is not buildable without MFD changes. For now, let's
disable the driver as it breaks build for major platforms (i.e. x86).

  CC [M]  drivers/power/twl4030_charger.o
drivers/power/twl4030_charger.c: In function 'twl4030_clear_set_boot_bci':
drivers/power/twl4030_charger.c:105: error: 'TWL4030_PM_MASTER_BOOT_BCI' undeclared (first use in this function)
drivers/power/twl4030_charger.c:105: error: (Each undeclared identifier is reported only once
drivers/power/twl4030_charger.c:105: error: for each function it appears in.)
drivers/power/twl4030_charger.c: In function 'twl4030_bci_have_vbus':
drivers/power/twl4030_charger.c:137: error: 'TWL4030_PM_MASTER_STS_HW_CONDITIONS' undeclared (first use in this function)
drivers/power/twl4030_charger.c: In function 'twl4030_bci_probe':
drivers/power/twl4030_charger.c:477: warning: overflow in implicit constant conversion
drivers/power/twl4030_charger.c:485: warning: overflow in implicit constant conversion
make[2]: *** [drivers/power/twl4030_charger.o] Error 1

We can re-enable it if MFD tree will finally merge into 2.6.37.

Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-10-28 12:59:52 +04:00
Linus Torvalds 45352bbf48 Merge git://git.infradead.org/battery-2.6
* git://git.infradead.org/battery-2.6:
  power_supply: Makefile cleanup
  bq27x00_battery: Add missing kfree(di->bus) in bq27x00_battery_remove()
  power_supply: Introduce maximum current property
  power_supply: Add types for USB chargers
  ds2782_battery: Fix units
  power_supply: Add driver for TWL4030/TPS65950 BCI charger
  bq20z75: Add support for more power supply properties
  wm831x_power: Add missing kfree(wm831x_power) in wm831x_power_remove()
  jz4740-battery: Add missing kfree(jz_battery) in jz_battery_remove()
  ds2760_battery: Add missing kfree(di) in ds2760_battery_remove()
  olpc_battery: Fix endian neutral breakage for s16 values
  ds2760_battery: Fix W1 and W1_SLAVE_DS2760 dependency
  pcf50633-charger: Add missing sysfs_remove_group()
  power_supply: Add driver for TI BQ20Z75 gas gauge IC
  wm831x_power: Remove duplicate chg mask
  omap: rx51: Add support for USB chargers
  power_supply: Add isp1704 charger detection driver
2010-10-26 10:14:23 -07:00
matt mooney 5789451713 power_supply: Makefile cleanup
Replace EXTRA_CFLAGS with ccflags-y; remove if-statements and replace
with lists using the kbuild idiom.

None of the dependencies are modified.

Signed-off-by: matt mooney <mfm@muteddisk.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-10-06 17:38:42 +04:00
Axel Lin 9292585c67 bq27x00_battery: Add missing kfree(di->bus) in bq27x00_battery_remove()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-10-06 17:38:15 +04:00
Heikki Krogerus fe3f6d097a power_supply: Introduce maximum current property
USB only gives the maximum current allowed to draw.

Signed-off-by: Heikki Krogerus <ext-heikki.krogerus@nokia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-10-06 17:37:22 +04:00
Heikki Krogerus 85efc8a18c power_supply: Add types for USB chargers
This adds power supply types for USB chargers defined in
Battery Charging Specification 1.1.

Signed-off-by: Heikki Krogerus <ext-heikki.krogerus@nokia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-10-06 17:37:09 +04:00
Ryan Mallon 353f867b55 ds2782_battery: Fix units
Correct the unit names in the ds2782 battery driver. Changes voltage_uA
to voltage_uV and capacity_uA to capacity.

Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Ben Hutchings <ben@decadent.org.uk>
Cc: Yulia Vilensky <vilensky@compulab.co.il>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-10-06 17:36:49 +04:00
Grazvydas Ignotas 2e727f1787 power_supply: Add driver for TWL4030/TPS65950 BCI charger
TWL4030/TPS65950 is a multi-function device with integrated charger,
which allows charging from AC or USB. This driver enables the charger
and provides several monitoring functions.

Tested on OMAP3 Pandora board.

Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-30 19:28:09 +04:00
Rhyland Klein d3ab61ecba bq20z75: Add support for more power supply properties
This patch adds properties to support devicekit power. Also, create IO
wrapper functions and fix some issues found while testing, including
unit conversions to match the power_supply types.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-28 16:42:35 +04:00
Axel Lin 9c99f08991 wm831x_power: Add missing kfree(wm831x_power) in wm831x_power_remove()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-28 15:52:34 +04:00
Axel Lin 5f29895f3e jz4740-battery: Add missing kfree(jz_battery) in jz_battery_remove()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-By: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-28 15:52:23 +04:00
Axel Lin a01bce6ad9 ds2760_battery: Add missing kfree(di) in ds2760_battery_remove()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-28 15:16:23 +04:00
Richard A. Smith 7cfbb29466 olpc_battery: Fix endian neutral breakage for s16 values
When the driver was updated to be endian neutral (8e9c7716c)
the signed part of the s16 values was lost.  This is because be16_to_cpu()
returns an unsigned value.  This patch casts the values back to a s16
number prior to the the implicit cast up to an int.

Signed-off-by: Richard A. Smith <richard@laptop.org>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Cc: <stable@kernel.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-28 15:14:31 +04:00
Martin Schwidefsky f6127b8645 ds2760_battery: Fix W1 and W1_SLAVE_DS2760 dependency
Fix this Kconfig warning on allmodconfig for s390:

warning: (BATTERY_DS2760 && POWER_SUPPLY) selects W1 which has unmet
direct dependencies (HAS_IOMEM)

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-23 17:33:28 +04:00
Axel Lin 305da8f504 pcf50633-charger: Add missing sysfs_remove_group()
sysfs entries should be removed when unload the module.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-22 16:14:49 +04:00
Anton Vorontsov 1d220334d6 apm_power: Add missing break statement
The missing break statement causes wrong capacity calculation for
batteries that report energy.

Reported-by: d binderman <dcb314@hotmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-08 14:35:10 +04:00
Rhyland Klein a7640bfa10 power_supply: Add driver for TI BQ20Z75 gas gauge IC
This driver depends on I2C and uses SMBUS for communication with
the host.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reviewed-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-06 11:35:39 +04:00
Ian Lartey 2d98dae206 wm831x_power: Remove duplicate chg mask
Reported-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Ian Lartey <ian@opensource.wolfsonmicro.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-09-01 22:35:06 +04:00
Shuduo Sang 77f4b9fe05 intel_pmic_battery: Fix battery charging status on mrst
The arguments got swapped on some functions which produces undefined results.
The main one got fixed before submit but the other two were missed.

Signed-off-by: Shuduo Sang <shuduo.sang@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-08-24 18:27:57 +04:00
Heikki Krogerus ec46475f3e power_supply: Add isp1704 charger detection driver
NXP ISP1704 is Battery Charging Specification 1.0 compliant USB
transceiver. This adds a power supply driver for ISP1704 and
ISP1707 USB transceivers.

Signed-off-by: Heikki Krogerus <ext-heikki.krogerus@nokia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-08-19 16:25:20 +04:00
Linus Torvalds 16bb85bc12 Merge git://git.infradead.org/battery-2.6
* git://git.infradead.org/battery-2.6:
  intel_mid_battery: Fix battery scaling
  intel_mid_battery: Fix the argument order to intel_scu_ipc_command
  olpc_battery: Fix build failure caused by sysfs changes
  Add s3c-adc-battery driver
  Intel MID platform battery driver

Fix up trivial conflicts (battery drivers added from different branches)
in drivers/power/{Kconfig,Makefile}
2010-08-12 09:58:33 -07:00
Linus Torvalds 636d17427b Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (226 commits)
  ARM: 6323/1: cam60: don't use __init for cam60_spi_{flash_platform_data,partitions}
  ARM: 6324/1: cam60: move cam60_spi_devices to .init.data
  ARM: 6322/1: imx/pca100: Fix name of spi platform data
  ARM: 6321/1: fix syntax error in main Kconfig file
  ARM: 6297/1: move U300 timer to dynamic clock lookup
  ARM: 6296/1: clock U300 intcon and timer properly
  ARM: 6295/1: fix U300 apb_pclk split
  ARM: 6306/1: fix inverted MMC card detect in U300
  ARM: 6299/1: errata: TLBIASIDIS and TLBIMVAIS operations can broadcast a faulty ASID
  ARM: 6294/1: etm: do a dummy read from OSSRR during initialization
  ARM: 6292/1: coresight: add ETM management registers
  ARM: 6288/1: ftrace: document mcount formats
  ARM: 6287/1: ftrace: clean up mcount assembly indentation
  ARM: 6286/1: fix Thumb-2 decompressor broken by "Auto calculate ZRELADDR"
  ARM: 6281/1: video/imxfb.c: allow usage without BACKLIGHT_CLASS_DEVICE
  ARM: 6280/1: imx: Fix build failure when including <mach/gpio.h> without <linux/spinlock.h>
  ARM: S5PV210: Fix on missing s3c-sdhci card detection method for hsmmc3
  ARM: S5P: Fix on missing S5P_DEV_FIMC in plat-s5p/Kconfig
  ARM: S5PV210: Override FIMC driver name on Aquila board
  ARM: S5PC100: enable FIMC on SMDKC100
  ...

Fix up conflicts in arch/arm/mach-{s5pc100,s5pv210}/cpu.c due to
different subsystem 'setname' calls, and trivial port types in
include/linux/serial_core.h
2010-08-11 09:13:19 -07:00
Guenter Roeck 20d7b2415c power: Remove owner field from attribute initialization code in OLPC driver
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2010-08-10 15:33:09 -07:00
Alan Cox f59f5bcb60 intel_mid_battery: Fix battery scaling
There are 3600 seconds per not 3600 hours per second. Correcting this
along with the previous fix gives sensible numbers.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-08-10 14:35:27 +04:00
Arjan van de Ven 08a9e07e3f intel_mid_battery: Fix the argument order to intel_scu_ipc_command
The arguments to intel_scu_ipc_command are "command, subcommand"
the battery driver got this the wrong way around.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-08-10 14:34:55 +04:00
David Woodhouse 690e85a395 olpc_battery: Fix build failure caused by sysfs changes
drivers/power/olpc_battery.c:387: error: unknown field 'owner' specified in initializer
drivers/power/olpc_battery.c:387: warning: excess elements in struct initializer
drivers/power/olpc_battery.c:387: warning: (near initialization for 'olpc_bat_eeprom.attr')

The .owner field has been dropped from the attr struct.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2010-08-09 18:13:09 +01:00
Russell King f165eb77f4 Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel-stable
Conflicts:
	arch/arm/mach-pxa/palmt5.c
	arch/arm/mach-pxa/palmtreo.c
2010-08-06 18:10:25 +01:00
Lars-Peter Clausen f6a21388bd POWER: Add JZ4740 battery driver.
Add support for the battery voltage measurement part of the JZ4740 ADC unit.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/1416/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
2010-08-05 13:26:20 +01:00
Marek Vasut 5aa9a2cbc0 [ARM] wm97xx_batt: remove now useless header file
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
2010-08-05 14:32:15 +08:00
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
Vasily Khoruzhick 808be4b22f Add s3c-adc-battery driver
s3c-adc-battery is driver for monitoring and charging battery on
iPAQ H1930/H1940/RX1950.

It depends on s3c-adc driver to get battery voltage and current.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-07-23 17:08:41 +04: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
Nithish Mahalingam 6721081b6b Intel MID platform battery driver
The PMIC Battery driver provides battery charging and battery gauge
functionality on Intel MID platforms. This provides the basic functions.
There are some USB drivers to merge before the selection of charging
between the different USB power levels can be enabled.

Moved to a platform device by Alek Du.

Signed-off-by: Nithish Mahalingam <nithish.mahalingam@intel.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2010-06-17 21:52:25 +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
Balaji Rao 31b4ff06e0 pcf50633: introduces battery charging current control
Implement a new sysfs attribute to allow changing MBC charging limit on
the fly independently of usb current limit. It also gets set
automatically every time usb current limit is changed.

Limiting charging current also prevents violating USB specification in
the case when the whole device is shut down and usb current limit is
reset to the factory default by the pcf50633 state transition.

Signed-off-by: Balaji Rao <balajirrao@openmoko.org>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-11-16 03:28:31 +03:00
Sean McNeil 7677f33f0a pcf50633: Add ac power supply class to the charger
This adds an appropriate ac power_supply class and shows usb only when
at the appropriate current limit.

Signed-off-by: Sean McNeil <sean@mcneil.com>
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-11-16 03:28:06 +03:00
Mark Brown c26964ead5 wm831x: Factor out WM831x backup battery charger
The backup battery on WM831x is a separate IP block to the main PMU
and is largely unrelated to the main supply functionality. Factor it
out into a separate driver in order to reflect this and better support
future hardware versions.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2009-11-16 03:27:30 +03:00
Anton Vorontsov f056878332 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
	drivers/power/wm97xx_battery.c
2009-09-23 03:49:27 +04:00
Mark Brown 3961f7c3cf power_supply: Add driver for the PMU on WM831x PMICs
The WM831x PMICs provide power path management from three sources:
a wall supply, USB and a battery with integrated charger. They also
provide an additional backup supply with integrated for maintaining
always on functionality such as the RTC and monitoring of power
switches.

After some initial configuration at startup the device operates
autonomously, the driver simply provides reporting of the current
state.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2009-09-04 21:02:32 +04:00
Daniel Mack b0525b48f0 ds2760_battery: Fix integer overflow for time_to_empty_now
On the device we're currently developing, battery sizes of ~2.8Ah and
current flow of ~600mA are typical.

With that values, the life_sec computation overflows due to the
multiplication by 3600.

Signed-off-by: Daniel Mack <daniel@caiaq.de>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Cc: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2009-09-04 20:26:40 +04:00
Marek Vasut 83a8af0d31 wm97xx_battery: Convert to dev_pm_ops
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2009-09-04 20:21:08 +04:00
Marek Vasut 7c87942aef wm97xx_battery: Use irq to detect charger state
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2009-09-04 20:21:08 +04:00
Marek Vasut b8bdc1d0cf wm97xx_battery: Use platform_data
This patch converts the wm97xx-battery driver to use platform_data
supplied by ac97 bus.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
2009-09-04 20:20:58 +04:00
Linus Torvalds fbdbf83899 Merge git://git.infradead.org/users/cbou/battery-2.6.31
* git://git.infradead.org/users/cbou/battery-2.6.31:
  Add ds2782 battery gas gauge driver
  olpc_battery: Ensure that the TRICKLE bit is checked
  olpc_battery: Fix up eeprom read function
2009-07-30 16:45:53 -07:00