misc/pca9552: Let external devices set pca9552 inputs
commitff557c272c21692e9fa4d5a18e2d8989485b00e4
authorGlenn Miles <milesg@linux.vnet.ibm.com>
Mon, 5 Feb 2024 07:40:15 +0000 (5 17:40 +1000)
committerNicholas Piggin <npiggin@gmail.com>
Fri, 23 Feb 2024 13:24:42 +0000 (23 23:24 +1000)
tree06eb8f6e1f74b8b8cd7856c26786bc4200e0d260
parent7b99fb30b39bb14733aa3645b68e0103bbf8e43a
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>
hw/misc/pca9552.c
include/hw/misc/pca9552.h