summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2013-03-11 11:30:40 -0700
committerChromeBot <chrome-bot@google.com>2013-03-12 14:47:31 -0700
commitb2db230e0cebde377deb88667a4e50e37c91ca27 (patch)
tree9119f55264fcf86a39ace27851b3dcd3989fda36 /chip
parentd4ca1d9c00c93b31dcf786095c3ac3828960990c (diff)
downloadchrome-ec-b2db230e0cebde377deb88667a4e50e37c91ca27.tar.gz
spring: stm32: Generate battery key when charging status changes.v1.4.0
In order to update charger status we have added a virtual keystroke to signal change to the kernel via the MKBP interface. CL creates the virtual key press and calls it from within the USB charging code. Signed-off-by: Todd Broch <tbroch@chromium.org> BUG=chrome-os-partner:17927 BRANCH=spring TEST=manual 1. Compile for daisy,snow,spring. 2. Test on spring. Change-Id: I0afa0fc82c96fa3fd8119523a113b5028c8f64a3 Reviewed-on: https://gerrit.chromium.org/gerrit/45249 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/stm32/keyboard_scan.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/chip/stm32/keyboard_scan.c b/chip/stm32/keyboard_scan.c
index db4263fd91..1e7298e3e7 100644
--- a/chip/stm32/keyboard_scan.c
+++ b/chip/stm32/keyboard_scan.c
@@ -678,6 +678,24 @@ void keyboard_enable_scanning(int enable)
}
}
+/* Changes to col,row here need to also be reflected in kernel.
+ * drivers/input/mkbp.c ... see KEY_BATTERY.
+ */
+#define BATTERY_KEY_COL 0
+#define BATTERY_KEY_ROW 7
+#define BATTERY_KEY_ROW_MASK (1 << BATTERY_KEY_ROW)
+
+void keyboard_send_battery_key()
+{
+ mutex_lock(&scanning_enabled);
+ debounced_state[BATTERY_KEY_COL] ^= BATTERY_KEY_ROW_MASK;
+ if (kb_fifo_add(debounced_state) == EC_SUCCESS)
+ board_interrupt_host(1);
+ else
+ CPRINTF("dropped battery keystroke\n");
+ mutex_unlock(&scanning_enabled);
+}
+
static int command_keyboard_press(int argc, char **argv)
{
int r, c, p;