Alexandru Gagniuc | b4417fb | 2014-04-06 23:57:57 -0500 | [diff] [blame] | 1 | /* |
| 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 */ |
| 10 | static void set_keyboard_matrix_us(void) |
| 11 | { |
| 12 | ec_kbc_write_cmd(0x59); |
| 13 | ec_kbc_write_ib(0xE5); |
| 14 | } |
| 15 | |
Alexandru Gagniuc | 73639e2 | 2014-04-09 12:24:39 -0500 | [diff] [blame] | 16 | /* Tell EC to operate in APM mode. Events generate SMIs instead of SCIs */ |
| 17 | static void enter_apm_mode(void) |
Alexandru Gagniuc | b4417fb | 2014-04-06 23:57:57 -0500 | [diff] [blame] | 18 | { |
| 19 | ec_kbc_write_cmd(0x59); |
Alexandru Gagniuc | 73639e2 | 2014-04-09 12:24:39 -0500 | [diff] [blame] | 20 | ec_kbc_write_ib(0xE9); |
Alexandru Gagniuc | b4417fb | 2014-04-06 23:57:57 -0500 | [diff] [blame] | 21 | } |
| 22 | |
| 23 | void pavilion_m6_1035dx_ec_init(void) |
| 24 | { |
| 25 | set_keyboard_matrix_us(); |
Alexandru Gagniuc | 73639e2 | 2014-04-09 12:24:39 -0500 | [diff] [blame] | 26 | |
| 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 Gagniuc | b4417fb | 2014-04-06 23:57:57 -0500 | [diff] [blame] | 36 | } |