diff mbox series

[v2,7/7] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type

Message ID 20210526172036.183223-8-krzysztof.kozlowski@canonical.com
State New
Headers show
Series mfd/power/rtc: Do not enforce (incorrect) interrupt trigger type | expand

Commit Message

Krzysztof Kozlowski May 26, 2021, 5:20 p.m. UTC
From: Krzysztof Kozlowski <krzk@kernel.org>

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>

---

Changes since v1:
1. Remove the 'flags' variable.
2. Added ack.
3. Rebase - the bindings were converted to dtschema.
---
 .../devicetree/bindings/power/supply/maxim,max17040.yaml      | 2 +-
 drivers/power/supply/max17040_battery.c                       | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

Comments

Rob Herring June 2, 2021, 8:06 p.m. UTC | #1
On Wed, 26 May 2021 13:20:36 -0400, Krzysztof Kozlowski wrote:
> From: Krzysztof Kozlowski <krzk@kernel.org>

> 

> 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>

> 

> ---

> 

> Changes since v1:

> 1. Remove the 'flags' variable.

> 2. Added ack.

> 3. Rebase - the bindings were converted to dtschema.

> ---

>  .../devicetree/bindings/power/supply/maxim,max17040.yaml      | 2 +-

>  drivers/power/supply/max17040_battery.c                       | 4 +---

>  2 files changed, 2 insertions(+), 4 deletions(-)

> 


Acked-by: Rob Herring <robh@kernel.org>
Sebastian Reichel June 4, 2021, 10:01 a.m. UTC | #2
Hi,

On Wed, Jun 02, 2021 at 03:06:09PM -0500, Rob Herring wrote:
> On Wed, 26 May 2021 13:20:36 -0400, Krzysztof Kozlowski wrote:
> > From: Krzysztof Kozlowski <krzk@kernel.org>
> > 
> > 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>
> > 
> > ---
> > 
> > Changes since v1:
> > 1. Remove the 'flags' variable.
> > 2. Added ack.
> > 3. Rebase - the bindings were converted to dtschema.
> > ---
> >  .../devicetree/bindings/power/supply/maxim,max17040.yaml      | 2 +-
> >  drivers/power/supply/max17040_battery.c                       | 4 +---
> >  2 files changed, 2 insertions(+), 4 deletions(-)
> > 
> 
> Acked-by: Rob Herring <robh@kernel.org>

Thanks, queued.

-- Sebastian
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml
index de91cf3f058c..f792d06db413 100644
--- a/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml
+++ b/Documentation/devicetree/bindings/power/supply/maxim,max17040.yaml
@@ -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;
       };
     };
diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index 1aab868adabf..e80dd9141ae7 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -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;