diff mbox series

[5/5] i2c: imx-lpi2c: increase PM timeout to avoid operate clk frequently

Message ID 20240829093722.2714921-5-carlos.song@nxp.com (mailing list archive)
State New, archived
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: Clark Wang <xiaoning.wang@nxp.com>

Switching the clock frequently will affect the data transmission
efficiency, and prolong the timeout to reduce autosuspend times for
lpi2c.

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

Comments

Alexander Stein Aug. 29, 2024, 10:55 a.m. UTC | #1
Hi,

Am Donnerstag, 29. August 2024, 11:37:22 CEST schrieb carlos.song@nxp.com:
> From: Clark Wang <xiaoning.wang@nxp.com>
> 
> Switching the clock frequently will affect the data transmission
> efficiency, and prolong the timeout to reduce autosuspend times for
> lpi2c.

Efficiency as in throughput or total time per transfer? Do you have any
numbers?

Best regards,
Alexander

> Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
> Signed-off-by: Carlos Song <carlos.song@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 210d505db76d..cc5e5d96aacd 100644
> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> @@ -129,7 +129,7 @@
>  #define I2C_CLK_RATIO	2
>  #define CHUNK_DATA	256
>  
> -#define I2C_PM_TIMEOUT		10 /* ms */
> +#define I2C_PM_TIMEOUT		1000 /* ms */
>  #define I2C_DMA_THRESHOLD	8 /* bytes */
>  
>  enum lpi2c_imx_mode {
>
Carlos Song Aug. 30, 2024, 8:53 a.m. UTC | #2
> -----Original Message-----
> From: Alexander Stein <alexander.stein@ew.tq-group.com>
> Sent: Thursday, August 29, 2024 6:55 PM
> To: Aisheng Dong <aisheng.dong@nxp.com>; andi.shyti@kernel.org;
> shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> festevam@gmail.com; linux-arm-kernel@lists.infradead.org
> Cc: linux-i2c@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Carlos Song
> <carlos.song@nxp.com>
> Subject: [EXT] Re: [PATCH 5/5] i2c: imx-lpi2c: increase PM timeout to avoid
> operate clk frequently
>
> 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,
>
> Am Donnerstag, 29. August 2024, 11:37:22 CEST schrieb carlos.song@nxp.com:
> > From: Clark Wang <xiaoning.wang@nxp.com>
> >
> > Switching the clock frequently will affect the data transmission
> > efficiency, and prolong the timeout to reduce autosuspend times for
> > lpi2c.
>
> Efficiency as in throughput or total time per transfer? Do you have any numbers?
>

Hi, Thank your for your quick ack!

Apologies for the unclear explanation. The efficiency I'm referring to isn't just for I2C. For platforms with SC firmware
like the 8X series, every i2c transfer to enable or disable the clock notifies the SC firmware to perform a clock operation.
So if the autosuspend time is short, i2c may enable and disable clock frequently, it will occupy resources of the SC firmware.

Therefore, we add this patch to minimize the excessive sc firmware resource waste caused by frequent I2C clock enable/disable operations.


> Best regards,
> Alexander
>
> > Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
> > Signed-off-by: Carlos Song <carlos.song@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 210d505db76d..cc5e5d96aacd 100644
> > --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> > +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> > @@ -129,7 +129,7 @@
> >  #define I2C_CLK_RATIO        2
> >  #define CHUNK_DATA   256
> >
> > -#define I2C_PM_TIMEOUT               10 /* ms */
> > +#define I2C_PM_TIMEOUT               1000 /* ms */
> >  #define I2C_DMA_THRESHOLD    8 /* bytes */
> >
> >  enum lpi2c_imx_mode {
> >
>
>
> --
> TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
> Amtsgericht München, HRB 105018
> Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
> http://www.tq-g/
> roup.com%2F&data=05%7C02%7Ccarlos.song%40nxp.com%7C85ca11fd9cff416
> ea43108dcc8191786%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C
> 638605257330352810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD
> AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C0%7C%7C%7C&sdat
> a=AV343gx9HRiXKLNQk5kBKj%2FfJM0p%2FSLKG%2FQFuQg64I0%3D&reserved
> =0
>
Alexander Stein Aug. 30, 2024, 9:07 a.m. UTC | #3
Hi,

Am Freitag, 30. August 2024, 10:53:16 CEST schrieb Carlos Song:
> > -----Original Message-----
> > From: Alexander Stein <alexander.stein@ew.tq-group.com>
> > Sent: Thursday, August 29, 2024 6:55 PM
> > To: Aisheng Dong <aisheng.dong@nxp.com>; andi.shyti@kernel.org;
> > shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
> > festevam@gmail.com; linux-arm-kernel@lists.infradead.org
> > Cc: linux-i2c@vger.kernel.org; imx@lists.linux.dev;
> > linux-arm-kernel@lists.infradead.org; linux-kernel@vger.kernel.org; Carlos Song
> > <carlos.song@nxp.com>
> > Subject: [EXT] Re: [PATCH 5/5] i2c: imx-lpi2c: increase PM timeout to avoid
> > operate clk frequently
> >
> > 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,
> >
> > Am Donnerstag, 29. August 2024, 11:37:22 CEST schrieb carlos.song@nxp.com:
> > > From: Clark Wang <xiaoning.wang@nxp.com>
> > >
> > > Switching the clock frequently will affect the data transmission
> > > efficiency, and prolong the timeout to reduce autosuspend times for
> > > lpi2c.
> >
> > Efficiency as in throughput or total time per transfer? Do you have any numbers?
> >
> 
> Hi, Thank your for your quick ack!
> 
> Apologies for the unclear explanation. The efficiency I'm referring to isn't just for I2C. For platforms with SC firmware
> like the 8X series, every i2c transfer to enable or disable the clock notifies the SC firmware to perform a clock operation.
> So if the autosuspend time is short, i2c may enable and disable clock frequently, it will occupy resources of the SC firmware.
> 
> Therefore, we add this patch to minimize the excessive sc firmware resource waste caused by frequent I2C clock enable/disable operations.

Thanks for the explanation. So this delay only occurs on systems using an SC (imx8qm/qxp) or SM (imx95), right?
Is there a chance to detect this kind of clock provider and make this timeout configurable?

Best regards,
Alexander
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index 210d505db76d..cc5e5d96aacd 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -129,7 +129,7 @@ 
 #define I2C_CLK_RATIO	2
 #define CHUNK_DATA	256
 
-#define I2C_PM_TIMEOUT		10 /* ms */
+#define I2C_PM_TIMEOUT		1000 /* ms */
 #define I2C_DMA_THRESHOLD	8 /* bytes */
 
 enum lpi2c_imx_mode {