Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | External(LCD0, DeviceObj) |
| 18 | |
| 19 | Name (BRCT, 0) |
| 20 | |
| 21 | Method(BRID, 1, NotSerialized) |
| 22 | { |
| 23 | Store (Match (BRIG, MEQ, Arg0, MTR, Zero, 2), Local0) |
| 24 | If (LEqual (Local0, Ones)) |
| 25 | { |
| 26 | Return (Subtract(SizeOf(BRIG), One)) |
| 27 | } |
| 28 | Return (Local0) |
| 29 | } |
| 30 | |
| 31 | Method (XBCL, 0, NotSerialized) |
| 32 | { |
| 33 | Store (1, BRCT) |
| 34 | Return (BRIG) |
| 35 | } |
| 36 | |
| 37 | /* Display Output Switching */ |
| 38 | Method (_DOS, 1) |
| 39 | { |
| 40 | /* Windows 2000 and Windows XP call _DOS to enable/disable |
| 41 | * Display Output Switching during init and while a switch |
| 42 | * is already active |
| 43 | */ |
| 44 | Store (And(Arg0, 7), DSEN) |
| 45 | } |
| 46 | |
Patrick Rudolph | 6838aae | 2018-07-29 10:53:01 +0200 | [diff] [blame^] | 47 | /* |
| 48 | * Decrement display brightness. |
| 49 | * |
| 50 | * Using Notify is the right way. But Windows doesn't handle |
| 51 | * it well. So use both method in a way to avoid double action. |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 52 | */ |
| 53 | Method (DECB, 0, NotSerialized) |
| 54 | { |
| 55 | If (BRCT) |
| 56 | { |
| 57 | Notify (LCD0, 0x87) |
| 58 | } Else { |
| 59 | Store (BRID (XBQC ()), Local0) |
| 60 | If (LNotEqual (Local0, 2)) |
| 61 | { |
| 62 | Decrement (Local0) |
| 63 | } |
| 64 | XBCM (DerefOf (Index (BRIG, Local0))) |
| 65 | } |
| 66 | } |
| 67 | |
Patrick Rudolph | 6838aae | 2018-07-29 10:53:01 +0200 | [diff] [blame^] | 68 | /* |
| 69 | * Increment display brightness. |
| 70 | */ |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 71 | Method (INCB, 0, NotSerialized) |
| 72 | { |
| 73 | If (BRCT) |
| 74 | { |
| 75 | Notify (LCD0, 0x86) |
| 76 | } Else { |
| 77 | Store (BRID (XBQC ()), Local0) |
| 78 | If (LNotEqual (Local0, Subtract(SizeOf(BRIG), One))) |
| 79 | { |
| 80 | Increment (Local0) |
| 81 | } |
| 82 | XBCM (DerefOf (Index (BRIG, Local0))) |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | /* Device Current Status */ |
| 87 | Method(XDCS, 1) |
| 88 | { |
| 89 | TRAP(1) |
| 90 | If (And(CSTE, ShiftLeft (1, Arg0))) { |
| 91 | Return (0x1f) |
| 92 | } |
| 93 | Return(0x1d) |
| 94 | } |
| 95 | |
| 96 | /* Query Device Graphics State */ |
| 97 | Method(XDGS, 1) |
| 98 | { |
| 99 | If (And(NSTE, ShiftLeft (1, Arg0))) { |
| 100 | Return(1) |
| 101 | } |
| 102 | Return(0) |
| 103 | } |
| 104 | |
| 105 | /* Device Set State */ |
Martin Roth | 5dbe8ee | 2018-05-06 21:08:37 -0500 | [diff] [blame] | 106 | Method(XDSS, 1) |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 107 | { |
| 108 | /* If Parameter Arg0 is (1 << 31) | (1 << 30), the |
| 109 | * display switch was completed |
| 110 | */ |
| 111 | If (LEqual(And(Arg0, 0xc0000000), 0xc0000000)) { |
| 112 | Store (NSTE, CSTE) |
| 113 | } |
| 114 | } |