summaryrefslogtreecommitdiff
path: root/drivers/power/supply/ingenic-battery.c
AgeCommit message (Collapse)AuthorFilesLines
2022-01-03power: supply_core: Pass pointer to battery infoLinus Walleij1-7/+7
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>
2020-12-30power: supply: ingenic: remove unneeded semicolonTom Rix1-1/+1
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>
2020-08-26power: supply: ingenic: Simplify with dev_err_probe()Krzysztof Kozlowski1-5/+3
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>
2020-02-24power/supply: ingenic-battery: Don't print error on -EPROBE_DEFERPaul Cercueil1-1/+2
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>
2019-12-19power/supply: ingenic-battery: Don't change scale if there's only onePaul Cercueil1-4/+11
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>
2019-04-18power: supply: add Ingenic JZ47xx battery driver.Artur Rojek1-0/+184
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>