nuttx/include/nuttx/ioexpander
Alan Carvalho de Assis 8342c51d59 ioexpander/ch422g: add a driver for the WCH CH422G I/O
The CH422G offers eight bi-directional pins, IO0-IO7, and four open-drain
outputs, OC0-OC3.  It appears on boards that have run out of usable GPIOs
once a parallel RGB panel has taken its share, the Waveshare
ESP32-S3-Touch-LCD-7 among them, where it holds the panel and touch
controller in and out of reset and switches the backlight.

Two things about the device do not fit the shape a register-per-address
I2C driver usually takes, and both are handled here rather than pushed on
to board logic:

  - A register is selected by the I2C address the transfer is addressed
    to, not by a register address written ahead of the data.  Each access
    carries a single byte to one of four addresses.
  - None of the write-only registers can be read back, so the driver
    keeps a shadow copy of each and updates it in step with the device.

IO0-IO7 have no individual direction control; one bit of the system
parameter register drives the whole group.  The driver records the
direction asked of each pin and puts the group in output mode once at
least one of them is an output, which is what a board that drives some of
the pins would expect.  Reading a pin of a group held in output mode
reports the value last written, because the hardware cannot report the
level, and that is documented rather than hidden.

The four open-drain outputs are presented as pins 8-11 of the same
ioexpander_dev_s so that one instance covers the chip, which means
CONFIG_IOEXPANDER_NPINS must be at least 12.

Builds clean with no new warnings on esp32s3-touch-lcd7:usbnsh and passes
nxstyle.

Signed-off-by: Alan Carvalho de Assis <acassis@gmail.com>
Assisted-by: Claude Code
2026-08-24 09:39:58 +02:00
..
aw9523b.h drivers/ioexpander/aw9523b: New driver for AW9523B i/o expander 2025-08-29 09:10:50 -03:00
ch422g.h ioexpander/ch422g: add a driver for the WCH CH422G I/O 2026-08-24 09:39:58 +02:00
gpio.h drivers/ioexpander: List the registered pins in /proc/gpio. 2026-08-19 00:46:56 +08:00
icjx.h drivers/ioexpander/icjx: add option to set filters during initialization 2025-04-24 10:05:56 -03:00
ioe_dummy.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
ioe_rpmsg.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
ioexpander.h drivers/ioexpander: add enable & disable macro for gpio SETDEBOUNCE and SETMASK 2026-01-13 09:27:52 -03:00
iso1h812g.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
iso1i813t.h ioexpander/iso1i813t: add option to check errors during read 2026-03-18 15:00:48 -03:00
mcp23x08.h This patch fix mcp23x08 support. Issue #15592 2025-01-21 01:59:25 +08:00
mcp23x17.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
pca9538.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
pca9555.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
pca9557.h drivers/ioexpander: Add support for PCA9557 2025-03-25 15:46:09 -03:00
pcf8574.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
pcf8575.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
pi4ioe5v6408.h drives/ioexpander: add support to PI4IOE IO Expander 2026-07-28 10:18:01 +08:00
sx1509.h include: migrate to SPDX identifier 2024-10-04 08:18:42 +08:00
tca64xx.h drivers/tca64xx: Add support for PCAL6416 2025-08-26 09:46:09 +08:00