summaryrefslogtreecommitdiff
path: root/driver/ioexpander/pca9555.h
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2019-11-19 10:15:35 -0800
committerCommit Bot <commit-bot@chromium.org>2019-11-22 02:02:15 +0000
commitb6e36785982074af5638c456f305871f1465d460 (patch)
tree1d8537c283419139d881b7321b28be5927c61b06 /driver/ioexpander/pca9555.h
parent2748f2cbe6850d9ec7a307f53b3025924e25bf05 (diff)
downloadchrome-ec-b6e36785982074af5638c456f305871f1465d460.tar.gz
cleanup: Segregate ioexpander related drivers in ioexpander folder
BUG=none BRANCH=none TEST=make buildall -j Change-Id: I7fe9ab23254dbd8515936d10ad6782305e76236c Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1925173 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'driver/ioexpander/pca9555.h')
-rw-r--r--driver/ioexpander/pca9555.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/driver/ioexpander/pca9555.h b/driver/ioexpander/pca9555.h
new file mode 100644
index 0000000000..273f898821
--- /dev/null
+++ b/driver/ioexpander/pca9555.h
@@ -0,0 +1,45 @@
+/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * NXP PCA9555 I/O Port expander driver header
+ */
+
+#ifndef __CROS_EC_IOEXPANDER_PCA9555_H
+#define __CROS_EC_IOEXPANDER_PCA9555_H
+
+#include "i2c.h"
+
+#define PCA9555_CMD_INPUT_PORT_0 0
+#define PCA9555_CMD_INPUT_PORT_1 1
+#define PCA9555_CMD_OUTPUT_PORT_0 2
+#define PCA9555_CMD_OUTPUT_PORT_1 3
+#define PCA9555_CMD_POLARITY_INVERSION_PORT_0 4
+#define PCA9555_CMD_POLARITY_INVERSION_PORT_1 5
+#define PCA9555_CMD_CONFIGURATION_PORT_0 6
+#define PCA9555_CMD_CONFIGURATION_PORT_1 7
+
+#define PCA9555_IO_0 BIT(0)
+#define PCA9555_IO_1 BIT(1)
+#define PCA9555_IO_2 BIT(2)
+#define PCA9555_IO_3 BIT(3)
+#define PCA9555_IO_4 BIT(4)
+#define PCA9555_IO_5 BIT(5)
+#define PCA9555_IO_6 BIT(6)
+#define PCA9555_IO_7 BIT(7)
+
+static inline int pca9555_read(const int port,
+ const uint16_t i2c_addr_flags,
+ int reg, int *data_ptr)
+{
+ return i2c_read8(port, i2c_addr_flags, reg, data_ptr);
+}
+
+static inline int pca9555_write(const int port,
+ const uint16_t i2c_addr_flags,
+ int reg, int data)
+{
+ return i2c_write8(port, i2c_addr_flags, reg, data);
+}
+
+#endif /* __CROS_EC_IOEXPANDER_PCA9555_H */