All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	Sebastian Reichel <sre@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-rtc@vger.kernel.org
Cc: Iskren Chernev <iskren.chernev@gmail.com>,
	Matheus Castello <matheus@castello.eng.br>,
	Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>,
	Angus Ainslie <angus@akkea.ca>,
	Hans de Goede <hdegoede@redhat.com>
Subject: [RFC 13/18] mfd: max77686: Do not enforce (incorrect) interrupt trigger type
Date: Thu, 10 Dec 2020 22:25:29 +0100	[thread overview]
Message-ID: <20201210212534.216197-13-krzk@kernel.org> (raw)
In-Reply-To: <20201210212534.216197-1-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 77686 datasheet describes the interrupt line as active low
with a requirement of acknowledge from the CPU therefore the edge
falling is not correct.

The interrupt line is shared between PMIC and RTC driver, so using level
sensitive interrupt is here especially important to avoid races.  With
an edge configuration in case if first PMIC signals interrupt followed
shortly after by the RTC, the interrupt might not be yet cleared/acked
thus the second one would not be noticed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

This patch should wait till DTS changes are merged, as it relies on
proper Devicetree.
---
 Documentation/devicetree/bindings/clock/maxim,max77686.txt | 4 ++--
 Documentation/devicetree/bindings/mfd/max77686.txt         | 2 +-
 Documentation/devicetree/bindings/regulator/max77686.txt   | 2 +-
 drivers/mfd/max77686.c                                     | 3 +--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/maxim,max77686.txt b/Documentation/devicetree/bindings/clock/maxim,max77686.txt
index 3472b461ca93..c10849efb444 100644
--- a/Documentation/devicetree/bindings/clock/maxim,max77686.txt
+++ b/Documentation/devicetree/bindings/clock/maxim,max77686.txt
@@ -49,7 +49,7 @@ Example:
 		max77686: max77686@9 {
 			compatible = "maxim,max77686";
 			interrupt-parent = <&wakeup_eint>;
-			interrupts = <26 0>;
+			interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 			reg = <0x09>;
 			#clock-cells = <1>;
 
@@ -74,7 +74,7 @@ Example:
 		max77802: max77802@9 {
 			compatible = "maxim,max77802";
 			interrupt-parent = <&wakeup_eint>;
-			interrupts = <26 0>;
+			interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 			reg = <0x09>;
 			#clock-cells = <1>;
 
diff --git a/Documentation/devicetree/bindings/mfd/max77686.txt b/Documentation/devicetree/bindings/mfd/max77686.txt
index 42968b7144e0..4447d074894a 100644
--- a/Documentation/devicetree/bindings/mfd/max77686.txt
+++ b/Documentation/devicetree/bindings/mfd/max77686.txt
@@ -21,6 +21,6 @@ Example:
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&wakeup_eint>;
-		interrupts = <26 0>;
+		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 		reg = <0x09>;
 	};
diff --git a/Documentation/devicetree/bindings/regulator/max77686.txt b/Documentation/devicetree/bindings/regulator/max77686.txt
index e9f7578ca09a..ff3d2dec8c4b 100644
--- a/Documentation/devicetree/bindings/regulator/max77686.txt
+++ b/Documentation/devicetree/bindings/regulator/max77686.txt
@@ -43,7 +43,7 @@ Example:
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&wakeup_eint>;
-		interrupts = <26 IRQ_TYPE_NONE>;
+		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 		reg = <0x09>;
 
 		voltage-regulators {
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 2ad554b921d9..f9e12ab2bc75 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -209,8 +209,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c)
 
 	ret = devm_regmap_add_irq_chip(&i2c->dev, max77686->regmap,
 				       max77686->irq,
-				       IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
-				       IRQF_SHARED, 0, irq_chip,
+				       IRQF_ONESHOT | IRQF_SHARED, 0, irq_chip,
 				       &max77686->irq_data);
 	if (ret < 0) {
 		dev_err(&i2c->dev, "failed to add PMIC irq chip: %d\n", ret);
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Chanwoo Choi <cw00.choi@samsung.com>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Lee Jones <lee.jones@linaro.org>,
	Sebastian Reichel <sre@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-rtc@vger.kernel.org
Cc: Angus Ainslie <angus@akkea.ca>,
	Hans de Goede <hdegoede@redhat.com>,
	Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>,
	Iskren Chernev <iskren.chernev@gmail.com>,
	Matheus Castello <matheus@castello.eng.br>
Subject: [RFC 13/18] mfd: max77686: Do not enforce (incorrect) interrupt trigger type
Date: Thu, 10 Dec 2020 22:25:29 +0100	[thread overview]
Message-ID: <20201210212534.216197-13-krzk@kernel.org> (raw)
In-Reply-To: <20201210212534.216197-1-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 77686 datasheet describes the interrupt line as active low
with a requirement of acknowledge from the CPU therefore the edge
falling is not correct.

The interrupt line is shared between PMIC and RTC driver, so using level
sensitive interrupt is here especially important to avoid races.  With
an edge configuration in case if first PMIC signals interrupt followed
shortly after by the RTC, the interrupt might not be yet cleared/acked
thus the second one would not be noticed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

---

This patch should wait till DTS changes are merged, as it relies on
proper Devicetree.
---
 Documentation/devicetree/bindings/clock/maxim,max77686.txt | 4 ++--
 Documentation/devicetree/bindings/mfd/max77686.txt         | 2 +-
 Documentation/devicetree/bindings/regulator/max77686.txt   | 2 +-
 drivers/mfd/max77686.c                                     | 3 +--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/clock/maxim,max77686.txt b/Documentation/devicetree/bindings/clock/maxim,max77686.txt
index 3472b461ca93..c10849efb444 100644
--- a/Documentation/devicetree/bindings/clock/maxim,max77686.txt
+++ b/Documentation/devicetree/bindings/clock/maxim,max77686.txt
@@ -49,7 +49,7 @@ Example:
 		max77686: max77686@9 {
 			compatible = "maxim,max77686";
 			interrupt-parent = <&wakeup_eint>;
-			interrupts = <26 0>;
+			interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 			reg = <0x09>;
 			#clock-cells = <1>;
 
@@ -74,7 +74,7 @@ Example:
 		max77802: max77802@9 {
 			compatible = "maxim,max77802";
 			interrupt-parent = <&wakeup_eint>;
-			interrupts = <26 0>;
+			interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 			reg = <0x09>;
 			#clock-cells = <1>;
 
diff --git a/Documentation/devicetree/bindings/mfd/max77686.txt b/Documentation/devicetree/bindings/mfd/max77686.txt
index 42968b7144e0..4447d074894a 100644
--- a/Documentation/devicetree/bindings/mfd/max77686.txt
+++ b/Documentation/devicetree/bindings/mfd/max77686.txt
@@ -21,6 +21,6 @@ Example:
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&wakeup_eint>;
-		interrupts = <26 0>;
+		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 		reg = <0x09>;
 	};
diff --git a/Documentation/devicetree/bindings/regulator/max77686.txt b/Documentation/devicetree/bindings/regulator/max77686.txt
index e9f7578ca09a..ff3d2dec8c4b 100644
--- a/Documentation/devicetree/bindings/regulator/max77686.txt
+++ b/Documentation/devicetree/bindings/regulator/max77686.txt
@@ -43,7 +43,7 @@ Example:
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&wakeup_eint>;
-		interrupts = <26 IRQ_TYPE_NONE>;
+		interrupts = <26 IRQ_TYPE_LEVEL_LOW>;
 		reg = <0x09>;
 
 		voltage-regulators {
diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index 2ad554b921d9..f9e12ab2bc75 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -209,8 +209,7 @@ static int max77686_i2c_probe(struct i2c_client *i2c)
 
 	ret = devm_regmap_add_irq_chip(&i2c->dev, max77686->regmap,
 				       max77686->irq,
-				       IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
-				       IRQF_SHARED, 0, irq_chip,
+				       IRQF_ONESHOT | IRQF_SHARED, 0, irq_chip,
 				       &max77686->irq_data);
 	if (ret < 0) {
 		dev_err(&i2c->dev, "failed to add PMIC irq chip: %d\n", ret);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-12-10 21:41 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 21:25 [PATCH 01/18] ARM: dts: exynos: correct fuel gauge interrupt trigger level on GT-I9100 Krzysztof Kozlowski
2020-12-10 21:25 ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 02/18] ARM: dts: exynos: correct fuel gauge interrupt trigger level on P4 Note family Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 03/18] ARM: dts: exynos: correct fuel gauge interrupt trigger level on Midas family Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-29 15:43   ` Krzysztof Kozlowski
2020-12-29 15:43     ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 04/18] ARM: dts: exynos: correct MUIC " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 05/18] ARM: dts: exynos: correct PMIC " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 06/18] ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid X/U3 family Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 07/18] ARM: dts: exynos: correct PMIC interrupt trigger level on P4 Note family Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 08/18] ARM: dts: exynos: correct PMIC interrupt trigger level on SMDK5250 Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 09/18] ARM: dts: exynos: correct PMIC interrupt trigger level on Snow Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 10/18] ARM: dts: s5pv210: correct fuel gauge interrupt trigger level on Fascinate family Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [PATCH 11/18] ARM: dts: qcom: msm8974-lge-nexus5: correct fuel gauge interrupt trigger level Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-11 15:29   ` Iskren Chernev
2020-12-11 15:29     ` Iskren Chernev
2020-12-10 21:25 ` [PATCH 12/18] ARM: dts: qcom: msm8974-samsung-klte: " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-11 15:25   ` Iskren Chernev
2020-12-11 15:25     ` Iskren Chernev
2020-12-10 21:25 ` Krzysztof Kozlowski [this message]
2020-12-10 21:25   ` [RFC 13/18] mfd: max77686: Do not enforce (incorrect) interrupt trigger type Krzysztof Kozlowski
2020-12-21 18:45   ` Rob Herring
2020-12-21 18:45     ` Rob Herring
2020-12-10 21:25 ` [RFC 14/18] rtc: " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [RFC 15/18] mfd: max77693: " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-21 18:46   ` Rob Herring
2020-12-21 18:46     ` Rob Herring
2020-12-10 21:25 ` [RFC 16/18] power: supply: max17042: " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 21:25 ` [RFC 17/18] mfd: max14577: " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-21 18:47   ` Rob Herring
2020-12-21 18:47     ` Rob Herring
2020-12-10 21:25 ` [RFC 18/18] power: supply: max17040: " Krzysztof Kozlowski
2020-12-10 21:25   ` Krzysztof Kozlowski
2020-12-10 22:16   ` Sebastian Reichel
2020-12-11  7:52     ` Krzysztof Kozlowski
2020-12-11  7:47   ` Krzysztof Kozlowski
2020-12-11  7:47     ` Krzysztof Kozlowski
2020-12-11 15:44     ` Iskren Chernev
2020-12-11 15:44       ` Iskren Chernev
2020-12-11 15:51       ` Krzysztof Kozlowski
2020-12-11 15:51         ` Krzysztof Kozlowski
2021-03-03 18:19 ` [PATCH 01/18] ARM: dts: exynos: correct fuel gauge interrupt trigger level on GT-I9100 Krzysztof Kozlowski
2021-03-03 18:19   ` Krzysztof Kozlowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201210212534.216197-13-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=a.zummo@towertech.it \
    --cc=agross@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=angus@akkea.ca \
    --cc=b.zolnierkie@samsung.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=iskren.chernev@gmail.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=matheus@castello.eng.br \
    --cc=mturquette@baylibre.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sebastian.krzyszkowiak@puri.sm \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.