2013年8月28日 星期三

[Hi3716c] Fix IR power key wake up mechanism

Some files worth noticing...
* device/hisilicon/godbox/driver/sdk/msp/ecs/drv/ir/ir_s2/ir_drv.c
IR driver. It handles IRQ.

* device/hisilicon/godbox/driver/sdk/msp_base/ecs/drv/include/ir.h
 IRQ no of IR is defined here

* kernel/arch/arm/mach-godbox/include/mach/irqs.h
Some IRQs are defined here

* device/hisilicon/godbox/driver/sdk/msp/ecs/drv/ir/ir_s2/hiir_ir2.h
Handles raw-linux_key_code mapping and works as API for the IR driver

* device/hisilicon/godbox/driver/sdk/sample/pmoc/sample_pmoc.c
A sample code to test IR and other ways to wake up the device

* device/hisilicon/godbox/driver/sdk/msp/ecs/drv/c51/drv_c51.c
MCU driver. MCU handles wake-up job after cpu power is down. The IR module decodes the infrared signals and then sends interrupts to MCU

* device/hisilicon/godbox/driver/sdk/msp/ecs/api/hi_unf_pm.c
A wrapped API to access MCU driver

* framework/base/core/jni/standby_wakeup.c
Hooked to the underlying HI_UNF_PM MCU driver wrapper APIs. It actually sets wake-up mode a particular power key code

* framework/base/service/jni/com_android_server_AlarmManagerService.cpp
android_server_AlarmManagerService_setWakeUp() body is here, which calls HI_Standby_Wakeup() in standby_wakeup.c

* framework/base/service/jni/com_android_server_PowerManagerService.cpp
android_server_PowerManagerService_nativeSetWakeup() body is here, which calls  android_server_AlarmManagerService_setWakeUp() in com_android_server_AlarmManagerService.cpp

* framework/base/services/java/com/android/server/PowerManagerService.java
goToSleep() body is here, which calls nativeSetWakeup() defined in com_android_server_PowerManagerService.cpp, which points to  android_server_PowerManagerService_nativeSetWakeup()

What happens when a power key is detected for standby mode to proceed to set the wake-up key attribute from the point of view of Android:

interceptKeyBeforeQueueing(), frameworks/base/services/jni/com_android_server_InputManager.cpp
 |
V
interceptKeyBeforeQueueing(), frameworks/base/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
 |
V
handleInterceptActions(), frameworks/base/services/jni/com_android_server_InputManager.cpp
 |
V
goToSleep(), framework/base/services/java/com/android/server/PowerManagerService.java
 |
V
nativeSetWakeup(),  framework/base/service/jni/com_android_server_PowerManagerService.cpp
 |
V
android_server_AlarmManagerService_setWakeUp(),  framework/base/service/jni/com_android_server_AlarmManagerService.cpp
 |
V
HI_Standby_Wakeup(),  framework/base/core/jni/standby_wakeup.c

Related shell commands...
* Trigger standby mode
echo MODE > /sys/power/state
MODE: on, standby, mem

* Test standby/wakeup functions
sample_pmoc

The fix:
Modify the wake-up value from 0x639cff00 to 0xfd024db2 in  HI_Standby_Wakeup().


沒有留言:

張貼留言