• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/* SPDX-License-Identifier: GPL-2.0-only */
2
3/*
4 * The mainboard must define a PNOT method to handle power
5 * state notifications and Notify CPU device objects to
6 * re-evaluate their _PPC and _CST tables.
7 */
8
9Device (EC0)
10{
11	Name (_HID, EISAID ("PNP0C09"))
12	Name (_UID, 1)
13	Name (_GPE, EC_SCI_GPE)	// GPE for Runtime SCI
14
15	OperationRegion (ERAM, EmbeddedControl, 0x00, 0xff)
16	Field (ERAM, ByteAcc, Lock, Preserve)
17	{
18		// EC Name Space Configuration
19		    , 1,        // Reserved                              ; 00h.0
20		LCDS, 1,        // 1= BACKLIGHT ON , 0= BACKLIGHT OFF    ; 00h.1
21		, 6,            // Reserved                              ; 00h.2 ~ 00h.6
22		HTBN, 8,        // HOTKEY_BUTTON_NUMBER                  ; 01h For ABO Hot Key Function
23		HTBT, 8,        // HOTKEY_BUTTON_TYPE                    ; 02h For ABO Hot Key Function
24		LMEN, 1,        // Launch Manager enable .(1=Enable )    ; 03h.0, Lauanch manage
25		, 7,            // Reserved                              ; 03h.1 ~ 03h.7
26		ADAP, 2,        // Adaptor Type                          ; 04h.0 ~ 1
27		                // 0x00 = default(65w)
28		                // 0x01 = 65w
29		                // 0x02 = 90w
30		                // 0x03 = 120w
31		, 6,            // Reserved                             ; 04h.2 ~ 04h.7
32		Offset(0x08),   // Project Common Name space definition ; 08h - 2Ch
33		Offset(0x2D),
34		DSPM, 1,        // Display Mode.(0=dGPU, 1=iGPU )       ; 2Dh.0
35		Offset(0x2E),
36		EFP1, 4,        // Turbo Off P-State                    ; 2Eh.3-0
37		Offset(0x40),   // ABO Common Name space definition     ; 2F - 5Ch
38		Offset(0x5D),
39		ENIB, 16,       // Ext_NameSpace_Index                  ; 5Dh
40		                // Ext_NameSpace_Bank                   ; 5Eh
41		ENDD, 8,        // Ext_NameSpace_Data                   ; 5Fh
42		Offset(0x60),
43		SMPR, 8,        // SMBus protocol register              ; 60h
44		SMST, 8,        // SMBus status register                ; 61h
45		SMAD, 8,        // SMBus address register               ; 62h
46		SMCM, 8,        // SMBus command register               ; 63h
47		SMD0, 0x100,    // SMBus data regs (32)                 ; 64h - 83h
48		BCNT, 8,        // SMBus Block Count                    ; 84h
49		SMAA, 24,       // SMBus Alarm Address                  ; 85h - 87h
50		Offset(0x90),
51		BMFN, 72,       // Battery Manufacture name             ; 90h - 98h
52		BATD, 56,       // Battery Device name                  ; 99h - 9fh
53		Offset(0xA1),
54		, 1,            // Reserve                              ; A1h.0
55		VIDO, 1,        // Video Out Button (1=Pressed)         ; A1h.1
56		TOUP, 1,        // Touch Pad Button (0=On, 1=Off)       ; A1h.2
57		Offset(0xA2),
58		ODTS, 8,        // OS Shutdown Temp2 (DTS)              ; A2h
59		Offset(0xA3),
60		OSTY, 3,        // OSTYPE :   000- XP                   ; A3h.0-2
61		                //            001- Vista
62		                //            010- Linux
63		                //            011- Win7
64		, 4,            // Reserve                              ; A3h.3-6
65		ADPT, 1,        // AC Adapter (0=OffLine, 1=OnLine)     ; A3h.7
66		Offset(0xA4),
67		PWAK, 1,        // PME Wake Enable(0=Disable, 1=Enable) ; A4h.0
68		MWAK, 1,        // Modem Wake Enable(0/1=Disable/Enable); A4h.1
69		LWAK, 1,        // LAN Wake Enable (0=Disable, 1=Enable); A4h.2
70		RWAK, 1,        // RTC Wake Enable(0=DIsable,1=Enable)  ; A4h.3
71		WWAK, 1,        // WLAN wake Enable (0=Disable,1=Enable); A4h.4
72		UWAK, 1,        // USB WAKE(0=Disable, 1=Enable)        ; A4h.5
73		KWAK, 1,        // Keyboard WAKE(0=Disable,1=Enable)    ; A4h.6
74		TWAK, 1,        // TouchPad WAKE(0=Disable,1=Enable)    ; A4h.7
75		Offset(0xA5),
76		CCAC, 1,        // Charge Current (1=AC OFF)            ; A5h.0
77		AOAC, 1,        // Adapter OVP (1=AC OFF)               ; A5h.1
78		BLAC, 1,        // Batt learning (1=AC OFF)             ; A5h.2
79		PSRC, 1,        // Command (1=AC OFF)                   ; A5h.3
80		BOAC, 1,        // Batt OVP (1=AC OFF)                  ; A5h.4
81		LCAC, 1,        // Leak Current (1=AC OFF)              ; A5h.5
82		AAAC, 1,        // Air Adapter (1=AC OFF)               ; A5h.6
83		ACAC, 1,        // AC Off (1=AC OFF)                    ; A5h.7
84		Offset(0xA6),
85		S3ST, 1,        // System entry S3 State                : A6.0
86		S3RM, 1,        // System resume from S3 State          : A6.1
87		S4ST, 1,        // System entry S4 State                : A6.2
88		S4RM, 1,        // System resume from S4 State          : A6.3
89		S5ST, 1,        // System entry S4 State                : A6.4
90		S5RM, 1,        // System resume from S4 State          : A6.5
91		, 2,            // Reserve                              ; A6h.6-7
92		Offset(0xA7),
93		OSTT, 8,        // OS Throttling Temp                   ; A7h
94		OSST, 8,        // OS Shutdown Temp                     ; A8h
95		THLT, 8,        // Throttling Temp                      ; A9h
96		TCNL, 8,        // Tcontrol Temp                        ; AAh
97		MODE, 1,        // Mode(0=Local, 1=Remote)              ; ABh.0
98		, 2,            // Reserve                              ; ABh.1-2
99		INIT, 1,        // INITOK(0/1=Controlled by OS/EC)      ; ABh.3
100		FAN1, 1,        // FAN1 Active                          ; ABh.4
101		FAN2, 1,        // FAN2 Active                          ; ABh.5
102		FANT, 1,        // FAN Speed Time OK                    ; ABh.6
103		SKNM, 1,        // Skin Mode (0/1=Skin Address 90/92)   ; ABh.7
104		SDTM, 8,        // Shutdown Thermal Temperature         ; ACh
105		FSSN, 4,        // Fan Speed Step Number                ; ADh.0-3
106		                // 00 : Fan Off
107		                // 01 : Fan On Speed 1
108		                // 10 : Fan On Speed 2
109		                // 11 : Fan On Speed 3
110		FANU, 4,        // Machine Fan's number                 ; ADh.4-7
111		PCVL, 4,        // Throttling Level                     ; AEh.0-3
112		                // 0000 : Nothing
113		                // 0001 : Clock throttling 12.5%
114		                // 0010 : Clock throttling 25%
115		                // 0011 : Clock throttling 37.5%
116		                // 0100 : Clock throttling 50%
117		, 2,            // Reserved                             ; AEh.4-5
118		SWTO, 1,        // SW Throttling (1=Active)             ; AEh.6
119		TTHR, 1,        // HW (THRM#) Throttling (1=Active)     ; AEh.7
120		TTHM, 1,        // TS_THERMAL(1:Throttling for thermal) ; AFh.0
121		THTL, 1,        // THROTTLING(1:Ctrl H/W throttling act); AFh.1
122		, 2,            // Reserved                             ; AFh.2-3
123		NPST, 4,        // Number of P-State level              ; AFh.4-7
124		CTMP, 8,        // Current CPU Temperature              ; B0h
125		CTML, 8,        // CPU local temperature                ; B1h
126		SKTA, 8,        // Skin Temperature A                   ; B2h
127		SKTB, 8,        // GPU Temperature                      ; B3h
128		SKTC, 8,        // Skin Temperature C                   ; B4h
129		, 8,            // Reserved                             ; B5h
130		NTMP, 8,        // North Bridge Diode Temp              ; B6h
131		Offset(0xB7),
132		, 1,            // Reserved                             ; B7h.0
133		SKEY, 1,        // Security key event                   ; B7h.1
134		DIGM, 1,        // Digital Mode (1=Selected)            ; B7h.2
135		CDLE, 1,        // CD lock mode enable                  ; B7h.3
136		, 4,            // Reserved                             ; B7h.4-7
137		, 1,            // Reserved                             ; B8h.0
138		LIDF, 1,        // LID flag (1=Closed, 0=Opened)        ; B8h.1
139		PMEE, 1,        // PME event (0=off, 1=On)              ; B8h.2
140		PWBE, 1,        // Power button event (0=off, 1=On)     ; B8h.3
141		RNGE, 1,        // Ring in event (0=off, 1=On)          ; B8h.4
142		BTWE, 1,        // Bluetooth wake event (0=off, 1=On)   ; B8h.5
143		, 2,            // Reserved                             ; B8h.6-7
144		Offset(0xB9),
145		BRTS, 8,        // Brightness Value                     ; B9h
146		S35M, 1,        // S3.5 HotKey test mode                ; BAh.0
147		S35S, 1,        // S3.5 function status                 ; BAh.1
148		, 2,            // Reserved                             ; BAh.2-3
149		FFEN, 1,        // IRST support bit (1= Support)        ; BAh.4
150		FFST, 1,        // IRST status flag                     ; BAh.5
151		, 2,            // Reserved                             ; BAh.6-7
152		WLAT, 1,        // Wireless LAN (0=Inactive, 1=Active)  ; BBh.0
153		BTAT, 1,        // BlueTooth (0=Inactive, 1=Active)     ; BBh.1
154		WLEX, 1,        // Wireless LAN (0=Not Exist, 1=Exist)  ; BBh.2
155		BTEX, 1,        // BlueTooth (0=Not Exist, 1=Exist)     ; BBh.3
156		KLSW, 1,        // Kill Switch (0=Off, 1=On)            ; BBh.4
157		WLOK, 1,        // Wireless LAN Initialize OK           ; BBh.5
158		AT3G, 1,        // 3G (0=non-active, 1=active)          ; BBh.6
159		EX3G, 1,        // 3G (0=Not Exist, 1=Exist)            ; BBh.7
160		PJID, 8,        // Project ID                           ; BCh
161		CPUJ, 3,        // CPU Type                             ; BDh.0-2
162		                // 00, Tj85,
163		                // 01, Tj90,
164		                // 02, Tj100,
165		                // 03, Tj105,
166		                // 04 - 07, Reserved
167		CPNM, 3,        // CPU Core number                      ; BDh.3-5
168		                // 00, Single Core
169		                // 01, Dual Core
170		                // 02, Quad Core
171		                // 03 - 07, Reserved
172		GATY, 2,        // VGA Type                             ; BDh.6-7
173		                // 00, UMA
174		                // 01. Discrete
175		                // 02 - 03, Reserved
176		Offset(0xBE),
177		BOL0, 1,        // Batt0 (0=OffLine, 1=OnLine)          ; BEh.0
178		BOL1, 1,        // Batt1 (0=OffLine, 1=OnLine)          ; BEh.1
179		, 2,            // Reserved                             ; BEh.2-3
180		BCC0, 1,        // Batt0 be charging (1=Charging)       ; BEh.4
181		BCC1, 1,        // Batt1 be charging (1=Charging)       ; BEh.5
182		, 2,            // Reserved                             ; BEh.6-7
183		BPU0, 1,        // Batt0 (1=PowerUp)                    ; BFh.0
184		BPU1, 1,        // Batt1 (1=PowerUp)                    ; BFh.1
185		, 2,            // Reserved                             ; BFh.2-3
186		BOS0, 1,        // Batt0 (1=OnSMBUS)                    ; BFh.4
187		BOS1, 1,        // Batt1 (1=OnSMBUS)                    ; BFh.5
188		, 2,            // Reserved                             ; BFh.6-7
189		Offset(0xC0),
190		BTY0, 1,        // Batt Type (0=NiMh, 1=LiIon)          ; C0h.0
191		BAM0, 1,        // Battery mode (0=mA, 1=mW)            ; C0h.1
192		BAL0, 1,        // Low Battery                          ; C0h.2
193		, 1,            // Reserved                             ; C0h.3
194		BMF0, 3,        // Battery Manufacturer                 ; C0h.4-6
195		                // 001 : Sanyo
196		                // 010 : Sony
197		                // 100 : Pansonic
198		                // 101 : CPT
199		, 1,            // Reserved                             ; C0h.7
200		BST0, 8,        // Battery Status                       ; C1h
201		                // Bit0 : Discharging
202		                // Bit1 : Charging
203		                // Bit2 : Discharg and Critical Low
204		                // Bit3-7 : Reserved
205		BRC0, 16,       // Batt Remaining Capacity              ; C2h, C3h
206		BSN0, 16,       // Batt Serial Number                   ; C4h, C5h
207		BPV0, 16,       // Batt Present Voltage                 ; C6h, C7h
208		BDV0, 16,       // Batt Design Voltage                  ; C8h, C9h
209		BDC0, 16,       // Batt Design Capacity                 ; CAh, CBh
210		BFC0, 16,       // Batt Last Full Charge Capacity       ; CCh, CDh
211		GAU0, 8,        // Batt Gasgauge                        ; CEh
212		CYC0, 8,        // Batt Cycle Counter                   ; CFh
213		BPC0, 16,       // Batt Current                         ; D0h, D1h
214		BAC0, 16,       // Batt Average Current                 ; D2h, D3h
215		BTW0, 8,        // Batt Comsuption                      ; D4h
216		BVL0, 8,        // Batt Battery Volt                    ; D5h
217		BTM0, 8,        // Batt Battery Temp                    ; D6h
218		BAT0, 8,        // Batt Average Temp (Degree C)         ; D7h
219		BCG0, 16,       // Batt charge current                  ; D8h, D9h
220		BCT0, 8,        // Batt Current Temp Semple counter     ; DAh
221		BCI0, 8,        // BATT CMD Index for read BATT(SMB)    ; DBh
222		BCM0, 8,        // Count up to Communicate BATT         ; DCh
223		BOT0, 8,        // Count up if BATT over Temp           ; DDh
224		BSSB, 16,       // BATT Battery Status SMB              ; DEh, DFh
225		BOV0, 8,        // BATT Over Voltage Count              ; E0h
226		BCF0, 8,        // BATT Communication Fail Counter      ; E1h
227		BAD0, 8,        // Battery Voltage of ADC               ; E2h
228		BCV1, 16,       // Cell Voltage 1 (mV)                  ; E3h, E4h
229		BCV2, 16,       // Cell Voltage 2 (mV)                  ; E5h, E6h
230		BCV3, 16,       // Cell Voltage 3 (mV)                  ; E7h, E8h
231		BCV4, 16,       // Cell Voltage 4 (mV)                  ; E9h, EAh
232		Offset(0xF4),
233		BMD0, 16,       // Manufacture Date                     ; F4h, F5h
234		                // Batt Day	                            ; BIT[4:0] (Day)
235		                // Batt Month                           ; BIT[9:5] (Month)
236		                // Batt Year                            ; BIT[15:10] (Year)
237		BACV, 16,       // Charging Voltage                     ; F6h, F7h
238		BDN0, 8,        // Battery Cell Number                  ; F8h
239		, 8             // Last byte for Reserved.
240	}
241
242	Method (_CRS, 0, NotSerialized)
243	{
244		Name (ECMD, ResourceTemplate()
245		{
246			IO (Decode16, 0x62, 0x62, 0, 1)
247			IO (Decode16, 0x66, 0x66, 0, 1)
248		})
249		Return (ECMD)
250	}
251
252	Method (_REG, 2, NotSerialized)
253	{
254		// Initialize AC power state
255		\PWRS = ADPT
256
257		// Force a read of CPU temperature
258		Local0 = CTML
259		/* So that we don't get a warning that Local0 is unused.  */
260		Local0++
261	}
262
263
264/*
265 * EC Query Responses
266 *
267 * DTS temperature update    10h
268 * Decrease brightness event 11h
269 * Increase brightness event 12h
270 * Cover lid open            15h
271 * Cover lid close           16h
272 * External device plugged   17h
273 * External device removed   18h
274 * Bluetooth wake up event   19h
275 * Scr expand event          1Bh
276 * Display toggle            1Ch
277 * CPU  fast/slow event      1Dh
278 * Battery in critical low   22h
279 * Battery in low state      23h
280 * Battery pack plug in      25h
281 * Docking in                2Ah
282 * Undock                    2Bh
283 * Power button pressed      32h
284 * AC plug in                37h
285 * AC removed                38h
286 * Modem ring in             3Ah
287 * PME signal active         3Eh
288 * Hotkey make Function      45h
289 * Hotkey break Function     46h
290 */
291
292	/* Decrease brightness hotkey */
293	Method (_Q11, 0, NotSerialized)
294	{
295		\_SB.MB.BRTD()
296	}
297
298	/* Increase brightness hotkey */
299	Method (_Q12, 0, NotSerialized)
300	{
301		\_SB.MB.BRTU()
302	}
303
304	/* Lid opened */
305	Method (_Q15, 0, NotSerialized)
306	{
307		\_SB.MB.LIDO()
308	}
309
310	/* Lid closed */
311	Method (_Q16, 0, NotSerialized)
312	{
313		\_SB.MB.LIDC()
314	}
315
316	/* Switch display hotkey */
317	Method (_Q1C, 0, NotSerialized)
318	{
319		\_SB.MB.DSPS()
320	}
321
322	// AC Power Connected
323	Method (_Q37, 0, NotSerialized)
324	{
325		\PWRS = 1
326		Notify (AC, 0x80)
327		Notify (BATX, 0x80)
328		// TODO ADD CPU power profile
329		\PNOT ()
330	}
331
332	// AC Power Removed
333	Method (_Q38, 0, NotSerialized)
334	{
335		\PWRS = 0
336		Notify (AC, 0x80)
337		Notify (BATX, 0x80)
338		// TODO ADD CPU power profile
339		\PNOT ()
340	}
341
342	/* Wireless toggle hotkey */
343	Method (_Q40, 0, NotSerialized)
344	{
345		\_SB.MB.WLTG()
346	}
347
348	// Battery at critical low state
349	Method (_Q22, 0, NotSerialized)
350	{
351		Notify (BATX, 0x80)
352	}
353
354	// Battery insert
355	Method(_Q25, 0, NotSerialized)
356	{
357		Notify(BATX, 0x81)
358		Notify(BATX, 0x80)
359	}
360
361	// Commuation Device Disable/Enable Event
362	Method(_Q60, 0, NotSerialized)
363	{
364		IF(WLEX) //if Wlan exist
365		{
366			//TODO LANE = WLAT
367		}
368	}
369
370	#include "ac.asl"
371	#include "battery.asl"
372}
373