diff mbox series

i2c: imx: add irqf_no_suspend

Message ID 20220307143630.28697-1-alifer.m@variscite.com
State New
Headers show
Series i2c: imx: add irqf_no_suspend | expand

Commit Message

Alifer Moraes March 7, 2022, 2:36 p.m. UTC
From: gaopan <b54642@freescale.com>

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.

Signed-off-by: Gao Pan <b54642@freescale.com>
Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
---
 drivers/i2c/busses/i2c-imx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Oleksij Rempel March 11, 2022, 9:01 a.m. UTC | #1
On Mon, Mar 07, 2022 at 11:36:30AM -0300, Alifer Moraes wrote:
> From: gaopan <b54642@freescale.com>
> 
> 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.
> 
> Signed-off-by: Gao Pan <b54642@freescale.com>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
> Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>

Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Thank you!

> ---
>  drivers/i2c/busses/i2c-imx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 27f969b3dc07..fcc09a1e7f44 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -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);
> -- 
> 2.25.1
> 
> 
>
Alexander Stein March 11, 2022, 10:57 a.m. UTC | #2
Hallo,

Am Montag, 7. März 2022, 15:36:30 CET schrieb Alifer Moraes:
> From: gaopan <b54642@freescale.com>
> 
> 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.
> 
> Signed-off-by: Gao Pan <b54642@freescale.com>
> Signed-off-by: Fugang Duan <B38611@freescale.com>
> Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
> ---
>  drivers/i2c/busses/i2c-imx.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 27f969b3dc07..fcc09a1e7f44 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -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:
> 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
Wolfram Sang May 21, 2022, 10:24 a.m. UTC | #3
Hi everyone,

> > 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.
> > 
> > Signed-off-by: Gao Pan <b54642@freescale.com>
> > Signed-off-by: Fugang Duan <B38611@freescale.com>
> > Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>

The SoB from Alifer Moraes is missing, too.

> > 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:
> > 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
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 27f969b3dc07..fcc09a1e7f44 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -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);