This series add IRQ handler for low level SOC alert, define a devicetree binding attribute to configure the alert level threshold and check for changes in SOC and power supply status for send uevents. Max17043/17044 have a pin for alert host about low level state of charge and this alert can be configured in a threshold from 1% up to 32% of SOC. Tested on Toradex Colibri iMX7D, with a SparkFun Lipo Fuel Gauge module based on MAXIM MAX17043. Thanks Krzysztof for your time reviewing it. Let me know what you think about the fixes. Changes since v3: (Suggested by Krzysztof Kozlowski) - Validate values of the maxim,alert-low-soc-level early as possible - Clear the alert bit while handling IRQ - Remove the "chip->alert_bit" - Check the SOC and status at the same time on max17040_work - Add note about the compatible of devices with ALERT feature - Only set alert register and IRQ when compatible is max77836 Changes since v2: (Suggested by Krzysztof Kozlowski) - Fix ebusy exception - Remove device_init_wakeup from probe, let wakeup-source from DT decide that - Fix the use of "charger" to fuel-gauge on device tree description - Clear ALRT bit while setting the SOC threshold - Check SOC and clear ALRT bit when the SOC are above alert threshold - Fix unnecessary uevent when SOC is an ERRNO - Notify user space when power supply status change (Suggested by Rob Herring) - Fix the use of "charger" to fuel-gauge on device tree description - Add the (%) units on the description of property - Drop interrupt-parent - Fix name of property to let clear that is a low level SOC alert Changes since v1: (Suggested by Krzysztof Kozlowski) - Put common code from max17040_work and max17040_thread_handler in a function - Code style fixes - Define mask and low level threshold alert default - Check return value from max17040_set_soc_threshold - Set low level state of charge threshold before IRQ - CC maintainers from drivers/mfd/max14577 - Use flags from FDT client->flags instead hard coded it - Mention interrupts on DT Documentation - Fix "maxim,max77836-battery" missed from DT Documentation - Fix commit description Matheus Castello (4): power: supply: max17040: Add IRQ handler for low SOC alert dt-bindings: power: supply: Max17040: Add low level SOC alert threshold power: supply: max17040: Config alert SOC low level threshold from FDT power: supply: max17040: Send uevent in SOC and status change .../power/supply/max17040_battery.txt | 33 +++++ drivers/power/supply/max17040_battery.c | 134 +++++++++++++++++- 2 files changed, 162 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/supply/max17040_battery.txt -- 2.24.0.rc2