1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <amdblocks/alib.h>
5 /* The ALIB method object is defined in an SSDT */
6 External(\_SB.ALIB, MethodObj)
8 /* Wrapper method that calls ALIB function 1 to report current AC/DC state. */
11 /* Send ALIB Function 1 the AC/DC state */
12 Local0 = Buffer (0x03) {}
13 CreateWordField (Local0, 0, F1SZ)
14 CreateByteField (Local0, 2, F1DA)
16 /* First argument is size i.e. 3 bytes */
20 * Second argument is power state i.e. AC or DC.
21 * ALIB expects AC = 0, DC = 1.
22 * PWRS reports AC = 1, DC = 0.
24 * Hence, need to invert the state of PWRS.
28 Printf ("ALIB call: func 1 params %o", Local0)
29 \_SB.ALIB (ALIB_FUNCTION_REPORT_AC_DC_STATE, Local0)