顯示具有 Hi3716c 標籤的文章。 顯示所有文章
顯示具有 Hi3716c 標籤的文章。 顯示所有文章

2013年9月16日 星期一

[hi3716c] Add custom prop file

build/core/Makefile
Add:
(1)
# -----------------------------------------------------------------
# gemtek.prop
INSTALLED_GTK_PROP_TARGET := $(TARGET_ROOT_OUT)/gemtek_default.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_GTK_PROP_TARGET)

$(INSTALLED_GTK_PROP_TARGET):
        @echo Target buildinfo: $@
        @mkdir -p $(dir $@)
        $(hide) echo "#Gemtek-defined properties" > $@;
        build/tools/post_process_props.py $@

(2)
cat $(INSTALLED_GTK_PROP_TARGET) > $(TARGET_RECOVERY_ROOT_OUT)/gemtek_default.prop

build/CleanSpec.mk
Add:
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/gemtek_default.prop)

build/tools/post_process_props.py
Add:
(1)
 Put the modifications that you need to make into the /data/gemtek.prop into this
# function. The prop object has get(name) and put(name,value) methods.
def mangle_gtk_prop(prop):
    prop.put("hotkey0", "com.android.settings")
    prop.put("hotkey1", "com.android.settings")
    prop.put("hotkey2", "com.android.settings")
    prop.put("hotkey3", "com.android.settings")
    prop.put("hotkey4", "com.android.settings")
    prop.put("hotkey5", "com.android.settings")
    prop.put("hotkey6", "com.android.settings")
    prop.put("hotkey7", "com.android.settings")

(2)
elif filename.endswith("/gemtek_default.prop"):
    mangle_gtk_prop(properties)


Then check it in init.rc and copy the gemtek_default.prop to /data if gemtek.prop doesn't exist.
gemtek.prop is the copy that user could modify on.

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().