summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2019-04-02 17:35:02 -0700
committerCommit Bot <commit-bot@chromium.org>2019-08-23 00:12:19 +0000
commit5ef014067c4782eee9faaf6bf28b33e7f0777394 (patch)
tree09dc321ec093f7f642f26fc3315f4de0c6f5e126 /include
parenteffce8961057b753c3c67f753857b2d214ac0852 (diff)
downloadchrome-ec-5ef014067c4782eee9faaf6bf28b33e7f0777394.tar.gz
tcpm: Refactor tcpc_config to include a flags field
tcpc_config contained a field for both the alert polarity and open drain/push pull configuration. There is also a possible difference in TCPC reset polarity. Instead of adding yet another field to describe this configuration, it would be better to convert alert polairty, open drain and reset polarity into a single flags field. This CL modifies the tcpc_config struct to use a single flags field and adds defines for what existing flag options can be. BUG=b:130194031 BRANCH=none TEST=make -j buildall Change-Id: Ifb7e7604edb7021fb2d36ee279049eb52fefc99e Signed-off-by: Scott Collyer <scollyer@google.com> Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1551581 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1767512 Reviewed-by: Edward Hill <ecgh@chromium.org> Commit-Queue: Edward Hill <ecgh@chromium.org> Tested-by: Edward Hill <ecgh@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/usb_pd_tcpm.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 2a9778c3dd..b2c2ab8638 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -309,22 +309,23 @@ struct tcpm_drv {
#endif
};
-enum tcpc_alert_polarity {
- TCPC_ALERT_ACTIVE_LOW,
- TCPC_ALERT_ACTIVE_HIGH,
-};
-
-enum tcpc_alert_open_drain {
- TCPC_ALERT_PUSH_PULL = 0,
- TCPC_ALERT_OPEN_DRAIN,
-};
+/*
+ * Macros for tcpc_config_t flags field.
+ *
+ * Bit 0 --> Polarity for TCPC alert. Set to 1 if alert is active high.
+ * Bit 1 --> Set to 1 if TCPC alert line is open-drain instead of push-pull.
+ * Bit 2 --> Polarity for TCPC reset. Set to 1 if reset line is active high.
+ */
+#define TCPC_FLAGS_ALERT_ACTIVE_HIGH BIT(0)
+#define TCPC_FLAGS_ALERT_OD BIT(1)
+#define TCPC_FLAGS_RESET_ACTIVE_HIGH BIT(2)
struct tcpc_config_t {
int i2c_host_port;
int i2c_slave_addr;
const struct tcpm_drv *drv;
- enum tcpc_alert_polarity pol;
- enum tcpc_alert_open_drain od;
+ /* See TCPC_FLAGS_* above */
+ uint32_t flags;
};
/**