summaryrefslogtreecommitdiff
path: root/Board/EM/Platform/SsdtSensorHub/SsdtSensorHub.asl
blob: 0918fdbb2408ba36f5237613dd1f720361b8e755 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/**************************************************************************;
;*                                                                        *;
;*    Intel Confidential                                                  *;
;*                                                                        *;
;*    Intel Corporation - ACPI Reference Code for the Ivy Bridge          *;
;*    Family of Customer Reference Boards.                                *;
;*                                                                        *;
;*                                                                        *;
;*    Copyright (c)  1999 - 2013 Intel Corporation. All rights reserved   *;
;*    This software and associated documentation (if any) is furnished    *;
;*    under a license and may only be used or copied in accordance        *;
;*    with the terms of the license. Except as permitted by such          *;
;*    license, no part of this software or documentation may be           *;
;*    reproduced, stored in a retrieval system, or transmitted in any     *;
;*    form or by any means without the express written consent of         *;
;*    Intel Corporation.                                                  *;
;*                                                                        *;
;*                                                                        *;
;**************************************************************************/
/*++
  This file contains a 'Sample Driver' and is licensed as such  
  under the terms of your license agreement with Intel or your  
  vendor.  This file may be modified by the user, subject to    
  the additional terms of the license agreement                 
--*/

DefinitionBlock (
    "SensorHubApp.aml",
    "SSDT",
    0x01, // SHAD revision.
        // A Revision field value greater than or equal to 2 signifies that integers 
        // declared within the Definition Block are to be evaluated as 64-bit values
    "INTEL", // OEM ID (6 byte string)
    "sensrhub", // OEM table ID  (8 byte string)
    0x0 // OEM version of DSDT table (4 byte Integer)
    )

// BEGIN OF ASL SCOPE

{
  External(\GPBS)
  External(\SDS0)
  External(\USBH)
  External(\_SB.RDGP, MethodObj)
  External(\_SB.WTGP, MethodObj)
  External(\_SB.PCI0.I2C0.SHUB, DeviceObj) // Sensor hub
  External(\_SB.PCI0.I2C0.DFUD, DeviceObj) // DFU

  Scope(\)
  {
    Device(SHAD)                  // Sensor Hub Application Device.
    {
      Name(_HID, EISAID("INT33D0"))
      Name(_CID, EISAID("PNP0C02"))

      Method(_STA, 0,Serialized)
      {
        If(LOr(And(SDS0,1), And(USBH,1)))
        {
          Return(0x000F)      // Sensor Hub Enabled, Show it
        }
        Return(0x00)          // Sensor Hub Disabled, Hide it
      }

      //
      // _DSM : Device Specific Method supporting USB Sideband Deferring function
      //
      // Arg0: UUID Unique function identifier
      // Arg1: Integer Revision Level
      // Arg2: Integer Function Index
      // Arg3: Package Parameters
      //
      Method (_DSM, 4, Serialized, 0, UnknownObj, {BuffObj, IntObj, IntObj, PkgObj})
      {

        // Define the Local Variables used throughout the method.

        Name(PGCE, 0) // Power Gate Control Enable.
        Name(PGCD, 0) // Power Gate Control Duration.
        Name(DFUE, 0) // DFU Enable.
        Name(DFUD, 0) // DFU Duration.
        Name(OLDV, 0) // Old value of both Power Gate and DFU GPIO.
        Name(PGCV, 0) // Power Gate Control Value
        Name(DFUV, 0) // DFU Control Value

        // Compare passed in UUID to supported UUID.

        If (LEqual(Arg0, ToUUID ("03C868D5-563F-42A8-9F57-9A18D949B7CB")))  
        {

          If (LEqual(1,ToInteger(Arg1)))        // Revision 1.
          {
            Switch (ToInteger(Arg2))            // Switch to Function Index.
            {
              //
              // Function 0, Query - return supported functions BitIndex.
              //

              Case (0)
              {
                Return (Buffer() {0x0F})
              }   

              //
              // Function 1, Power Gate Control - Pass in 2 value package via Arg3
              //

              Case (1)
              {

                Store (DeRefOf (Index (Arg3, 0)), PGCE)
                Store (DeRefOf (Index (Arg3, 1)), PGCD)

                Store(\_SB.RDGP(46), OLDV)           // Save off GPIO46 = PWRGATE#
                \_SB.WTGP(46, PGCE)                  // Set value to GPIO46 = PWRGATE#

                If(LGreater(PGCD, 0))                // test duration value
                { 
                  Sleep(PGCD)
                  \_SB.WTGP(46, OLDV)                // Restore GPIO46 = PWRGATE#
                }  

                If (LEqual(\_SB.RDGP(46), 0x01))     // check for powered on (1 = on)
                {
                  Sleep(150)                         // Delay so sensor hub has time to init.
                  If (LEqual(\_SB.RDGP(44), 0x01)) { // check mode, Sensor or DFU (1 = Sensor)
                    // Powering up in sensor hub mode
                    Notify(\_SB.PCI0.I2C0.SHUB, 1)   // Check the sensor hub status
                  } Else {
                    // Powering up in DFU mode
                    Notify(\_SB.PCI0.I2C0.DFUD, 1)   // Check the DFU device status
                  }
                }

                Return (0)
              } // End Case (1)
          
              //
              // Function2, DFU Control - Pass in 2 value package via Arg3
              //

              Case (2)
              {

                Store (DeRefOf (Index (Arg3, 0)), DFUE)
                Store (DeRefOf (Index (Arg3, 1)), DFUD)

                Store(\_SB.RDGP(44), OLDV)          // Save off GPIO44 = DFU_ENA#
                \_SB.WTGP(44, DFUE)                 // Set Value to GPIO44 = DFU_ENA#

                If (LGreater(DFUD, 0))              // Test duration value
                { 
                    Sleep(DFUD)                     // Delay for passed in duration.
                    \_SB.WTGP(44, OLDV)             // Restore GPIO44 = DFU_ENA#
                } 

                Return (0) 
              } // End Case 2...

              //
              // Function 3, Query Status ?Return the current status of GPIO signals.
              //

              Case (3)
              {
                Store(\_SB.RDGP(44), DFUV)
                Store(\_SB.RDGP(46), PGCV)
                Return(Package(){PGCV, DFUV})
              } // End Case 3

            } // End Function Index...
            Return (0)
          }  // End Revision check...
          Return (0)
        }  // End UUID check...
        Return (0)
      }  // End _DSM Method...
    }  // End Device....
  }  // End Scope...
}  // End DefinitionBlock Termlist