Commit Graph

8 Commits (d2ff4fc557a4c5248b2d99b0d48e47a246d994b2)

Author SHA1 Message Date
Olof Johansson a22b41a31e sbs-battery: Probe should try talking to the device
Turns out this driver doesn't actually try talking to the device at
probe time, so if it's incorrectly configured in the device tree or
platform data (or if the battery has been removed from the system),
then probe will succeed and every access will sit there and time out.
The end result is a possibly laggy system that thinks it has a battery
but can never read status, which isn't very useful.

Instead, just read any register (I chose status) at probe, and if that
fails, don't register the device.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 14:57:52 -07:00
Nikolaus Voss 5da50988a1 sbs-battery: Don't trigger false supply_changed event
power_supply_changed() events are triggerd based on the return value
of a get_property() call. However the property TECHNOLOGY is
hard-coded to LION in this driver, thus always succeeds.

So, with the battery removed, this triggers a false battery present
uevent. This uevent triggers a new query via power_supply_uevent()
which again starts to query all known properties and thus leads to
an infinite loop of battery present/not-present uevents.

This patch skips the battery presence detection for the hard-coded
property TECHNOLOGY.

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Acked-by Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-06-19 19:26:40 -07:00
Nikolaus Voss b1f092f648 sbs-battery.c: Capacity attr = remaining relative capacity
Currently, the capacity exported by this driver refers to reg 0x0e,
which is the absolute state of charge which according to SBS
refers to the design capacity/ energy of the battery. It can be
> 100 % and drops below 100 % for a fully charged battery with
the battery aging.

This is not what the user exspects of a remaining capacity
indication between 0 and 100 % with 100 % referring to
a fully charged battery. This is provided by SBS reg 0x0d,
which is the relative state of charge referring to the
full charge capacity.

Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-05-05 20:05:07 -07:00
Axel Lin 5ff92e7ab3 power_supply: Convert i2c drivers to module_i2c_driver
Factor out some boilerplate code for i2c driver registration
into module_i2c_driver.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Woogyom Kim <milo.kim@ti.com>
Cc: Daniel Jeong <daniel.jeong@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Peter Edwards <sweetlilmre@gmail.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Acked-by: Ryan Mallon <rmallon@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-03-26 20:41:22 +04:00
Olof Johansson 62df3935a7 sbs-battery: Fix devicetree match table
It should be an of module table, not i2c.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:46:18 +04:00
Rhyland Klein 52f56c69be sbs-battery: Change power supply name
The power supply name used to be fixed as "battery". This change allows
for multiple batteries by generating the name rather than using a fixed
value.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:27:36 +04:00
Rhyland Klein 3ddca062f8 sbs-battery: Rename internals to new name
Now that this driver is named more generally, this change updates
the internal variables, defines and functions to use this new name.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:22:21 +04:00
Rhyland Klein c78f2b6496 bq20z75: Rename to sbs-battery
This driver for the bq20z75 implemented the register spec defined
by the SBS standard. As this is not unique to this the TI part this
was originally written for, we can generalize this driver to
show its support for any SBS compliant battery.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
2012-01-06 05:22:12 +04:00