From 887edac45c4b91c399d9fd80013187918f8cc251 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Tue, 28 May 2013 12:37:08 -0700 Subject: [PATCH] RTC: Skip rtc_init() in S3 resume path In addition to not clearing the pending interrupts, we also don't want to reset the RTC control register when booting with an S3 resume. On most new systems, when the RTC well is losing power, we will also lose state that is required to perform a resume, so we end up in a normal boot anyways. Hence don't do any RTC initialization in the S3 resume path. Signed-off-by: Stefan Reinauer BUG=none TEST=Resume on Link, observe RTC initialization is skipped BRANCH=none Change-Id: I73b486082faa741e9dccd15f2b8e3a8399c98f80 Reviewed-on: https://gerrit.chromium.org/gerrit/56826 Reviewed-by: Duncan Laurie Reviewed-by: Aaron Durbin Reviewed-by: Derek Basehore Commit-Queue: Stefan Reinauer Tested-by: Stefan Reinauer --- src/drivers/pc80/mc146818rtc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/drivers/pc80/mc146818rtc.c b/src/drivers/pc80/mc146818rtc.c index d91f207427..f084a8659c 100644 --- a/src/drivers/pc80/mc146818rtc.c +++ b/src/drivers/pc80/mc146818rtc.c @@ -71,6 +71,16 @@ void rtc_init(int invalid) unsigned char x; #endif +#if CONFIG_HAVE_ACPI_RESUME + /* Avoid clearing pending interrupts and resetting the RTC control + * register in the resume path because the Linux kernel relies on + * this to know if it should restart the RTC timerqueue if the wake + * was due to the RTC alarm. + */ + if (acpi_slp_type == 3) + return; +#endif + printk(BIOS_DEBUG, "RTC Init\n"); #if CONFIG_USE_OPTION_TABLE @@ -128,16 +138,6 @@ void rtc_init(int invalid) PC_CKS_RANGE_END,PC_CKS_LOC); #endif -#if CONFIG_HAVE_ACPI_RESUME - /* - * Avoid clearing pending interrupts in the resume path because - * the Linux kernel relies on this to know if it should restart - * the RTC timerqueue if the wake was due to the RTC alarm. - */ - if (acpi_slp_type == 3) - return; -#endif - /* Clear any pending interrupts */ (void) cmos_read(RTC_INTR_FLAGS); }