Sven Schnelle (sv...@stackframe.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/25
-gerrit
commit a33c371dc98d721f20f3a8fa6b96cfa1909b1a0d Author: Sven Schnelle <sv...@stackframe.org> Date: Sun Jun 12 14:35:11 2011 +0200 X60: trigger save cmos on volume/brightness change Change-Id: I020e06bc311c4e4327c9d3cf2c379dc8fe070a7a Signed-off-by: Sven Schnelle <sv...@stackframe.org> diff --git a/src/mainboard/lenovo/x60/Makefile.inc b/src/mainboard/lenovo/x60/Makefile.inc index 83cdeb9..e840c58 100644 --- a/src/mainboard/lenovo/x60/Makefile.inc +++ b/src/mainboard/lenovo/x60/Makefile.inc @@ -17,6 +17,6 @@ ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ## -smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c dock.c +smm-$(CONFIG_HAVE_SMI_HANDLER) += mainboard_smi.c dock.c ../../../pc80/mc146818rtc.c ../../../lib/cbfs.c ../../../lib/memcmp.c ../../../lib/memset.c ../../../lib/lzma.c romstage-y += dock.c ramstage-y += dock.c diff --git a/src/mainboard/lenovo/x60/acpi/ec.asl b/src/mainboard/lenovo/x60/acpi/ec.asl index c3569e8..5c04339 100644 --- a/src/mainboard/lenovo/x60/acpi/ec.asl +++ b/src/mainboard/lenovo/x60/acpi/ec.asl @@ -1 +1,24 @@ #include <ec/lenovo/h8/acpi/ec.asl> + +Scope(\_SB.PCI0.LPCB.EC) +{ + /* Volume down */ + Method(_Q1C, 0, NotSerialized) + { + Trap(SMI_SAVE_CMOS) + } + + /* Volume up */ + Method(_Q1D, 0, NotSerialized) + { + Trap(SMI_SAVE_CMOS) + } + + /* Mute key pressed */ + Method(_Q1E, 0, NotSerialized) + { + Trap(SMI_SAVE_CMOS) + } + + +} diff --git a/src/mainboard/lenovo/x60/acpi/video.asl b/src/mainboard/lenovo/x60/acpi/video.asl index c2f9dfb..b38d82b 100644 --- a/src/mainboard/lenovo/x60/acpi/video.asl +++ b/src/mainboard/lenovo/x60/acpi/video.asl @@ -19,6 +19,8 @@ * MA 02110-1301 USA */ +#include "smi.h" + Device (DSPC) { Name (_ADR, 0x00020001) @@ -36,6 +38,7 @@ Device (DSPC) { Subtract(Local0, 16, Local0) Store(Local0, BRTC) + Trap(SMI_SAVE_CMOS) } } @@ -46,6 +49,7 @@ Device (DSPC) { Add (Local0, 16, Local0) Store(Local0, BRTC) + Trap(SMI_SAVE_CMOS) } } } diff --git a/src/mainboard/lenovo/x60/mainboard_smi.c b/src/mainboard/lenovo/x60/mainboard_smi.c index 78f7f2a..202fe3d 100644 --- a/src/mainboard/lenovo/x60/mainboard_smi.c +++ b/src/mainboard/lenovo/x60/mainboard_smi.c @@ -25,6 +25,8 @@ #include <cpu/x86/smm.h> #include "southbridge/intel/i82801gx/nvs.h" #include <ec/acpi/ec.h> +#include <pc80/mc146818rtc.h> +#include <ec/lenovo/h8/h8.h> #include "dock.h" #include "smi.h" @@ -38,7 +40,25 @@ static void mainboard_smm_init(void) printk(BIOS_DEBUG, "initializing SMI\n"); /* Enable 0x1600/0x1600 register pair */ ec_set_bit(0x00, 0x05); - ec_set_ports(0x1604, 0x1600); +} + +static void mainboard_smi_save_cmos(void) +{ + u8 val; + u8 tmp70, tmp72, tmpcf8; + + tmp70 = inb(0x70); + tmp72 = inb(0x72); + tmpcf8 = inl(0xcf8); + + val = pci_read_config8(PCI_DEV(0, 2, 1), 0xf4); + set_option("tft_brightness", &val); + val = ec_read(H8_VOLUME_CONTROL); + set_option("volume", &val); + + outb(tmp70, 0x70); + outb(tmp72, 0x72); + outb(tmpcf8, 0xcf8); } int mainboard_io_trap_handler(int smif) @@ -67,6 +87,9 @@ int mainboard_io_trap_handler(int smif) ec_write(0x0c, 0x08); break; + case SMI_SAVE_CMOS: + mainboard_smi_save_cmos(); + break; default: return 1; } diff --git a/src/mainboard/lenovo/x60/smi.h b/src/mainboard/lenovo/x60/smi.h index 6eb8402..ad096b9 100644 --- a/src/mainboard/lenovo/x60/smi.h +++ b/src/mainboard/lenovo/x60/smi.h @@ -3,5 +3,6 @@ #define SMI_DOCK_CONNECT 0x01 #define SMI_DOCK_DISCONNECT 0x02 +#define SMI_SAVE_CMOS 0x03 #endif
-- coreboot mailing list: coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot