Skip to content

Commit 7602c0e

Browse files
konradybcioarndb
authored andcommitted
firmware: psci: Set pm_set_resume/suspend_via_firmware() for SYSTEM_SUSPEND
PSCI specification defines the SYSTEM_SUSPEND feature which enables the firmware to implement the suspend to RAM (S2RAM) functionality by transitioning the system to a deeper low power state. When the system enters such state, the power to the peripheral devices might be removed. So the respective device drivers must prepare for the possible removal of the power by performing actions such as shutting down or resetting the device in their system suspend callbacks. The Linux PM framework allows the platform drivers to convey this info to device drivers by calling the pm_set_suspend_via_firmware() and pm_set_resume_via_firmware() APIs. Hence, if the PSCI firmware supports SYSTEM_SUSPEND feature, call the above mentioned APIs in the psci_system_suspend_begin() and psci_system_suspend_enter() callbacks. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> [mani: reworded the description to be more elaborative] Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Lorenzo Pieralisi <lpieralisi@kernel.org> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent d1f29ea commit 7602c0e

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

drivers/firmware/psci/psci.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,12 +539,22 @@ static int psci_system_suspend(unsigned long unused)
539539

540540
static int psci_system_suspend_enter(suspend_state_t state)
541541
{
542+
pm_set_resume_via_firmware();
543+
542544
return cpu_suspend(0, psci_system_suspend);
543545
}
544546

547+
static int psci_system_suspend_begin(suspend_state_t state)
548+
{
549+
pm_set_suspend_via_firmware();
550+
551+
return 0;
552+
}
553+
545554
static const struct platform_suspend_ops psci_suspend_ops = {
546555
.valid = suspend_valid_only_mem,
547556
.enter = psci_system_suspend_enter,
557+
.begin = psci_system_suspend_begin,
548558
};
549559

550560
static void __init psci_init_system_reset2(void)

0 commit comments

Comments
 (0)