pm_runtime

Early suspend mechanism is totally replaced by the concept of pm_runtime. 
Theusage is totally changed.
Difference: Early suspend is totally controlled by kernel, while pm_runtimeexports interface to user space, and let user space to decide when device is ready to enter lower power mode.
When you try to implement early suspend in your driver, you need to modify codenot only in BSP Level, but also in Android Level. 

 How to use pm_runtime in your driver?
1.      Initial the instance



2.      Enable the device’s pm_runtime

 What’s done in Android Level?
Below is MRVL’s current implement. Only four devices are controlled by Android, which replace early suspend mechanism.they are Touch, LCD, GC and FM.
Source code patch:[hardware/libhardware/modules/power/power.c] 
28 #definePM_TOUCH_CONTROL"/sys/bus/i2c/devices/2-0039/power/control"                                                                                                
29 #define PM_TOUCH_STATE"/sys/bus/i2c/devices/2-0039/power/runtime_status"                                                                                           
30                                                                                                                                                                     
31 #definePM_LCD_CONTROL"/sys/devices/platform/pxa168-fb.0/power/control"                                                                                            
32 #define PM_LCD_STATE"/sys/devices/platform/pxa168-fb.0/power/runtime_status"                                                                                       
33                                                                                                                                                                     
34 #definePM_LCD1_CONTROL"/sys/devices/platform/pxa168-fb.1/power/control"                                                                                          
 35 #define PM_LCD1_STATE"/sys/devices/platform/pxa168-fb.1/power/runtime_status"                                                                                     
 36                                                                                                                                                                     
37 #definePM_GC_CONTROL"/sys/devices/platform/galcore/power/control"                                                                                                 
38 #define PM_GC_STATE"/sys/devices/platform/galcore/power/runtime_status"                                                                                           
 39                                                                                                                                                                    
 40 #definePM_FM_CONTROL"/sys/devices/platform/mrvl8xxx_fm.0/power/control"                                                                                           
41 #define PM_FM_STATE"/sys/devices/platform/mrvl8xxx_fm.0/power/runtime_status"   

Example
When you        
 # echoauto>/sys/devices/platform/pxa168-fb.0/power/control
LCD will call runtime_suspend();
When you         
#echoon> /sys/devices/platform/pxa168-fb.0/power/control
LCD will call runtime_resume

 

你可能感兴趣的:(android,linux)