Skip to contentSkip to conversation

ARM: dts: exynos: correct fuel gauge interrupt trigger level on GT-I9100

PATCH In review Krzysztof Kozlowski 4 participants 30 messages Dec 10, 2020 – Mar 3, 2021

Subsystems (11)
lore
Share & tools
lore

Krzysztof Kozlowski

author maintainer
#0 lore raw

PATCH 1/18 ARM: dts: exynos: correct fuel gauge interrupt trigger level on GT-I9100

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes 8620cc2f99b7 ("ARM: dts: exynos: Add devicetree file for the Galaxy S2")
---
 arch/arm/boot/dts/exynos4210-i9100.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4210-i9100.dts +1 -1
index a0c3bab382ae..e56b64e237d3 100644
@@ -136,7 +136,7 @@ battery@36 {
 			compatible = "maxim,max17042";
 
 			interrupt-parent = <&gpx2>;
-			interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+			interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 
 			pinctrl-0 = <&max17042_fuel_irq>;
 			pinctrl-names = "default";
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 2/18 ARM: dts: exynos: correct fuel gauge interrupt trigger level on P4 Note family

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes f48b5050c301 ("ARM: dts: exynos: add Samsung's Exynos4412-based P4 Note boards")
---
 arch/arm/boot/dts/exynos4412-p4note.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-p4note.dtsi +1 -1
index b2f9d5448a18..5fe371543cbb 100644
@@ -146,7 +146,7 @@ fuel-gauge@36 {
 			pinctrl-0 = <&fuel_alert_irq>;
 			pinctrl-names = "default";
 			interrupt-parent = <&gpx2>;
-			interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+			interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 			maxim,rsns-microohm = <10000>;
 			maxim,over-heat-temp = <600>;
 			maxim,over-volt = <4300>;
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH 3/18 ARM: dts: exynos: correct fuel gauge interrupt trigger level on Midas family

In reply to Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes e8614292cd41 ("ARM: dts: Add Maxim 77693 fuel gauge node for exynos4412-trats2")
---
 arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
index 111c32bae02c..b8b75dc81aa1 100644
@@ -221,7 +221,7 @@ i2c_max77693_fuel: i2c-gpio-3 {
 		fuel-gauge@36 {
 			compatible = "maxim,max17047";
 			interrupt-parent = <&gpx2>;
-			interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+			interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&max77693_fuel_irq>;
 			reg = <0x36>;
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

Re: [PATCH 03/18] ARM: dts: exynos: correct fuel gauge interrupt trigger level on Midas family

Quoted 9 lines · Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes e8614292cd41 ("ARM: dts: Add Maxim 77693 fuel gauge node for exynos4412-trats2")
---
 arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi Marek,

I remember you were reporting that on Trats2 you see fuel gauge interrupt storm with this patchset. Is it correct? Shall I wait with applying this?

Best regards,
Krzysztof

Quoted 16 lines
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
index 111c32bae02c..b8b75dc81aa1 100644
@@ -221,7 +221,7 @@ i2c_max77693_fuel: i2c-gpio-3 {
 		fuel-gauge@36 {
 			compatible = "maxim,max17047";
 			interrupt-parent = <&gpx2>;
-			interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+			interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&max77693_fuel_irq>;
 			reg = <0x36>;
Signature · 1 line
2.25.1
author maintainer
#4 lore raw

PATCH 4/18 ARM: dts: exynos: correct MUIC interrupt trigger level on Midas family

In reply to Krzysztof Kozlowski

The Maxim MUIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.

Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.

Fixes 7eec1266751b ("ARM: dts: Add Maxim 77693 PMIC to exynos4412-trats2")
---
 arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
index b8b75dc81aa1..d75f554efde0 100644
@@ -173,7 +173,7 @@ i2c_max77693: i2c-gpio-1 {
 		pmic@66 {
 			compatible = "maxim,max77693";
 			interrupt-parent = <&gpx1>;
-			interrupts = <5 IRQ_TYPE_EDGE_FALLING>;
+			interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
 			pinctrl-names = "default";
 			pinctrl-0 = <&max77693_irq>;
 			reg = <0x66>;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#5 lore raw

PATCH 5/18 ARM: dts: exynos: correct PMIC interrupt trigger level on Midas family

In reply to Krzysztof Kozlowski

The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.

Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.

Fixes 15dfdfad2d4a ("ARM: dts: Add basic dts for Exynos4412-based Trats 2 board")
---
 arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
index d75f554efde0..fc77c1bfd844 100644
@@ -665,7 +665,7 @@ &i2c_7 {
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&gpx0>;
-		interrupts = <7 IRQ_TYPE_NONE>;
+		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-0 = <&max77686_irq>;
 		pinctrl-names = "default";
 		reg = <0x09>;
Signature · 1 line
2.25.1
author maintainer
#6 lore raw

PATCH 6/18 ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid X/U3 family

In reply to Krzysztof Kozlowski

The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.

Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.

Fixes eea6653aae7b ("ARM: dts: Enable PMIC interrupts for exynos4412-odroid-common")
---
 arch/arm/boot/dts/exynos4412-odroid-common.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-odroid-common.dtsi +1 -1
index 2b20d9095d9f..eebe6a3952ce 100644
@@ -278,7 +278,7 @@ usb3503: usb-hub@8 {
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&gpx3>;
-		interrupts = <2 IRQ_TYPE_NONE>;
+		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&max77686_irq>;
 		reg = <0x09>;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#7 lore raw

PATCH 7/18 ARM: dts: exynos: correct PMIC interrupt trigger level on P4 Note family

In reply to Krzysztof Kozlowski

The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.

Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.

Fixes f48b5050c301 ("ARM: dts: exynos: add Samsung's Exynos4412-based P4 Note boards")
---
 arch/arm/boot/dts/exynos4412-p4note.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-p4note.dtsi +1 -1
index 5fe371543cbb..9e750890edb8 100644
@@ -322,7 +322,7 @@ &i2c_7 {
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&gpx0>;
-		interrupts = <7 IRQ_TYPE_NONE>;
+		interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-0 = <&max77686_irq>;
 		pinctrl-names = "default";
 		reg = <0x09>;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#8 lore raw

PATCH 8/18 ARM: dts: exynos: correct PMIC interrupt trigger level on SMDK5250

In reply to Krzysztof Kozlowski

The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.

Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.

Fixes 47580e8d94c2 ("ARM: dts: Specify MAX77686 pmic interrupt for exynos5250-smdk5250")
---
 arch/arm/boot/dts/exynos5250-smdk5250.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5250-smdk5250.dts +1 -1
index 8b5a79a8720c..39bbe18145cf 100644
@@ -134,7 +134,7 @@ max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		reg = <0x09>;
 		interrupt-parent = <&gpx3>;
-		interrupts = <2 IRQ_TYPE_NONE>;
+		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&max77686_irq>;
 		#clock-cells = <1>;
Signature · 1 line
2.25.1
author maintainer
#9 lore raw

PATCH 9/18 ARM: dts: exynos: correct PMIC interrupt trigger level on Snow

In reply to Krzysztof Kozlowski

The Maxim PMIC datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. Without specifying the interrupt type in Devicetree, kernel might apply some fixed configuration, not necessarily working for this hardware.

Additionally, the interrupt line is shared so using level sensitive interrupt is here especially important to avoid races.

Fixes c61248afa819 ("ARM: dts: Add max77686 RTC interrupt to cros5250-common")
---
 arch/arm/boot/dts/exynos5250-snow-common.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5250-snow-common.dtsi +1 -1
index 6635f6184051..2335c4687349 100644
@@ -292,7 +292,7 @@ &i2c_0 {
 	max77686: pmic@9 {
 		compatible = "maxim,max77686";
 		interrupt-parent = <&gpx3>;
-		interrupts = <2 IRQ_TYPE_NONE>;
+		interrupts = <2 IRQ_TYPE_LEVEL_LOW>;
 		pinctrl-names = "default";
 		pinctrl-0 = <&max77686_irq>;
 		wakeup-source;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#10 lore raw

PATCH 10/18 ARM: dts: s5pv210: correct fuel gauge interrupt trigger level on Fascinate family

In reply to Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes 99bb20321f0e ("ARM: dts: s5pv210: Correct fuelgauge definition on Aries")
---
 arch/arm/boot/dts/s5pv210-fascinate4g.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/s5pv210-fascinate4g.dts +1 -1
index ca064359dd30..b47d8300e536 100644
@@ -115,7 +115,7 @@ &fg {
 	compatible = "maxim,max77836-battery";
 
 	interrupt-parent = <&gph3>;
-	interrupts = <3 IRQ_TYPE_EDGE_FALLING>;
+	interrupts = <3 IRQ_TYPE_LEVEL_LOW>;
 
 	pinctrl-names = "default";
 	pinctrl-0 = <&fg_irq>;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#11 lore raw

PATCH 11/18 ARM: dts: qcom: msm8974-lge-nexus5: correct fuel gauge interrupt trigger level

In reply to Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes 45dfa741df86 ("ARM: dts: qcom: msm8974-lge-nexus5: Add fuel gauge")
---
 arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +1 -1
index e769f638f205..4c6f54aa9f66 100644
@@ -575,7 +575,7 @@ fuelgauge: max17048@36 {
 			maxim,rcomp = /bits/ 8 <0x4d>;
 
 			interrupt-parent = <&msmgpio>;
-			interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
+			interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
 
 			pinctrl-names = "default";
 			pinctrl-0 = <&fuelgauge_pin>;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer Acked-by on v1 11/18
#12 lore raw

Re: [PATCH 11/18] ARM: dts: qcom: msm8974-lge-nexus5: correct fuel gauge interrupt trigger level

Quoted 15 lines · Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU.  The falling edge interrupt will mostly work but it's not correct.

Fixes 45dfa741df86 ("ARM: dts: qcom: msm8974-lge-nexus5: Add fuel gauge")

---
  arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +0 -0
index e769f638f205..4c6f54aa9f66 100644

arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts fuelgauge: max17048@36 { · line 581

Quoted 8 lines
arch/arm/boot/dts/qcom-msm8974-lge-nexus5-hammerhead.dts +1 -1
@@ -575,7 +575,7 @@ fuelgauge: max17048@36 {
              maxim,rcomp = /bits/ 8 <0x4d>;
 
              interrupt-parent = <&msmgpio>;
-            interrupts = <9 IRQ_TYPE_EDGE_FALLING>;
+            interrupts = <9 IRQ_TYPE_LEVEL_LOW>;
 
              pinctrl-names = "default";
              pinctrl-0 = <&fuelgauge_pin>;

According to the datasheet for max17048 the ALRT pin is active low, so that looks good. The reason it was implemented EDGE_FALLING is mostly due to fragments taken from downstream, and the fact that it worked :)

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#13 lore raw

PATCH 12/18 ARM: dts: qcom: msm8974-samsung-klte: correct fuel gauge interrupt trigger level

In reply to Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes da8d46992e67 ("ARM: dts: qcom: msm8974-klte: Add fuel gauge")
---
 arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +1 -1
index 97352de91314..64a3fdb79539 100644
@@ -691,7 +691,7 @@ fuelgauge@36 {
 			maxim,rcomp = /bits/ 8 <0x56>;
 
 			interrupt-parent = <&pma8084_gpios>;
-			interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
+			interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
 
 			pinctrl-names = "default";
 			pinctrl-0 = <&fuelgauge_pin>;
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
reviewer Acked-by Tested-by on v1 12/18
#14 lore raw

Re: [PATCH 12/18] ARM: dts: qcom: msm8974-samsung-klte: correct fuel gauge interrupt trigger level

Quoted 15 lines · Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU.  The falling edge interrupt will mostly work but it's not correct.

Fixes da8d46992e67 ("ARM: dts: qcom: msm8974-klte: Add fuel gauge")

---
  arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +0 -0
index 97352de91314..64a3fdb79539 100644

arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts fuelgauge@36 { · line 697

Quoted 8 lines
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +1 -1
@@ -691,7 +691,7 @@ fuelgauge@36 {
              maxim,rcomp = /bits/ 8 <0x56>;
 
              interrupt-parent = <&pma8084_gpios>;
-            interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
+            interrupts = <21 IRQ_TYPE_LEVEL_LOW>;
 
              pinctrl-names = "default";
              pinctrl-0 = <&fuelgauge_pin>;

After testing this patch + the rfc modifying 17040 driver I can confirm it works on the klte. Also, according to the max17048 datasheet, the ALRT pin is active low, so everything is in order.

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#15 lore raw

RFC 13/18 mfd: max77686: Do not enforce (incorrect) interrupt trigger type

In reply to Krzysztof Kozlowski

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.

---

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(-)
Documentation/devicetree/bindings/clock/maxim,max77686.txt +2 -2
index 3472b461ca93..c10849efb444 100644
@@ -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>;
 
Documentation/devicetree/bindings/mfd/max77686.txt +1 -1
index 42968b7144e0..4447d074894a 100644
@@ -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>;
 	};
Documentation/devicetree/bindings/regulator/max77686.txt +1 -1
index e9f7578ca09a..ff3d2dec8c4b 100644
@@ -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 {
drivers/mfd/max77686.c +1 -2
index 2ad554b921d9..f9e12ab2bc75 100644
@@ -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);
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Acked-by on v1 13/18
#16 lore raw

Re: [RFC 13/18] mfd: max77686: Do not enforce (incorrect) interrupt trigger type

Quoted 18 lines · Krzysztof Kozlowski

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.

---

Quoted 9 lines

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(-)
author maintainer
#17 lore raw

RFC 14/18 rtc: max77686: Do not enforce (incorrect) interrupt trigger type

In reply to Krzysztof Kozlowski

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.

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 drivers/rtc/rtc-max77686.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-max77686.c +2 -2
index d51cc12114cb..eae7cb9faf1e 100644
@@ -717,8 +717,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
 
 add_rtc_irq:
 	ret = regmap_add_irq_chip(info->rtc_regmap, info->rtc_irq,
-				  IRQF_TRIGGER_FALLING | IRQF_ONESHOT |
-				  IRQF_SHARED, 0, info->drv_data->rtc_irq_chip,
+				  IRQF_ONESHOT | IRQF_SHARED,
+				  0, info->drv_data->rtc_irq_chip,
 				  &info->rtc_irq_data);
 	if (ret < 0) {
 		dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret);
Signature · 7 lines
2.25.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
author maintainer
#18 lore raw

RFC 15/18 mfd: max77693: Do not enforce (incorrect) interrupt trigger type

In reply to Krzysztof Kozlowski

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

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 Documentation/devicetree/bindings/mfd/max77693.txt |  2 +-
 drivers/mfd/max77693.c                             | 12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/mfd/max77693.txt +1 -1
index 0ced96e16c16..1032df14498b 100644
@@ -139,7 +139,7 @@ Example:
 		compatible = "maxim,max77693";
 		reg = <0x66>;
 		interrupt-parent = <&gpx1>;
-		interrupts = <5 2>;
+		interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
 
 		regulators {
 			esafeout@1 {
drivers/mfd/max77693.c +4 -8
index 596ed85cab3b..4e6244e17559 100644
@@ -222,8 +222,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
 	}
 
 	ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
-				IRQF_ONESHOT | IRQF_SHARED |
-				IRQF_TRIGGER_FALLING, 0,
+				IRQF_ONESHOT | IRQF_SHARED, 0,
 				&max77693_led_irq_chip,
 				&max77693->irq_data_led);
 	if (ret) {
@@ -232,8 +231,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
 	}
 
 	ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
-				IRQF_ONESHOT | IRQF_SHARED |
-				IRQF_TRIGGER_FALLING, 0,
+				IRQF_ONESHOT | IRQF_SHARED, 0,
 				&max77693_topsys_irq_chip,
 				&max77693->irq_data_topsys);
 	if (ret) {
@@ -242,8 +240,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
 	}
 
 	ret = regmap_add_irq_chip(max77693->regmap, max77693->irq,
-				IRQF_ONESHOT | IRQF_SHARED |
-				IRQF_TRIGGER_FALLING, 0,
+				IRQF_ONESHOT | IRQF_SHARED, 0,
 				&max77693_charger_irq_chip,
 				&max77693->irq_data_chg);
 	if (ret) {
@@ -252,8 +249,7 @@ static int max77693_i2c_probe(struct i2c_client *i2c,
 	}
 
 	ret = regmap_add_irq_chip(max77693->regmap_muic, max77693->irq,
-				IRQF_ONESHOT | IRQF_SHARED |
-				IRQF_TRIGGER_FALLING, 0,
+				IRQF_ONESHOT | IRQF_SHARED, 0,
 				&max77693_muic_irq_chip,
 				&max77693->irq_data_muic);
 	if (ret) {
Signature · 1 line
2.25.1
maintainer Acked-by on v1 15/18
#19 lore raw

Re: [RFC 15/18] mfd: max77693: Do not enforce (incorrect) interrupt trigger type

Quoted 16 lines · Krzysztof Kozlowski

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

Quoted 9 lines

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 Documentation/devicetree/bindings/mfd/max77693.txt |  2 +-
 drivers/mfd/max77693.c                             | 12 ++++--------
 2 files changed, 5 insertions(+), 9 deletions(-)
author maintainer
#20 lore raw

RFC 16/18 power: supply: max17042: Do not enforce (incorrect) interrupt trigger type

In reply to Krzysztof Kozlowski

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 17047/77693 datasheets describe 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.

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 drivers/power/supply/max17042_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/supply/max17042_battery.c +1 -1
index 79d4b5988360..8117ecabe31c 100644
@@ -1104,7 +1104,7 @@ static int max17042_probe(struct i2c_client *client,
 	}
 
 	if (client->irq) {
-		unsigned int flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;
+		unsigned int flags = IRQF_ONESHOT;
 
 		/*
 		 * On ACPI systems the IRQ may be handled by ACPI-event code,
Signature · 1 line
2.25.1
author maintainer
#21 lore raw

RFC 17/18 mfd: max14577: Do not enforce (incorrect) interrupt trigger type

In reply to Krzysztof Kozlowski

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.

The interrupt line is shared between PMIC and charger 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.

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 Documentation/devicetree/bindings/mfd/max14577.txt | 4 ++--
 drivers/mfd/max14577.c                             | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/mfd/max14577.txt +2 -2
index 92070b346756..be11943a0560 100644
@@ -71,7 +71,7 @@ max14577@25 {
 	compatible = "maxim,max14577";
 	reg = <0x25>;
 	interrupt-parent = <&gpx1>;
-	interrupts = <5 IRQ_TYPE_NONE>;
+	interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
 
 	muic: max14577-muic {
 		compatible = "maxim,max14577-muic";
@@ -106,7 +106,7 @@ max77836@25 {
 	compatible = "maxim,max77836";
 	reg = <0x25>;
 	interrupt-parent = <&gpx1>;
-	interrupts = <5 IRQ_TYPE_NONE>;
+	interrupts = <5 IRQ_TYPE_LEVEL_LOW>;
 
 	muic: max77836-muic {
 		compatible = "maxim,max77836-muic";
drivers/mfd/max14577.c +3 -3
index be185e9d5f16..6c487fa14e9c 100644
@@ -332,7 +332,7 @@ static int max77836_init(struct max14577 *max14577)
 	}
 
 	ret = regmap_add_irq_chip(max14577->regmap_pmic, max14577->irq,
-			IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED,
+			IRQF_ONESHOT | IRQF_SHARED,
 			0, &max77836_pmic_irq_chip,
 			&max14577->irq_data_pmic);
 	if (ret != 0) {
@@ -418,14 +418,14 @@ static int max14577_i2c_probe(struct i2c_client *i2c,
 		irq_chip = &max77836_muic_irq_chip;
 		mfd_devs = max77836_devs;
 		mfd_devs_size = ARRAY_SIZE(max77836_devs);
-		irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT | IRQF_SHARED;
+		irq_flags = IRQF_ONESHOT | IRQF_SHARED;
 		break;
 	case MAXIM_DEVICE_TYPE_MAX14577:
 	default:
 		irq_chip = &max14577_irq_chip;
 		mfd_devs = max14577_devs;
 		mfd_devs_size = ARRAY_SIZE(max14577_devs);
-		irq_flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;
+		irq_flags = IRQF_ONESHOT;
 		break;
 	}
 
Signature · 1 line
2.25.1
maintainer Acked-by on v1 17/18
#22 lore raw

Re: [RFC 17/18] mfd: max14577: Do not enforce (incorrect) interrupt trigger type

Quoted 16 lines · Krzysztof Kozlowski

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.

The interrupt line is shared between PMIC and charger 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.

Quoted 9 lines

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 Documentation/devicetree/bindings/mfd/max14577.txt | 4 ++--
 drivers/mfd/max14577.c                             | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
author maintainer
#23 lore raw

RFC 18/18 power: supply: max17040: Do not enforce (incorrect) interrupt trigger type

In reply to Krzysztof Kozlowski

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.

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 .../devicetree/bindings/power/supply/max17040_battery.txt       | 2 +-
 drivers/power/supply/max17040_battery.c                         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/power/supply/max17040_battery.txt +1 -1
index c802f664b508..194eb9fe574d 100644
@@ -39,7 +39,7 @@ Example:
 		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;
 	};
 
drivers/power/supply/max17040_battery.c +1 -1
index d956c67d5155..f737de0470de 100644
@@ -367,7 +367,7 @@ static int max17040_enable_alert_irq(struct max17040_chip *chip)
 
 	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;
Signature · 1 line
2.25.1
#24 lore raw

Re: [RFC 18/18] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type

(I shortened the Cc)

Hi,

drivers/power/supply/max17040_battery.c static int max17040_enable_alert_irq(struct max17040_chip *chip) · line 373

Quoted 13 lines · Krzysztof Kozlowski

[...]
index d956c67d5155..f737de0470de 100644

drivers/power/supply/max17040_battery.c +1 -1
@@ -367,7 +367,7 @@ static int max17040_enable_alert_irq(struct max17040_chip *chip)
 
 	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;

'flags' is unused after this change.

-- Sebastian

author maintainer
#25 lore raw

Re: [RFC 18/18] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type

Quoted 17 lines · Sebastian Reichel

(I shortened the Cc)

Hi,

Quoted 12 lines · Krzysztof Kozlowski

[...]
index d956c67d5155..f737de0470de 100644

drivers/power/supply/max17040_battery.c +1 -1
@@ -367,7 +367,7 @@ static int max17040_enable_alert_irq(struct max17040_chip *chip)
 
 	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);
 
Quoted 3 lines

drivers/power/supply/max17040_battery.c static int max17040_enable_alert_irq(struct max17040_chip *chip) · line 373

Quoted 1 line
drivers/power/supply/max17040_battery.c +0 -0
 	return ret;

'flags' is unused after this change.

Indeed, thanks. Kbuild also complained now on my github branch. I'll fix it in v2.

author maintainer
#26 lore raw

Re: [RFC 18/18] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type

In reply to Krzysztof Kozlowski
Quoted 37 lines · Krzysztof Kozlowski

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.

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.

---
 .../devicetree/bindings/power/supply/max17040_battery.txt       | 2 +-
 drivers/power/supply/max17040_battery.c                         | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/power/supply/max17040_battery.txt +1 -1
index c802f664b508..194eb9fe574d 100644
@@ -39,7 +39,7 @@ Example:
 		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;
 	};
 
drivers/power/supply/max17040_battery.c +0 -0
index d956c67d5155..f737de0470de 100644

drivers/power/supply/max17040_battery.c static int max17040_enable_alert_irq(struct max17040_chip *chip) · line 368

Quoted 2 lines
drivers/power/supply/max17040_battery.c +0 -0
@@ -367,7 +367,7 @@ static int max17040_enable_alert_irq(struct max17040_chip *chip)
 
 	flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;

This has to be removed. I will fix it in v2.

Best regards,
Krzysztof

Quoted 9 lines
drivers/power/supply/max17040_battery.c +1 -1
 	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;
Signature · 1 line
2.25.1
reviewer Acked-by
#27 lore raw

Re: [RFC 18/18] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type

Quoted 39 lines · Krzysztof Kozlowski
Quoted 38 lines · Krzysztof Kozlowski

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.

---

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.
---
.../devicetree/bindings/power/supply/max17040_battery.txt       | 2 +- drivers/power/supply/max17040_battery.c                         | 2 +-

  2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/power/supply/max17040_battery.txt +1 -1
index c802f664b508..194eb9fe574d 100644
@@ -39,7 +39,7 @@ Example:
          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;
      };
 
drivers/power/supply/max17040_battery.c +0 -0
index d956c67d5155..f737de0470de 100644
@@ -367,7 +367,7 @@ static int max17040_enable_alert_irq(struct max17040_chip *chip)
 
Quoted 6 lines

drivers/power/supply/max17040_battery.c static int max17040_enable_alert_irq(struct max17040_chip *chip) · line 368

Quoted 1 line
drivers/power/supply/max17040_battery.c +0 -0
      flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;

This has to be removed. I will fix it in v2.

Best regards,
Krzysztof

I removed the IRQF_TRIGGER_FALLING, tweaked the DT as per the DT patch, and it worked on the samsung klte.

I don't understand how the DT irq flag ends up being used by the kernel. It is never explicitly read from DT or passed to interrupt API, only i2c->irq, which is a pure int.

Fixing the DT and the drivers will hopefully set a precedent, so future drivers (when copied/tweaked from existing drivers) will do it right.

Quoted 9 lines
Quoted 9 lines
drivers/power/supply/max17040_battery.c +1 -2
      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;
--

2.25.1

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#28 lore raw

Re: [RFC 18/18] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type

Quoted 52 lines · Iskren Chernev
Quoted 13 lines · Krzysztof Kozlowski
Quoted 12 lines · Krzysztof Kozlowski

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.

---

Quoted 8 lines
Quoted 8 lines

This patch should wait till DTS changes are merged, as it relies on proper Devicetree.
---
.../devicetree/bindings/power/supply/max17040_battery.txt       | 2 +- drivers/power/supply/max17040_battery.c                         | 2 +-

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

diff --git

a/Documentation/devicetree/bindings/power/supply/max17040_battery.txt b/Documentation/devicetree/bindings/power/supply/max17040_battery.txt

Quoted 12 lines
Quoted 12 lines

index c802f664b508..194eb9fe574d 100644

Documentation/devicetree/bindings/power/supply/max17040_battery.txt +1 -1
@@ -39,7 +39,7 @@ Example:
          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;
      };
 
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/power/supply/max17040_battery.c

Quoted 4 lines

drivers/power/supply/max17040_battery.c static int max17040_enable_alert_irq(struct

Quoted 4 lines

index d956c67d5155..f737de0470de 100644

drivers/power/supply/max17040_battery.c +0 -0
@@ -367,7 +367,7 @@ static int max17040_enable_alert_irq(struct

max17040_chip *chip)

Quoted 7 lines

drivers/power/supply/max17040_battery.c static int max17040_enable_alert_irq(struct max17040_chip *chip) · line 368

Quoted 2 lines
drivers/power/supply/max17040_battery.c +0 -0
      flags = IRQF_TRIGGER_FALLING | IRQF_ONESHOT;

This has to be removed. I will fix it in v2.

Best regards,
Krzysztof

Quoted 6 lines

I removed the IRQF_TRIGGER_FALLING, tweaked the DT as per the DT patch, and it worked on the samsung klte.

I don't understand how the DT irq flag ends up being used by the kernel. It is never explicitly read from DT or passed to interrupt API, only i2c->irq, which is a pure int.

The core __setup_irq() calls irqd_get_trigger_type() on IRQ data matching the IRQ.

Best regards,
Krzysztof

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

author maintainer
#29 lore raw
In reply to Krzysztof Kozlowski
Quoted 10 lines · Krzysztof Kozlowski

The Maxim fuel gauge datasheets describe the interrupt line as active low with a requirement of acknowledge from the CPU. The falling edge interrupt will mostly work but it's not correct.

Fixes 8620cc2f99b7 ("ARM: dts: exynos: Add devicetree file for the Galaxy S2")
---
 arch/arm/boot/dts/exynos4210-i9100.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied 1-10 (Exynos and S5P dts patches).

Best regards,
Krzysztof