Commit Graph

16 Commits

Author SHA1 Message Date
Sebastian Reichel
be2919d835 power: supply: gpio-charger: add charge-current-limit feature
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>
2020-08-27 21:13:23 +02:00
Sebastian Reichel
39e95bbbac 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>
 -----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>
2020-08-27 17:34:01 +02:00
Linus Walleij
17529bcf0a power: supply: gpio-charger: Convert to GPIO descriptors
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>
2020-08-27 16:47:14 +02:00
Krzysztof Kozlowski
52a023a14e power: supply: gpio-charger: 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>
2020-08-26 17:25:42 +02:00
Sebastian Reichel
1d85f6d1b0 power: supply: gpio-charger: Make gpios optional
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>
2020-06-19 18:15:38 +02:00
Thomas Gleixner
a912e80bd0 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151
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>
2019-05-30 11:26:28 -07:00
Artur Rojek
df68c44c72 power: supply: gpio-charger: Add support for charger status.
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>
2019-04-15 22:07:18 +02:00
Sebastian Reichel
fb4d494480 power: supply: gpio-charger: Do not use deprecated POWER_SUPPLY_TYPE_USB_*
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-12-13 00:17:01 +01:00
Wolfram Sang
bb772d0fdf power: supply: simplify getting .drvdata
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>
2018-04-25 23:15:51 +02:00
Ladislav Michl
d47c1e4b2f power: supply: gpio-charger: Remove pdata from gpio_charger
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>
2018-03-09 16:50:28 +01:00
Ladislav Michl
f5fec4cc29 power: supply: gpio-charger: Use GPIOF_ACTIVE_LOW for legacy setup
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>
2018-03-09 16:16:34 +01:00
Ladislav Michl
d433d04bb7 power: supply: gpio-charger: Remove redundant dev_err call in probe function
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>
2018-03-09 16:14:02 +01:00
Ladislav Michl
416a1ae673 power: supply: gpio-charger: use helper variable to access device info
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>
2018-02-13 13:48:24 +01:00
Ladislav Michl
419cac572b power: supply: gpio-charger: Drop driver remove function
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>
2018-02-13 13:48:23 +01:00
Linus Walleij
fb9a33ae6b power: supply: gpio_charger: switch to using GPIO descriptors
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>
2017-01-04 22:04:50 +01:00
Sebastian Reichel
8c0984e5a7 power: move power supply drivers to power/supply
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>
2016-08-11 01:11:03 +02:00