[PATCH v7 0/2] i2c: i2c-gpio: Enhance driver for buses with shared SCL
From: Markus Stockhausen
Date: Tue Jul 14 2026 - 12:30:40 EST
This series adds support for devices with multiple I2C buses
that share a single clock line.
Signed-off-by: Markus Stockhausen <markus.stockhausen@xxxxxx>
---
v6 -> v7
- Handle devicetree GPIO node attributes opaque. E.g. do not
interpret a pin from args[0]. With this generalize the shared
SCL detection by simply comparing all attributes.
- Gracefully disable pin sharing if devicetree lookup does not
work as expected. This avoids interference with otherwise sane
setups.
- Disable bit_test only if a (potentially) shared SCL pin is
detected.
v6: https://lore.kernel.org/linux-i2c/20260714062018.3009830-1-markus.stockhausen@xxxxxx/
v6 Sashiko: https://sashiko.dev/#/patchset/20260714062018.3009830-1-markus.stockhausen%40gmx.de
v5 -> v6
- Add legacy system detection (without dts/fwnode)
- Add skip_bit_test setting to algorithm options via pre-commit
- Make use of skip_bit_test in the driver
v5: https://lore.kernel.org/linux-i2c/20260713062021.2995641-1-markus.stockhausen@xxxxxx/
v5 Sashiko: https://sashiko.dev/#/patchset/20260713062021.2995641-1-markus.stockhausen%40gmx.de
v4 -> v5
- Whitespace cleanup
- Send to LKML for Sashiko review
- Add Reviewed-by
v4: https://lore.kernel.org/linux-i2c/20260709062534.2864521-1-markus.stockhausen@xxxxxx/
v3 -> v4
- add Reviewed-by and Tested-by
v3: https://lore.kernel.org/linux-i2c/20260520173129.1382489-1-markus.stockhausen@xxxxxx/
v2 -> v3
- Fix lockdep_set_class() with DEBUG_LOCK_ALLOC=y
v2: https://lore.kernel.org/linux-i2c/20260518161013.900504-1-markus.stockhausen@xxxxxx/
v1 -> v2
- Convert fault injector to scl->gpio (reported by test robot)
- Use rt_mutex and i2c_lock_operations instead of pre/post_xfer
(logic taken from i2c-cht-wc.c and enhanced)
- i2c_gpio_lookup_scl()
- Improve list control flow
- Improve comment
- Carve out SCL node comparison into i2c_gpio_scl_matches()
- Drop "valid" attribute and directly check gpiod instead
- Improve fwnode args check for #gpio-cells=1 case
- Add sda/scl cleanup during probe failures
- Replace dev_info() with dev_dbg()
- Reflect changed locking in commmit message
- Tested with config option GPIO_SHARED/GPIO_SHARED_PROXY
as requested by Bartosz
v1: https://lore.kernel.org/linux-i2c/20260514092042.3265986-1-markus.stockhausen@xxxxxx/
v0 -> v1
- Initially this enhancement was submitted as a new driver with
a new devicetree structure. After some discussion Wolfram
advised to make only an enhancement to the i2c-gpio driver.
v0: https://lore.kernel.org/linux-i2c/20260511162528.84508-1-markus.stockhausen@xxxxxx/
Markus Stockhausen (2):
i2c: algo: bit: Allow to skip bit test
i2c: i2c-gpio: Enhance driver for buses with shared SCL
drivers/i2c/algos/i2c-algo-bit.c | 2 +-
drivers/i2c/busses/i2c-gpio.c | 223 +++++++++++++++++++++++++++++--
include/linux/i2c-algo-bit.h | 1 +
3 files changed, 211 insertions(+), 15 deletions(-)
--
2.54.0