Thread (3 messages) 3 messages, 2 authors, 2026-03-31

Re: [PATCH v2] i2c: rk3x: add support for SCL OE debounce and slave hold recovery

From: Andi Shyti <andi.shyti@kernel.org>
Date: 2026-03-27 14:13:09
Also in: linux-i2c, linux-rockchip, lkml

Hi Anand,

...
quoted hunk ↗ jump to hunk
@@ -1125,6 +1141,17 @@ static int rk3x_i2c_xfer_common(struct i2c_adapter *adap,
 		}
 	}
 
+	/*
+	 * If a timeout occurred and the slave is holding SCL,
+	 * re-apply the timings/dividers to attempt recovery.
+	 */
+	if (ret == -ETIMEDOUT && i2c->soc_data->has_scl_oe_debounce) {
+		if (ipd & REG_INT_SLV_HDSCL) {
+			dev_err(i2c->dev, "SCL hold by slave detected, resetting timings.\n");
+			rk3x_i2c_adapt_div(i2c, clk_get_rate(i2c->clk));
argh! this nests i2c->lock. rk3x_i2c_xfer_common() already holds
it when calling rk3x_i2c_adapt_div().
Andi
+		}
+	}
+
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help