drivers/mipi: Add support for KD_KD110N11_51IE panel
[coreboot2.git] / src / mainboard / getac / p470 / acpi / superio.asl
blobab3839c6aa9588ea51d6e905195d1d8a0f8f70d7
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 /* SMSC SIO10N268 */
5 Device (SIO1)
7         Name (_HID, EISAID("PNP0A05"))
8         Name (_UID, 1)
10         OperationRegion(SIOR, SystemIO, 0x4e, 0x02)
11         Field (SIOR, ByteAcc, Nolock, Preserve)
12         {
13                 INDX,   8,
14                 DATA,   8
15         }
17         Mutex (SIOM, 0x00)
19         Method (READ, 3)
20         {
21                 Acquire (SIOM, 0xffff)
22                 If (Arg0 == 0) {
23                         INDX = 0x55
24                         INDX = Arg1
25                         Local1 = DATA
26                         INDX = 0xaa
27                 }
28                 Local1 &= Arg2
29                 Release(SIOM)
30                 Return(Local1)
31         }
33         Method (WRIT, 3)
34         {
35                 Acquire (SIOM, 0xffff)
36                 If (Arg0 == 0) {
37                         INDX = 0x55
38                         INDX = Arg1
39                         DATA = Arg2
40                         INDX = 0xaa
41                 }
42                 Release(SIOM)
43         }
45         Device (UAR1)
46         {
47                 Name(_HID, EISAID("PNP0501"))
48                 Name(_UID, 1)
49                 Name(_DDN, "COM1")
50                 Name(_PRW, Package() { 0x08, 0x03 })
52                 /* Device Status */
53                 Method (_STA, 0)
54                 {
55                         Acquire (SIOM, 0xffff)
57                         // Is the hardware enabled?
58                         Local0 = READ (0, 0x24, 0xff)
59                         If (Local0 == 0) {
60                                 Return (0xd)
61                         } Else {
62                                 // Power Enabled?
63                                 Local0 = READ (0, 0x02, 0x08)
64                                 If (Local0 == 0) {
65                                         Return (0x0d)
66                                 } Else {
67                                         Return (0x0f)
68                                 }
69                         }
70                 }
72                 /* Device Disable */
73                 Method (_DIS, 0)
74                 {
75                         WRIT(0, 0x24, 0x00)
77                         Local0 = READ (0, 0x28, 0x0f)
78                         WRIT(0, 0x28, Local0)
80                         Local0 = READ (0, 0x02, 0xff)
81                         Local1 = ~0x08
82                         Local0 &= Local1
83                         WRIT(0, 0x02, Local0)
84                 }
86                 /* Possible Resource Settings */
87                 Name(_PRS, ResourceTemplate() {
88                         StartDependentFn(0, 1) {
89                                 IO(Decode16, 0x3f8, 0x3f8, 0x8, 0x8)
90                                 IRQNoFlags() { 4 }
91                         } EndDependentFn()
92                 })
94                 /* Current Resource Settings */
95                 Method(_CRS, 0, Serialized)
96                 {
97                         Name(NONE, ResourceTemplate() {
98                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
99                                 IRQNoFlags() { }
100                         })
102                         Name(RSRC, ResourceTemplate() {
103                                 IO(Decode16, 0x3f8, 0x3f8, 0x8, 0x8, _IOA)
104                                 IRQNoFlags(_IRA) { 4 }
105                         })
107                         Local0 = (_STA () & 0x02)
108                         If (Local0 == 0) {
109                                 Return(NONE)
110                         }
112                         CreateWordField(RSRC,
113                                 \_SB.PCI0.LPCB.SIO1.UAR1._CRS._IOA._MIN, IOMN)
114                         CreateWordField(RSRC,
115                                 \_SB.PCI0.LPCB.SIO1.UAR1._CRS._IOA._MAX, IOMX)
116                         CreateWordField(RSRC,
117                                 \_SB.PCI0.LPCB.SIO1.UAR1._CRS._IRA._INT, IRQ)
119                         /* I/O Base */
120                         Local0 = READ (0, 0x24, 0xfe)
121                         Local0 <<= 2
122                         IOMN = Local0
123                         IOMX = Local0
125                         /* Interrupt */
126                         Local0 = READ (0, 0x28, 0xf0)
127                         Local0 >>= 4
128                         IRQ = 1 << Local0
129                         Return(RSRC)
130                 }
132                 /* Set Resource Settings */
133                 Method(_SRS, 1)
134                 {
135                         CreateByteField(Arg0, 0x02, IOLO)
136                         CreateByteField(Arg0, 0x03, IOHI)
137                         CreateByteField(Arg0, 0x09, IRQL)
139                         WRIT(0, 0x24, 0)
140                         FindSetRightBit(IRQL, Local0)
141                         Local0--
142                         Local0 <<= 4
144                         Local1 = READ (0, 0x28, 0x0f)
145                         Local0 |= Local1
146                         WRIT(0, 0x28, Local0)
148                         Local0 = IOLO
149                         Local0 >>= 2
150                         Local0 &= 0xfe
152                         Local1 = IOHI
153                         Local1 <<= 6
154                         Local0 |= Local1
155                         WRIT(0, 0x24, Local0)
157                         Local0 = READ (0, 0x02, 0xff)
158                         Local0 |= 0x08
159                         WRIT(0, 0x02, Local0)
161                         Local0 = READ (0, 0x07, 0xff)
162                         Local1 = ~0x40
163                         Local0 &= Local1
164                         WRIT(0, 0x07, Local0)
165                 }
168                 /* D0 state - Line drivers are on */
169                 Method (_PS0, 0)
170                 {
171                         Local0 = READ (0, 0x02, 0xff)
172                         Local0 |= 0x08
173                         WRIT(0, 0x02, Local0)
175                         Local0 = READ (0, 0x07, 0xff)
176                         Local1 = ~0x40
177                         Local0 &= Local1
178                         WRIT(0, 0x07, Local0)
179                 }
181                 /* D3 State - Line drivers are off */
182                 Method(_PS3, 0)
183                 {
184                         Local0 = READ (0, 0x02, 0xff)
185                         Local1 = ~0x08
186                         Local0 &= Local1
187                         WRIT(0, 0x02, Local0)
188                 }
189         }
191         Device (UAR2)
192         {
193                 Name(_HID, EISAID("PNP0501"))
194                 Name(_UID, 2)
195                 Name(_DDN, "COM2")
196                 Name(_PRW, Package() { 0x08, 0x03 })
198                 /* Device Status */
199                 Method (_STA, 0)
200                 {
201                         /* IRDA? */
202                         Local0 = READ(0, 0x0c, 0x38)
203                         If (Local0 != 0) {
204                                 Return (0)
205                         }
207                         // Is the hardware enabled?
208                         Local0 = READ (0, 0x25, 0xff)
209                         If (Local0 == 0) {
210                                 Return (0xd)
211                         } Else {
212                                 // Power Enabled?
213                                 Local0 = READ (0, 0x02, 0x80)
214                                 If (Local0 == 0) {
215                                         Return (0x0d)
216                                 } Else {
217                                         Return (0x0f)
218                                 }
219                         }
220                 }
222                 /* Device Disable */
223                 Method (_DIS, 0)
224                 {
225                         WRIT(0, 0x25, 0x00)
227                         Local0 = READ (0, 0x28, 0xf0)
228                         WRIT(0, 0x28, Local0)
230                         Local0 = READ (0, 0x02, 0xff)
231                         Local1 = ~0x80
232                         Local0 &= Local1
233                         WRIT(0, 0x02, Local0)
234                 }
236                 /* Possible Resource Settings */
237                 Name(_PRS, ResourceTemplate() {
238                         StartDependentFn(0, 1) {
239                                 IO(Decode16, 0x2f8, 0x2f8, 0x8, 0x8)
240                                 IRQNoFlags() { 3 }
241                         } EndDependentFn()
242                 })
244                 /* Current Resource Settings */
245                 Method(_CRS, 0, Serialized)
246                 {
247                         Name(NONE, ResourceTemplate() {
248                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
249                                 IRQNoFlags() { }
250                         })
252                         Name(RSRC, ResourceTemplate() {
253                                 IO(Decode16, 0x2f8, 0x2f8, 0x8, 0x8, _IOB)
254                                 IRQNoFlags(_IRB) { 3 }
255                         })
257                         Local0 = _STA () & 0x02
258                         If (Local0 == 0) {
259                                 Return(NONE)
260                         }
262                         CreateWordField(RSRC,
263                                 \_SB.PCI0.LPCB.SIO1.UAR2._CRS._IOB._MIN, IOMN)
264                         CreateWordField(RSRC,
265                                 \_SB.PCI0.LPCB.SIO1.UAR2._CRS._IOB._MAX, IOMX)
266                         CreateWordField(RSRC,
267                                 \_SB.PCI0.LPCB.SIO1.UAR2._CRS._IRB._INT, IRQ)
269                         /* I/O Base */
270                         Local0 = READ (0, 0x25, 0xfe)
271                         Local0 <<= 2
272                         IOMN = Local0
273                         IOMX = Local0
275                         /* Interrupt */
276                         Local0 = READ (0, 0x28, 0x0f)
277                         Local0 >>= 4
278                         IRQ = 1 << Local0
279                         Return(RSRC)
280                 }
282                 /* Set Resource Settings */
283                 Method(_SRS, 1)
284                 {
285                         CreateByteField(Arg0, 0x02, IOLO)
286                         CreateByteField(Arg0, 0x03, IOHI)
287                         CreateByteField(Arg0, 0x09, IRQL)
289                         WRIT(0, 0x25, 0)
290                         FindSetRightBit(IRQL, Local0)
291                         Local0--
293                         Local1 = READ (0x00, 0x28, 0xf0)
294                         Local0 |= Local1
295                         WRIT(0, 0x28, Local0)
297                         Local0 = IOLO
298                         Local0 >>= 2
299                         Local0 &= 0xfe
301                         Local1 = IOHI
302                         Local1 <<= 6
303                         Local0 |= Local1
304                         WRIT(0, 0x25, Local0)
306                         Local0 = READ (0, 0x0c, 0xff)
307                         Local1 = ~0x38
308                         Local0 &= Local1
309                         WRIT(0, 0x0c, Local0)
311                         Local0 = READ (0, 0x02, 0xff)
312                         Local0 |= 0x80
313                         WRIT(0, 0x02, Local0)
315                         Local0 = READ (0, 0x07, 0xff)
316                         Local1 = ~0x20
317                         Local0 &= Local1
318                         WRIT(0, 0x07, Local0)
319                 }
321                 /* D0 state - Line drivers are on */
322                 Method (_PS0, 0)
323                 {
324                         Local0 = READ (0, 0x02, 0xff)
325                         Local0 |= 0x80
326                         WRIT(0, 0x02, Local0)
328                         Local0 = READ (0, 0x07, 0xff)
329                         Local1 = ~0x20
330                         Local0 &= Local1
331                         WRIT(0, 0x07, Local0)
332                 }
334                 /* D3 State - Line drivers are off */
335                 Method(_PS3, 0)
336                 {
337                         Local0 = READ (0, 0x02, 0xff)
338                         Local1 = ~0x80
339                         Local0 &= Local1
340                         WRIT(0, 0x02, Local0)
341                 }
342         }
344         Device (UAR3)
345         {
346                 Name(_HID, EISAID("PNP0501"))
347                 Name(_UID, 3)
348                 Name(_DDN, "COM3")
349                 Name(_PRW, Package() { 0x08, 0x03 })
351                 /* Device Status */
352                 Method (_STA, 0)
353                 {
354                         Acquire (SIOM, 0xffff)
356                         // Is the hardware enabled?
357                         Local0 = READ (0, 0x1b, 0xff)
358                         If (Local0 == 0) {
359                                 Return (0xd)
360                         } Else {
361                                 // Power Enabled?
362                                 Local0 = READ (0, 0x02, 0x02)
363                                 If (Local0 == 0) {
364                                         Return (0x0d)
365                                 } Else {
366                                         Return (0x0f)
367                                 }
368                         }
369                 }
371                 /* Device Disable */
372                 Method (_DIS, 0)
373                 {
374                         WRIT(0, 0x1b, 0x00)
376                         Local0 = READ (0, 0x1d, 0x0f)
377                         WRIT(0, 0x1d, Local0)
379                         Local0 = READ (0, 0x02, 0xff)
380                         Local1 = ~0x02
381                         Local0 &= Local1
382                         WRIT(0, 0x02, Local0)
383                 }
385                 /* Possible Resource Settings */
386                 Name(_PRS, ResourceTemplate() {
387                         StartDependentFn(0, 1) {
388                                 IO(Decode16, 0x3e8, 0x3e8, 0x8, 0x8)
389                                 IRQNoFlags() { 5 }
390                         } EndDependentFn()
391                 })
393                 /* Current Resource Settings */
394                 Method(_CRS, 0, Serialized)
395                 {
396                         Name(NONE, ResourceTemplate() {
397                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
398                                 IRQNoFlags() { }
399                         })
401                         Name(RSRC, ResourceTemplate() {
402                                 IO(Decode16, 0x3e8, 0x3e8, 0x8, 0x8, _IOA)
403                                 IRQNoFlags(_IRA) { 5 }
404                         })
406                         Local0 = _STA () & 0x02
407                         If (Local0 == 0) {
408                                 Return(NONE)
409                         }
411                         CreateWordField(RSRC,
412                                 \_SB.PCI0.LPCB.SIO1.UAR3._CRS._IOA._MIN, IOMN)
413                         CreateWordField(RSRC,
414                                 \_SB.PCI0.LPCB.SIO1.UAR3._CRS._IOA._MAX, IOMX)
415                         CreateWordField(RSRC,
416                                 \_SB.PCI0.LPCB.SIO1.UAR3._CRS._IRA._INT, IRQ)
418                         /* I/O Base */
419                         Local0 = READ (0x00, 0x1b, 0xfe)
420                         Local0 <<= 2
421                         IOMN = Local0
422                         IOMX = Local0
424                         /* Interrupt */
425                         Local0 = READ (0, 0x1d, 0xf0)
426                         Local0 >>= 4
427                         IRQ = 1 << Local0
428                         Return(RSRC)
429                 }
431                 /* Set Resource Settings */
432                 Method(_SRS, 1)
433                 {
434                         CreateByteField(Arg0, 0x02, IOLO)
435                         CreateByteField(Arg0, 0x03, IOHI)
436                         CreateByteField(Arg0, 0x09, IRQL)
438                         WRIT(0, 0x1b, 0)
439                         FindSetRightBit(IRQL, Local0)
440                         Local0--
441                         Local0 <<= 4
443                         Local1 = READ (0, 0x1d, 0x0f)
444                         Local0 |= Local1
445                         WRIT(0, 0x1d, Local0)
447                         Local0 = IOLO
448                         Local0 >>= 2
449                         Local0 &= 0xfe
451                         Local1 = IOHI
452                         Local1 <<= 6
453                         Local0 |= Local1
454                         WRIT(0, 0x1b, Local0)
456                         Local0 = READ (0, 0x02, 0xff)
457                         Local0 |= 0x02
458                         WRIT(0, 0x02, Local0)
460                         Local0 = READ (0, 0x07, 0xff)
461                         Local1 = ~0x04
462                         Local0 &= Local1
463                         WRIT(0, 0x07, Local0)
464                 }
467                 /* D0 state - Line drivers are on */
468                 Method (_PS0, 0)
469                 {
470                         Local0 = READ (0, 0x02, 0xff)
471                         Local0 |= 0x02
472                         WRIT(0, 0x02, Local0)
474                         Local0 = READ (0, 0x07, 0xff)
475                         Local1 = ~0x04
476                         Local0 &= Local1
477                         WRIT(0, 0x07, Local0)
478                 }
480                 /* D3 State - Line drivers are off */
481                 Method(_PS3, 0)
482                 {
483                         Local0 = READ (0, 0x02, 0xff)
484                         Local1 = ~0x02
485                         Local0 &= Local1
486                         WRIT(0, 0x02, Local0)
487                 }
488         }
491         Device (UAR4)
492         {
493                 Name(_HID, EISAID("PNP0501"))
494                 Name(_UID, 4)
495                 Name(_DDN, "COM4")
496                 Name(_PRW, Package() { 0x08, 0x03 })
498                 /* Device Status */
499                 Method (_STA, 0)
500                 {
501                         Acquire (SIOM, 0xffff)
503                         // Is the hardware enabled?
504                         Local0 = READ (0, 0x1c, 0xff)
505                         If (Local0 == 0) {
506                                 Return (0xd)
507                         } Else {
508                                 // Power Enabled?
509                                 Local0 = READ (0, 0x02, 0x04)
510                                 If (Local0 == 0) {
511                                         Return (0x0d)
512                                 } Else {
513                                         Return (0x0f)
514                                 }
515                         }
516                 }
518                 /* Device Disable */
519                 Method (_DIS, 0)
520                 {
521                         WRIT(0, 0x1c, 0x00)
523                         Local0 = READ (0, 0x1d, 0x0f)
524                         WRIT(0, 0x1d, Local0)
526                         Local0 = READ (0, 0x02, 0xff)
527                         Local1 = ~0x04
528                         Local0 &= Local1
529                         WRIT(0, 0x02, Local0)
530                 }
532                 /* Possible Resource Settings */
533                 Name(_PRS, ResourceTemplate() {
534                         StartDependentFn(0, 1) {
535                                 IO(Decode16, 0x2e8, 0x2e8, 0x8, 0x8)
536                                 IRQNoFlags() { 11 }
537                         } EndDependentFn()
538                 })
540                 /* Current Resource Settings */
541                 Method(_CRS, 0, Serialized)
542                 {
543                         Name(NONE, ResourceTemplate() {
544                                 IO(Decode16, 0x000, 0x000, 0x0, 0x1)
545                                 IRQNoFlags() { }
546                         })
548                         Name(RSRC, ResourceTemplate() {
549                                 IO(Decode16, 0x2e8, 0x2e8, 0x8, 0x8, _IOA)
550                                 IRQNoFlags(_IRA) { 11 }
551                         })
553                         Local0 = _STA () & 0x02
554                         If (Local0 == 0) {
555                                 Return(NONE)
556                         }
558                         CreateWordField(RSRC,
559                                 \_SB.PCI0.LPCB.SIO1.UAR4._CRS._IOA._MIN, IOMN)
560                         CreateWordField(RSRC,
561                                 \_SB.PCI0.LPCB.SIO1.UAR4._CRS._IOA._MAX, IOMX)
562                         CreateWordField(RSRC,
563                                 \_SB.PCI0.LPCB.SIO1.UAR4._CRS._IRA._INT, IRQ)
565                         /* I/O Base */
566                         Local0 = READ (0, 0x1c, 0xfe)
567                         Local0 <<= 2
568                         IOMN = Local0
569                         IOMX = Local0
571                         /* Interrupt */
572                         Local0 = READ (0, 0x1d, 0xf0)
573                         Local0 >>= 4
574                         IRQ = 1 << Local0
575                         Return(RSRC)
576                 }
578                 /* Set Resource Settings */
579                 Method(_SRS, 1)
580                 {
581                         CreateByteField(Arg0, 0x02, IOLO)
582                         CreateByteField(Arg0, 0x03, IOHI)
583                         CreateByteField(Arg0, 0x09, IRQL)
585                         WRIT(0, 0x1c, 0)
586                         FindSetRightBit(IRQL, Local0)
587                         Local0--
588                         Local0 <<= 4
590                         Local1 = READ (0x00, 0x1d, 0x0f)
591                         Local0 |= Local1
592                         WRIT(0, 0x1d, Local0)
594                         Local0 = IOLO
595                         Local0 >>= 2
596                         Local0 &= 0xfe
598                         Local1 = IOHI
599                         Local1 <<= 6
600                         Local0 |= Local1
601                         WRIT(0, 0x1c, Local0)
603                         Local0 = READ (0, 0x02, 0xff)
604                         Local0 |= 0x04
605                         WRIT(0, 0x02, Local0)
607                         Local0 = READ (0, 0x07, 0xff)
608                         Local1 = ~0x08
609                         Local0 &= Local1
610                         WRIT(0, 0x07, Local0)
611                 }
614                 /* D0 state - Line drivers are on */
615                 Method (_PS0, 0)
616                 {
617                         Local0 = READ (0, 0x02, 0xff)
618                         Local0 |= 0x04
619                         WRIT(0, 0x02, Local0)
621                         Local0 = READ (0, 0x07, 0xff)
622                         Local1 = ~0x08
623                         Local0 &= Local1
624                         WRIT(0, 0x07, Local0)
625                 }
627                 /* D3 State - Line drivers are off */
628                 Method(_PS3, 0)
629                 {
630                         Local0 = READ (0, 0x02, 0xff)
631                         Local1 = ~0x04
632                         Local0 &= Local1
633                         WRIT(0, 0x02, Local0)
634                 }
635         }