X60: trigger save cmos on volume/brightness change
[coreboot.git] / src / mainboard / lenovo / x60 / acpi / video.asl
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (c) 2011 Sven Schnelle <svens@stackframe.org>
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.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19  * MA 02110-1301 USA
20  */
21
22 #include "smi.h"
23
24 Device (DSPC)
25 {
26         Name (_ADR, 0x00020001)
27         OperationRegion (DSPC, PCI_Config, 0x00, 0x100)
28         Field (DSPC, ByteAcc, NoLock, Preserve)
29         {
30                 Offset (0xf4),
31                        BRTC, 8
32         }
33
34         Method(BRTD, 0, NotSerialized)
35         {
36                 Store(BRTC, Local0)
37                 if (LGreater (Local0, 15))
38                 {
39                         Subtract(Local0, 16, Local0)
40                         Store(Local0, BRTC)
41                         Trap(SMI_SAVE_CMOS)
42                 }
43         }
44
45         Method(BRTU, 0, NotSerialized)
46         {
47                 Store (BRTC, Local0)
48                 if (LLess(Local0, 0xff))
49                 {
50                         Add (Local0, 16, Local0)
51                         Store(Local0, BRTC)
52                         Trap(SMI_SAVE_CMOS)
53                 }
54         }
55 }