blob: 2dd0009b7b8427d20135192fb0a7ebe1350b3040 [file] [log] [blame]
Alexandru Gagniucb4417fb2014-04-06 23:57:57 -05001/*
2 * Copyright (C) 2014 Alexandru Gagniuc <mr.nuke.me@gmail.com>
3 * Subject to the GNU GPL v2, or (at your option) any later version.
4 */
5
6#include "ec.h"
7#include <ec/compal/ene932/ec.h>
8
9/* The keyboard matrix tells the EC how the keyboard is wired internally */
10static void set_keyboard_matrix_us(void)
11{
12 ec_kbc_write_cmd(0x59);
13 ec_kbc_write_ib(0xE5);
14}
15
Alexandru Gagniuc73639e22014-04-09 12:24:39 -050016/* Tell EC to operate in APM mode. Events generate SMIs instead of SCIs */
17static void enter_apm_mode(void)
Alexandru Gagniucb4417fb2014-04-06 23:57:57 -050018{
19 ec_kbc_write_cmd(0x59);
Alexandru Gagniuc73639e22014-04-09 12:24:39 -050020 ec_kbc_write_ib(0xE9);
Alexandru Gagniucb4417fb2014-04-06 23:57:57 -050021}
22
23void pavilion_m6_1035dx_ec_init(void)
24{
25 set_keyboard_matrix_us();
Alexandru Gagniuc73639e22014-04-09 12:24:39 -050026
27 /*
28 * The EC has a special "blinking Caps Lock LED" mode which it normally
29 * enters when it believes the OS is not responding. It occasionally
30 * disables battery charging when in this mode, although other
31 * functionality is unaffected. Although the EC starts in APM mode by
32 * default, it only leaves the "blinking Caps Lock LED" mode after
33 * receiving the following command.
34 */
35 enter_apm_mode();
Alexandru Gagniucb4417fb2014-04-06 23:57:57 -050036}