summaryrefslogtreecommitdiff
path: root/drivers/power/supply/gpio-charger.c
AgeCommit message (Collapse)Author
2020-08-27power: supply: gpio-charger: add charge-current-limit featureSebastian Reichel
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-27Merge tag 'psy-arm-gpio-charger-immutable-for-5.10-signed' into psy-nextSebastian Reichel
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-27power: supply: gpio-charger: Convert to GPIO descriptorsLinus Walleij
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-26power: supply: gpio-charger: Simplify with dev_err_probe()Krzysztof Kozlowski
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-06-19power: supply: gpio-charger: Make gpios optionalSebastian Reichel
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>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 151Thomas Gleixner
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-04-15power: supply: gpio-charger: Add support for charger status.Artur Rojek
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>
2018-12-13power: supply: gpio-charger: Do not use deprecated POWER_SUPPLY_TYPE_USB_*Sebastian Reichel
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2018-04-25power: supply: simplify getting .drvdataWolfram Sang
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-03-09power: supply: gpio-charger: Remove pdata from gpio_chargerLadislav Michl
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-09power: supply: gpio-charger: Use GPIOF_ACTIVE_LOW for legacy setupLadislav Michl
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-09power: supply: gpio-charger: Remove redundant dev_err call in probe functionLadislav Michl
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-02-13power: supply: gpio-charger: use helper variable to access device infoLadislav Michl
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-13power: supply: gpio-charger: Drop driver remove functionLadislav Michl
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>
2017-01-04power: supply: gpio_charger: switch to using GPIO descriptorsLinus Walleij
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>
2016-08-11power: move power supply drivers to power/supplySebastian Reichel
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>