ARM: dts: exynos: correct fuel gauge interrupt trigger level on GT-I9100
Subsystems (11)
Krzysztof Kozlowski
maintainerPATCH 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.
--- arch/arm/boot/dts/exynos4210-i9100.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4210-i9100.dts +1 -1
@@ -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
Krzysztof Kozlowski
maintainerPATCH 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.
--- arch/arm/boot/dts/exynos4412-p4note.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-p4note.dtsi +1 -1
@@ -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
Krzysztof Kozlowski
maintainerPATCH 3/18 ARM: dts: exynos: correct fuel gauge interrupt trigger level on Midas family
In reply to Krzysztof KozlowskiThe 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.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -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
Krzysztof Kozlowski
maintainerRe: [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")Signed-off-by Krzysztof Kozlowski <[email protected]>--- 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@@ -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
Krzysztof Kozlowski
maintainerPATCH 4/18 ARM: dts: exynos: correct MUIC interrupt trigger level on Midas family
In reply to Krzysztof KozlowskiThe 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.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -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
Krzysztof Kozlowski
maintainerPATCH 5/18 ARM: dts: exynos: correct PMIC interrupt trigger level on Midas family
In reply to Krzysztof KozlowskiThe 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.
--- arch/arm/boot/dts/exynos4412-midas.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-midas.dtsi +1 -1
@@ -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
Krzysztof Kozlowski
maintainerPATCH 6/18 ARM: dts: exynos: correct PMIC interrupt trigger level on Odroid X/U3 family
In reply to Krzysztof KozlowskiThe 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.
--- 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
@@ -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
Krzysztof Kozlowski
maintainerPATCH 7/18 ARM: dts: exynos: correct PMIC interrupt trigger level on P4 Note family
In reply to Krzysztof KozlowskiThe 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.
--- arch/arm/boot/dts/exynos4412-p4note.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos4412-p4note.dtsi +1 -1
@@ -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
Krzysztof Kozlowski
maintainerPATCH 8/18 ARM: dts: exynos: correct PMIC interrupt trigger level on SMDK5250
In reply to Krzysztof KozlowskiThe 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.
--- arch/arm/boot/dts/exynos5250-smdk5250.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/exynos5250-smdk5250.dts +1 -1
@@ -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
Krzysztof Kozlowski
maintainerPATCH 9/18 ARM: dts: exynos: correct PMIC interrupt trigger level on Snow
In reply to Krzysztof KozlowskiThe 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.
--- 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
@@ -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
Krzysztof Kozlowski
maintainerPATCH 10/18 ARM: dts: s5pv210: correct fuel gauge interrupt trigger level on Fascinate family
In reply to Krzysztof KozlowskiThe 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.
--- arch/arm/boot/dts/s5pv210-fascinate4g.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/s5pv210-fascinate4g.dts +1 -1
@@ -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
Krzysztof Kozlowski
maintainerPATCH 11/18 ARM: dts: qcom: msm8974-lge-nexus5: correct fuel gauge interrupt trigger level
In reply to Krzysztof KozlowskiThe 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.
--- 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
@@ -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
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")Signed-off-by Krzysztof Kozlowski <[email protected]>---
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
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
Krzysztof Kozlowski
maintainerPATCH 12/18 ARM: dts: qcom: msm8974-samsung-klte: correct fuel gauge interrupt trigger level
In reply to Krzysztof KozlowskiThe 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.
--- 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
@@ -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
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")Signed-off-by Krzysztof Kozlowski <[email protected]>---
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
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
Krzysztof Kozlowski
maintainerRFC 13/18 mfd: max77686: Do not enforce (incorrect) interrupt trigger type
In reply to Krzysztof KozlowskiInterrupt 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
@@ -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
@@ -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
@@ -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
@@ -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
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.
Signed-off-by Krzysztof Kozlowski <[email protected]>---
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(-)
Krzysztof Kozlowski
maintainerRFC 14/18 rtc: max77686: Do not enforce (incorrect) interrupt trigger type
In reply to Krzysztof KozlowskiInterrupt 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
@@ -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
Krzysztof Kozlowski
maintainerRFC 15/18 mfd: max77693: Do not enforce (incorrect) interrupt trigger type
In reply to Krzysztof KozlowskiInterrupt 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
@@ -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
@@ -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
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.
Signed-off-by Krzysztof Kozlowski <[email protected]>
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(-)
Krzysztof Kozlowski
maintainerRFC 16/18 power: supply: max17042: Do not enforce (incorrect) interrupt trigger type
In reply to Krzysztof KozlowskiInterrupt 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
@@ -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
Krzysztof Kozlowski
maintainerRFC 17/18 mfd: max14577: Do not enforce (incorrect) interrupt trigger type
In reply to Krzysztof KozlowskiInterrupt 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
@@ -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
@@ -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
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.
Signed-off-by Krzysztof Kozlowski <[email protected]>
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(-)
Krzysztof Kozlowski
maintainerRFC 18/18 power: supply: max17040: Do not enforce (incorrect) interrupt trigger type
In reply to Krzysztof KozlowskiInterrupt 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
@@ -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
@@ -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
Sebastian Reichel
maintainerRe: [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
[...]
indexd956c67d5155..f737de0470de100644drivers/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
Krzysztof Kozlowski
maintainerRe: [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
[...]
indexd956c67d5155..f737de0470de100644drivers/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
-0return ret;'flags' is unused after this change.
Indeed, thanks. Kbuild also complained now on my github branch. I'll fix it in v2.
Krzysztof Kozlowski
maintainerRe: [RFC 18/18] power: supply: max17040: Do not enforce (incorrect) interrupt trigger type
In reply to Krzysztof KozlowskiQuoted 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.
Signed-off-by Krzysztof Kozlowski <[email protected]>---
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@@ -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
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
-1ret =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
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.
Signed-off-by Krzysztof Kozlowski <[email protected]>---
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@@ -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@@ -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
-0flags = 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
-2ret = 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
Krzysztof Kozlowski
maintainerRe: [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.
Signed-off-by Krzysztof Kozlowski <[email protected]>---
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.txtb/Documentation/devicetree/bindings/power/supply/max17040_battery.txtQuoted 12 lines
Quoted 12 lines
index
c802f664b508..194eb9fe574d100644Documentation/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.cQuoted 4 lines
drivers/power/supply/max17040_battery.c static int max17040_enable_alert_irq(struct
Quoted 4 lines
index
d956c67d5155..f737de0470de100644drivers/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
-0flags = 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
Krzysztof Kozlowski
maintainerQuoted 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")Signed-off-by Krzysztof Kozlowski <[email protected]>--- 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