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

rtc: pcf8523: add suspend handlers for alarm IRQ

Ensure the RTC is able to wake up the system from suspend.

Link: https://lore.kernel.org/r/20240227211833.1820800-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

+25
+25
drivers/rtc/rtc-pcf8523.c
··· 370 370 return regmap_write(pcf8523->regmap, PCF8523_REG_OFFSET, value); 371 371 } 372 372 373 + #ifdef CONFIG_PM_SLEEP 374 + static int pcf8523_suspend(struct device *dev) 375 + { 376 + struct i2c_client *client = to_i2c_client(dev); 377 + 378 + if (client->irq > 0 && device_may_wakeup(dev)) 379 + enable_irq_wake(client->irq); 380 + 381 + return 0; 382 + } 383 + 384 + static int pcf8523_resume(struct device *dev) 385 + { 386 + struct i2c_client *client = to_i2c_client(dev); 387 + 388 + if (client->irq > 0 && device_may_wakeup(dev)) 389 + disable_irq_wake(client->irq); 390 + 391 + return 0; 392 + } 393 + #endif 394 + 395 + static SIMPLE_DEV_PM_OPS(pcf8523_pm, pcf8523_suspend, pcf8523_resume); 396 + 373 397 static const struct rtc_class_ops pcf8523_rtc_ops = { 374 398 .read_time = pcf8523_rtc_read_time, 375 399 .set_time = pcf8523_rtc_set_time, ··· 511 487 .driver = { 512 488 .name = "rtc-pcf8523", 513 489 .of_match_table = pcf8523_of_match, 490 + .pm = &pcf8523_pm, 514 491 }, 515 492 .probe = pcf8523_probe, 516 493 .id_table = pcf8523_id,