summaryrefslogtreecommitdiff
path: root/include/device_state.h
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2016-05-10 12:50:31 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-05-27 18:08:50 -0700
commit1d7984ad20a33b6062a96b498d06fa8266d52014 (patch)
tree74c98efe8b7b57eeb4a6f5743fd280e291ec583c /include/device_state.h
parentcebf8734d96d8c6a44185ee1b7d38b4d42efd36a (diff)
downloadchrome-ec-1d7984ad20a33b6062a96b498d06fa8266d52014.tar.gz
cr50: monitor the state of Servo, the EC, and AP
There are a couple of issues that cr50 has when it cannot know the state of servo, the EC, and the AP. This change adds support so we can detect when the AP or EC has been powered on and when servo has been connected. It uses the UART RX signals to monitor the power state of the AP and EC. The TX signals are used to monitor the state of servo. BUG=chrome-os-partner:52056,chrome-os-partner:52322 BRANCH=none TEST=verify device states are correct when the AP and EC are powered on or off and when Servo is attached or detached Change-Id: Id0a2281b65cb367ecc8d0ca2f9a576672318a5fb Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/344019
Diffstat (limited to 'include/device_state.h')
-rw-r--r--include/device_state.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/device_state.h b/include/device_state.h
new file mode 100644
index 0000000000..1af3972bfb
--- /dev/null
+++ b/include/device_state.h
@@ -0,0 +1,36 @@
+/* Copyright 2016 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.
+ */
+
+#include "gpio.h"
+
+#ifndef __CROS_DEVICE_STATE_H
+#define __CROS_DEVICE_STATE_H
+
+/* Device state indexes */
+enum device_state {
+ DEVICE_STATE_UNKNOWN = 0,
+ DEVICE_STATE_OFF,
+ DEVICE_STATE_ON,
+ DEVICE_STATE_COUNT,
+};
+
+struct device_config {
+ enum device_state state;
+ int state_change;
+ const struct deferred_data *deferred;
+ enum gpio_signal detect_on;
+ enum gpio_signal detect_off;
+};
+
+enum device_type;
+
+extern struct device_config device_states[];
+
+int device_get_state(enum device_type device);
+
+void device_set_state(enum device_type device, enum device_state state);
+
+void board_update_device_state(enum device_type device);
+#endif /* __CROS_DEVICE_STATE_H */