[RFC PATCH 7/7] gpio: p3h2x4x: add GPIO expander for the NXP P3H2x4x I3C hub

Lee Jones lee at kernel.org
Mon Oct 19 07:25:55 PDT 2026


On Fri, 16 Oct 2026, Lakshay Piplani wrote:

> Expose the pins of the target ports placed in GPIO mode as a gpio_chip, so
> the hub can be used as an IO expander.
> 
> Each port contributes two lines, the SCL pin first, so target port N owns
> the lines 2 * N and 2 * N + 1, and the line number is also the port bit
> position in the direction and level registers. Ports that carry bus traffic
> are masked out through init_valid_mask. The port function is taken from the
> device tree rather than from the GPIO mode register, because the hub child
> that programs that register and this child are independent MFD devices with
> no probe ordering guarantee.
> 
> Direction is the output enable: clearing it leaves the pin in Hi-Z. An
> output drives the level before the buffer is enabled to avoid a glitch, and
> the input level register is used for reads in both directions. These
> registers are not protected, so the callbacks do not take the shared
> register lock. Implement get_multiple and set_multiple so an access to all
> lines of the hub costs two register accesses instead of one per line.
> 
> Interrupts on input level changes are not supported yet: they arrive as an
> I3C in-band interrupt and the edge detection configuration is shared by
> groups of four ports.
> 
> Signed-off-by: Lakshay Piplani <lakshay.piplani at nxp.com>
> Signed-off-by: Aman Kumar Pandey <aman.kumarpandey at nxp.com>
> Signed-off-by: Vikash Bansal <vikash.bansal at nxp.com>
> ---
>  MAINTAINERS                 |   1 +
>  drivers/gpio/Kconfig        |  11 ++
>  drivers/gpio/Makefile       |   1 +
>  drivers/gpio/gpio-p3h2x4x.c | 294 ++++++++++++++++++++++++++++++++++++
>  drivers/mfd/p3h2840.c       |   5 +

This needs to be a separate patch.

>  5 files changed, 312 insertions(+)
>  create mode 100644 drivers/gpio/gpio-p3h2x4x.c

-- 
Lee Jones



More information about the linux-i3c mailing list