Add new charge-current-limit feature to gpio-charger.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This immutable branch drops legacy gpio API from
gpio-charger and updates the remaining users to
the new gpiod API instead.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
-----BEGIN PGP SIGNATURE-----
iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAl9H0T8ACgkQ2O7X88g7
+poL9A//X+8A8rX4wsZt1SQCwWVjRnikaluhJpbo24lq4GGolsiTJtV+efk5u3wT
SoNOZboUBF7Fr9EoNCh203eGr3Z1vG8q+a7DFa41wSb8N5SQSjDECzbwFwMudXMo
uPwQ21ETQHIyOk6J/fuoQnjpZ9h2ytPgX7gAh6DyDNiz0cdFlLezkewQEmHPq7Ni
GBPzHuFE3+jGu28Od3FevhP5WnRnAq5sbP6I0KGq1Bbt7FB5N9MKa9j+ZBVcAvHj
VIH1SVeNjYY7fw3Zr6Qtn0FwDh+p0bzMGCmwtnFvsDzh2mWaMF4imKoGctSIkopl
5559885mwCDEtTeGO3s38cBNyMKBxNEX+hUN3O82UWf0VcVP97IaFsv0s2TyVg/z
N3punW6fEBfyQFs+otefQ/AONL6PfxK2bqfu+zJigVXuWaOTS8k3svYGbo5e4oKV
1Eaj6yH5LWqWdbTg6FZG7zSJJUjEDHXIb+wMaQJHoZXErrqRvdJz89rp0gw7pX3/
oL0Qj1LKMDYya5YSYF+1k5ykQ9SZYy1aDCex7PYY8Nz5X3phwVqTXcG9SRgduG+U
m+1DDzw0pn7zG3LRAhXKRxj+9Yy+0DgTMRZ3AbYToS/7+r6o77FrFgud7JUBgHcW
ZXah7mWdb3uadv6Rb98aNtDmsWtZnwrcY+T2Q86b8Nw3ApLFnT8=
=RhVS
-----END PGP SIGNATURE-----
Merge tag 'psy-arm-gpio-charger-immutable-for-5.10-signed' into psy-next
Immutable branch between arm and power-supply for gpio-charger for 5.10
This immutable branch drops legacy gpio API from
gpio-charger and updates the remaining users to
the new gpiod API instead.
Signed-off-by: Sebastian Reichel <sre@kernel.org>
This converts the GPIO charger to use exclusively GPIO
descriptors, moving the two remaining platforms passing
global GPIO numbers over to using a GPIO descriptor table.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
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>
While strongly recommended, not all devices have a gpio to
detect if the charger is connected. This moves the 'gpios'
from required to optional section.
This also modifies error handling for the GPIO a bit: We
no longer fallback to pdata, if a GPIO is specified using
GPIO descriptor tables. This is a bit cleaner and does
not have any real impact: There are only two mainline pdata
users (arm/mach-sa1100/collie.c, arm/mach-pxa/tosa.c) and
none of them specify the GPIO via gpiod descriptor tables.
Once both have been converted the driver's support for
specifying GPIOs numbers in pdata will be dropped.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Based on 1 normalized pattern(s):
this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version you should have received a copy of the
gnu general public license along with this program if not write to
the free software foundation inc 675 mass ave cambridge ma 02139 usa
extracted by the scancode license scanner the SPDX license identifier
GPL-2.0-or-later
has been chosen to replace the boilerplate/reference in 35 file(s).
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Armijn Hemel <armijn@tjaldur.nl>
Reviewed-by: Richard Fontana <rfontana@redhat.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.655028468@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Introduce optional support of POWER_SUPPLY_PROP_STATUS for chargers
which provide charging status GPIO.
Signed-off-by: Artur Rojek <contact@artur-rojek.eu>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
We should get drvdata from struct device directly. Going via
platform_device is an unneeded step back and forth.
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Platform data are now used only during probe time, so remove
them from gpio_charger structure and consolidate probing
function accordingly.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
[Replace of_property_read_string with dev_property_read_string]
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Setting GPIOF_ACTIVE_LOW flag based on platform data gpio_active_low
makes return value of gpiod_get_value_cansleep directly usable.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
There is an error message within devm_kzalloc already.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Using explicit struct device variable makes code a bit more readable.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Simplify error unwinding using devm_* allocators. This also
makes driver remove function empty, so remove it.
Signed-off-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
The GPIO charger is using a mix of the legacy GPIO interface
and <linux/of_gpio.h> which is not the modern way to use GPIOs.
Refactor like this:
- Use a GPIO descriptor for the GPIO line used to monitor the
charger.
- Fetch the descriptor with devm_gpiod_get() as the first
method.
- If this fails and we are *not* using device tree, then
start looking to see if we can use platform data instead.
- After looking up and requesting a GPIO number with the
legacy API, convert it to a descriptor.
This way we can later isolate and drop the legacy code as
more platforms move over to using descriptors.
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
This moves all power supply drivers from drivers/power/
to drivers/power/supply/. The intention is a cleaner
source tree, since drivers/power/ also contains frameworks
unrelated to power supply, like adaptive voltage scaling.
Signed-off-by: Sebastian Reichel <sre@kernel.org>