History log of /drivers/power/olpc_battery.c
Revision Date Author Comments
6d2cea4fcaff539f803b06d5c3146966f78d47c4 22-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org> Drivers: power: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitconst,
and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Jamie Lentin <jm@lentin.co.uk>
Cc: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
415ec69fb1861fc377c65cb30ddc76999891b8e1 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> 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>
c8afa6406e60aec6ff90033e5ffe41a206609296 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> 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>
28ea73f4c67cb3dd8c972b21d9fdf84ea78d6daa 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu> 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>
3bf9428f220911795edde453a95f9509945004e5 11-Jul-2012 Andres Salomon <dilinger@queued.net> drivers: OLPC: update various drivers to include olpc-ec.h

Switch over to using olpc-ec.h in multiple steps, so as not to break builds.
This covers every driver that calls olpc_ec_cmd().

Signed-off-by: Andres Salomon <dilinger@queued.net>
Acked-by: Paul Fox <pgf@laptop.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
ecc2edd56c49fa31a0a9ed15a7bf810ae79d3b85 15-Jul-2012 Richard A. Smith <richard@laptop.org> olpc-battery: update CHARGE_FULL_DESIGN property for BYD LiFe batteries

Reduce the mAh value for the BYD LiFe battery from 3100mAh to 2800mAh
to better reflect the average usable capacity as measured by olpc-pwr-log.

Signed-off-by: Richard A. Smith <richard@laptop.org>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
5619d0ba97cd336a100121cf8f2968c4b1f6c848 15-Jul-2012 Richard A. Smith <richard@laptop.org> olpc-battery: Add VOLTAGE_MAX_DESIGN property

upowerd wants to compute the energy in the battery by looking at this
property. If it's not present then it falls back on using the reported
voltage of the battery at time upowerd loads. That's close but also
means that every time you boot you get a slightly different energy
capacity.

Adding the VOLTAGE_MAX_DESIGN property allows upowerd to compute the
same energy every time.

