[PATCH 0/3] PCA I2C GPIO expanders

Titus Rwantare posted 3 patches 1 year, 2 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230206194936.168843-1-titusr@google.com
Maintainers: Peter Maydell <peter.maydell@linaro.org>, Thomas Huth <thuth@redhat.com>, Laurent Vivier <lvivier@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
hw/arm/Kconfig                  |   1 +
hw/gpio/meson.build             |   1 +
hw/gpio/pca_i2c_gpio.c          | 482 ++++++++++++++++++++++++++++++++
hw/gpio/trace-events            |   5 +
hw/i2c/Kconfig                  |   4 +
include/hw/gpio/pca_i2c_gpio.h  |  81 ++++++
tests/qtest/meson.build         |   1 +
tests/qtest/pca_i2c_gpio-test.c | 169 +++++++++++
8 files changed, 744 insertions(+)
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
[PATCH 0/3] PCA I2C GPIO expanders
Posted by Titus Rwantare 1 year, 2 months ago
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 outputs 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

Titus Rwantare (3):
  hw/gpio: add PCA6414 i2c GPIO expander
  hw/gpio: add PCA9538 8-bit GPIO expander
  hw/gpio: add PCA9536 i2c gpio expander

 hw/arm/Kconfig                  |   1 +
 hw/gpio/meson.build             |   1 +
 hw/gpio/pca_i2c_gpio.c          | 482 ++++++++++++++++++++++++++++++++
 hw/gpio/trace-events            |   5 +
 hw/i2c/Kconfig                  |   4 +
 include/hw/gpio/pca_i2c_gpio.h  |  81 ++++++
 tests/qtest/meson.build         |   1 +
 tests/qtest/pca_i2c_gpio-test.c | 169 +++++++++++
 8 files changed, 744 insertions(+)
 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

-- 
2.39.1.519.gcb327c4b5f-goog