summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChromeOS Developer <dparker@chromium.org>2014-01-10 14:15:34 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-02-03 22:30:39 +0000
commitc65f82a5b02cdecf5b62f71ef2e916795f808389 (patch)
tree3e9a223b7e43cbf8b6ebc45828e22e422351e15a /include
parentbd4437ddedda7de706a6bc6c6d0548080bb968cb (diff)
downloadchrome-ec-c65f82a5b02cdecf5b62f71ef2e916795f808389.tar.gz
8042: Add interface for handling off-matrix button changes
BUG=chrome-os-partner:24370 BRANCH=tot TEST=Power key and keyboard work normally. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I291ff384ae2fc3e074132330713f0b0c2cc36a76 Reviewed-on: https://chromium-review.googlesource.com/184543
Diffstat (limited to 'include')
-rw-r--r--include/button.h24
-rw-r--r--include/keyboard_protocol.h10
2 files changed, 34 insertions, 0 deletions
diff --git a/include/button.h b/include/button.h
new file mode 100644
index 0000000000..e8344b308f
--- /dev/null
+++ b/include/button.h
@@ -0,0 +1,24 @@
+/* Copyright (c) 2014 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.
+ */
+
+/* Button API for Chrome EC */
+
+#ifndef __CROS_EC_BUTTON_H
+#define __CROS_EC_BUTTON_H
+
+#include "common.h"
+#include "gpio.h"
+
+#define BUTTON_FLAG_ACTIVE_HIGH (1 << 0)
+
+enum keyboard_button_type {
+ KEYBOARD_BUTTON_POWER = 0,
+ KEYBOARD_BUTTON_VOLUME_DOWN,
+ KEYBOARD_BUTTON_VOLUME_UP,
+
+ KEYBOARD_BUTTON_COUNT
+};
+
+#endif /* __CROS_EC_BUTTON_H */
diff --git a/include/keyboard_protocol.h b/include/keyboard_protocol.h
index 866c58807b..6fc0a06f7c 100644
--- a/include/keyboard_protocol.h
+++ b/include/keyboard_protocol.h
@@ -9,6 +9,7 @@
#define __CROS_EC_KEYBOARD_PROTOCOL_H
#include "common.h"
+#include "button.h"
/* Routines common to all protocols */
@@ -17,6 +18,15 @@
*/
void keyboard_clear_buffer(void);
+/*
+ * Respond to button changes. Implemented by a host-specific
+ * handler.
+ *
+ * @param button The button that changed.
+ * @param is_pressed Whether the button is now pressed.
+ */
+void keyboard_update_button(enum keyboard_button_type button, int is_pressed);
+
/* Protocol-specific includes */
#ifdef CONFIG_KEYBOARD_PROTOCOL_8042