Files
OpenCellular/include/keyboard_scan.h
Randall Spangler 7b155fb8ac Refactor boot key detection
Keyboard scan module now owns the recovery key state on all platforms.

And clean up a few comments to linux kernel style

BUG=chrome-os-partner:10890
TEST=manual
- Power on system.  Should boot normally.
- Power+Refresh+D.  Should turn dev switch on.
- Power+Refresh+F.  Should turn dev switch off.
- Power+Esc.  Should reboot system.  Power button should power on normally.
- Power+Refresh+Esc.  Should power on into recovery mode.
- Then press power to shut system down.
- Power button should power on normally (not back into recovery mode).

Change-Id: I4d16e1e8b039efeacbd41e8acec115844bc8457d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/26147
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-06-26 17:01:52 -07:00

47 lines
1.4 KiB
C

/* Copyright (c) 2012 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.
*/
/* Keyboard scanner module for Chrome EC */
#ifndef __CROS_EC_KEYBOARD_SCAN_H
#define __CROS_EC_KEYBOARD_SCAN_H
#include "common.h"
/* Initializes the module. */
int keyboard_scan_init(void);
/* Key held down at keyboard-controlled reset boot time. */
enum boot_key {
BOOT_KEY_NONE, /* No keys other than keyboard-controlled reset keys */
BOOT_KEY_ESC,
BOOT_KEY_D,
BOOT_KEY_F,
BOOT_KEY_DOWN_ARROW,
BOOT_KEY_OTHER = -1, /* None of the above */
};
/*
* Return the key held down at boot time in addition to the keyboard-controlled
* reset keys. Returns BOOT_KEY_OTHER if none of the keys specifically checked
* was pressed, or reset was not caused by a keyboard-controlled reset, or if
* the state has been cleared by keyboard_scan_clear_boot_key().
*/
enum boot_key keyboard_scan_get_boot_key(void);
/* Clear the boot key state. */
void keyboard_scan_clear_boot_key(void);
/* Return non-zero if recovery key was pressed at boot. */
int keyboard_scan_recovery_pressed(void);
/* Clear any saved keyboard state (empty FIFO, etc) */
void keyboard_clear_state(void);
/* Enables/disables keyboard matrix scan. */
void keyboard_enable_scanning(int enable);
#endif /* __CROS_EC_KEYBOARD_SCAN_H */