Commit Graph

4 Commits

Author SHA1 Message Date
Krzysztof Kozlowski e03e3601fb power: supply: lego_ev3: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Reviewed-by: David Lechner <david@lechnology.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-08-26 17:25:45 +02:00
David Lechner 9c7272412b power: supply: lego_ev3_battery: fix Vce offset
This fixes the value that accounts for the Vce of a transistor in the
LEGO MINDSTORMS EV3 power supply driver. The old value (200mV) was the
max value from the data sheet. After testing, the actual value has been
found to be 50mV. By using 50mV we get a more accurate voltage
indication.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-07-22 23:33:43 +02:00
David Lechner 6e92cecb1e power: supply: lego_ev3_battery: Don't ignore iio_read_channel_processed() return value
This changes the LEGO MINDSTORMS EV3 power supply driver to return an
error if iio_read_channel_processed() fails.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-07-22 23:33:43 +02:00
David Lechner 53db88586a power: supply: New driver for LEGO MINDSTORMS EV3 battery
This adds a new driver for the LEGO MINDSTORMS EV3 battery. The EV3 is
an embedded ARM device that can use 6 AA batteries or a special rechargeable
Li-ion battery pack. The rechargeable battery pack presses a special key
switch in the battery compartment to indicate that it is present.

The EV3 is only capable of monitoring battery voltage and current. The
charging circuit is built into the rechargeable battery pack and there is
no way to communicate with is, so we can't provide any information about
charging status.

When not using the rechargeable battery pack, it is most common to use
alkaline batteries to power the device, but it is also common for people to
use rechargeable NiMH batteries. Since there is not a way to automatically
differentiate between these, the technology property is made writable.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-04-14 01:41:35 +02:00