[MTK] 如何调整模块earlySuspend/lateResume的顺序

文摘 MediaTek 2020-05-21 阅读:1668

[DESCRIPTION]

有些情况下,因为一些模块在earlySuspend时的特殊操作,而导致另外一些模块在earlySuspend/lateResume后无法工作,

比如常见的CTP跟MEMs Sensor如果公用一个I2C port,经常会有一些冲突;

调整earlySuspend/lateResume的顺序可以解决类似的问题

[SOLUTION]

earlySuspend跟lateResume的顺序是关联的,简单地说先执行earlySuspend的模块,必然后执行lateResume;

类似于堆栈,先进后出;这个顺序是在模块驱动代码中注册earlySuspend函数时传入的:


obj->early_drv.level = EARLY_SUSPEND_LEVEL_DISABLE_FB-1,

obj->early_drv.suspend = xxx_early_suspend,       

obj->early_drv.resume =xxx_late_resume,

register_early_suspend(&obj->early_drv),


这里的level值就决定了该模块在earlySuspend/lateResume执行中的顺序

earlySuspend的执行顺序是 low level ---> high level

lateResume 的执行顺序是 high level ---> low level

EarlySuspend.h中定义了几个宏作为基准,主要依据是屏幕的状态;

其他的模块可以参照这些基准值自行决定,一般来说,跟屏幕显示有关的,都要放到EARLY_SUSPEND_LEVEL_DISABLE_FB之前


enum {

    EARLY_SUSPEND_LEVEL_BLACK_SCREEN = 50,

     EARLY_SUSPEND_LEVEL_STOP_DRAWING = 100,

    EARLY_SUSPEND_LEVEL_DISABLE_FB =150,

};




0条评论

© 2020 芯缘异码. Powered by Typecho