Files
system76-coreboot/src/mainboard/lenovo/s230u/ec.c
Angel Pons 89ab2503c9 mainboard/lenovo: Use SPDX for GPL-2.0-only files
Done with sed and God Lines. Only done for C-like code for now.

Change-Id: I7b7670bb541cf4814fd4958d5c0d8c68cbee80c2
Signed-off-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/40085
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Peter Lemenkov <lemenkov@gmail.com>
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
2020-04-04 16:22:40 +00:00

38 lines
1017 B
C

/* SPDX-License-Identifier: GPL-2.0-only */
/* This file is part of the coreboot project. */
#include "ec.h"
#include <ec/compal/ene932/ec.h>
/* The keyboard matrix tells the EC how the keyboard is wired internally */
static void set_keyboard_matrix_us(void)
{
ec_kbc_write_cmd(0x59);
ec_kbc_write_ib(0xE5);
}
/* Tell EC to operate in APM mode. Events generate SMIs instead of SCIs */
static void enter_apm_mode(void)
{
ec_kbc_write_cmd(0x59);
ec_kbc_write_ib(0xE9);
}
void lenovo_s230u_ec_init(void)
{
set_keyboard_matrix_us();
/*
* The EC has a special "blinking Caps Lock LED" mode which it normally
* enters when it believes the OS is not responding. It occasionally
* disables battery charging when in this mode, although other
* functionality is unaffected. Although the EC starts in APM mode by
* default, it only leaves the "blinking Caps Lock LED" mode after
* receiving the following command.
*/
enter_apm_mode();
/* Enable external USB port power. */
ec_mm_set_bit(0x3b, 4);
}