MTK 驱动开发(39 )---待机流程

MTK kernel待机流程

 

echomem > /sys/power/state              [android层调用节点]

 state_store()                          [kernel/power/main.c]

1|↘pm_suspend()     [PM: suspend entry 2016-02-22…年月日UTC] 进入suspend时间

2|↘enter_state()  

2.1∣↘suspend_syssync_enqueue()        [PM:syncyingfile systems …done]

2.2∣↘suspend_prepare()                  [alluser serves suspend here]

    2.2.1∣↘pm_prepare_console()

    2.2.2∣↘pm_notifier_call_chain()      [PM_SUSPEND_PREPARE:start]

    2.2.3∣↘suspend_freeze_processes()

       2.2.3.1∣↘freeze_proceses()      [Freezing user spaceprocesses…]

       2.2.3.2∣↘freeze_kernel_threads()[Freezing remaining freezable…]

2.3∣↘suspend_devices_and_enter()        //allextern devices supend here

        2.3.1∣↘platform_suspend_begin()

    2.3.2∣↘suspend_console()       [Suspendingconsole(s) (use no_console_suspend to debug)]关闭串口

    2.3.3∣↘dpm_suspend_start()

        2.3.3.1∣↘dpm_suspend()  [PM:suspend of devices complete after…]

   2.3.4∣↘suspend_enter()      

            2.3.4.1∣↘platform_suspend_prepare()

2.3.4.2∣↘dpm_suspend_late()               [PM:late suspend of…]

            2.3.4.3∣↘platform_suspend_prepare_late() 

        2.3.4.4∣↘dpm_suspend_noirq()      [PM:noirq suspend of禁止中断]

2.3.4.5∣platform_suspend_prepare_noirq()

2.3.4.5.1∣↘suspend_ops->prepare_late()   //准备待机,进行检查

       2.3.4.6∣↘disable_nonboot_cpus()        [Disabling non-boot CPUs…]

       2.3.4.7∣↘arch_suspend_disable_iqrs()

       2.3.4.8∣↘syscore_suspend()

       2.3.4.9∣↘suspend_ops->enter()        //真正待机

          

接着是唤醒流程

1 suspend_enter()

1.1∣↘syscore_resume()

1.3∣↘arch_suspend_enable_iqrs()              [打开中断]

1.4∣↘enable_nonboot_cpus()                   [Enabling non-boot CPUs ...]

1.5∣↘platform_resume_noirq()

1.5.1∣↘suspend_ops->wake()              //准备唤醒,进行检查

  1.5∣↘dpm_resume_noirq()                [PM: noirq resume ofdevices… ]

1.6∣↘dpm_resume_early()                [PM:early resume of devices…]

1.7∣↘platform_resume_finish()

1.7.1∣↘suspend_ops->finish()

2∣↘suspend_devices_and_enter()

2.1∣↘suspend_ops->again()                [all extern devices supend here…]


2.2∣↘dpm_resume_end()             [PM:resume of devices complete…]

2.3∣↘resume_console()

3∣↘enter_state()

3.1∣↘suspend_finish()             [解冻进程和服务]

4∣↘pm_suspend()                     [PM: suspend exit…]

 

 

大体框架如下:

 

待机

1|↘pm_suspend()                           

2|↘enter_state()  [冻结用户态进程和内核态任务]

2.3∣↘suspend_devices_and_enter()  [调用外设(非系统设备)的suspend的回调函数]

2.3.4∣↘suspend_enter()[按照注册顺序休眠核心设备和使CPU进入休眠态。]

唤醒

1 suspend_enter()

2∣↘suspend_devices_and_enter()

3∣↘enter_state()

4∣↘pm_suspend()

 

由此可见,睡眠与唤醒的过程是对称的, 睡眠走了多少步,退出睡眠的过程一步不能少的唤醒,类似一种“回滚”过程。


你可能感兴趣的:(MTK,驱动)