Skip to content

PCA I2C GPIO expanders

Titus Rwantare qemu-arm qemu-devel 3 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest5 patches 0 repliesNew
  2. v24 patches 4 repliesSuperseded
  3. v13 patches 9 repliesSuperseded

Changes in v3 from the cover letter

- switched to extract / deposit API
- added deposit16 to bitops.h
- squashed PCA9538 patch into PCA6416 to use the same send and recv functions
- updated unit tests use asymmetric 16-bit test values
- add patch to imply I2C devices on NPCM7xx boards

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5bitops.h: add deposit16 functioninclude/qemu/bitops.h+26 -00 replies
2/5hw/gpio: add PCA953x i2c GPIO expandershw/gpio/Kconfig hw/gpio/meson.build hw/gpio/pca_i2c_gpio.c +9 more+664 -50 replies
3/5hw/gpio: add PCA9536 i2c gpio expanderhw/gpio/pca_i2c_gpio.c include/hw/gpio/pca_i2c_gpio.h tests/lcitool/libvirt-ci+21 -10 replies
4/5hw/i2c: add canonical path to i2c event traceshw/i2c/core.c hw/i2c/trace-events+6 -40 replies
5/5hw/arm: imply I2C_DEVICES on NPCM7xxhw/arm/Kconfig+1 -00 replies

Reviews trailers per patch

3 of 5 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-DaudéHao Wu
1/5
2/5R-b R-b
3/5R-b R-b
4/5R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/5] PCA I2C GPIO expanders

This patch series contains a set of i2c GPIO expanders, with support for 4, 8, and 16 GPIO connections.

The devices are configured as GPIO inputs by default, but can have pins configured to be inputs with qmp commands.

For example, the following snippet in a board file for a system, configures a 16 bit pca6416 to have pins 8-11 as inputs, then asserts them.

    dev = DEVICE(i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 3), "pca6416", 0x72));
    object_property_set_uint(OBJECT(dev), "gpio_config", 0x0F00, &error_abort);
    object_property_set_uint(OBJECT(dev), "gpio_input", 0x0F00, &error_abort);

We currently use these to test hardware presence and LEDs in simulation.

Thanks

Since v2:
- switched to extract / deposit API
- added deposit16 to bitops.h
- squashed PCA9538 patch into PCA6416 to use the same send and recv functions
- updated unit tests use asymmetric 16-bit test values
- add patch to imply I2C devices on NPCM7xx boards

Since v1:
- addressed comments
- fixed typos in commit messages

Titus Rwantare (5):
bitops.h: add deposit16 function
hw/gpio: add PCA953x i2c GPIO expanders
hw/gpio: add PCA9536 i2c gpio expander
hw/i2c: add canonical path to i2c event traces
hw/arm: imply I2C_DEVICES on NPCM7xx

 hw/arm/Kconfig                  |   1 +
 hw/gpio/Kconfig                 |   5 +
 hw/gpio/meson.build             |   1 +
 hw/gpio/pca_i2c_gpio.c          | 410 ++++++++++++++++++++++++++++++++
 hw/gpio/trace-events            |   5 +
 hw/i2c/core.c                   |   8 +-
 hw/i2c/trace-events             |   2 +-
 include/hw/gpio/pca_i2c_gpio.h  |  69 ++++++
 include/qemu/bitops.h           |  26 ++
 roms/edk2                       |   2 +-
 roms/openbios                   |   2 +-
 roms/opensbi                    |   2 +-
 roms/seabios                    |   2 +-
 tests/qtest/meson.build         |   1 +
 tests/qtest/pca_i2c_gpio-test.c | 188 +++++++++++++++
 15 files changed, 716 insertions(+), 8 deletions(-)
 create mode 100644 hw/gpio/pca_i2c_gpio.c
 create mode 100644 include/hw/gpio/pca_i2c_gpio.h
 create mode 100644 tests/qtest/pca_i2c_gpio-test.c
Signature · 1 line
2.40.0.rc1.284.g88254d51c5-goog