power: supply: max17040: Do not enforce (incorrect) interrupt trigger type
authorKrzysztof Kozlowski <krzk@kernel.org>
Wed, 26 May 2021 17:20:36 +0000 (13:20 -0400)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Fri, 4 Jun 2021 09:58:22 +0000 (11:58 +0200)
Interrupt line can be configured on different hardware in different way,
even inverted.  Therefore driver should not enforce specific trigger
type - edge falling - but instead rely on Devicetree to configure it.

The Maxim 14577/77836 datasheets describe the interrupt line as active
low with a requirement of acknowledge from the CPU therefore the edge
falling is not correct.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Acked-by: Iskren Chernev <iskren.chernev@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml
drivers/power/supply/max17040_battery.c

index de91cf3f058cce4f5d8c49c75338ecfa0416f1b8..f792d06db413f461eaa21f3a5eac41ecc6f02411 100644 (file)
@@ -89,7 +89,7 @@ examples:
         reg = <0x36>;
         maxim,alert-low-soc-level = <10>;
         interrupt-parent = <&gpio7>;
-        interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+        interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
         wakeup-source;
       };
     };
index 1aab868adabf7d825841d7f023df098868c7db0e..e80dd9141ae723c015f5f18f7905b3260a512661 100644 (file)
@@ -361,12 +361,10 @@ static irqreturn_t max17040_thread_handler(int id, void *dev)
 static int max17040_enable_alert_irq(struct max17040_chip *chip)
 {
        struct i2c_client *client = chip->client;
-       unsigned int flags;
        int ret;
 
-       flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;
        ret = devm_request_threaded_irq(&client->dev, client->irq, NULL,
-                                       max17040_thread_handler, flags,
+                                       max17040_thread_handler, IRQF_ONESHOT,
                                        chip->battery->desc->name, chip);
 
        return ret;