summary refs log tree commit diff stats
path: root/include/hw/misc
diff options
context:
space:
mode:
authorGlenn Miles <milesg@linux.vnet.ibm.com>2024-02-05 17:40:15 +1000
committerNicholas Piggin <npiggin@gmail.com>2024-02-23 23:24:42 +1000
commitff557c272c21692e9fa4d5a18e2d8989485b00e4 (patch)
tree06eb8f6e1f74b8b8cd7856c26786bc4200e0d260 /include/hw/misc
parent7b99fb30b39bb14733aa3645b68e0103bbf8e43a (diff)
downloadfocaccia-qemu-ff557c272c21692e9fa4d5a18e2d8989485b00e4.tar.gz
focaccia-qemu-ff557c272c21692e9fa4d5a18e2d8989485b00e4.zip
misc/pca9552: Let external devices set pca9552 inputs
Allow external devices to drive pca9552 input pins by adding
input GPIO's to the model.  This allows a device to connect
its output GPIO's to the pca9552 input GPIO's.

In order for an external device to set the state of a pca9552
pin, the pin must first be configured for high impedance (LED
is off).  If the pca9552 pin is configured to drive the pin low
(LED is on), then external input will be ignored.

Here is a table describing the logical state of a pca9552 pin
given the state being driven by the pca9552 and an external device:

                   PCA9552
                   Configured
                   State

                  | Hi-Z | Low |
            ------+------+-----+
  External   Hi-Z |  Hi  | Low |
  Device    ------+------+-----+
  State      Low  |  Low | Low |
            ------+------+-----+

Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Diffstat (limited to 'include/hw/misc')
-rw-r--r--include/hw/misc/pca9552.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/hw/misc/pca9552.h b/include/hw/misc/pca9552.h
index b6f4e264fe..c36525f0c3 100644
--- a/include/hw/misc/pca9552.h
+++ b/include/hw/misc/pca9552.h
@@ -30,7 +30,8 @@ struct PCA955xState {
     uint8_t pointer;
 
     uint8_t regs[PCA955X_NR_REGS];
-    qemu_irq gpio[PCA955X_PIN_COUNT_MAX];
+    qemu_irq gpio_out[PCA955X_PIN_COUNT_MAX];
+    uint8_t ext_state[PCA955X_PIN_COUNT_MAX];
     char *description; /* For debugging purpose only */
 };