aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Touzeau <gabrielx.touzeau@intel.com>2013-12-11 08:35:18 +0100
committerBeare, Bruce J <bruce.j.beare@intel.com>2015-10-20 22:23:05 +0100
commitb4e573b8c3fd17c2eaac2e7b96e8dc9e82c9a03f (patch)
tree2986f4357a42cb5b81508c13d268148763cdc688
parent2dd1db2128b7869485c85624b81398fa24ee5f5b (diff)
downloadedison-v3.10-b4e573b8c3fd17c2eaac2e7b96e8dc9e82c9a03f.tar.gz
rtc-cmos driver: add wakeup and day of month support
BZ: 144574 This patch adds two configurable features to the rtc-cmos driver: - if CONFIG_RTC_DRV_CMOS_WAKEUP_FROM_LPSTATES is set then driver will add alarm wakeup capability from S3 (suspend to RAM) and S4/5 (OFF). - if CONFIG_RTC_DRV_CMOS_DAYOFMONTH_ALARM is set on top of the above flag then alarm wakeup from low power states will be supported up to one month instead of only one day. Day of month is set in RTC CMOS register D. This patch comes as part of the overall wakeup from OFF feature supported on Intel mobile platforms. Change-Id: I94d56710f570d58be1806c1642f1fa6722d3e3dc Signed-off-by: Gabriel Touzeau <gabrielx.touzeau@intel.com> Reviewed-on: https://android.intel.com/425802 Reviewed-by: Wood, Brian J <brian.j.wood@intel.com> Tested-by: Wood, Brian J <brian.j.wood@intel.com> Reviewed-by: Noziska, Patrick J <patrick.j.noziska@intel.com>
-rw-r--r--drivers/rtc/Kconfig14
-rw-r--r--drivers/rtc/rtc-cmos.c23
2 files changed, 35 insertions, 2 deletions
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index b9838130a7b..fe9640c3149 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -614,6 +614,20 @@ config RTC_DRV_CMOS
This driver can also be built as a module. If so, the module
will be called rtc-cmos.
+config RTC_DRV_CMOS_WAKEUP_FROM_LPSTATES
+ tristate "PC-style 'CMOS' can wakeup from low power states"
+ depends on RTC_DRV_CMOS
+ help
+ Say "yes" to have rtc-cmos driver capability to wakeup from low
+ power states (S3 and S4/5).
+
+config RTC_DRV_CMOS_DAYOFMONTH_ALARM
+ tristate "PC-style 'CMOS' supports day of month for alarms"
+ depends on RTC_DRV_CMOS_WAKEUP_FROM_LPSTATES
+ help
+ Say "yes" to have rtc-cmos driver support day of month for
+ alarms through REG_D register.
+
config RTC_DRV_VRTC
tristate "Virtual RTC for Intel MID platforms"
depends on X86_INTEL_MID
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 204d529ef22..459bdadac76 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -729,8 +729,10 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
hpet_set_periodic_freq(cmos_rtc.rtc->irq_freq);
CMOS_WRITE(RTC_REF_CLCK_32KHZ | 0x06, RTC_FREQ_SELECT);
+#ifndef CONFIG_RTC_DRV_CMOS_WAKEUP_FROM_LPSTATES
/* disable irqs */
cmos_irq_disable(&cmos_rtc, RTC_PIE | RTC_AIE | RTC_UIE);
+#endif
rtc_control = CMOS_READ(RTC_CONTROL);
@@ -1023,12 +1025,27 @@ static void cmos_wake_setup(struct device *dev)
device_init_wakeup(dev, 1);
}
-#elif defined(CONFIG_X86_INTEL_MID)
+#elif defined(CONFIG_RTC_DRV_CMOS_WAKEUP_FROM_LPSTATES)
+
+#ifdef CONFIG_RTC_DRV_CMOS_DAYOFMONTH_ALARM
+static struct cmos_rtc_board_info cmos_wakeup_rtc_info;
+#endif
static void cmos_wake_setup(struct device *dev)
{
+#ifdef CONFIG_RTC_DRV_CMOS_DAYOFMONTH_ALARM
+ /* add day of month capability for alarms */
+ cmos_wakeup_rtc_info.rtc_day_alarm = RTC_REG_D;
+ cmos_wakeup_rtc_info.rtc_mon_alarm = 0;
+ cmos_wakeup_rtc_info.rtc_century = 0;
+
+ cmos_wakeup_rtc_info.wake_on = NULL;
+ cmos_wakeup_rtc_info.wake_off = NULL;
+
+ dev->platform_data = &cmos_wakeup_rtc_info;
+#endif
+
/* RTC always wakes from S1/S2/S3, and often S4/STD */
- /* on all Intel MID platforms using legacy RTC */
device_init_wakeup(dev, 1);
}
@@ -1177,10 +1194,12 @@ static int __exit cmos_platform_remove(struct platform_device *pdev)
static void cmos_platform_shutdown(struct platform_device *pdev)
{
+#ifndef CONFIG_RTC_DRV_CMOS_WAKEUP_FROM_LPSTATES
if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(&pdev->dev))
return;
cmos_do_shutdown();
+#endif
}
/* work with hotplug and coldplug */