1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <ec/acpi/ec.h>
8 * Return the EC sense status register state.
10 * Observations showed the sense registers are all zero until the EC populates
11 * them after some time. Likely the EC sets all bits to it's valid state at
12 * once, but there's no prove as the firmware isn't available.
14 * Wait for any register having at least one bit set.
15 * Unlikely that all register will be zero after booting has finished.
17 * @return 1 if the EC provides valid data in sense status registers
19 int h8_get_sense_ready(void)
21 static const u8 regs
[] = { H8_STATUS0
, H8_STATUS1
, H8_STATUS2
,
24 for (size_t i
= 0; i
< ARRAY_SIZE(regs
); i
++) {
33 * Return the state of Fn key.
34 * Only valid if h8_get_sense_ready (see above) returns true.
36 * @return 1 if the key is pressed.
38 int h8_get_fn_key(void)
40 return ec_read(H8_STATUS0
) & H8_STATUS0_FN_KEY_DOWN
;