linux-yocto/drivers/base/power
Charan Teja Kalla 1f152ae557 PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn()
[ Upstream commit 40d3b40dce ]

pm_runtime_put_autosuspend() schedules a hrtimer to expire
at "dev->power.timer_expires". If the hrtimer's callback,
pm_suspend_timer_fn(), observes that the current time equals
"dev->power.timer_expires", it unexpectedly bails out instead of
proceeding with runtime suspend.

pm_suspend_timer_fn():

 if (expires > 0 && expires < ktime_get_mono_fast_ns()) {
 	dev->power.timer_expires = 0;
 	rpm_suspend(..)
 }

Additionally, as ->timer_expires is not cleared, all the future auto
suspend requests will not schedule hrtimer to perform auto suspend.

rpm_suspend():

 if ((rpmflags & RPM_AUTO) &&...) {
 	if (!(dev->power.timer_expires && ...) { <-- this will fail.
 		hrtimer_start_range_ns(&dev->power.suspend_timer,...);
 	}
 }

Fix this by as well checking if current time reaches the set expiration.

Co-developed-by: Patrick Daly <quic_pdaly@quicinc.com>
Signed-off-by: Patrick Daly <quic_pdaly@quicinc.com>
Signed-off-by: Charan Teja Kalla <quic_charante@quicinc.com>
Link: https://patch.msgid.link/20250515064125.1211561-1-quic_charante@quicinc.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:11:28 +01:00
..
clock_ops.c PM: clk: make pm_clk_add_notifier() take a const pointer 2024-01-04 14:35:57 +01:00
common.c PM: domains: Fix alloc/free in dev_pm_domain_attach|detach_list() 2024-10-10 13:55:17 +02:00
generic_ops.c
main.c PM: sleep: Fix power.is_suspended cleanup for direct-complete devices 2025-06-19 15:32:18 +02:00
Makefile PM: domains: Move genpd and its governor to the pmdomain subsystem 2023-12-18 12:49:48 +01:00
power.h
qos-test.c
qos.c PM: QoS: Use kcalloc() instead of kzalloc() 2024-01-09 14:55:49 +01:00
runtime.c PM: runtime: fix denying of auto suspend in pm_suspend_timer_fn() 2025-06-27 11:11:28 +01:00
sysfs.c
trace.c rtc: Extend timeout for waiting for UIP to clear to 1s 2023-12-17 22:33:55 +01:00
wakeirq.c PM: sleep: wakeirq: fix wake irq warning in system suspend 2024-03-05 12:39:05 +01:00
wakeup_stats.c
wakeup.c PM: wakeup: make device_wakeup_disable() return void 2024-04-03 16:51:37 +02:00