summaryrefslogtreecommitdiffstats
path: root/drivers/power
Commit message (Collapse)AuthorAgeFilesLines
...
* | power: supply: pcf50633-charger: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-22-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: max8925_power: Convert to platform remove callback returning voidUwe Kleine-König2023-09-181-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-21-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: max77693_charger: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-20-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: max77650-charger: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-19-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: max14577_charger: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-18-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: lp8788-charger: Convert to platform remove callback returning ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-17-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: isp1704_charger: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-16-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: ipaq_micro_battery: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-15-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: goldfish_battery: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-14-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: da9150-charger: Convert to platform remove callback returning ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-13-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: da9052-battery: Convert to platform remove callback returning ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-12-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: da9030_battery: Convert to platform remove callback returning ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-11-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: cpcap-charger: Convert to platform remove callback returning voidUwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-10-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: cpcap-battery: Convert to platform remove callback returning voidUwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-9-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: charger-manager: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-8-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: act8945a_charger: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-7-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: acer_a500_battery: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-6-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: ab8500_fg: Convert to platform remove callback returning voidUwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-5-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: ab8500_charger: Convert to platform remove callback returning ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-4-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: ab8500_chargalg: Convert to platform remove callback ↵Uwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | returning void The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-3-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: ab8500_btemp: Convert to platform remove callback returning voidUwe Kleine-König2023-09-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230918133700.1254499-2-u.kleine-koenig@pengutronix.de Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: core: Don't export power_supply_notifierSebastian Reichel2023-09-171-2/+1
| | | | | | | | | | | | | | | | power_supply_notifier can be internal, since all users are going through power_supply_reg_notifier()/power_supply_unreg_notifier(). Link: https://lore.kernel.org/r/20230913133900.591637-1-sebastian.reichel@collabora.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: mm8013: Add more propertiesKonrad Dybcio2023-09-171-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While scanning the internet for MM8013 PDFs, I found one for a different IC from Mitsumi, MM8118 at [1]. It turned out however, that when you search through the PDF, the MM8118 text has an invsible text layer containing "MM8013" underneath.. With some elbow grease, I was able to confirm that most of the registers match between the two ICs. Based on that finding, introduce live battery voltage readout, hw-decided charge behavior readout and max current readout. Also, expand the existing POWER_SUPPLY_HEALTH reporting. [1] https://product.minebeamitsumi.com/en/product/category/ics/battery/fuel_gauge/parts/download/__icsFiles/afieldfile/2023/07/12/1_download_01_12.pdf Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20230916-topic-mm8013_2-v1-1-02495e07fca0@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: Add driver for pm8916 lbcNikita Travkin2023-09-153-0/+393
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pm8916 LBC is a Linear Battery Charger hardware block in pm8916 PMIC. This block implements simple CC/CV charging for Li-Po batteries. The hardware has internal state machine to switch between modes and works mostly autonomously, only needing the limits and targets to be set to operate. This driver allows setting limits and enabling the LBC block, monitoring it's state. Signed-off-by: Nikita Travkin <nikita@trvn.ru> Link: https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-4-f30881e951a0@trvn.ru Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: Add pm8916 VM-BMS supportNikita Travkin2023-09-153-0/+317
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This driver adds basic support for VM-BMS found in pm8916. VM-BMS is a very basic fuel-gauge hardware block that is, sadly, incapable of any gauging. The hardware supports measuring OCV in sleep mode, where the battery is not in use, or measuring average voltage over time when the device is active. This driver implements basic value readout from this block. Signed-off-by: Nikita Travkin <nikita@trvn.ru> Link: https://lore.kernel.org/r/20230915-pm8916-bms-lbc-v3-3-f30881e951a0@trvn.ru Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: Propagate of_node to child deviceVincent Whitchurch2023-09-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that the dynamically created power supply device sets its ->of_node if the driver supplies one. This brings it in line with several other subsystems (see git grep 'of_node =.*parent.*of_node') and allows easier identification of the device from udev rules and similar. Before this patch: /sys/class/power_supply# ls -l bq256xx-battery/of_node ls: cannot access 'bq256xx-battery/of_node': No such file or directory # ls -l bq256xx-battery/hwmon1/of_node ls: cannot access 'bq256xx-battery/hwmon1/of_node': No such file or directory After: /sys/class/power_supply# ls -l bq256xx-battery/of_node lrwxrwxrwx 1 root root 0 May 17 09:14 bq256xx-battery/of_node -> ../../../../../../../../firmware/devicetree/base/virtio@1/i2c/bq25619@09 # ls -l bq256xx-battery/hwmon1/of_node lrwxrwxrwx 1 root root 0 May 17 09:14 bq256xx-battery/hwmon1/of_node -> ../../../../../../../../../firmware/devicetree/base/virtio@1/i2c/bq25619@09 Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Link: https://lore.kernel.org/r/20230915-power-of-v2-1-ca54c441867e@axis.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: Introduce MM8013 fuel gauge driverKonrad Dybcio2023-09-153-0/+284
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a driver for the Mitsumi MM8013 fuel gauge. The driver is a vastly cleaned up and improved version of the one that shipped in some obscure Lenovo downstream kernel [1], with some register definitions borrowed from ChromeOS EC platform code [2]. [1] https://github.com/adazem009/kernel_lenovo_bengal/commit/b6b346427a871715709bd22aae449b9383f3b66b [2] https://chromium.googlesource.com/chromiumos/platform/ec/+/master/driver/battery/mm8013.h Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20230621-topic-mm8013-v4-3-975aecd173ed@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: rk817: query battery properties right after resumeMaximilian Weigand2023-09-141-0/+13
| | | | | | | | | | | | | | | | | | | | | | The driver reads battery properties every 8 seconds. In order to prevent problems with wrong property values right after resume, trigger an update of those properties on resuming the system and restart the 8-second interval from there. Signed-off-by: Maximilian Weigand <mweigand@mweigand.net> Link: https://lore.kernel.org/r/20230601-rk817_query_at_resume-v1-1-630b0adefbd9@mweigand.net Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: max17040: get thermal data from adc if availableSvyatoslav Ryhel2023-09-142-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | Since fuel gauge does not support thermal monitoring, some vendors may couple this fuel gauge with thermal/adc sensor to monitor battery cell exact temperature. Add this feature by adding optional iio thermal channel. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Iskren Chernev <me@iskren.info> Link: https://lore.kernel.org/r/20230731073613.10394-4-clamor95@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: max17040: pass status property from supplierSvyatoslav Ryhel2023-09-141-0/+6
| | | | | | | | | | | | | | | | | | | | Optionally pass status property from supplier if has support for it. If cell is online assume it is present as well. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Reviewed-by: Iskren Chernev <me@iskren.info> Link: https://lore.kernel.org/r/20230731073613.10394-3-clamor95@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: core: Use blocking_notifier_call_chain to avoid RCU complaintKai-Heng Feng2023-09-131-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AMD PMF driver can cause the following warning: [ 196.159546] ------------[ cut here ]------------ [ 196.159556] Voluntary context switch within RCU read-side critical section! [ 196.159571] WARNING: CPU: 0 PID: 9 at kernel/rcu/tree_plugin.h:320 rcu_note_context_switch+0x43d/0x560 [ 196.159604] Modules linked in: nvme_fabrics ccm rfcomm snd_hda_scodec_cs35l41_spi cmac algif_hash algif_skcipher af_alg bnep joydev btusb btrtl uvcvideo btintel btbcm videobuf2_vmalloc intel_rapl_msr btmtk videobuf2_memops uvc videobuf2_v4l2 intel_rapl_common binfmt_misc hid_sensor_als snd_sof_amd_vangogh hid_sensor_trigger bluetooth industrialio_triggered_buffer videodev snd_sof_amd_rembrandt hid_sensor_iio_common amdgpu ecdh_generic kfifo_buf videobuf2_common hp_wmi kvm_amd sparse_keymap snd_sof_amd_renoir wmi_bmof industrialio ecc mc nls_iso8859_1 kvm snd_sof_amd_acp irqbypass snd_sof_xtensa_dsp crct10dif_pclmul crc32_pclmul mt7921e snd_sof_pci snd_ctl_led polyval_clmulni mt7921_common polyval_generic snd_sof ghash_clmulni_intel mt792x_lib mt76_connac_lib sha512_ssse3 snd_sof_utils aesni_intel snd_hda_codec_realtek crypto_simd mt76 snd_hda_codec_generic cryptd snd_soc_core snd_hda_codec_hdmi rapl ledtrig_audio input_leds snd_compress i2c_algo_bit drm_ttm_helper mac80211 snd_pci_ps hid_multitouch ttm drm_exec [ 196.159970] drm_suballoc_helper snd_rpl_pci_acp6x amdxcp drm_buddy snd_hda_intel snd_acp_pci snd_hda_scodec_cs35l41_i2c serio_raw gpu_sched snd_hda_scodec_cs35l41 snd_acp_legacy_common snd_intel_dspcfg snd_hda_cs_dsp_ctls snd_hda_codec libarc4 drm_display_helper snd_pci_acp6x cs_dsp snd_hwdep snd_soc_cs35l41_lib video k10temp snd_pci_acp5x thunderbolt snd_hda_core drm_kms_helper cfg80211 snd_seq snd_rn_pci_acp3x snd_pcm snd_acp_config cec snd_soc_acpi snd_seq_device rc_core ccp snd_pci_acp3x snd_timer snd soundcore wmi amd_pmf platform_profile amd_pmc mac_hid serial_multi_instantiate wireless_hotkey hid_sensor_hub sch_fq_codel msr parport_pc ppdev lp parport efi_pstore ip_tables x_tables autofs4 btrfs blake2b_generic raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx libcrc32c xor raid6_pq raid1 raid0 multipath linear dm_mirror dm_region_hash dm_log cdc_ether usbnet r8152 mii hid_generic nvme i2c_hid_acpi i2c_hid nvme_core i2c_piix4 xhci_pci amd_sfh drm xhci_pci_renesas nvme_common hid [ 196.160382] CPU: 0 PID: 9 Comm: kworker/0:1 Not tainted 6.6.0-rc1 #4 [ 196.160397] Hardware name: HP HP EliteBook 845 14 inch G10 Notebook PC/8B6E, BIOS V82 Ver. 01.02.00 08/24/2023 [ 196.160405] Workqueue: events power_supply_changed_work [ 196.160426] RIP: 0010:rcu_note_context_switch+0x43d/0x560 [ 196.160440] Code: 00 48 89 be 40 08 00 00 48 89 86 48 08 00 00 48 89 10 e9 63 fe ff ff 48 c7 c7 10 e7 b0 9e c6 05 e8 d8 20 02 01 e8 13 0f f3 ff <0f> 0b e9 27 fc ff ff a9 ff ff ff 7f 0f 84 cf fc ff ff 65 48 8b 3c [ 196.160450] RSP: 0018:ffffc900001878f0 EFLAGS: 00010046 [ 196.160462] RAX: 0000000000000000 RBX: ffff88885e834040 RCX: 0000000000000000 [ 196.160470] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 [ 196.160476] RBP: ffffc90000187910 R08: 0000000000000000 R09: 0000000000000000 [ 196.160482] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 [ 196.160488] R13: 0000000000000000 R14: ffff888100990000 R15: ffff888100990000 [ 196.160495] FS: 0000000000000000(0000) GS:ffff88885e800000(0000) knlGS:0000000000000000 [ 196.160504] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 196.160512] CR2: 000055cb053c8246 CR3: 000000013443a000 CR4: 0000000000750ef0 [ 196.160520] PKRU: 55555554 [ 196.160526] Call Trace: [ 196.160532] <TASK> [ 196.160548] ? show_regs+0x72/0x90 [ 196.160570] ? rcu_note_context_switch+0x43d/0x560 [ 196.160580] ? __warn+0x8d/0x160 [ 196.160600] ? rcu_note_context_switch+0x43d/0x560 [ 196.160613] ? report_bug+0x1bb/0x1d0 [ 196.160637] ? handle_bug+0x46/0x90 [ 196.160658] ? exc_invalid_op+0x19/0x80 [ 196.160675] ? asm_exc_invalid_op+0x1b/0x20 [ 196.160709] ? rcu_note_context_switch+0x43d/0x560 [ 196.160727] __schedule+0xb9/0x15f0 [ 196.160746] ? srso_alias_return_thunk+0x5/0x7f [ 196.160765] ? srso_alias_return_thunk+0x5/0x7f [ 196.160778] ? acpi_ns_search_one_scope+0xbe/0x270 [ 196.160806] schedule+0x68/0x110 [ 196.160820] schedule_timeout+0x151/0x160 [ 196.160829] ? srso_alias_return_thunk+0x5/0x7f [ 196.160842] ? srso_alias_return_thunk+0x5/0x7f [ 196.160855] ? acpi_ns_lookup+0x3c5/0xa90 [ 196.160878] __down_common+0xff/0x220 [ 196.160905] __down_timeout+0x16/0x30 [ 196.160920] down_timeout+0x64/0x70 [ 196.160938] acpi_os_wait_semaphore+0x85/0x200 [ 196.160959] acpi_ut_acquire_mutex+0x9e/0x280 [ 196.160979] acpi_ex_enter_interpreter+0x2d/0xb0 [ 196.160992] acpi_ns_evaluate+0x2f0/0x5f0 [ 196.161005] acpi_evaluate_object+0x172/0x490 [ 196.161018] ? acpi_os_signal_semaphore+0x8a/0xd0 [ 196.161038] acpi_evaluate_integer+0x52/0xe0 [ 196.161055] ? kfree+0x79/0x120 [ 196.161071] ? srso_alias_return_thunk+0x5/0x7f [ 196.161089] acpi_ac_get_state.part.0+0x27/0x80 [ 196.161110] get_ac_property+0x5c/0x70 [ 196.161127] ? __pfx___power_supply_is_system_supplied+0x10/0x10 [ 196.161146] __power_supply_is_system_supplied+0x44/0xb0 [ 196.161166] class_for_each_device+0x124/0x160 [ 196.161184] ? acpi_ac_get_state.part.0+0x27/0x80 [ 196.161203] ? srso_alias_return_thunk+0x5/0x7f [ 196.161223] power_supply_is_system_supplied+0x3c/0x70 [ 196.161243] amd_pmf_get_power_source+0xe/0x20 [amd_pmf] [ 196.161276] amd_pmf_power_slider_update_event+0x49/0x90 [amd_pmf] [ 196.161310] amd_pmf_pwr_src_notify_call+0xe7/0x100 [amd_pmf] [ 196.161340] notifier_call_chain+0x5f/0xe0 [ 196.161362] atomic_notifier_call_chain+0x33/0x60 [ 196.161378] power_supply_changed_work+0x84/0x110 [ 196.161394] process_one_work+0x178/0x360 [ 196.161412] ? __pfx_worker_thread+0x10/0x10 [ 196.161424] worker_thread+0x307/0x430 [ 196.161440] ? __pfx_worker_thread+0x10/0x10 [ 196.161451] kthread+0xf4/0x130 [ 196.161467] ? __pfx_kthread+0x10/0x10 [ 196.161486] ret_from_fork+0x43/0x70 [ 196.161502] ? __pfx_kthread+0x10/0x10 [ 196.161518] ret_from_fork_asm+0x1b/0x30 [ 196.161558] </TASK> [ 196.161562] ---[ end trace 0000000000000000 ]--- Since there's no guarantee that all the callbacks can work in atomic context, switch to use blocking_notifier_call_chain to relax the constraint. Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Reported-by: Allen Zhong <allen@atr.me> Fixes: 4c71ae414474 ("platform/x86/amd/pmf: Add support SPS PMF feature") Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217571 Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://lore.kernel.org/r/20230913033233.602986-1-kai.heng.feng@canonical.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq24257_charger: Cleanup OF/ID table terminatorsBiju Das2023-09-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | Some cleanups: * Remove trailing comma in the terminator entry for OF/ID/ACPI table. * Drop a space from terminator entry for OF table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230902193331.83672-3-biju.das.jz@bp.renesas.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq24257_charger: Make chip type and name in syncBiju Das2023-09-121-35/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add struct bq2425x_chip_info to make enum bq2425x_chip and it's name in sync and replace chip->info in struct bq24257_device and add struct bq2425x_chip_info as match data for OF/ACPI/ID tables. Simpilfy probe() by replacing acpi_match_device() and id lookup for retrieving match data by using i2c_get_match_data(). Drop bq2425x_chip_name as there is no user and also drop the comment related to syncing chip and name as it is taken care by struct bq2425x_chip_info. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230902193331.83672-2-biju.das.jz@bp.renesas.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq2515x: Cleanup OF/ID table terminatorsBiju Das2023-09-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | Some cleanups: * Remove trailing comma in the terminator entry for OF/ID table. * Drop a space from terminator entry for OF table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230902200518.91585-3-biju.das.jz@bp.renesas.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq2515x: Simpilfy bq2515x_read_properties() and probe()Biju Das2023-09-121-32/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add struct bq2515x_info and replace device_id->info in struct bq2515x_device. Simpilfy bq2515x_read_properties() and probe() by adding struct bq2425x_chip_info as match data for OF/ID tables and use i2c_get_match_data for retrieving match data instead of ID lookup. Drop enum bq2515x_id as there is no user. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230902200518.91585-2-biju.das.jz@bp.renesas.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: syscon-poweroff: get regmap from parent nodeKrzysztof Kozlowski2023-09-121-2/+5
| | | | | | | | | | | | | | | | | | | | | | Just like syscon-reboot device, the syscon-poweroff is supposed to be a child of syscon node, thus we can take the same approach as syscon-poweroff: deprecate the 'regmap' field in favor of taking it from the parent's node. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230901120057.47018-3-krzysztof.kozlowski@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: syscon-poweroff: simplify pdev->dev usageKrzysztof Kozlowski2023-09-121-8/+9
| | | | | | | | | | | | | | | | | | Make the probe() code a bit simpler and shorter by storing all the '&pdev->dev' as 'dev'. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230901120057.47018-2-krzysztof.kozlowski@linaro.org Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: max17042_battery: Do not use CONFIG_ prefix in regular C codePrzemyslaw Chwiala2023-09-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | Using CONFIG_ prefix for macros is not a good practice. Use CONFIG_ prefix in Kconfig only. Signed-off-by: Przemyslaw Chwiala <przemekchwiala@gmail.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Link: https://lore.kernel.org/r/20230720123102.154699-1-przemekchwiala@gmail.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: Remove redundant dev_err_probe() for platform_get_irq_byname()Ruan Jinjie2023-09-122-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to call the dev_err_probe() function directly to print a custom message when handling an error from platform_get_irq_byname() function as it is going to display an appropriate error message in case of a failure. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Reviewed-by: Dhruva Gole <d-gole@ti.com> Link: https://lore.kernel.org/r/20230727113550.2599335-1-ruanjinjie@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: 88pm860x_battery: fix the return value handle for ↵Ruan Jinjie2023-09-121-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | platform_get_irq() There is no possible for platform_get_irq() to return 0, and the return value of platform_get_irq() is more sensible to show the error reason. Signed-off-by: Ruan Jinjie <ruanjinjie@huawei.com> Link: https://lore.kernel.org/r/20230731113959.1957820-1-ruanjinjie@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: syscon-poweroff: use builtin_platform_driver() to simplify codeYang Yingliang2023-09-121-6/+1
| | | | | | | | | | | | | | | | | | The syscon_poweroff_register() doesn't do anything special, so it can use the builtin_platform_driver() macro to eliminate boilerplate code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230807131951.3443880-6-yangyingliang@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: axxia-reset: use builtin_platform_driver() to simplify codeYang Yingliang2023-09-121-6/+1
| | | | | | | | | | | | | | | | | | The axxia_reset_init() doesn't do anything special, so it can use the builtin_platform_driver() macro to eliminate boilerplate code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230807131951.3443880-5-yangyingliang@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: xgene-reboot: use builtin_platform_driver() to simplify codeYang Yingliang2023-09-121-6/+1
| | | | | | | | | | | | | | | | | | The xgene_reboot_init() doesn't do anything special, so it can use the builtin_platform_driver() macro to eliminate boilerplate code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230807131951.3443880-4-yangyingliang@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: msm: use builtin_platform_driver() to simplify codeYang Yingliang2023-09-121-6/+1
| | | | | | | | | | | | | | | | | | The msm_restart_init() doesn't do anything special, so it can use the builtin_platform_driver() macro to eliminate boilerplate code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230807131951.3443880-3-yangyingliang@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: st-poweroff: use builtin_platform_driver() to simplify codeYang Yingliang2023-09-121-6/+1
| | | | | | | | | | | | | | | | | | The st_reset_init() doesn't do anything special, so it can use the builtin_platform_driver() macro to eliminate boilerplate code. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20230807131951.3443880-2-yangyingliang@huawei.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: reset: nvmem-reboot-mode: quiet some device deferralsAndrew Halaney2023-09-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Some errors are being logged that are really due to deferrals, which is confusing to users. Use dev_err_probe() to handle when to log at error level versus debug. This also has the added bonuses of logging to devices_deferred and printing the error value. Signed-off-by: Andrew Halaney <ahalaney@redhat.com> Reviewed-by: Brian Masney <bmasney@redhat.com> Tested-by: Brian Masney <bmasney@redhat.com> Link: https://lore.kernel.org/r/20230817214218.638846-1-ahalaney@redhat.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: sbs-battery: Make similar OF and ID tableBiju Das2023-09-121-4/+4
| | | | | | | | | | | | | | | | | | | | Make similar OF and ID table to extend support for ID match using i2c_match_data(). Currently it works only for OF match tables as the field is wrong for ID match. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/r/20230831171235.58477-1-biju.das.jz@bp.renesas.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq256xx: Some cleanupsBiju Das2023-09-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | Some cleanups: * Remove trailing comma in the terminator entry for OF/ID/ACPI table. * Drop a space from terminator entry for OF table. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230902202505.97609-3-biju.das.jz@bp.renesas.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* | power: supply: bq256xx: Use i2c_get_match_data()Biju Das2023-09-121-22/+22
|/ | | | | | | | | | | Use i2c_get_match_data() for OF/ID/ACPI match instead of ID lookup by replacing OF/ACPI/ID match data from enum bq256xx_id to struct bq256xx_chip_info. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230902202505.97609-2-biju.das.jz@bp.renesas.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
* thermal: Use thermal_tripless_zone_device_register()Rafael J. Wysocki2023-09-051-2/+2
| | | | | | | | | | | All of the remaining callers of thermal_zone_device_register() can use thermal_tripless_zone_device_register(), so make them do so in order to allow the former to be dropped. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>