summaryrefslogtreecommitdiff
path: root/driver/tcpm/ps8xxx.h
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2021-06-10 12:41:45 -0700
committerCommit Bot <commit-bot@chromium.org>2021-06-16 05:30:06 +0000
commit4e5339a70b8109969aec6b9352ae81918fca62b7 (patch)
tree83572ed0c7d5a16f202944da0219f2d50736f710 /driver/tcpm/ps8xxx.h
parent1d1bb1f716e62d33fb06fcb6fd86c66c26792703 (diff)
downloadchrome-ec-4e5339a70b8109969aec6b9352ae81918fca62b7.tar.gz
ps8805: Add driver method to set/get GPIO signals
The PS8805 has 3 GPIO signals which can be controlled by the EC with I2C register accesses. This CL adds functions to both set and get a one of the 3 PS8805 GPIO signals. BUG=b:159330563 BRANCH=quiche TEST=verified on gingerbread that VBUS control is functioning. Signed-off-by: Scott Collyer <scollyer@google.com> Change-Id: I1ef688e713ea84d2b0c6a6c23385fe6afb4f96b2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2953868 Commit-Queue: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'driver/tcpm/ps8xxx.h')
-rw-r--r--driver/tcpm/ps8xxx.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/driver/tcpm/ps8xxx.h b/driver/tcpm/ps8xxx.h
index 1f3d2d9b88..514579ecca 100644
--- a/driver/tcpm/ps8xxx.h
+++ b/driver/tcpm/ps8xxx.h
@@ -58,4 +58,42 @@
/* Vendor defined registers */
#define PS8815_P1_REG_HW_REVISION 0xF0
+/*
+ * PS8805 GPIO control register. Note the device I2C address of 0x1A is
+ * independent of the ADDR pin on the chip, and not the same address being used
+ * for TCPCI functions.
+ */
+#define PS8805_VENDOR_DEFINED_I2C_ADDR 0x1A
+#define PS8805_REG_GPIO_CONTROL 0x21
+#define PS8805_REG_GPIO_0 BIT(7)
+#define PS8805_REG_GPIO_1 BIT(5)
+#define PS8805_REG_GPIO_2 BIT(6)
+
+enum ps8805_gpio {
+ PS8805_GPIO_0,
+ PS8805_GPIO_1,
+ PS8805_GPIO_2,
+ PS8805_GPIO_NUM,
+};
+
+/**
+ * Set PS8805 gpio signal to desired level
+ *
+ * @param port: The Type-C port number.
+ * @param signal PS8805 gpio number (0, 1, or 2)
+ * @param level desired level
+ * @return EC_SUCCESS if I2C accesses are successful
+ */
+int ps8805_gpio_set_level(int port, enum ps8805_gpio signal, int level);
+
+/**
+ * Get PS8805 gpio signal value
+ *
+ * @param port: The Type-C port number.
+ * @param signal PS8805 gpio number (0, 1, or 2)
+ * @param pointer location to store gpio level
+ * @return EC_SUCCESS if I2C accesses are successful
+ */
+int ps8805_gpio_get_level(int port, enum ps8805_gpio signal, int *level);
+
#endif /* defined(__CROS_EC_USB_PD_TCPM_PS8XXX_H) */