alder_lake_bios/Intel/AlderLake/AlderLakePlatSamplePkg/EC/Asl/Atm.asi

995 lines
36 KiB
Plaintext

//
// FILENAME.
// Atm.asi - Describes Advanced Thermal Management function.
//
//
//
//
// FUNCTIONAL DESCRIPTION.
// This file describes Advanced Thermal Management function related code.
// This file also has Intelligent Cooling support function code (DYTC) and
// ITS (Intelligent Thermal Solution) vertual device node definition.
//
//
// MODIFICATION HISTORY.
// H. Uchida 10/04/12. #1.000, initial version.
// N. Araki 10/10/05. #1.000, preparation for scramble mode and Turbo disable.
// N. Araki 10/11/26. #1.000, enable scramble mode
// N. Araki 10/12/14. #1.000, enable extended tau.
// N. Araki 11/01/04. #1.000, add not-turbo CPU support.
// N. Araki 11/01/19. #1.000, add an interface for extended tau.
// H. Uchida 11/08/25. #1.000, removed interface for "reduce fan noise" feature.
// N. Araki 11/12/13. #1.000, initial code for DPTF cTDP support.
// N. Araki 12/01/27. #1.000, added cTDP down support.
// N. Araki 12/01/27. #1.000, Updated cTDP down support.
// N. Araki 12/03/02. #1.000, Support IVB ULV CPU.
// N. Araki 13/03/18. #1.000, Support ULV CPU.
// N. Araki 13/08/05. #1.000, Update P-State limit method for CPPC.
// N. Araki 13/10/03. #1.000, Change PPM flag usage.
// N. Araki 13/10/22. #1.000, Remove unused code.
// N. Araki 13/10/31. #1.000, Remove unused code.
// N. Araki 13/11/14. #1.000, Change variable name.
// M. Itoh 14/02/05. #1.000, Added DYTC support //@DYTC001
// N. Ishida 15/03/24. #1.000, Added Intelligent Cooling NVIDIA support in DYTC.
// N. Ishida 15/09/17. #1.000, Added W/A to supress power consumption in DYTC.
// N. Ishida 15/09/24. #1.000, Added W/A to supress Notify() to NVIDIA driver in DYTC until the driver becomes ready.
// M. Itoh 15/11/16. #1.000, Update PL1 value of STD&DMC for PL1 15W->25.
// M. Itoh 15/11/16. #1.000, PT1S code cleanup.
// M. Itoh 15/11/16. #1.000, Use _PR.CLVL to check supporting cTDP levels instead of _SB.PCI0.CTNL.
// Y. Katayama 16/04/07. #1.000, Replace OPTION_LENOVO_SUPPORT_IVB_ULV with OPTION_LENOVO_SUPPORT_CTDP.
// M. Itoh 16/12/21. #1.000, Add DCPL for DC mode PL1 handling.
// Y. Katayama 17/01/27. #1.000, Replace the rest of OPTION_LENOVO_SUPPORT_IVB_ULV with OPTION_LENOVO_SUPPORT_CTDP.
// M. Itoh 17/08/01. #1.000, Add ITSD (Intelligent Thermal Solution) vertual device.
// Ru.Xu 19/01/31 #1.000, Added DYTC support for LNB on Intel Platform
// Ru Xu 20/05/06 #1.000, DYTC (Dynamic Thermal Control) Method Rev5 for Intelligent Cooling
// NOTICE.
// Lenovo Confidential
// Microcode Source Materials
// COPYRIGHT LENOVO 2010-2011 All RIGHTS RESERVED
//
////////////////////////////////////////////////////////////////////////////////
// //
// //
// ATM - Advanced Thermal Management functions //
// //
// //
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
// //
// //
// DYTC - External Method (IdeaPad Intelligent Thermal control) //
// //
// //
////////////////////////////////////////////////////////////////////////////////
#include <Lfc.h>
/////////////////// Input Parameter Definition ///////////////////
//////// For DYTC_CMD_QUERY ////////
// DYTC Supprot
#define DYTC_SPT_SHFT 0x00000008 // Bit8
#define DYTC_SPT_DIS 0x00000000
#define DYTC_SPT_ENA 0x00000001
// DYTC Revision
#define DYTC_SUBREV_SHFT 0x00000010 // Bit16-27
#define DYTC_REV_SHFT 0x0000001C // Bit28-31
#define DYTC_REV_3 0x00000003
#define DYTC_REV_4 0x00000004
#define DYTC_REV_5 0x00000005
#define DYTC_SUBREV_0 0x00000000
#define DYTC_SUBREV_1 0x00000001
#define DYTC_SUBREV_2 0x00000002
//////// For DYTC_CMD_QUERY_CNT ////////
// Thermal Control Version
#define DYTC_TCV_SHFT 0x00000010 // Bit16-31
#define DYTC_TCV_CLAMSHELL 0x00001001 // version1 & Clamshell
#define DYTC_TCV_TABLET 0x00002001 // version1 & Tablet
#define OPTION_DYTC_CLAMSHELL 1
// Command Definition
#define DYTC_CMD_MASK 0x000001FF // Bit0-8
#define DYTC_CMD_QUERY 0x00000000
#define DYTC_CMD_SET 0x00000001
#define DYTC_CMD_GET 0x00000002
#define DYTC_CMD_FUNC_CAP 0x00000003
#define DYTC_CMD_MODE_MYH_CAP 0x00000004
#define DYTC_CMD_MODE_MMC_CAP 0x00000006
#define DYTC_CMD_MODE_MMC_GET 0x00000007
#define DYTC_CMD_MODE_AAA_GET 0x00000008
#define DYTC_CMD_MODE_NIT_GET 0x00000009
#define DYTC_CMD_FUNC_CAP_EXT 0x0000000A
#define DYTC_CMD_QUERY_CNT 0x00000100
#define DYTC_CMD_RESET 0x000001FF
//////// For DYTC_CMD_SET/DYTC_CMD_GET ////////
// IC Function
#define DYTC_ICFUNC_SHFT 0x0000000C // Bit12-15
#define DYTC_ICFUNC_MASK 0x0000000F
// IC Mode
#define DYTC_ICMODE_SHFT 0x00000010 // Bit16-19
#define DYTC_ICMODE_MASK 0x0000000F
// Valid Flag
#define DYTC_VLDFLG_SHFT 0x00000014 // Bit20
#define DYTC_VLDFLG_MASK 0x00000001
// Current Function/Mode
#define DYTC_CRNTFUNC_SHFT 0x00000008 // Bit8
#define DYTC_CRNTMODE_SHFT 0x0000000C // Bit12
// Current Function/Mode
#define DYTC_FLAGCAP_SHFT 0x00000010 // Bit16
//////// For DYTC_CMD_FUNC_CAP ////////
// Function/Mode Capability
#define DYTC_FCAP_SHFT 0x00000010 // Bit16
#define DYTC_MCAP_SHFT 0x00000010 // Bit16
//////// For DYTC_CMD_MODE_NIT_GET ////////
#define DYTC_MNIT_SHFT 0x00000010 // Bit16
//LCFCTODO:Brightness will change to 60nit when user choose BSM mode,due to different panels, this value need tune by BIOS
#define DYTC_NITS_60 0x00000043 // 60 nits , 0x43(67%) means Windows display brightness value
//[-start-210916-FLINT00020-add]//
//[-start-210924-TAMT000013-modify]//
//[-start-211221-QINGLIN0131-modify]//
#if defined(C970_SUPPORT) || defined(S77013_SUPPORT) || defined(S77014_SUPPORT) || defined(C770_SUPPORT) || defined(S370_SUPPORT) || defined(S77014IAH_SUPPORT)
//[-end-211221-QINGLIN0131-modify]//
//[-end-210924-TAMT000013-modify]//
Name(NITS, 0x43)
#endif
//[-end-210916-FLINT00020-add]//
//////// For DYTC_CMD_FUNC_CAP_EXT////////
#define DYTC_CAPE_SHFT 0x00000010 // Bit16
#define DYTC_CRETOR_APP_SUPPORT 0x1 // 1 mean Creator App supported
/////////////////// Output Parameter Definition //////////////////
// Status Definition
#define DYTC_STS_SUCCESS 0x00000001
#define DYTC_STS_FAIL 0x00000000
// Error Code Definition
#define DYTC_ERR_SHFT 0x00000001 // Bit1-3
#define DYTC_ERR_INVALID_FUNC 0x00000001 // Unsupported or Undefined IC Function
#define DYTC_ERR_INVALID_CMD 0x00000002
#define DYTC_ERR_NOT_READY 0x00000003
#define DYTC_ERR_UNSUPPORTED 0x00000004
#define DYTC_ERR_INVALID_MODE 0x00000005
#define DYTC_ERR_RSV2 0x00000006
#define DYTC_ERR_RSV3 0x00000007
#if ( OPTION_DYTC_ENABLE )
Method( DYTC , 1) {
Store( Arg0, Local0 ) // Save Input Parameter
Store( Local0, DYTP ) // DYTC commond parameter,for debug
Store( 0, Local1 ) // Initialize Output Parameter
//[-start-211125-JEPLIUT120-add]// Update special variable when DPTC driver update. (optional)
//[-start-211214-JEPLIUT207-add]//
#if defined(S570_SUPPORT)
Store(And (ADP2,0x1) , \ODVL) //ODV21 45W ADP
Store (\CPTD, \ODVM) //ODV22
#endif
//[-start-211214-JEPLIUT207-add]//
//[-end-211125-JEPLIUT120-add]//
// DYTC Command
Switch ( ToInteger( And( Local0, DYTC_CMD_MASK ) ) ) {
Case ( DYTC_CMD_QUERY ) {
#if ( OPTION_DYTC_ENABLE )
Store( ShiftLeft( DYTC_SPT_ENA, DYTC_SPT_SHFT ), Local1 )
#else // ( OPTION_DYTC_ENABLE )
Store( ShiftLeft( DYTC_SPT_DIS, DYTC_SPT_SHFT ), Local1 )
#endif // ( OPTION_DYTC_ENABLE )
Or( Local1, ShiftLeft( DYTC_REV_5, DYTC_REV_SHFT ), Local1 )
Or( Local1, ShiftLeft( DYTC_SUBREV_0, DYTC_SUBREV_SHFT ), Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_SET ) {
And( ShiftRight( Local0, DYTC_ICFUNC_SHFT ), DYTC_ICFUNC_MASK , Local2 ) // IC Function
And( ShiftRight( Local0, DYTC_ICMODE_SHFT ), DYTC_ICMODE_MASK , Local3 ) // IC Mode
And( ShiftRight( Local0, DYTC_VLDFLG_SHFT ), DYTC_VLDFLG_MASK , Local4 ) // Valid Flag
// Requested Intelligent Cooling Function
Switch ( Local2 ) {
#if ( OPTION_DYTC_SUPPORT_ICFUNC_FBC )
Case ( DYTC_ICFUNC_FBC ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// Off Request
If( LEqual( Local4, 0 ) ) {
Store( 0, \VFBC )
} Else {
Store( 1, \VFBC )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_FBC )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_MYH )
Case ( DYTC_ICFUNC_MYH ) {
Switch ( Local3 ) {
#if ( OPTION_DYTC_SUPPORT_ICMODE_TBL )
Case ( DYTC_ICMODE_TBL ) {
If( LNotEqual( Local4, 1)) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICMODE_TBL )
#if ( OPTION_DYTC_SUPPORT_ICMODE_TNT )
Case ( DYTC_ICMODE_TNT ) {
If( LNotEqual( Local4, 1)) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICMODE_TNT )
#if ( OPTION_DYTC_SUPPORT_ICMODE_LFT )
Case ( DYTC_ICMODE_LFT ) {
If( LNotEqual( Local4, 1)) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICMODE_LFT )
Case ( DYTC_ICMODE_MASK ) {
If( LNotEqual( Local4, 0)) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
Default { // Unsupported or Undefined IC Function
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
// Off Request
If( LEqual( Local4, 0 ) ) {
Store( 0, \VMYH )
Store( 0, \SMYH )
} Else {
Store( 1, \VMYH )
Store( Local3, \SMYH )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_MYH )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_STP )
Case ( DYTC_ICFUNC_STP ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// Off Request
If( LEqual( Local4, 0 ) ) {
Store( 0, \VSTP )
} Else {
Store( 1, \VSTP )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_STP )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_APM )
Case ( DYTC_ICFUNC_APM ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// Off Request
If( LEqual( Local4, 0 ) ) {
Store( 0, \VAPM )
} Else {
Store( 1, \VAPM )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_APM )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_AQM )
Case ( DYTC_ICFUNC_AQM ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// Off Request
If( LEqual( Local4, 0 ) ) {
Store( 0, \VAQM )
} Else {
Store( 1, \VAQM )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_AQM )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_IEPM )
Case ( DYTC_ICFUNC_IEPM ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// Off Request
If( LEqual( Local4, 0 ) ) {
Store( 0, \VIEP )
} Else {
Store( 1, \VIEP )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_IEPM )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_IBSM )
Case ( DYTC_ICFUNC_IBSM ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// Off Request
If( LEqual( Local4, 0 ) ) {
Store( 0, \VIBS )
} Else {
Store( 1, \VIBS )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_IBSM )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_AAA )
Case ( DYTC_ICFUNC_AAA ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// Off Request ?
If( LEqual( Local4, 0 ) ) {
Store( 0, \VAAA )
} Else {
Store( 1, \VAAA )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_AAA )
#if ( OPTION_DYTC_SUPPORT_ICFUNC_MMC )
Case ( DYTC_ICFUNC_MMC ) {
Switch ( Local3 ) {
#if ( OPTION_DYTC_SUPPORT_ICMODE_EPM )
Case ( DYTC_ICMODE_EPM ) {
If( LNotEqual( Local4, 1)) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICMODE_PFM )
#if ( OPTION_DYTC_SUPPORT_ICMODE_BSM )
Case ( DYTC_ICMODE_BSM ) {
If( LNotEqual( Local4, 1)) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICMODE_BSM )
Case ( DYTC_ICMODE_MASK ) {
If( LNotEqual( Local4, 0)) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
Default { // Unsupported or Undefined IC Mode
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
// Off Request
If( LEqual( Local4, 0 ) ) {
If( LEqual( Local3, DYTC_ICMODE_MASK ) ) {
Store( 0, \VMMC )
Store( 0xF, \SMMC )
}
Else
{
Store( 0, \VMMC )
Store( 0, \SMMC )
}
} Else {
Store( 1, \VMMC )
Store( Local3, \SMMC )
}
}
#endif // ( OPTION_DYTC_SUPPORT_ICFUNC_MMC )
Case ( DYTC_ICFUNC_STD ) {
// Expect IC mode = No mode
If( LNotEqual( Local3, DYTC_ICMODE_MASK )) {
// Fail
ShiftLeft( DYTC_ERR_INVALID_MODE, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
// No action for initializing DYTC
}
Default { // Unsupported or Undefined IC Function
// Fail
ShiftLeft( DYTC_ERR_INVALID_FUNC, DYTC_ERR_SHFT, Local1 )
Return ( Local1 )
}
}
////////////// Start : Need to customize by Product
//LCFCTODO:If you eanble DPTF and add ODV0 ~ ODVK variable in your porject, you can remove "//" before ODV0 ~ ODVK variable
//Standard Mode (Default Mode)
Store( DYTC_ICFUNC_STD, \CICF)
Store(1,\ODV0) //STD always enable
//[-start-210902-FLINT00017-add]//
Store(0,\ODV8)
Store(0,\ODV9)
//[-end-210902-FLINT00017-add]//
Store(0,EC0_SCOPE.EC0.SPMO)
Store(0,EC0_SCOPE.EC0.FCMO)
//[-start-210701-KEBIN00030-modify]//
//AQM
If(LEqual (\VAQM, 1)) {
Store( DYTC_ICFUNC_AQM, \CICF)
Store(1,\ODVH) //ODV17
Store(4,EC0_SCOPE.EC0.FCMO)
}Else{
Store(0,\ODVH)
}
//APM
If(LEqual (\VAPM, 1)) {
Store( DYTC_ICFUNC_APM, \CICF)
Store(1,\ODVG) //ODV16
Store(3,EC0_SCOPE.EC0.FCMO)
}Else{
Store(0,\ODVG)
}
#if ( OPTION_DYTC_SUPPORT_ICFUNC_MYH )
//MYH
If(LEqual (\VMYH, 1)) {
Store( DYTC_ICFUNC_MYH, \CICF)
Store(\SMYH, Local6)
Switch(Local6) {
Case(DYTC_ICMODE_TBL) {//Tablet
Store(1,\ODV1)
Store(0,\ODV2)
Store(0,\ODV3)
}
Case(DYTC_ICMODE_TNT) {//Tent
Store(0,\ODV1)
Store(1,\ODV2)
Store(0,\ODV3)
}
Case(DYTC_ICMODE_LFT) {//Flat
Store(0,\ODV1)
Store(0,\ODV2)
Store(1,\ODV3)
}
Default {
Store(0,\ODV1)
Store(0,\ODV2)
Store(0,\ODV3)
}
}
}Else{ //Exit MYH Mode
Store(0,\ODV1)
Store(0,\ODV2)
Store(0,\ODV3)
}
#endif
//[-start-210809-QINGLIN0011-add]//
#if ( OPTION_DYTC_SUPPORT_ICFUNC_IBSM )
//[-end-210809-QINGLIN0011-add]//
//IBSM
If(LEqual (\VIBS, 1)) {
Store( DYTC_ICFUNC_IBSM, \CICF)
Store(1,\ODVK) //ODV20
Store(7,EC0_SCOPE.EC0.FCMO)
}Else{
Store(0,\ODVK)
}
//[-start-210809-QINGLIN0011-add]//
#endif
//[-end-210809-QINGLIN0011-add]//
//[-start-210809-QINGLIN0011-add]//
#if ( OPTION_DYTC_SUPPORT_ICFUNC_IEPM )
//[-end-210809-QINGLIN0011-add]//
//IEPM
If(LEqual (\VIEP, 1)) {
Store( DYTC_ICFUNC_IEPM, \CICF)
Store(1,\ODVJ) //ODV19
Store(6,EC0_SCOPE.EC0.FCMO)
}Else{
Store(0,\ODVJ)
}
//[-start-210809-QINGLIN0011-add]//
#endif
//[-end-210809-QINGLIN0011-add]//
//MMC
If (LEqual (\VMMC, 1)) {
Store( DYTC_ICFUNC_MMC, \CICF)
Store(\SMMC, Local6)
Switch(Local6) {
Case(DYTC_ICMODE_EPM) { //Extreme Performance Mode
Store(1,\ODV8)
Store(0,\ODV9)
Store(1,EC0_SCOPE.EC0.SPMO)
Store(1,EC0_SCOPE.EC0.FCMO)
}
Case(DYTC_ICMODE_BSM) { //Battery Saving Mode
Store(0,\ODV8)
Store(1,\ODV9)
Store(2,EC0_SCOPE.EC0.SPMO)
Store(2,EC0_SCOPE.EC0.FCMO)
}
Default { //Invalid Mode
Store(0,\ODV8)
Store(0,\ODV9)
Store(0,EC0_SCOPE.EC0.SPMO)
Store(0,EC0_SCOPE.EC0.FCMO)
}
}
}Else{ //Exit MMC Mode
//[-start-210902-FLINT00015-remove]//
// Store(0,\ODV8)
// Store(0,\ODV9)
// Store(0,EC0_SCOPE.EC0.SPMO)
// Store(0,EC0_SCOPE.EC0.FCMO)
//[-end-210902-FLINT00015-remove]//
}
//[-end-210701-KEBIN00030-modify]//
#if ( OPTION_DYTC_SUPPORT_ICFUNC_STP )
//STP
If(LEqual (\VSTP, 1)) {
Store( DYTC_ICFUNC_STP, \CICF)
Store(1,\ODV4)
}Else{
Store(0,\ODV4)
}
#endif
Sleep(5)
//Notify DPTF driver OEM variable value has changed
Notify(\_SB.IETM, 0x88)
//[-start-210924-GEORGE0008-add]//
//[-start-210930-QINGLIN0089-modify]//
#if defined(S77014_SUPPORT) || defined(S570_SUPPORT) || defined(S77014IAH_SUPPORT)
//[-end-210930-QINGLIN0089-modify]//
Notify(\_SB.PC00.PEG2.PEGP, 0xC0)//notify driver to change GPS
#endif
//[-end-210924-GEORGE0008-add]//
//[-start-211129-GEORGE0025-modify]//
//[-start-211122-GEORGE0023-add]//
#if defined(S77014_SUPPORT) || defined(S77014IAH_SUPPORT)
If (CondRefOf (\_SB.NPCF))
{
Sleep(50)
Notify(\_SB.NPCF, 0xC0) // Notify GPU change TGP
}
#endif
//[-end-211122-GEORGE0023-add]//
//[-end-211129-GEORGE0025-modify]//
////////////// End : Need to customize by Product
// Organize Valid Flag Status
Store( \VSTD, Local5 )
Or( ShiftLeft( \VFBC, DYTC_ICFUNC_FBC ), Local5, Local5 )
Or( ShiftLeft( \VMYH, DYTC_ICFUNC_MYH ), Local5, Local5 )
Or( ShiftLeft( \VSTP, DYTC_ICFUNC_STP ), Local5, Local5 )
Or( ShiftLeft( \VAPM, DYTC_ICFUNC_APM ), Local5, Local5 )
Or( ShiftLeft( \VAQM, DYTC_ICFUNC_AQM ), Local5, Local5 )
Or( ShiftLeft( \VIEP, DYTC_ICFUNC_IEPM ), Local5, Local5 )
Or( ShiftLeft( \VIBS, DYTC_ICFUNC_IBSM ), Local5, Local5 )
Or( ShiftLeft( \VAAA, DYTC_ICFUNC_AAA ), Local5, Local5 )
Or( ShiftLeft( \VMMC, DYTC_ICFUNC_MMC ), Local5, Local5 )
Store( ShiftLeft( \CICF, DYTC_CRNTFUNC_SHFT ), Local1 )
If( LEqual( \CICF, DYTC_ICFUNC_MYH ) ){
Store( \SMYH, \CICM ) //
} ElseIf( LEqual( \CICF, DYTC_ICFUNC_MMC ) ){
Store( \SMMC, \CICM ) //
} Else {
Store( DYTC_ICMODE_MASK, \CICM ) // Save Current IC Mode as NO Mode
}
Or( ShiftLeft( \CICM, DYTC_CRNTMODE_SHFT ), Local1, Local1 )
Or( ShiftLeft( Local5, DYTC_FLAGCAP_SHFT ), Local1, Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_GET ) {
// Organize Valid Flag Status
Store( \VSTD, Local5 )
Or( ShiftLeft( \VFBC, DYTC_ICFUNC_FBC ), Local5, Local5 )
Or( ShiftLeft( \VMYH, DYTC_ICFUNC_MYH ), Local5, Local5 )
Or( ShiftLeft( \VSTP, DYTC_ICFUNC_STP ), Local5, Local5 )
Or( ShiftLeft( \VAPM, DYTC_ICFUNC_APM ), Local5, Local5 )
Or( ShiftLeft( \VAQM, DYTC_ICFUNC_AQM ), Local5, Local5 )
Or( ShiftLeft( \VIEP, DYTC_ICFUNC_IEPM ), Local5, Local5 )
Or( ShiftLeft( \VIBS, DYTC_ICFUNC_IBSM ), Local5, Local5 )
Or( ShiftLeft( \VAAA, DYTC_ICFUNC_AAA ), Local5, Local5 )
Or( ShiftLeft( \VMMC, DYTC_ICFUNC_MMC ), Local5, Local5 )
Store( ShiftLeft( \CICF, DYTC_CRNTFUNC_SHFT ), Local1 )
If( LEqual( \CICF, DYTC_ICFUNC_MYH ) ){
Store( \SMYH, \CICM ) //
} ElseIf( LEqual( \CICF, DYTC_ICFUNC_MMC ) ){
Store( \SMMC, \CICM ) //
} Else {
Store( DYTC_ICMODE_MASK, \CICM ) // Save Current IC Mode as NO Mode
}
Or( ShiftLeft( \CICM, DYTC_CRNTMODE_SHFT ), Local1, Local1 )
Or( ShiftLeft( Local5, DYTC_FLAGCAP_SHFT ), Local1, Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_FUNC_CAP ) {
Store( ShiftLeft( FCAP, DYTC_FCAP_SHFT ), Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_MODE_MYH_CAP ) {
Store( ShiftLeft( MYHC, DYTC_MCAP_SHFT ), Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_MODE_MMC_CAP ) {
And( ShiftRight( Local0, 9 ), 0xF , Local2 ) // Valid Flag
If( LNotEqual( Local2, 1 )) {
Store( ShiftLeft( MMCC, DYTC_MCAP_SHFT ), Local1 )
} Else {
Store( ShiftLeft( CONFIG_DYTC_IC_MMC_DEFAULT, 8 ), Local1 )
}
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_MODE_MMC_GET ) {
Store( ShiftLeft( SMMC, DYTC_MCAP_SHFT ), Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
// Case ( DYTC_CMD_MODE_AAA_GET ) {
// Store( ShiftLeft( SAAA, DYTC_MCAP_SHFT ), Local1 )
// // Success
// Or( Local1, DYTC_STS_SUCCESS, Local1 )
// }
Case ( DYTC_CMD_QUERY_CNT ) {
#if ( OPTION_DYTC_CLAMSHELL )
Store( ShiftLeft( DYTC_TCV_CLAMSHELL, DYTC_TCV_SHFT ), Local1 )
#else // ( OPTION_DYTC_CLAMSHELL )
Store( ShiftLeft( DYTC_TCV_TABLET, DYTC_TCV_SHFT ), Local1 )
#endif // ( OPTION_DYTC_CLAMSHELL )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_MODE_NIT_GET ) {
//[-start-210916-FLINT00020-modify]//
//[-start-210924-TAMT000013-modify]//
//[-start-211117-TANBAO00016-modify]//
//[-start-211208-GEORGE0028-modify]//
//[-start-211221-QINGLIN0131-modify]//
#if defined(C970_SUPPORT) || defined(S77013_SUPPORT) || defined(S77014_SUPPORT) || defined(C770_SUPPORT) || defined(S370_SUPPORT) || defined(S77014IAH_SUPPORT)
//[-end-211221-QINGLIN0131-modify]//
//[-end-210924-TAMT000013-modify]//
If(LAnd(LEqual (MFID, 0x6F0E),LEqual (PAID, 0x1413))) {
store(0x3B,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE430),LEqual (PAID, 0x06ED))) {
store(0x3A,NITS)
} ElseIf(LAnd(LEqual (MFID, 0x834C),LEqual (PAID, 0x4152))) {
store(0x30,NITS)
} ElseIf(LAnd(LEqual (MFID, 0x834C),LEqual (PAID, 0x415A))) {
store(0x2F,NITS)
} ElseIf(LAnd(LEqual (MFID, 0x6F0E),LEqual (PAID, 0x1617))) {
store(0x3B,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x0AA7))) {
store(0x3B,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0x6A9F))) {
store(0x3B,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xCF26),LEqual (PAID, 0x8C45))) { //14 IVO
store(0x3D,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x099F))) {
store(0x3F,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0xA195))) { //14 AUO
store(0x3D,NITS)
} ElseIf(LAnd(LEqual (MFID, 0x6F0E),LEqual (PAID, 0x140C))) {
store(0x3B,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0xC391))) {
store(0x37,NITS)
//[-start-211221-QINGLIN0131-add]//
} ElseIf (LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x09D3))) {
Store(0x3C,NITS)
//[-end-211221-QINGLIN0131-add]//
//[-start-220110-GEORGE0042-modify]//
//[-start-220104-GEORGE0041-add]//
//[-start-220222-dennis0014-add]//
}ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0x683D))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x098E))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x08C2))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x0AB0))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0xE48D))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xCF26),LEqual (PAID, 0x061F))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0x408D))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x08D7))) {
Store(0x3C,NITS)
} ElseIf(LAnd(LEqual (MFID, 0x6F0E),LEqual (PAID, 0x1311))) {
Store(0x3A,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x0ACB))) {
Store(0x3C,NITS)
//[-end-220222-dennis0014-add]//
//[-end-220104-GEORGE0041-add]//
//[-end-220110-GEORGE0042-modify]//
//[-start-220302-YUNLEI0162-modify]//
} ElseIf(LAnd(LEqual (MFID, 0x834C),LEqual (PAID, 0x417A))) { //14 OLED
store(0x30,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x0B1B))) { //14 BOE
store(0x3F,NITS)
} ElseIf(LAnd(LEqual (MFID, 0x6F0E),LEqual (PAID, 0x1619))) { //16CSOT
store(0x3B,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xE509),LEqual (PAID, 0x0ADF))) { //16BOE
store(0x3B,NITS)
} ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0xF09F))) { //16AUO
store(0x3B,NITS)
//[-start-220406-GEORGE0059-add]//
} ElseIf(LAnd(LEqual (MFID, 0xAF06),LEqual (PAID, 0x2698))) { //14 AUO
store(0x3F,NITS)
//[-end-220406-GEORGE0059-add]//
}Else {
store(0x43,NITS)
}
//[-end-220302-YUNLEI0162-modify]//
Store( ShiftLeft(NITS, DYTC_MNIT_SHFT ), Local1 )
#else
Store( ShiftLeft(DYTC_NITS_60, DYTC_MNIT_SHFT ), Local1 )
#endif
//[-end-211208-GEORGE0028-modify]//
//[-end-211117-TANBAO00016-modify]//
//[-end-210916-FLINT00020-modify]//
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_FUNC_CAP_EXT ) {
Store( ShiftLeft(DYTC_CRETOR_APP_SUPPORT, DYTC_CAPE_SHFT ), Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Case ( DYTC_CMD_RESET ) {
////////////// Start : Need to customize by Product
//LCFCTODO:If you eanble DPTF and add ODV0 ~ ODVK variable in your porject, you can remove "//" before ODV0 ~ ODVK variable
Store(0,EC0_SCOPE.EC0.SPMO) //Intelligent/STD Mode
Store(0,EC0_SCOPE.EC0.FCMO) //Intelligent/STD Mode
Store(1,\ODV0)
Store(0,\ODV1)
Store(0,\ODV2)
Store(0,\ODV3)
Store(0,\ODV4)
//[-start-210701-KEBIN00030-modify]//
Store(0,\ODV5)
Store(0,\ODV6)
Store(0,\ODV7)
Store(0,\ODV8)
Store(0,\ODV9)
Store(0,\ODVA)
Store(0,\ODVB)
Store(0,\ODVC)
Store(0,\ODVD)
Store(0,\ODVE)
Store(0,\ODVF)
Store(0,\ODVG)
Store(0,\ODVH)
Store(0,\ODVI)
Store(0,\ODVJ)
Store(0,\ODVK)
//[-end-210701-KEBIN00030-modify]//
//[-start-211125-JEPLIUT120-add]//
#if defined(S570_SUPPORT)
Store(And (ADP2,0x1) , \ODVL) //ODV21 45W ADP
#endif
//[-end-211125-JEPLIUT120-add]//
Sleep(5)
Notify(\_SB.IETM, 0x88) //Notify DPTF driver OEM variable value has changed
////////////// End : Need to customize by Product
Store( 0, \VFBC )
Store( 0, \VMYH )
Store( 0, \VSTP )
Store( 0, \VAPM )
Store( 0, \VAQM )
Store( 0, \VIEP )
Store( 0, \VIBS )
Store( 0, \VAAA )
Store( 0, \VMMC )
Store( 0, \SMYH )
Store( 0xF, \SMMC )
// STD Set
Store( DYTC_ICFUNC_STD, \CICF ) // Save Current IC Function
Store( DYTC_ICMODE_MASK, \CICM ) // Save Current IC Mode as NO Mode
// Organize Valid Flag Status
Store( \VSTD, Local5 )
Or( ShiftLeft( \VFBC, DYTC_ICFUNC_FBC ), Local5, Local5 )
Or( ShiftLeft( \VMYH, DYTC_ICFUNC_MYH ), Local5, Local5 )
Or( ShiftLeft( \VSTP, DYTC_ICFUNC_STP ), Local5, Local5 )
Or( ShiftLeft( \VAPM, DYTC_ICFUNC_APM ), Local5, Local5 )
Or( ShiftLeft( \VAQM, DYTC_ICFUNC_AQM ), Local5, Local5 )
Or( ShiftLeft( \VIEP, DYTC_ICFUNC_IEPM ), Local5, Local5 )
Or( ShiftLeft( \VIBS, DYTC_ICFUNC_IBSM ), Local5, Local5 )
Or( ShiftLeft( \VAAA, DYTC_ICFUNC_AAA ), Local5, Local5 )
Or( ShiftLeft( \VMMC, DYTC_ICFUNC_MMC ), Local5, Local5 )
Store( ShiftLeft( \CICF, DYTC_CRNTFUNC_SHFT ), Local1 )
Or( ShiftLeft( \CICM, DYTC_CRNTMODE_SHFT ), Local1, Local1 )
Or( ShiftLeft( Local5, DYTC_FLAGCAP_SHFT ), Local1, Local1 )
// Success
Or( Local1, DYTC_STS_SUCCESS, Local1 )
}
Default {
// Fail
ShiftLeft( DYTC_ERR_INVALID_CMD, DYTC_ERR_SHFT, Local1 )
}
}
Return ( Local1 )
}
#endif // ( OPTION_DYTC_ENABLE )
////////////////////////////////////////////////////////////////////////////////
// //
// //
// ITS - Lenovo Intelligent Thermal Solution device driver support //
// //
// //
////////////////////////////////////////////////////////////////////////////////
//
// ITSD : Vertual device for Intelligent Thermal Solution (ITS) driver
// Device Node : ITSD
// Propaties : _HID : IDEA2004
// Method : _STA : 0x0F (Always present, enabled, visible for UI, functional)
//
#if ( OPTION_DYTC_ENABLE )
Scope (EC0_SCOPE.EC0) {
Device( ITSD ) {
//
// PnP ID for ITS (Lenovo Intelligent Thermal Solution device
//
//[-start-211009-QINGLIN0091-modify]//
#if defined(S370_SUPPORT)
Name(_HID, "IDEA2004" ) // PnP ID for Virtual ITS Device
#else
Name(_HID, "IDEA2008" ) // PnP ID for Virtual ITS Device
#endif
//[-end-211009-QINGLIN0091-modify]//
//
// Status (Always enabled)
//
Method( _STA ){
Return( 0x0F ) // Always present, enable, UI, functional
}
}
}
#endif // ( OPTION_DYTC_ENABLE )