Re: [PATCH v2 2/2] i2c: Add GPIO-based hotplug gate
From: Svyatoslav Ryhel
Date: Wed Jun 21 2023 - 07:01:08 EST
ср, 21 черв. 2023 р. о 13:32 Andi Shyti <andi.shyti@xxxxxxxxxx> пише:
>
> Hi,
>
> On Mon, Jun 19, 2023 at 06:37:32PM +0300, Svyatoslav Ryhel wrote:
> > From: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> >
> > Implement driver for hot-plugged I2C busses, where some devices on
> > a bus are hot-pluggable and their presence is indicated by GPIO line.
> >
> > Co-developed-by: Ion Agorria <ion@xxxxxxxxxxx>
> > Signed-off-by: Ion Agorria <ion@xxxxxxxxxxx>
> > Signed-off-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> > Signed-off-by: Svyatoslav Ryhel <clamor95@xxxxxxxxx>
> > ---
> > drivers/i2c/Kconfig | 11 ++
> > drivers/i2c/Makefile | 1 +
> > drivers/i2c/i2c-hotplug-gpio.c | 266 +++++++++++++++++++++++++++++++++
> > 3 files changed, 278 insertions(+)
> > create mode 100644 drivers/i2c/i2c-hotplug-gpio.c
>
> without going through the code I am missing the big picture here.
>
> What is this actually doing?
Basically it duplicates the parent i2c bus once detection GPIO triggers
and probes all hot-pluggable devices which are connected to it. Once
GPIO triggers detach signal all hot-pluggable devices are unprobed and
bus removed.
> Is this a new bus driver support?
Most likely not.
> Is this a feature to existing drivers?
Yes, it is more like i2c mux
> Is the GPIO an irq line for signalling hoplugging and can be used by
> any driver or just this one?
>
It can be shared if necessary but usually all hot-pluggable devices
are gathered in one container and are plugged simultaneously.
> Without further discussing technicalities, can you please explain
> better and more in detail what is the scope of this patch, why
> there is a need for such a patch, how this new driver/feature
> has been implemented and finally how it can be used.
This patch is a predecessor of a possible larger patchset which
should bring support for a asus-ec, a i2c mfd device programmed by
Asus for their Transformers tablet line.
This is Michał Mirosław, original author quote about this driver:
"The Transformers have a connector that's used for USB, charging or
for attaching a keyboard (called a dock; it also has a battery and
a touchpad). This connector probably (I don't have the means to verify
that) has an I2C bus lines and a "detect" line (pulled low on the dock
side) among the pins. I guess there is either no additional chip or
a transparent bridge/buffer chip, but nothing that could be controlled
by software. For DT this setup could be modelled like an I2C gate or
2-port mux with enable joining two I2C busses (one "closer" to the
CPU -- parent)."
Similar approach is used in Microsoft Surface RT for attachable
Type Cover.
> This would help a lot so that I know already beforehand what I am
> going to read without figuring it out.
>
> Thanks,
> Andi
>
> PS Please notice that my set of questions is even longer than
> your commit log :)