Skip to contentSkip to conversation

i2c: imx: add irqf_no_suspend

PATCH In review Alifer Moraes 4 participants 4 messages Mar 7, 2022 – May 21, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: imx: add irqf_no_suspend

From: gaopan <[email protected]>

The i2c irq is masked when pcie starts a i2c transfer process during noirq suspend stage. As a result, i2c transfer fails. To solve the problem, IRQF_NO_SUSPEND is added to i2c bus.

---
 drivers/i2c/busses/i2c-imx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-imx.c +2 -1
index 27f969b3dc07..fcc09a1e7f44 100644
@@ -1478,7 +1478,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
 		goto rpm_disable;
 
 	/* Request IRQ */
-	ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
+	ret = request_threaded_irq(irq, i2c_imx_isr, NULL,
+				   IRQF_SHARED | IRQF_NO_SUSPEND,
 				   pdev->name, i2c_imx);
 	if (ret) {
 		dev_err(&pdev->dev, "can't claim irq %d\n", irq);
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alifer Moraes

From: gaopan <[email protected]>

The i2c irq is masked when pcie starts a i2c transfer process during noirq suspend stage. As a result, i2c transfer fails. To solve the problem, IRQF_NO_SUSPEND is added to i2c bus.

Thank you!

Quoted 23 lines
---
 drivers/i2c/busses/i2c-imx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-imx.c +2 -1
index 27f969b3dc07..fcc09a1e7f44 100644
@@ -1478,7 +1478,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
 		goto rpm_disable;
 
 	/* Request IRQ */
-	ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
+	ret = request_threaded_irq(irq, i2c_imx_isr, NULL,
+				   IRQF_SHARED | IRQF_NO_SUSPEND,
 				   pdev->name, i2c_imx);
 	if (ret) {
 		dev_err(&pdev->dev, "can't claim irq %d\n", irq);
Signature · 1 line
2.25.1
Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#2 lore raw

Re: (EXT) [PATCH] i2c: imx: add irqf_no_suspend

In reply to Alifer Moraes

Hallo,

Am Montag, 7. März 2022, 15:36:30 CET schrieb Alifer Moraes:

Quoted 18 lines

From: gaopan <[email protected]>

The i2c irq is masked when pcie starts a i2c transfer process during noirq suspend stage. As a result, i2c transfer fails. To solve the problem, IRQF_NO_SUSPEND is added to i2c bus.

---
 drivers/i2c/busses/i2c-imx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-imx.c +0 -0
index 27f969b3dc07..fcc09a1e7f44 100644

drivers/i2c/busses/i2c-imx.c static int i2c_imx_probe(struct platform_device *pdev) · line 1485

Quoted 9 lines
drivers/i2c/busses/i2c-imx.c +2 -1
@@ -1478,7 +1478,8 @@ static int i2c_imx_probe(struct platform_device *pdev)
 goto rpm_disable;
 
 	/* Request IRQ */
-	ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
+	ret = request_threaded_irq(irq, i2c_imx_isr, NULL,
+				   IRQF_SHARED | IRQF_NO_SUSPEND,
 				   pdev->name, i2c_imx);
 	if (ret) {
 		dev_err(&pdev->dev, "can't claim irq %d\n", irq);

I stumbled across Documentation/power/suspend-and-interrupts.rst which states:

Quoted 2 lines

For this reason, using IRQF_NO_SUSPEND and IRQF_SHARED at the same time should be avoided.

Given this IMHO at least a comment should be inserted why this is fine. I dont have a full picture about the situation, but to me it seems there is a reference missing, or why/how does some PCIe start some I2C transfer when the controller is suspended already? Do I miss something?

Best regards,
Alexander

#3 lore raw

Re: (EXT) [PATCH] i2c: imx: add irqf_no_suspend

Hi everyone,

Quoted 7 lines
Quoted 7 lines

The i2c irq is masked when pcie starts a i2c transfer process during noirq suspend stage. As a result, i2c transfer fails. To solve the problem, IRQF_NO_SUSPEND is added to i2c bus.

The SoB from Alifer Moraes is missing, too.

Quoted 12 lines

drivers/i2c/busses/i2c-imx.c static int i2c_imx_probe(struct platform_device *pdev) · line 1485

Quoted 9 lines

goto rpm_disable;

drivers/i2c/busses/i2c-imx.c +2 -1
 	/* Request IRQ */
-	ret = request_threaded_irq(irq, i2c_imx_isr, NULL, IRQF_SHARED,
+	ret = request_threaded_irq(irq, i2c_imx_isr, NULL,
+				   IRQF_SHARED | IRQF_NO_SUSPEND,
 				   pdev->name, i2c_imx);
 	if (ret) {
 		dev_err(&pdev->dev, "can't claim irq %d\n", irq);

I stumbled across Documentation/power/suspend-and-interrupts.rst which states:

Quoted 6 lines
Quoted 2 lines

For this reason, using IRQF_NO_SUSPEND and IRQF_SHARED at the same time should be avoided.

Given this IMHO at least a comment should be inserted why this is fine. I dont have a full picture about the situation, but to me it seems there is a reference missing, or why/how does some PCIe start some I2C transfer when the controller is suspended already? Do I miss something?

Thank you for this comment, Alexander. I second you, this needs explanation.

Happy hacking,

Wolfram