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

Andi Shyti andi.shyti at kernel.org
Fri Mar 27 07:13:04 PDT 2026


Hi Anand,

...

> @@ -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

> +		}
> +	}
> +



More information about the Linux-rockchip mailing list