1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #ifdef IT8516E_FIRST_DATA
5 Name (_HID, EisaId("PNP0C02"))
6 Name (_STR, Unicode("IT8516E PM Channel 1"))
7 Name (_UID, SUPERIO_UID(PM, 1))
10 * The EC firmware exposes CPU temperature through ec ram
11 * on the first PM channel.
15 #define EC_DATA_IO IT8516E_FIRST_DATA
17 #define EC_SC_IO IT8516E_FIRST_SC
18 #include <ec/acpi/ec.asl>
22 /* Announce the used i/o ports to the OS */
23 Return (ResourceTemplate () {
24 IO (Decode16, IT8516E_FIRST_DATA, IT8516E_FIRST_DATA, 0x01, 0x01)
25 IO (Decode16, IT8516E_FIRST_SC, IT8516E_FIRST_SC, 0x01, 0x01)
30 * Get CPU temperature from first PM channel (in 10th Kelvin)
34 Local0 = EC_READ (0x52)
35 If (Local0 & EC_ERROR_MASK) {
39 Return (Local0 + 2732) /* Return as 10th Kelvin */
44 #ifdef IT8516E_SECOND_DATA
46 Name (_HID, EisaId("PNP0C02"))
47 Name (_STR, Unicode("IT8516E PM Channel 2"))
48 Name (_UID, SUPERIO_UID(PM, 2))
51 * The EC firmware exposes fan and GPIO control through the
56 #define EC_DATA_IO IT8516E_SECOND_DATA
58 #define EC_SC_IO IT8516E_SECOND_SC
59 #include <ec/acpi/ec.asl>
63 /* Announce the used i/o ports to the OS */
64 Return (ResourceTemplate () {
65 IO (Decode16, IT8516E_SECOND_DATA, IT8516E_SECOND_DATA, 0x01, 0x01)
66 IO (Decode16, IT8516E_SECOND_SC, IT8516E_SECOND_SC, 0x01, 0x01)
71 * Get CPU temperature from second PM channel (in 10th Kelvin)
75 Acquire (EC_MUTEX, 0xffff)
76 Local0 = SEND_EC_COMMAND (0x20) /* GET_CPUTEMP */
77 If (Local0 & EC_ERROR_MASK) {
81 Local0 = RECV_EC_DATA () /* Temp low byte in 64th °C */
82 If (Local0 & EC_ERROR_MASK) {
86 Local1 = RECV_EC_DATA () /* Temp high byte in 64th °C */
87 If (Local1 & EC_ERROR_MASK) {
94 Local0 *= 10 / 64 /* Convert to 10th °C */
95 Return (Local0 + 2732) /* Return as 10th Kelvin */