aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/supply/ltc2941-battery-gauge.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-02-13power: supply: ltc2941: clean up error messagesMichał Mirosław1-33/+20
Replace dev_err() with dev_err_probe() in probe() and extend register access failure messages. dev_err()s in _reset() are removed as they are redundant: register access wrappers already log the error. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2022-02-13power: supply: ltc2941: simplify Qlsb calculationMichał Mirosław1-4/+4
Replace two divisions with a subtraction+shift for a small code size improvement and less brackets. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2021-03-23power: supply: Clean-up few drivers by using managed work initMatti Vaittinen1-13/+7
Few drivers implement remove call-back only for ensuring a delayed work gets cancelled prior driver removal. Clean-up these by switching to use devm_delayed_work_autocancel() instead. This change is compile-tested only. All testing is appreciated. Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Link: https://lore.kernel.org/r/e5b1b0380cdd1aa066c9ac6d7a8b1a86ba1ddbbe.1616506559.git.matti.vaittinen@fi.rohmeurope.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-10power: supply: ltc2941: Fix ptr to enum castIskren Chernev1-1/+2
clang complains about casting pointers to smaller enum types. Signed-off-by: Iskren Chernev <iskren.chernev@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2020-01-14power: supply: ltc2941-battery-gauge: fix use-after-freeSven Van Asbroeck1-1/+1
This driver's remove path calls cancel_delayed_work(). However, that function does not wait until the work function finishes. This could mean that the work function is still running after the driver's remove function has finished, which would result in a use-after-free. Fix by calling cancel_delayed_work_sync(), which ensures that that the work is properly cancelled, no longer running, and unable to re-schedule itself. This issue was detected with the help of Coccinelle. Cc: stable <stable@vger.kernel.org> Signed-off-by: Sven Van Asbroeck <TheSven73@gmail.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
2019-05-21treewide: Add SPDX license identifier for more missed filesThomas Gleixner1-0/+1
Add SPDX license identifiers to all files which: - Have no license information of any form - Have MODULE_LICENCE("GPL*") inside which was used in the initial scan/conversion to ignore the file These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-12Merge branch 'fixes' into for-nextSebastian Reichel1-4/+4
Merge for-stable fixes branch into for-next development branch. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-02-22power: supply: ltc2941-battery-gauge: Fix temperature unitsLadislav Michl1-4/+4
Temperature is measured in tenths of degree Celsius. Fixes: 085bc24d1553 ("Add LTC2941/LTC2943 Battery Gauge Driver") Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2018-02-12power: supply: ltc2941-battery-gauge: Add charge empty and full propertiesLadislav Michl1-9/+50
Add properties for charge empty and charge full thresholds. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-12-01power: ltc2941-battery-gauge: Disable continuous monitoring on shutdownMike Looijmans1-0/+25
The driver sets the fuel gauge to continuous monitoring on startup, for the models that support this. When the board shuts down, the chip remains in that mode, causing a few mA drain on the battery every 2 or 10 seconds. This patch registers a shutdown handler that turns off the monitoring to prevent this battery drain. Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-07-25power: supply: ltc2941-battery-gauge: Add LTC2944 supportDragos Bogdan1-5/+22
LTC2944 is compatible with LTC2943, but uses different voltage and current computing constants. Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Tested-by: Dragos Bogdan <dragos.bogdan@analog.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-07-25power: supply: ltc2941-battery-gauge: Add LTC2942 supportLadislav Michl1-13/+67
LTC2942 is pin compatible with LTC2941 providing additional informations about battery voltage and temperature. It can be runtime detected using bit A7 in the Status register. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Rob Herring <robh@kernel.org> Acked-by: Dragos Bogdan <dragos.bogdan@analog.com> Tested-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-07-25power: supply: ltc2941-battery-gauge: Prepare for LTC2942 and LTC2944Ladislav Michl1-32/+31
In order to support LTC2942 which has temperature registers at different offsets than LTC2943 use following register naming scheme (prefixes): - LTC294X_ common registers - LTC2942_ chips specific registers - LTC2943_ specific registers LTC2944 is compatible with LTC2943 but uses different constants to compute voltage and current, so replace num_regs misused for device indentification with real device id to discriminate between those two. There are no functional changes. Signed-off-by: Ladislav Michl <ladis@linux-mips.org> Acked-by: Dragos Bogdan <dragos.bogdan@analog.com> Tested-by: Dragos Bogdan <dragos.bogdan@analog.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
2017-04-14power: supply: ltc2941-battery-gauge: Add OF device ID tableJavier Martinez Canillas1-2/+17
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-11power: move power supply drivers to power/supplySebastian Reichel1-0/+514
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>