Signed-off-by: Richard A. Smith <richard@laptop.org>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
300bac7fb85a20b2704dc3645419057992f78565 25-Nov-2011 Axel Lin <axel.lin@gmail.com> power_supply: Convert drivers/power/* to use module_platform_driver()

This patch converts the drivers in drivers/power/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.

Cc: Mike Rapoport <mike@compulab.co.il>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Nithish Mahalingam <nithish.mahalingam@intel.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Balaji Rao <balajirrao@openmoko.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Clifton Barnes <cabarnes@indesign-llc.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
7ab2f0207dd493e9ac8bae78324cf5592fa92650 24-Nov-2011 Anton Vorontsov <cbouatmailru@gmail.com> olpc_battery: Remove unneeded 'olpc_battery_trigger_uevent'

It is no longer used, so we can safely remove it.

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
5519d00e6a5d99a163484722ef7cea8bff47bc58 24-Nov-2011 Anton Vorontsov <cbouatmailru@gmail.com> olpc_battery: Fix section mismatch noise

This patch fixes the following noise (by renaming _drv to _driver):

WARNING: drivers/power/olpc_battery.o(.data+0x100): Section mismatch in reference from the variable olpc_battery_drv to the function .devinit.text:olpc_battery_probe()
The variable olpc_battery_drv references
the function __devinit olpc_battery_probe()
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/power/olpc_battery.o(.data+0x104): Section mismatch in reference from the variable olpc_battery_drv to the function .devexit.text:olpc_battery_remove()
The variable olpc_battery_drv references
the function __devexit olpc_battery_remove()
If the reference is valid then annotate the
variable with __exit* (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

WARNING: drivers/power/olpc_battery.o(.data+0x128): Section mismatch in reference from the variable olpc_battery_drv to the variable .devinit.rodata:olpc_battery_ids
The variable olpc_battery_drv references
the variable __devinitconst olpc_battery_ids
If the reference is valid then annotate the
variable with __init* or __refdata (see linux/init.h) or name the variable:
*driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
cae659af87288a4b1723cdf94d713ef7fb4c56d9 10-Aug-2011 Daniel Drake <dsd@laptop.org> olpc_battery: Add wakeup support

Battery and AC events can now be used to wake up the system from suspend.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
c3503fd02558245ebbb0b48f3ae1d62416e3fd2a 10-Aug-2011 Daniel Drake <dsd@laptop.org> olpc_battery: Bind to device tree

This is cleaner, and allows suspend/resume (wakeup) handlers to be
added in an upcoming patch.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Acked-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
bf542a4e7b634c2adcba4241a29082f69b0f45dc 12-Jan-2011 Sascha Silbe <sascha-pgp@silbe.org> olpc_battery: Fix up XO-1.5 properties list

The patches adding support for CURRENT_NOW, VOLTAGE_NOW, CHARGE_NOW and
CHARGE_FULL_DESIGN were based on a tree not including c566d299
("olpc_battery: Ambient temperature is not available on XO-1.5") and
therefore only modified the then-common, now-XO-1 properties list. This
patch adds the new properties to XO-1.5 as well.

Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
22fadd766b2a222b273df9f2264b72e4b3bbe921 10-Dec-2010 Sascha Silbe <sascha-pgp@silbe.org> olpc_battery: Add support for CURRENT_NOW and VOLTAGE_NOW

{CURRENT,VOLTAGE}_AVG are actually {CURRENT,VOLTAGE}_NOW (the EC code
directly passes through the value from the gas gauge instead of the
internally used average). We retain {CURRENT,VOLTAGE}_AVG as an alias
for compatibility reasons, it will be removed later.

Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
[ pgf@laptop.org: added VOLTAGE_NOW, aliased to VOLTAGE_AVG ]
Signed-off-by: Paul Fox <pgf@laptop.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
20fd9830ccc685adce65ba89ffc3ca5426a2b064 10-Dec-2010 Sascha Silbe <sascha-pgp@silbe.org> olpc_battery: Add support for CHARGE_NOW

CHARGE_NOW is needed by some user space software (read: UPower) for
internal calculations.

This patch violates the power supply class definition (as we already
do for CAPACITY though it isn't as obvious there), but this is the best
we can do without adding rather sophisticated algorithms to either the EC
or UPower.

Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
Signed-off-by: Paul Fox <pgf@laptop.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
b202a5e6c94d8c43ade5adb97e87734cc4f4f228 10-Dec-2010 Sascha Silbe <sascha-pgp@silbe.org> olpc_battery: Add support for CHARGE_FULL_DESIGN

Some user space software (read: UPower) uses CHARGE_FULL_DESIGN for internal
calculations. The design capacity of the OLPC batteries is effectively fixed
and only needs to be exported.

Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
Signed-off-by: Paul Fox <pgf@laptop.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
c566d299f91bdb622046126dbcb040f9e52572ba 29-Dec-2010 Daniel Drake <dsd@laptop.org> olpc_battery: Ambient temperature is not available on XO-1.5

The XO-1.5 does not support the ambient temperature property.
Create a separate list of properties for that configuration where
ambient temperature is not included, and apply the correct property
list at runtime.

Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
7cfbb29466633e6ecdc14f76a693c8478c2b22af 25-Sep-2010 Richard A. Smith <richard@laptop.org> 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>
20d7b2415c55aece840048e1e01348daa8f646b0 10-Aug-2010 Guenter Roeck <guenter.roeck@ericsson.com> 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>
690e85a3957291f4cfe0cac22d97994ec7e5ee45 09-Aug-2010 David Woodhouse <David.Woodhouse@intel.com> 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>
2c3c8bea608866d8bd9dcf92657d57fdcac011c5 13-May-2010 Chris Wright <chrisw@sous-sol.org> 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>
ee8076ed3e1cdd0cd1e61318386932669c90b92f 02-Jul-2009 Andres Salomon <dilinger@collabora.co.uk> power_supply: Add a charge_type property, and use it for olpc driver

This adds a new sysfs file called 'charge_type' which displays the
type of charging (unknown, n/a, trickle charge, or fast charging).

This allows things like battery diagnostics to determine what the
battery/EC is doing without resorting to changing the 'status' sysfs
output.

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
144bbeaedc53290eab21da82ce1cb5faefd14374 30-Jun-2009 Andres Salomon <dilinger@collabora.co.uk> olpc_battery: Add an 'error' sysfs device that displays raw errors

Grab the error code from EC_BAT_ERRCODE and let the user see it (rather
than attempting to decode it as we do with PROP_HEALTH) with a separate
error sysfs file.

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
b294a290d24d1196d68399cc3a9b8c50bfb55abd 30-Jun-2009 Andres Salomon <dilinger@collabora.co.uk> Revert "power: remove POWER_SUPPLY_PROP_CAPACITY_LEVEL"

This reverts commit 8efe444038a205e79b38b7ad03878824901849a8 and
4cbc76eadf56399cd11fb736b33c53aec9caab8c.

Richard@laptop.org was apparently using CAPACITY_LEVEL for debugging
battery/EC problems, and was upset that it was removed. This readds it.

Conflicts:

Documentation/power_supply_class.txt

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
8f7e57985fa794ab6afdcd3642581d9e1fe6de31 30-Jun-2009 Andres Salomon <dilinger@collabora.co.uk> olpc_battery: Ensure that the TRICKLE bit is checked

There are times when the battery is present but trickle charging,
and the EC sets only the TRICKLE bit. So we must check for the bit
when we're checking the charging/present status.

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
04a820ead0838c76e9c1242feb5e71048bf3e9dc 30-Jun-2009 Andres Salomon <dilinger@collabora.co.uk> olpc_battery: Fix up eeprom read function

The eeprom read function was placing values into the wrong place in
'buf'; we were starting from buf[off], rather than buf[0].

Also, the for loop that we were using was much uglier than it needed to
be. This cleans it up a bit.

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
8e9c7716c138fa82d919bfe1115ec8c938e90918 16-Oct-2008 Harvey Harrison <harvey.harrison@gmail.com> olpc: olpc_battery.c sparse endian annotations

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Acked-by: Andres Salomon <dilinger@queued.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
75d8807962fc7529b4946e9ec92cae197be5a967 15-May-2008 Andres Salomon <dilinger@queued.net> power_supply: fix up CHARGE_COUNTER output to be more precise

As Richard Smith pointed out, ACR * 6250 / 15 provides for less
precision loss than ACR * 4167 / 10, _and_ it doesn't overflow. Switch
to using that equation for CHARGE_COUNTER.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Cc: "Richard A. Smith" <richard@laptop.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
8e552c36d90c03d2cabf5373788998966751b609 13-May-2008 Andres Salomon <dilinger@debian.org> power_supply: add CHARGE_COUNTER property and olpc_battery support for it

This adds PROP_CHARGE_COUNTER to the power supply class (documenting it
as well). The OLPC battery driver uses this for spitting out its ACR
values (in uAh). We have some rounding errors (the data sheet claims
416.7, the math actually works out to 416.666667, so we're forced to
choose between overflows or precision loss. I chose precision loss,
and stuck w/ data sheet values), but I don't think anyone will care
that much.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
484d6d50cca3941db6e063113d124333aed0abc0 02-May-2008 Andres Salomon <dilinger@queued.net> power_supply: bump EC version check that we refuse to run with in olpc_battery

Refuse to run with an EC < 0x44. We're playing it safe, and this is a pretty
old EC version.

Also, add a comment about why we're checking the EC version.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
b2bd8a3bcdd18101eb5d85c267c1a1fb8ce9acc7 02-May-2008 Andres Salomon <dilinger@queued.net> power_supply: cleanup of the OLPC battery driver

Move portions of the massive switch statement into functions. The layout of
this thing has already caused one bug (a break in the wrong place), it needed
to shrink.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
d7eb9e36c42504e87c7d92dd5c05cb6f2cf74d28 02-May-2008 Andres Salomon <dilinger@queued.net> power_supply: add eeprom dump file to olpc_battery's sysfs

This allows you to dump 0x60 bytes from the battery's EEPROM (starting at
address 0x20). Note that it does an EC command for each byte, so it's pretty
slow. OTOH, if you want to grab just a single byte from somewhere in the
EEPROM, you can do something like:

dd bs=1 count=1 skip=16 if=/sys/class/power_supply/olpc-battery/eeprom | od -x

Userspace battery collection/logging information needs this.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
1ca5b9d2183f11bb8b69e04b19a7faf7f600a840 04-May-2008 David Woodhouse <dwmw2@infradead.org> power_supply: Support serial number in olpc_battery

This adds serial number support to the OLPC battery driver.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
3ef0e1f8cad0a851b3dbf91802b14af7dd780352 29-Apr-2008 Andres Salomon <dilinger@queued.net> x86: olpc: add One Laptop Per Child architecture support

This adds support for OLPC XO hardware. Open Firmware on XOs don't contain
the VSA, so it is necessary to emulate the PCI BARs in the kernel. This also
adds functionality for running EC commands, and a CONFIG_OLPC.

A number of OLPC drivers depend upon CONFIG_OLPC.

olpc_ec_timeout is a hack to work around Embedded Controller bugs.

[akpm@linux-foundation.org: build fix]
[akpm@linux-foundation.org: geode_has_vsa build fix]
[akpm@linux-foundation.org: olpc_register_battery_callback doesn't exist]
Signed-off-by: Andres Salomon <dilinger@debian.org>
Acked-by: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <ak@suse.de>
Cc: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8efe444038a205e79b38b7ad03878824901849a8 12-Dec-2007 Andres Salomon <dilinger@queued.net> power: remove POWER_SUPPLY_PROP_CAPACITY_LEVEL

The CAPACITY_LEVEL stuff defines various levels of charge; however, what
is the difference between them? What differentiates between HIGH and NORMAL,
LOW and CRITICAL, etc?

As it appears that these are fairly arbitrary, we end up making such policy
decisions in the kernel (or in hardware). This is the sort of decision that
should be made in userspace, not in the kernel.

If the hardware does not support _CAPACITY and it cannot be easily calculated,
then perhaps the driver should register a custom CAPACITY_LEVEL attribute;
however, userspace should not become accustomed to looking for such a thing,
and we should certainly not encourage drivers to provide CAPACITY_LEVEL
stubs.

The following removes support for POWER_SUPPLY_PROP_CAPACITY_LEVEL. The
OLPC battery driver is the only driver making use of this, so it's
removed from there as well.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
7b3d54a8c30d2c524889a05d0c1334813d516b93 15-Jul-2007 Anton Vorontsov <cbou@mail.ru> Power supply class and drivers: remove non obligatory return statements

Per Jeff Garzik request.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
fb972873a767220333ffb509de8d9131336e212c 03-May-2007 David Woodhouse <dwmw2@infradead.org> [BATTERY] One Laptop Per Child power/battery driver

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>