diff mbox series

[2/5] i2c: imx-lpi2c: add IRQF_NO_SUSPEND IRQ flag

Message ID 20240829093722.2714921-2-carlos.song@nxp.com (mailing list archive)
State New
Headers show
Series [1/5] i2c: imx-lpi2c: add target mode support | expand

Commit Message

Carlos Song Aug. 29, 2024, 9:37 a.m. UTC
From: Carlos Song <carlos.song@nxp.com>

Set IRQF_NO_SUSPEND flag when request_irq(). Some devices such
as extend GPIO will need i2c transfer during the entire system
suspend and resume period so keep it enabled.

Signed-off-by: Carlos Song <carlos.song@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefan Wahren Aug. 29, 2024, 10:52 a.m. UTC | #1
Hi Carlos,

Am 29.08.24 um 11:37 schrieb carlos.song@nxp.com:
> From: Carlos Song <carlos.song@nxp.com>
>
> Set IRQF_NO_SUSPEND flag when request_irq(). Some devices such
> as extend GPIO will need i2c transfer during the entire system
> suspend and resume period so keep it enabled.
do you mean GPIO expander which are connected to I2C?

Do the mentioned expander have a dedicated IRQ line or does the host
needs to poll I2C?

Best regards

>
> Signed-off-by: Carlos Song <carlos.song@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
>   drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
> index c8f3dadfb36e..23f83f10d5f6 100644
> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> @@ -1309,7 +1309,7 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
>   	if (ret)
>   		lpi2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
>
> -	ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, 0,
> +	ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, IRQF_NO_SUSPEND,
>   			       pdev->name, lpi2c_imx);
>   	if (ret)
>   		return dev_err_probe(&pdev->dev, ret, "can't claim irq %d\n", irq);
Carlos Song Aug. 30, 2024, 8:53 a.m. UTC | #2
> -----Original Message-----
> From: Stefan Wahren <wahrenst@gmx.net>
> Sent: Thursday, August 29, 2024 6:53 PM
> To: Carlos Song <carlos.song@nxp.com>; Aisheng Dong
> <aisheng.dong@nxp.com>; andi.shyti@kernel.org; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com
> Cc: linux-i2c@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org
> Subject: [EXT] Re: [PATCH 2/5] i2c: imx-lpi2c: add IRQF_NO_SUSPEND IRQ flag
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
> 
> 
> Hi Carlos,
> 
> Am 29.08.24 um 11:37 schrieb carlos.song@nxp.com:
> > From: Carlos Song <carlos.song@nxp.com>
> >
> > Set IRQF_NO_SUSPEND flag when request_irq(). Some devices such as
> > extend GPIO will need i2c transfer during the entire system suspend
> > and resume period so keep it enabled.
> do you mean GPIO expander which are connected to I2C?
> 
> Do the mentioned expander have a dedicated IRQ line or does the host needs to
> poll I2C?
> 
Hi,

Yes, we have both gpio expanders. But devices polling i2c may have a stronger need for this.
Like pmic, it may use i2c transfer at any time regardless of whether the system enters suspend or disables irq.
This flag is added to make the I2c irq won't be mask in the system suspend.

But I find that it is not enough if just add this flag. Because lpi2c clock is enabled at rpm function. If rpm is disabled,
the lpi2c still can not work. So I will add an extra patch to make lpi2c can work also at no irq stage. I will send this patch
with this in next new patch serials.

> Best regards
> 
> >
> > Signed-off-by: Carlos Song <carlos.song@nxp.com>
> > Signed-off-by: Frank Li <Frank.Li@nxp.com>
> > ---
> >   drivers/i2c/busses/i2c-imx-lpi2c.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c
> > b/drivers/i2c/busses/i2c-imx-lpi2c.c
> > index c8f3dadfb36e..23f83f10d5f6 100644
> > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> > @@ -1309,7 +1309,7 @@ static int lpi2c_imx_probe(struct platform_device
> *pdev)
> >       if (ret)
> >               lpi2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
> >
> > -     ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, 0,
> > +     ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr,
> > + IRQF_NO_SUSPEND,
> >                              pdev->name, lpi2c_imx);
> >       if (ret)
> >               return dev_err_probe(&pdev->dev, ret, "can't claim irq
> > %d\n", irq);
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index c8f3dadfb36e..23f83f10d5f6 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -1309,7 +1309,7 @@  static int lpi2c_imx_probe(struct platform_device *pdev)
 	if (ret)
 		lpi2c_imx->bitrate = I2C_MAX_STANDARD_MODE_FREQ;
 
-	ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, 0,
+	ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, IRQF_NO_SUSPEND,
 			       pdev->name, lpi2c_imx);
 	if (ret)
 		return dev_err_probe(&pdev->dev, ret, "can't claim irq %d\n", irq);