Skip to content

Commit f2a3f51

Browse files
NXP-CarlosSongWolfram Sang
authored andcommitted
i2c: imx-lpi2c: change to PIO mode in system-wide suspend/resume progress
EDMA resumes early and suspends late in the system power transition sequence, while LPI2C enters the NOIRQ stage for both suspend and resume. This means LPI2C resources become available before EDMA is fully resumed. Once IRQs are enabled, a slave device may immediately trigger an LPI2C transfer. If the transfer length meets DMA requirements, the driver will attempt to use EDMA even though EDMA may still be unavailable. This timing gap can lead to transfer failures. To prevent this, force LPI2C to use PIO mode during system-wide suspend and resume transitions. This reduces dependency on EDMA and avoids using an unready DMA resource. Fixes: a09c8b3 ("i2c: imx-lpi2c: add eDMA mode support for LPI2C") Signed-off-by: Carlos Song <carlos.song@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
1 parent c0c50e3 commit f2a3f51

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/i2c/busses/i2c-imx-lpi2c.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,13 @@ static bool is_use_dma(struct lpi2c_imx_struct *lpi2c_imx, struct i2c_msg *msg)
592592
if (!lpi2c_imx->can_use_dma)
593593
return false;
594594

595+
/*
596+
* A system-wide suspend or resume transition is in progress. LPI2C should use PIO to
597+
* transfer data to avoid issue caused by no ready DMA HW resource.
598+
*/
599+
if (pm_suspend_in_progress())
600+
return false;
601+
595602
/*
596603
* When the length of data is less than I2C_DMA_THRESHOLD,
597604
* cpu mode is used directly to avoid low performance.

0 commit comments

Comments
 (0)