Linux-Suspend-to-Ram【Sleep,S3】

S3:suspend to ram


基于Linux-3.16.0内核

(1)进出S3的脉络

state_store
    pm_suspend
        enter_state
            suspend_devices_and_enter
                suspend_enter
                    /*suspend_ops为acpi_suspend_ops_old or acpi_suspend_ops
                     *当有中断或者其他时间唤醒时,才会从该callback返回,继续执行后面的code
                     */
                    error = suspend_ops->enter(state);
                    syscore_resume
                    ...
                    

(2)suspend_ops的初始化,最终会初始化为acpi_suspend_ops_old /acpi_suspend_ops

acpi_init
    acpi_bus_init
        acpi_sleep_init
            acpi_sleep_suspend_setup
                suspend_set_ops(old_suspend_ordering ?&acpi_suspend_ops_old : &acpi_suspend_ops);

static const struct platform_suspend_ops acpi_suspend_ops = {
.valid = acpi_suspend_state_valid,
.begin = acpi_suspend_begin,
.prepare_late = acpi_pm_prepare,
.enter = acpi_suspend_enter,
.wake = acpi_pm_finish,
.end = acpi_pm_end,

};

static const struct platform_suspend_ops acpi_suspend_ops_old = {
.valid = acpi_suspend_state_valid,
.begin = acpi_suspend_begin_old,
.prepare_late = acpi_pm_pre_suspend,
.enter = acpi_suspend_enter,
.wake = acpi_pm_finish,
.end = acpi_pm_end,
.recover = acpi_pm_finish,
};

你可能感兴趣的:(Linux)