Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/olpc/xo1/sci: Report RTC wakeup events

When the system is woken due to a RTC event, report the wakeup
event on the relevant rtc device (if it can be found).

Signed-off-by: Daniel Drake <dsd@laptop.org>
Cc: dilinger@queued.net
Cc: pgf@laptop.org
Link: http://lkml.kernel.org/r/20120418223402.D73249D401E@zog.reactivated.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Daniel Drake and committed by
Ingo Molnar
c2c21e9b d2aa3741

+16 -2
+15 -2
arch/x86/platform/olpc/olpc-xo1-sci.c
··· 236 236 pm_wakeup_event(&power_button_idev->dev, 0); 237 237 } 238 238 239 + if ((sts & (CS5536_RTC_FLAG | CS5536_WAK_FLAG)) == 240 + (CS5536_RTC_FLAG | CS5536_WAK_FLAG)) { 241 + /* When the system is woken by the RTC alarm, report the 242 + * event on the rtc device. */ 243 + struct device *rtc = bus_find_device_by_name( 244 + &platform_bus_type, NULL, "rtc_cmos"); 245 + if (rtc) { 246 + pm_wakeup_event(rtc, 0); 247 + put_device(rtc); 248 + } 249 + } 250 + 239 251 if (gpe & CS5536_GPIOM7_PME_FLAG) { /* EC GPIO */ 240 252 cs5535_gpio_set(OLPC_GPIO_ECSCI, GPIO_NEGATIVE_EDGE_STS); 241 253 schedule_work(&sci_work); ··· 338 326 outb(lo, CS5536_PIC_INT_SEL2); 339 327 } 340 328 341 - /* Enable SCI from power button, and clear pending interrupts */ 329 + /* Enable interesting SCI events, and clear pending interrupts */ 342 330 sts = inl(acpi_base + CS5536_PM1_STS); 343 - outl((CS5536_PM_PWRBTN << 16) | 0xffff, acpi_base + CS5536_PM1_STS); 331 + outl(((CS5536_PM_PWRBTN | CS5536_PM_RTC) << 16) | 0xffff, 332 + acpi_base + CS5536_PM1_STS); 344 333 345 334 r = request_irq(sci_irq, xo1_sci_intr, 0, DRV_NAME, pdev); 346 335 if (r)
+1
include/linux/cs5535.h
··· 95 95 96 96 /* CS5536_PM1_STS bits */ 97 97 #define CS5536_WAK_FLAG (1 << 15) 98 + #define CS5536_RTC_FLAG (1 << 10) 98 99 #define CS5536_PWRBTN_FLAG (1 << 8) 99 100 100 101 /* CS5536_PM1_EN bits */