Re: [PATCH v4 3/3] i2c: qcom-geni: Add bus recovery support for GPI DMA mode
From: Aniket RANDIVE
Date: Tue Nov 03 2026 - 07:07:03 EST
On 11/3/2026 4:14 PM, Mukesh Savaliya wrote:
On 11/3/2026 2:26 PM, Aniket Randive wrote:
I2C transfers in GPI DMA mode can fail with -EIO when a target holds
SDA low, leaving the bus stuck and preventing subsequent transactions.
The GPI completion callback reports a NACK and a genuine bus error
alike as -EIO, and the existing recovery path switches the SE to FIFO
mode which is not valid in GPI DMA mode.
Add bus recovery support using the I2C_BUS_CLEAR and I2C_STOP_ON_BUS
opcodes issued via the GPI TX DMA channel. Guard the -EIO recovery
trigger with a SE_GENI_IOS I2C_BUS_FREE check to skip recovery when both
SDA and SCL are already released. Extend the recovery callback to dispatch
through the GPI DMA path when gi2c->gpi_mode is set.
Use the adapter timeout for GPI recovery commands, and preserve the DMA
configuration error code when GPI setup fails.
Stop recovery on a GPI command timeout and report DMA termination
failures. Do not issue another command or override the timeout with a
bus-idle result, since DMA cleanup may not have completed successfully.
Signed-off-by: Aniket Randive <aniket.randive@xxxxxxxxxxxxxxxx>
---
drivers/i2c/busses/i2c-qcom-geni.c | 107 +++++++++++++++++++++++++++ +++++-----
1 file changed, 94 insertions(+), 13 deletions(-)
diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/ i2c-qcom-geni.c
[...]
@@ -1356,10 +1439,8 @@ static int geni_i2c_probe(struct platform_device *pdev)
if (ret < 0)
return ret;
- if (!gi2c->gpi_mode) {
- gi2c->rinfo.recover_bus = geni_i2c_recover_bus;
- gi2c->adap.bus_recovery_info = &gi2c->rinfo;
- }
+ gi2c->rinfo.recover_bus = geni_i2c_recover_bus;
+ gi2c->adap.bus_recovery_info = &gi2c->rinfo;
I guess one more time this. Why patch 2 is adding and patch 3 is removing the change ? keep it clean way.
This is intentional. In patch 2, bus recovery is supported only in FIFO mode, so we guard the registration with !gi2c->gpi_mode. Patch 3 adds the corresponding bus recovery support for GPI mode, after which the mode check is no longer needed and is removed.
ret = i2c_add_adapter(&gi2c->adap);
if (ret) {