i2c: muxes: Add GPIO-detected hotplug I2C
Subsystems (3)
cover i2c: muxes: Add GPIO-detected hotplug I2C
Implement driver for hot-plugged I2C busses, where some devices on a bus are hot-pluggable and their presence is indicated by GPIO line. This feature is used by the ASUS Transformers family, by the Microsoft Surface RT/2 and maybe more.
ASUS Transformers expose i2c line via proprietary 40 pin plug and wire that line through optional dock accessory. Devices in the dock are connected to this i2c line and docks presence is detected by a dedicted GPIO.
Michał Mirosław (1):
i2c: muxes: Add GPIO-detected hotplug I2C
Svyatoslav Ryhel (1):
dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus
.../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/muxes/Kconfig | 11 + drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.c
Signature · 1 line
2.48.1
PATCH 1/2 dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus
Schema describes hardware configuration that uses a GPIO signal to determine the bus's presence and state, allowing the system to dynamically configure I2C devices as they are plugged in or removed.
--- .../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml
Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml new file +65 -0
@@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/i2c/i2c-hotplug-gpio.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: GPIO detected hot-plugged I2C bus + +maintainers: + - Michał Mirosław <[email protected]> + - Svyatoslav Ryhel <[email protected]> + +description: An I2C bus, where some devices on the bus are hot-pluggable + and their presence is indicated by GPIO line. + +properties: + compatible: + const: i2c-hotplug-gpio + + '#address-cells': + const: 1 + + '#size-cells': + const: 0 + + interrupts: + maxItems: 1 + + detect-gpios: + description: usually the same GPIO used as an interrupt. In the active + state should indicate that detachable devices are plugged in. + maxItems: 1 + + i2c-parent: + maxItems: 1 + +required: + - compatible + - '#address-cells' + - '#size-cells' + - interrupts + - detect-gpios + - i2c-parent + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + #include <dt-bindings/interrupt-controller/irq.h> + + i2c-dock { + compatible = "i2c-hotplug-gpio"; + + interrupt-parent = <&gpio>; + interrupts = <164 IRQ_TYPE_EDGE_BOTH>; + + detect-gpios = <&gpio 164 GPIO_ACTIVE_LOW>; + + i2c-parent = <&gen2_i2c>; + + #address-cells = <1>; + #size-cells = <0>; + }; +...
Signature · 1 line
2.48.1
PATCH 2/2 i2c: muxes: Add GPIO-detected hotplug I2C
In reply to Svyatoslav RyhelFrom: Michał Mirosław <[email protected]>
Add support for hot-plugged I2C busses, where some devices on the bus are hot-pluggable and their presence is indicated by GPIO line.
This feature is used by the ASUS Transformers, Microsoft Surface RT/2 and maybe more.
--- drivers/i2c/muxes/Kconfig | 11 ++ drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 +++++++++++++++++++++++++++ 3 files changed, 275 insertions(+) create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.c
drivers/i2c/muxes/Kconfig +11 -0
@@ -19,6 +19,17 @@ config I2C_ARB_GPIO_CHALLENGE This driver can also be built as a module. If so, the module will be called i2c-arb-gpio-challenge. +config I2C_HOTPLUG_GPIO + tristate "Hot-plugged I2C bus detected by GPIO" + depends on GPIOLIB + depends on OF + help + Say Y here if you want support for hot-plugging I2C devices + with presence detected by GPIO pin value. + + This driver can also be built as a module. If so, the module + will be called i2c-hotplug-gpio. + config I2C_MUX_GPIO tristate "GPIO-based I2C multiplexer" depends on GPIOLIB
drivers/i2c/muxes/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_I2C_ARB_GPIO_CHALLENGE) += i2c-arb-gpio-challenge.o obj-$(CONFIG_I2C_DEMUX_PINCTRL) += i2c-demux-pinctrl.o +obj-$(CONFIG_I2C_HOTPLUG_GPIO) += i2c-hotplug-gpio.o obj-$(CONFIG_I2C_MUX_GPIO) += i2c-mux-gpio.o obj-$(CONFIG_I2C_MUX_GPMUX) += i2c-mux-gpmux.o obj-$(CONFIG_I2C_MUX_LTC4306) += i2c-mux-ltc4306.o
drivers/i2c/muxes/i2c-hotplug-gpio.c new file +263 -0
263 lines not on this page · raw message
Signature · 1 line
2.48.1
Quoted 16 lines · Svyatoslav Ryhel
Implement driver for hot-plugged I2C busses, where some devices on a bus are hot-pluggable and their presence is indicated by GPIO line. This feature is used by the ASUS Transformers family, by the Microsoft Surface RT/2 and maybe more.
ASUS Transformers expose i2c line via proprietary 40 pin plug and wire that line through optional dock accessory. Devices in the dock are connected to this i2c line and docks presence is detected by a dedicted GPIO.
Michał Mirosław (1):
i2c: muxes: Add GPIO-detected hotplug I2CSvyatoslav Ryhel (1):
dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus
Quoted 7 lines
.../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/muxes/Kconfig | 11 + drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.c
Adding Herve and Luca to CC because they want to achieve the same with their I2C bus extensions, no?
пн, 15 вер. 2025 р. о 14:35 Wolfram Sang
<[email protected]> пише:
Quoted 26 lines · Svyatoslav Ryhel
Quoted 16 lines
Implement driver for hot-plugged I2C busses, where some devices on a bus are hot-pluggable and their presence is indicated by GPIO line. This feature is used by the ASUS Transformers family, by the Microsoft Surface RT/2 and maybe more.
ASUS Transformers expose i2c line via proprietary 40 pin plug and wire that line through optional dock accessory. Devices in the dock are connected to this i2c line and docks presence is detected by a dedicted GPIO.
Michał Mirosław (1):
i2c: muxes: Add GPIO-detected hotplug I2CSvyatoslav Ryhel (1):
dt-bindings: i2c: Document GPIO detected hot-plugged I2C busQuoted 7 lines
.../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/muxes/Kconfig | 11 + drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.c
Quoted 3 lines
Adding Herve and Luca to CC because they want to achieve the same with their I2C bus extensions, no?
I have no idea what you are talking about, this an original series I have sent 2 years ago but now I decided that would be nice to have it in mainline Linux. Here is a link to patchset from 19th Jun 2023
https://lkml.org/lkml/2023/6/19/781
Quoted 30 lines · Svyatoslav Ryhel
пн, 15 вер. 2025 р. о 14:35 Wolfram Sang
<[email protected]> пише:Quoted 28 lines · Svyatoslav Ryhel
Quoted 16 lines
Implement driver for hot-plugged I2C busses, where some devices on a bus are hot-pluggable and their presence is indicated by GPIO line. This feature is used by the ASUS Transformers family, by the Microsoft Surface RT/2 and maybe more.
ASUS Transformers expose i2c line via proprietary 40 pin plug and wire that line through optional dock accessory. Devices in the dock are connected to this i2c line and docks presence is detected by a dedicted GPIO.
Michał Mirosław (1):
i2c: muxes: Add GPIO-detected hotplug I2CSvyatoslav Ryhel (1):
dt-bindings: i2c: Document GPIO detected hot-plugged I2C busQuoted 7 lines
.../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/muxes/Kconfig | 11 + drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.cAdding Herve and Luca to CC because they want to achieve the same with their I2C bus extensions, no?
Sorry, a misunderstanding: the question was for Herve and Luca. I wanted to ask for a comment from them if this is the same problem (which I think it is). The question was not meant for you.
Hi Wolfram,
Quoted 29 lines · On Mon, 15 Sep 2025 17:42:06 +0200 Wolfram Sang…
Quoted 28 lines · Svyatoslav Ryhel
пн, 15 вер. 2025 р. о 14:35 Wolfram Sang
<[email protected]> пише:Quoted 26 lines · Svyatoslav Ryhel
Quoted 23 lines
Implement driver for hot-plugged I2C busses, where some devices on a bus are hot-pluggable and their presence is indicated by GPIO line. This feature is used by the ASUS Transformers family, by the Microsoft Surface RT/2 and maybe more.
ASUS Transformers expose i2c line via proprietary 40 pin plug and wire that line through optional dock accessory. Devices in the dock are connected to this i2c line and docks presence is detected by a dedicted GPIO.
Michał Mirosław (1):
i2c: muxes: Add GPIO-detected hotplug I2CSvyatoslav Ryhel (1):
dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus.../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/muxes/Kconfig | 11 + drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.c
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Adding Herve and Luca to CC because they want to achieve the same with their I2C bus extensions, no?
Sorry, a misunderstanding: the question was for Herve and Luca. I wanted to ask for a comment from them if this is the same problem (which I think it is). The question was not meant for you.
Indeed, we try to handle the same use case.
The i2c-hotplug-gpio.c driver handles only an connector with an I2C bus.
On our side, we try to have something more generic that can handle more than one I2C and some other busses and resources (gpio, pwm, ...) wired to a connector.
To move this i2c-hotplug-gpio to our proposal direction, this should become a connector driver with a i2c bus extension and an addon DT describing the i2c devices available on the addon board.
The connector driver should monitor the gpio and apply the addon DT when it detects the addon plugged.
Also, I am waiting for conclusions in the export symbols discussion [1] to re-spin the i2c bus extension series.
Best regards,
Hervé
[1]: https://lore.kernel.org/all/20250902105710.00512c6d@booty/
Signature · 3 lines
Hervé Codina, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Hello,
thanks Wolfram for pulling Hervé and me in.
+Cc my Bootlin e-mail address
Il 16/09/25 08:19, Herve Codina ha scritto:
Quoted 54 lines
Hi Wolfram,
Quoted 29 lines · On Mon, 15 Sep 2025 17:42:06 +0200 Wolfram Sang…
Quoted 28 lines · Svyatoslav Ryhel
пн, 15 вер. 2025 р. о 14:35 Wolfram Sang
<[email protected]> пише:Quoted 26 lines · Svyatoslav Ryhel
Quoted 23 lines
Implement driver for hot-plugged I2C busses, where some devices on a bus are hot-pluggable and their presence is indicated by GPIO line. This feature is used by the ASUS Transformers family, by the Microsoft Surface RT/2 and maybe more.
ASUS Transformers expose i2c line via proprietary 40 pin plug and wire that line through optional dock accessory. Devices in the dock are connected to this i2c line and docks presence is detected by a dedicted GPIO.
Michał Mirosław (1):
i2c: muxes: Add GPIO-detected hotplug I2CSvyatoslav Ryhel (1):
dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus.../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/muxes/Kconfig | 11 + drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.cQuoted 7 lines
Quoted 2 lines
Quoted 2 lines
Adding Herve and Luca to CC because they want to achieve the same with their I2C bus extensions, no?
Sorry, a misunderstanding: the question was for Herve and Luca. I wanted to ask for a comment from them if this is the same problem (which I think it is). The question was not meant for you.
Indeed, we try to handle the same use case.
The
i2c-hotplug-gpio.cdriver handles only an connector with an I2C bus.On our side, we try to have something more generic that can handle more than one I2C and some other busses and resources (gpio, pwm, ...) wired to a connector.
To move this i2c-hotplug-gpio to our proposal direction, this should become a connector driver with a i2c bus extension and an addon DT describing the i2c devices available on the addon board.
Quoted 5 lines
The connector driver should monitor the gpio and apply the addon DT when it detects the addon plugged.
Also, I am waiting for conclusions in the export symbols discussion [1] to re-spin the i2c bus extension series.
I just have one question to add to what Hervé wrote.
I guess in the big picture you have a device tree where all hot-pluggable I2C devices are always described, but they won't probe until i2c_hotplug_activate() adds an adapter for them. Is my understanding correct?
If correct, this implies you can connect only one type of dock. Multple dock models with different peripherals cannot be supported.
Best regards,
Luca
вт, 16 вер. 2025 р. о 10:50 Luca Ceresoli <[email protected]> пише:
Quoted 68 lines
Hello,
thanks Wolfram for pulling Hervé and me in.
+Cc my Bootlin e-mail address
Il 16/09/25 08:19, Herve Codina ha scritto:
Quoted 54 lines
Hi Wolfram,
Quoted 29 lines · On Mon, 15 Sep 2025 17:42:06 +0200 Wolfram Sang…
Quoted 28 lines · Svyatoslav Ryhel
пн, 15 вер. 2025 р. о 14:35 Wolfram Sang
<[email protected]> пише:Quoted 26 lines · Svyatoslav Ryhel
Quoted 23 lines
Implement driver for hot-plugged I2C busses, where some devices on a bus are hot-pluggable and their presence is indicated by GPIO line. This feature is used by the ASUS Transformers family, by the Microsoft Surface RT/2 and maybe more.
ASUS Transformers expose i2c line via proprietary 40 pin plug and wire that line through optional dock accessory. Devices in the dock are connected to this i2c line and docks presence is detected by a dedicted GPIO.
Michał Mirosław (1):
i2c: muxes: Add GPIO-detected hotplug I2CSvyatoslav Ryhel (1):
dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus.../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/muxes/Kconfig | 11 + drivers/i2c/muxes/Makefile | 1 + drivers/i2c/muxes/i2c-hotplug-gpio.c | 263 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/muxes/i2c-hotplug-gpio.cQuoted 7 lines
Quoted 2 lines
Quoted 2 lines
Adding Herve and Luca to CC because they want to achieve the same with their I2C bus extensions, no?
Sorry, a misunderstanding: the question was for Herve and Luca. I wanted to ask for a comment from them if this is the same problem (which I think it is). The question was not meant for you.
Indeed, we try to handle the same use case.
The
i2c-hotplug-gpio.cdriver handles only an connector with an I2C bus.On our side, we try to have something more generic that can handle more than one I2C and some other busses and resources (gpio, pwm, ...) wired to a connector.
To move this i2c-hotplug-gpio to our proposal direction, this should become a connector driver with a i2c bus extension and an addon DT describing the i2c devices available on the addon board.
Quoted 5 lines
The connector driver should monitor the gpio and apply the addon DT when it detects the addon plugged.
Also, I am waiting for conclusions in the export symbols discussion [1] to re-spin the i2c bus extension series.
Quoted 7 lines
I just have one question to add to what Hervé wrote.
I guess in the big picture you have a device tree where all hot-pluggable I2C devices are always described, but they won't probe until
i2c_hotplug_activate()adds an adapter for them. Is my understanding correct?
Yes, your understanding is correct, i2c_hotplug creates a i2c mux from parent with a set of always described devices by GPIO signal.
Quoted 3 lines
If correct, this implies you can connect only one type of dock. Multple dock models with different peripherals cannot be supported.
This configuration is used for ASUS Transformers and they don't have multiple docks, only one accessory is used and it is not swappable even between models by design, not even talking about different generations. SO configuration used by Transformers can be described just as title says "GPIO-detected hotplug I2C" devices are fixed just can be detached, but never swapped.
Quoted 3 lines
Best regards,
Luca