* [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C
@ 2025-10-13 6:00 Svyatoslav Ryhel
2025-10-13 6:00 ` [PATCH v1 1/2 RESEND] dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus Svyatoslav Ryhel
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Svyatoslav Ryhel @ 2025-10-13 6:00 UTC (permalink / raw)
To: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Peter Rosin, Michał Mirosław, Svyatoslav Ryhel,
Jonas Schwöbel
Cc: linux-i2c, devicetree, linux-kernel
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
--
2.48.1
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v1 1/2 RESEND] dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus 2025-10-13 6:00 [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C Svyatoslav Ryhel @ 2025-10-13 6:00 ` Svyatoslav Ryhel 2025-10-13 6:00 ` [PATCH v1 2/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C Svyatoslav Ryhel 2025-10-15 22:50 ` [PATCH v1 0/2 " Andi Shyti 2 siblings, 0 replies; 9+ messages in thread From: Svyatoslav Ryhel @ 2025-10-13 6:00 UTC (permalink / raw) To: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Svyatoslav Ryhel, Jonas Schwöbel Cc: linux-i2c, devicetree, linux-kernel 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. Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> --- .../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml diff --git a/Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml b/Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml new file mode 100644 index 000000000000..d1d5d830c91b --- /dev/null +++ b/Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml @@ -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 <mirq-linux@rere.qmqm.pl> + - Svyatoslav Ryhel <clamor95@gmail.com> + +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>; + }; +... -- 2.48.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v1 2/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C 2025-10-13 6:00 [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C Svyatoslav Ryhel 2025-10-13 6:00 ` [PATCH v1 1/2 RESEND] dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus Svyatoslav Ryhel @ 2025-10-13 6:00 ` Svyatoslav Ryhel 2025-10-15 22:50 ` [PATCH v1 0/2 " Andi Shyti 2 siblings, 0 replies; 9+ messages in thread From: Svyatoslav Ryhel @ 2025-10-13 6:00 UTC (permalink / raw) To: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Svyatoslav Ryhel, Jonas Schwöbel Cc: linux-i2c, devicetree, linux-kernel From: Michał Mirosław <mirq-linux@rere.qmqm.pl> 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. Co-developed-by: Ion Agorria <ion@agorria.com> Signed-off-by: Ion Agorria <ion@agorria.com> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> --- 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 diff --git a/drivers/i2c/muxes/Kconfig b/drivers/i2c/muxes/Kconfig index 6d2f66810cdc..0e410be5ce55 100644 --- a/drivers/i2c/muxes/Kconfig +++ b/drivers/i2c/muxes/Kconfig @@ -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 diff --git a/drivers/i2c/muxes/Makefile b/drivers/i2c/muxes/Makefile index 4b24f49515a7..36df41c8cf05 100644 --- a/drivers/i2c/muxes/Makefile +++ b/drivers/i2c/muxes/Makefile @@ -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 diff --git a/drivers/i2c/muxes/i2c-hotplug-gpio.c b/drivers/i2c/muxes/i2c-hotplug-gpio.c new file mode 100644 index 000000000000..7f56964e285e --- /dev/null +++ b/drivers/i2c/muxes/i2c-hotplug-gpio.c @@ -0,0 +1,263 @@ +// SPDX-License-Identifier: GPL-2.0-or-later + +#include <linux/delay.h> +#include <linux/gpio/consumer.h> +#include <linux/i2c.h> +#include <linux/interrupt.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +struct i2c_hotplug_priv { + struct i2c_adapter adap; + struct i2c_adapter *parent; + struct device *dev; + struct gpio_desc *gpio; + int irq; +}; + +static inline struct i2c_adapter *i2c_hotplug_parent(struct i2c_adapter *adap) +{ + struct i2c_hotplug_priv *priv = container_of(adap, struct i2c_hotplug_priv, adap); + + return priv->parent; +} + +static int i2c_hotplug_master_xfer(struct i2c_adapter *adap, + struct i2c_msg msgs[], int num) +{ + struct i2c_adapter *parent = i2c_hotplug_parent(adap); + + return parent->algo->master_xfer(parent, msgs, num); +} + +static int i2c_hotplug_smbus_xfer(struct i2c_adapter *adap, u16 addr, + unsigned short flags, char read_write, + u8 command, int protocol, + union i2c_smbus_data *data) +{ + struct i2c_adapter *parent = i2c_hotplug_parent(adap); + + return parent->algo->smbus_xfer(parent, addr, flags, read_write, + command, protocol, data); +} + +static u32 i2c_hotplug_functionality(struct i2c_adapter *adap) +{ + u32 parent_func = i2c_get_functionality(i2c_hotplug_parent(adap)); + + return parent_func & ~I2C_FUNC_SLAVE; +} + +static const struct i2c_algorithm i2c_hotplug_algo_i2c = { + .master_xfer = i2c_hotplug_master_xfer, + .functionality = i2c_hotplug_functionality, +}; + +static const struct i2c_algorithm i2c_hotplug_algo_smbus = { + .smbus_xfer = i2c_hotplug_smbus_xfer, + .functionality = i2c_hotplug_functionality, +}; + +static const struct i2c_algorithm i2c_hotplug_algo_both = { + .master_xfer = i2c_hotplug_master_xfer, + .smbus_xfer = i2c_hotplug_smbus_xfer, + .functionality = i2c_hotplug_functionality, +}; + +static const struct i2c_algorithm *const i2c_hotplug_algo[2][2] = { + /* non-I2C */ + { NULL, &i2c_hotplug_algo_smbus }, + /* I2C */ + { &i2c_hotplug_algo_i2c, &i2c_hotplug_algo_both } +}; + +static void i2c_hotplug_lock_bus(struct i2c_adapter *adap, unsigned int flags) +{ + i2c_lock_bus(i2c_hotplug_parent(adap), flags); +} + +static int i2c_hotplug_trylock_bus(struct i2c_adapter *adap, + unsigned int flags) +{ + return i2c_trylock_bus(i2c_hotplug_parent(adap), flags); +} + +static void i2c_hotplug_unlock_bus(struct i2c_adapter *adap, + unsigned int flags) +{ + i2c_unlock_bus(i2c_hotplug_parent(adap), flags); +} + +static const struct i2c_lock_operations i2c_hotplug_lock_ops = { + .lock_bus = i2c_hotplug_lock_bus, + .trylock_bus = i2c_hotplug_trylock_bus, + .unlock_bus = i2c_hotplug_unlock_bus, +}; + +static int i2c_hotplug_recover_bus(struct i2c_adapter *adap) +{ + return i2c_recover_bus(i2c_hotplug_parent(adap)); +} + +static struct i2c_bus_recovery_info i2c_hotplug_recovery_info = { + .recover_bus = i2c_hotplug_recover_bus, +}; + +static int i2c_hotplug_activate(struct i2c_hotplug_priv *priv) +{ + int ret; + + if (priv->adap.algo_data) + return 0; + + /* + * Store the dev data in adapter dev, since + * previous i2c_del_adapter might have wiped it. + */ + priv->adap.dev.parent = priv->dev; + priv->adap.dev.of_node = priv->dev->of_node; + + dev_dbg(priv->adap.dev.parent, "connection detected"); + + ret = i2c_add_adapter(&priv->adap); + if (!ret) + priv->adap.algo_data = (void *)1; + + return ret; +} + +static void i2c_hotplug_deactivate(struct i2c_hotplug_priv *priv) +{ + if (!priv->adap.algo_data) + return; + + dev_dbg(priv->adap.dev.parent, "disconnection detected"); + + i2c_del_adapter(&priv->adap); + priv->adap.algo_data = NULL; +} + +static irqreturn_t i2c_hotplug_interrupt(int irq, void *dev_id) +{ + struct i2c_hotplug_priv *priv = dev_id; + + /* debounce */ + msleep(20); + + if (gpiod_get_value_cansleep(priv->gpio)) + i2c_hotplug_activate(priv); + else + i2c_hotplug_deactivate(priv); + + return IRQ_HANDLED; +} + +static void wrap_i2c_put_adapter(void *adapter) +{ + i2c_put_adapter(adapter); +} + +static void wrap_i2c_hotplug_deactivate(void *priv) +{ + i2c_hotplug_deactivate(priv); +} + +static int i2c_hotplug_gpio_probe(struct platform_device *pdev) +{ + struct device_node *parent_np; + struct i2c_adapter *parent; + struct i2c_hotplug_priv *priv; + bool is_i2c, is_smbus; + int err; + + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + + platform_set_drvdata(pdev, priv); + priv->dev = &pdev->dev; + + parent_np = of_parse_phandle(pdev->dev.of_node, "i2c-parent", 0); + if (IS_ERR(parent_np)) + return dev_err_probe(&pdev->dev, PTR_ERR(parent_np), + "cannot parse i2c-parent\n"); + + parent = of_find_i2c_adapter_by_node(parent_np); + of_node_put(parent_np); + if (IS_ERR(parent)) + return dev_err_probe(&pdev->dev, PTR_ERR(parent), + "failed to get parent I2C adapter\n"); + priv->parent = parent; + + err = devm_add_action_or_reset(&pdev->dev, wrap_i2c_put_adapter, + parent); + if (err) + return err; + + priv->gpio = devm_gpiod_get(&pdev->dev, "detect", GPIOD_IN); + if (IS_ERR(priv->gpio)) + return dev_err_probe(&pdev->dev, PTR_ERR(priv->gpio), + "failed to get detect GPIO\n"); + + is_i2c = parent->algo->master_xfer; + is_smbus = parent->algo->smbus_xfer; + + snprintf(priv->adap.name, sizeof(priv->adap.name), + "i2c-hotplug (master i2c-%d)", i2c_adapter_id(parent)); + priv->adap.owner = THIS_MODULE; + priv->adap.algo = i2c_hotplug_algo[is_i2c][is_smbus]; + priv->adap.algo_data = NULL; + priv->adap.lock_ops = &i2c_hotplug_lock_ops; + priv->adap.class = parent->class; + priv->adap.retries = parent->retries; + priv->adap.timeout = parent->timeout; + priv->adap.quirks = parent->quirks; + if (parent->bus_recovery_info) + /* .bus_recovery_info is not const, but won't be modified */ + priv->adap.bus_recovery_info = (void *)&i2c_hotplug_recovery_info; + + if (!priv->adap.algo) + return -EINVAL; + + err = devm_add_action_or_reset(&pdev->dev, wrap_i2c_hotplug_deactivate, priv); + if (err) + return err; + + priv->irq = platform_get_irq(pdev, 0); + if (priv->irq < 0) + return dev_err_probe(&pdev->dev, priv->irq, + "failed to get IRQ %d\n", priv->irq); + + err = devm_request_threaded_irq(&pdev->dev, priv->irq, NULL, + i2c_hotplug_interrupt, + IRQF_ONESHOT | IRQF_SHARED, + "i2c-hotplug", priv); + if (err) + return dev_err_probe(&pdev->dev, err, + "failed to register IRQ %d\n", priv->irq); + + irq_wake_thread(priv->irq, priv); + + return 0; +} + +static const struct of_device_id i2c_hotplug_gpio_of_match[] = { + { .compatible = "i2c-hotplug-gpio" }, + { }, +}; +MODULE_DEVICE_TABLE(of, i2c_hotplug_gpio_of_match); + +static struct platform_driver i2c_hotplug_gpio_driver = { + .driver = { + .name = "i2c-hotplug-gpio", + .of_match_table = i2c_hotplug_gpio_of_match, + }, + .probe = i2c_hotplug_gpio_probe, +}; + +module_platform_driver(i2c_hotplug_gpio_driver); + +MODULE_DESCRIPTION("Hot-plugged I2C bus detected by GPIO"); +MODULE_AUTHOR("Michał Mirosław <mirq-linux@rere.qmqm.pl>"); +MODULE_LICENSE("GPL"); -- 2.48.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C 2025-10-13 6:00 [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C Svyatoslav Ryhel 2025-10-13 6:00 ` [PATCH v1 1/2 RESEND] dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus Svyatoslav Ryhel 2025-10-13 6:00 ` [PATCH v1 2/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C Svyatoslav Ryhel @ 2025-10-15 22:50 ` Andi Shyti 2025-10-16 7:00 ` Svyatoslav Ryhel 2025-10-16 7:11 ` Herve Codina 2 siblings, 2 replies; 9+ messages in thread From: Andi Shyti @ 2025-10-15 22:50 UTC (permalink / raw) To: Svyatoslav Ryhel Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Jonas Schwöbel, linux-i2c, devicetree, linux-kernel, Luca Ceresoli, Herve Codina Hi, On Mon, Oct 13, 2025 at 09:00:15AM +0300, Svyatoslav Ryhel wrote: > 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. This is a resend of the previous series. I want to understand whether this effort can align with what Herve and Luca are working on. I have not looked into the implementation details yet, but I want to avoid overlapping or conflicting patches. Thanks, Andi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C 2025-10-15 22:50 ` [PATCH v1 0/2 " Andi Shyti @ 2025-10-16 7:00 ` Svyatoslav Ryhel 2025-10-16 7:32 ` Wolfram Sang 2025-10-16 7:11 ` Herve Codina 1 sibling, 1 reply; 9+ messages in thread From: Svyatoslav Ryhel @ 2025-10-16 7:00 UTC (permalink / raw) To: Andi Shyti Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Jonas Schwöbel, linux-i2c, devicetree, linux-kernel, Luca Ceresoli, Herve Codina чт, 16 жовт. 2025 р. о 01:50 Andi Shyti <andi.shyti@kernel.org> пише: > > Hi, > > On Mon, Oct 13, 2025 at 09:00:15AM +0300, Svyatoslav Ryhel wrote: > > 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. > > This is a resend of the previous series. Yes > I want to understand > whether this effort can align with what Herve and Luca are > working on. I have not looked into the implementation details > yet, but I want to avoid overlapping or conflicting patches. Herve and Luca did not come up with anything meaningful, they provided just a few rough ideas. It will take an inconsiderate amount of time before there will be any consensus between them and schema maintainers, and even more time would be requited to settle this into schemas and implement into drivers. Why should I suffer from this? Why should changes I need be halted due to some incomplete 'ideas'? This driver uses existing i2c mux framework and fits into it just fine. > Thanks, > Andi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C 2025-10-16 7:00 ` Svyatoslav Ryhel @ 2025-10-16 7:32 ` Wolfram Sang 2025-10-17 10:29 ` Andi Shyti 2025-10-21 13:25 ` Rob Herring 0 siblings, 2 replies; 9+ messages in thread From: Wolfram Sang @ 2025-10-16 7:32 UTC (permalink / raw) To: Svyatoslav Ryhel Cc: Andi Shyti, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Jonas Schwöbel, linux-i2c, devicetree, linux-kernel, Luca Ceresoli, Herve Codina [-- Attachment #1: Type: text/plain, Size: 1770 bytes --] Hi Svyatoslav, > Herve and Luca did not come up with anything meaningful, they provided > just a few rough ideas. It will take an inconsiderate amount of time Well, IIRC they said that your use case can be mapped onto their approach. Which is meaningful in my book. > before there will be any consensus between them and schema > maintainers, and even more time would be requited to settle this into > schemas and implement into drivers. Why should I suffer from this? Why > should changes I need be halted due to some incomplete 'ideas'? This > driver uses existing i2c mux framework and fits into it just fine. I am sorry to bring you bad news, but you need to suffer because this is how development goes. If I get presented a generic solution (see Herve's mail) and a specific solution (your driver), for this case I as a maintainer will prefer the generic solution. Generic solutions need more time because there are more things to handle, of course. This is typical for development, I would say, it is not Linux or Free Software specific. I appreciate that you tackled your issue and were open to share it with the community. I see the work being done there. However, there are so many things going on independently that I can't really prevent double development from happening despite it having a high priority for me. As soon as I get aware of people working on similar issues, I connect them. That's what I did here as well. So, if you want upstream supported I2C hot-plugging, you need to wait for Luca's and Herve's work being accepted. Or provide a superior solution. Or, if you want, join the ride. You already have experience in this field (and hardware plus use case), you would be a very welcome contributor, I would say. All the best, Wolfram [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C 2025-10-16 7:32 ` Wolfram Sang @ 2025-10-17 10:29 ` Andi Shyti 2025-10-21 13:25 ` Rob Herring 1 sibling, 0 replies; 9+ messages in thread From: Andi Shyti @ 2025-10-17 10:29 UTC (permalink / raw) To: Wolfram Sang Cc: Svyatoslav Ryhel, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Jonas Schwöbel, linux-i2c, devicetree, linux-kernel, Luca Ceresoli, Herve Codina Hi Svyatoslav, On Thu, Oct 16, 2025 at 09:32:24AM +0200, Wolfram Sang wrote: > > Herve and Luca did not come up with anything meaningful, they provided > > just a few rough ideas. It will take an inconsiderate amount of time > > Well, IIRC they said that your use case can be mapped onto their > approach. Which is meaningful in my book. > > > before there will be any consensus between them and schema > > maintainers, and even more time would be requited to settle this into > > schemas and implement into drivers. Why should I suffer from this? Why > > should changes I need be halted due to some incomplete 'ideas'? This > > driver uses existing i2c mux framework and fits into it just fine. > > I am sorry to bring you bad news, but you need to suffer because this is > how development goes. If I get presented a generic solution (see Herve's > mail) and a specific solution (your driver), for this case I as a > maintainer will prefer the generic solution. Generic solutions need more > time because there are more things to handle, of course. This is typical > for development, I would say, it is not Linux or Free Software specific. > > I appreciate that you tackled your issue and were open to share it with > the community. I see the work being done there. However, there are so > many things going on independently that I can't really prevent double > development from happening despite it having a high priority for me. As > soon as I get aware of people working on similar issues, I connect them. > That's what I did here as well. > > So, if you want upstream supported I2C hot-plugging, you need to wait > for Luca's and Herve's work being accepted. Or provide a superior > solution. Or, if you want, join the ride. You already have experience in > this field (and hardware plus use case), you would be a very welcome > contributor, I would say. I agree with all what is said above. I just want to add that Herve has provided links to all his work and what I would do is to rebase all my work on top of theirs; make sure their work together with yours work in your system and, perhaps, merge the series. Please, let me know if this works. Andi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C 2025-10-16 7:32 ` Wolfram Sang 2025-10-17 10:29 ` Andi Shyti @ 2025-10-21 13:25 ` Rob Herring 1 sibling, 0 replies; 9+ messages in thread From: Rob Herring @ 2025-10-21 13:25 UTC (permalink / raw) To: Wolfram Sang Cc: Svyatoslav Ryhel, Andi Shyti, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Jonas Schwöbel, linux-i2c, devicetree, linux-kernel, Luca Ceresoli, Herve Codina On Thu, Oct 16, 2025 at 09:32:24AM +0200, Wolfram Sang wrote: > Hi Svyatoslav, > > > Herve and Luca did not come up with anything meaningful, they provided > > just a few rough ideas. It will take an inconsiderate amount of time > > Well, IIRC they said that your use case can be mapped onto their > approach. Which is meaningful in my book. > > > before there will be any consensus between them and schema > > maintainers, and even more time would be requited to settle this into > > schemas and implement into drivers. Why should I suffer from this? Why > > should changes I need be halted due to some incomplete 'ideas'? This > > driver uses existing i2c mux framework and fits into it just fine. > > I am sorry to bring you bad news, but you need to suffer because this is > how development goes. If I get presented a generic solution (see Herve's > mail) and a specific solution (your driver), for this case I as a > maintainer will prefer the generic solution. Generic solutions need more > time because there are more things to handle, of course. This is typical > for development, I would say, it is not Linux or Free Software specific. > > I appreciate that you tackled your issue and were open to share it with > the community. I see the work being done there. However, there are so > many things going on independently that I can't really prevent double > development from happening despite it having a high priority for me. As > soon as I get aware of people working on similar issues, I connect them. > That's what I did here as well. > > So, if you want upstream supported I2C hot-plugging, you need to wait > for Luca's and Herve's work being accepted. Or provide a superior > solution. Or, if you want, join the ride. You already have experience in > this field (and hardware plus use case), you would be a very welcome > contributor, I would say. Agreed. What really slows things down is when there is only 1 user of a new binding. Too many times have I accepted one only for the 2nd user to show up right after accepting it and wanting something different. So now I just require more than 1 user and it is on the submitter(s) to do that. After all, it is their itch, not mine. Rob ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C 2025-10-15 22:50 ` [PATCH v1 0/2 " Andi Shyti 2025-10-16 7:00 ` Svyatoslav Ryhel @ 2025-10-16 7:11 ` Herve Codina 1 sibling, 0 replies; 9+ messages in thread From: Herve Codina @ 2025-10-16 7:11 UTC (permalink / raw) To: Andi Shyti Cc: Svyatoslav Ryhel, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Rosin, Michał Mirosław, Jonas Schwöbel, linux-i2c, devicetree, linux-kernel, Luca Ceresoli, David Gibson Hi Andy, +Cc David Gibson On Thu, 16 Oct 2025 00:50:47 +0200 Andi Shyti <andi.shyti@kernel.org> wrote: > Hi, > > On Mon, Oct 13, 2025 at 09:00:15AM +0300, Svyatoslav Ryhel wrote: > > 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. > > This is a resend of the previous series. I want to understand > whether this effort can align with what Herve and Luca are > working on. I have not looked into the implementation details > yet, but I want to avoid overlapping or conflicting patches. > Here, in this series, a fake i2c mux is proposed to handle this case. This can work if only i2c devices are added by the dock on the 40 pin plug. If this 40 pin connector provide other resources or busses usable by the dock, the fake i2c mux will not be enough. Even if this fake mux is accepted, we will not use it. Indeed, in our case more resources are provided at the connector and are used by the addon. We have: - Some gpios used as reset and interrupts on the addon - One PWM - Two I2C busses Described and handled at connector level I2C extension busses. - ... With that, different addon can be connected. We detect connection with GPIOs and identify the addon connected thanks to an I2C EEPROM available on the addon. On our side, we handle this case using: - A connector driver This driver handle the connector. Its purpose is: - Detect insertion an removal of the addon - Identify the addon - Load a DT overlay that describes the addon - A DT overlay describing the addon This DT overlay has to be board agnostic. I mean from the addon point of view, only the connector is known. The addon DT describes devices connected at the I2C bus available at the connector but it shouldn't have to know if this I2C bus is i2c3 or i2c4 in the base board. To do that we introduced a first draft of i2c bus extension implementation [1] and its binding [2]. Also we introduce export symbols. This is the main blocking point. Having the export symbols feature working with device-tree overlay has been a no go from device-tree maintainers Rob Herring and David Gibson (dtc maintainer) and we need the export symbols feature to have the addon described. Luca did a really clear presentation at ELCE related to our issue and explained the purpose of i2c bus extension and export symbols feature. His slides [3] and the video of the talk [4] are available. Discussion is ongoing related to the export symbols feature [5] and depending on the conclusion of the discussion, the binding and the implementation of i2c bus extension could change. This is the reason why I didn't send a new iteration of the I2C bus extension binding and its related implementation. IHMO, export symbols feature is the key to unlock the situation and move forward. That's said, if you want a more up to date i2c bus extension binding and implementation, I can send a new iterations but you have to be prepare for changes in the future. Again, depending of the conclusion of export symbols feature discussion, the current proposal for i2c bus extension binding and implementation could be obsolete. Feel free to ask for more details if needed. Best regards, Hervé [1] https://lore.kernel.org/all/20250205173918.600037-1-herve.codina@bootlin.com/ [2] https://lore.kernel.org/all/20250618082313.549140-1-herve.codina@bootlin.com/ [3] https://bootlin.com/pub/conferences/2025/elce/ceresoli-hotplug-status.pdf [4] https://www.youtube.com/watch?v=C8dEQ4OzMnc [5] https://lore.kernel.org/all/20250902105710.00512c6d@booty/ ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-10-21 13:25 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-13 6:00 [PATCH v1 0/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C Svyatoslav Ryhel 2025-10-13 6:00 ` [PATCH v1 1/2 RESEND] dt-bindings: i2c: Document GPIO detected hot-plugged I2C bus Svyatoslav Ryhel 2025-10-13 6:00 ` [PATCH v1 2/2 RESEND] i2c: muxes: Add GPIO-detected hotplug I2C Svyatoslav Ryhel 2025-10-15 22:50 ` [PATCH v1 0/2 " Andi Shyti 2025-10-16 7:00 ` Svyatoslav Ryhel 2025-10-16 7:32 ` Wolfram Sang 2025-10-17 10:29 ` Andi Shyti 2025-10-21 13:25 ` Rob Herring 2025-10-16 7:11 ` Herve Codina
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).