On Thu, Jul 09, 2026 at 08:25:33AM +0200, Markus Stockhausen wrote: > Some lower end hardware (especially Realtek based switches) are > designed with multiple I2C buses that share a single clock line. > E.g. the D-Link DGS-1250-28X realizes 4 I2C SFP busses with 5 gpios. > > Enhance the i2c-gpio driver so it can handle such hardware designs. > > - Detect GPIOs that are used by multiple I2C buses in the dts by > using a unique identifier for each managed SCL. > > - The first probing instance allocates and requests the shared SCL > GPIO plus an associated rt_mutex. Subsequent instances detect the > existing entry via the identifier and increment a reference count > to reuse the descriptor. > > - All data transfers are serialized via custom lock_ops that handle > both the standard adapter bus lock and the shared SCL mutex. This > ensures mutual exclusion across adapters sharing the clock line. > > This patch was successfully tested on Linksys LGS310C that has two > SFP slots with two GPIO based I2C buses that share a sinlge SCL. > Test environment: OpenWrt snapshot ported to kernel 6.19.14 > including CONFIG_GPIO_SHARED=y and CONFIG_GPIO_SHARED_PROXY=y. > > Signed-off-by: Markus Stockhausen > Tested-by: Sander Vanheule > Reviewed-by: Bartosz Golaszewski Well, what I saw looks good to me. I have to admit that I don't have the time to dive into the corner cases of its complexity. So, I wonder if this patch should be resend with lkml in CC, so Sashiko can have a look at it, too? This is optional, though, if Bartosz is also happy, we can surely try it as is. Reviewed-by: Wolfram Sang Oh, there is a checkpatch warning: WARNING: please, no spaces at the start of a line #225: FILE: drivers/i2c/busses/i2c-gpio.c:440: + return a->fw_node == b->fw_node && a->fw_pin == b->fw_pin && a->fw_flags == b->fw_flags;$