History log of /linux-master/drivers/power/supply/ingenic-battery.c
Revision Date Author Comments
# 25fd3303 14-Dec-2021 Linus Walleij <linus.walleij@linaro.org>

power: supply_core: Pass pointer to battery info

The function to retrieve battery info (from the device tree) assumes
we have a static info struct that gets populated by calling into
power_supply_get_battery_info().

This is awkward since I want to support tables of static battery
info by just assigning a pointer to all info based on e.g. a
compatible value in the device tree.

We also have a mixture of static and dynamically allocated
variables here.

Bite the bullet and let power_supply_get_battery_info() allocate
also the memory used for the very top level
struct power_supply_battery_info container. Pass pointers
around and lifecycle this with the psy device just like the
stuff we allocate inside it.

Change all current users over.

As part of the change, initializers need to be added to some
previously uninitialized fields in struct
power_supply_battery_info.

Reviewed-By: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>


# 1e625fe6 01-Nov-2020 Tom Rix <trix@redhat.com>

power: supply: ingenic: remove unneeded semicolon

A semicolon is not needed after a switch statement.

Signed-off-by: Tom Rix <trix@redhat.com>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Sebastian Reichel <sre@kernel.org>


# 31873dc2 26-Aug-2020 Krzysztof Kozlowski <krzk@kernel.org>

power: supply: ingenic: 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>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>


# 5b11e5d7 20-Feb-2020 Paul Cercueil <paul@crapouillou.net>

power/supply: ingenic-battery: Don't print error on -EPROBE_DEFER

Don't print an error message if devm_power_supply_register() returns
-EPROBE_DEFER, since the driver will simply re-probe later.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>


# 86b9182d 16-Nov-2019 Paul Cercueil <paul@crapouillou.net>

power/supply: ingenic-battery: Don't change scale if there's only one

The ADC in the JZ4740 can work either in high-precision mode with a 2.5V
range, or in low-precision mode with a 7.5V range. The code in place in
this driver will select the proper scale according to the maximum
voltage of the battery.

The JZ4770 however only has one mode, with a 6.6V range. If only one
scale is available, there's no need to change it (and nothing to change
it to), and trying to do so will fail with -EINVAL.

Fixes: fb24ccfbe1e0 ("power: supply: add Ingenic JZ47xx battery driver.")

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Artur Rojek <contact@artur-rojek.eu>
Cc: stable@vger.kernel.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>


# fb24ccfb 18-Apr-2019 Artur Rojek <contact@artur-rojek.eu>

power: supply: add Ingenic JZ47xx battery driver.

Add a driver for battery present on Ingenic JZ47xx SoCs.

Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>