by b47504
Overview
This document is intended to introduce debug tips about i.MX power management based on i.MX Android software. The following topics are involved in this document:
Power management options --->
[*] Power Management Debug Support
[*] Extra PM attributes in sysfs for low-level debugging/testing
root@android:/ # echo 15 > /sys/module/wakelock/parameters/debug_mask
root@android:/ # echo 15 > /sys/module/userwakelock/parameters/debug_mask
root@sabresd_6dq:/ # echo 15 > /sys/module/earlysuspend/parameters/debug_mask
This makes the system print more useful info before entry in suspend
Eg:
--- a/sabresd_6dq/BoardConfig.mk
+++ b/sabresd_6dq/BoardConfig.mk
-BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off fbmem=10M fb0base=0x27b00000 vmalloc=400M androidboot.console=ttymxc0 androidboot.hardware=freescale
+BOARD_KERNEL_CMDLINE := console=ttymxc0,115200 init=/init video=mxcfb0:dev=ldb,bpp=32 video=mxcfb1:off video=mxcfb2:off fbmem=10M fb0base=0x27b00000 vmalloc=400M androidboot.console=ttymxc0 androidboot.hardware=freescale no_console_suspend=1
§ Whether the usb cable has been removed(usb gadget will hold a wake lock)
§ Setting->Display->Sleep, check whether the inactivity timeout period setting is longer than your expected time.
§ Setting->System->Developer options->stay awake(stay awake not be set), check whether the option is disabled
root@sabresd_6dq:/ # cat /sys/power/wake_lock
System use PMIC_STBY_REQ signal to notify power management IC to change voltage from standby voltage to functional voltage and vice versa. In general, pmic_stby_req pin is connected to pmic standby pin. So measure the pin to check whether the de-assert signal is triggered.
If the signal is not triggered, we may consider whether wake-up sources are correctly setup. If the signal is triggered, we may double-check whether the pmic supply power normally.
And not limited to the two points, we should also double-check everything we doubt according to the system log and hardware measured waves.
Please view trace32 website to get more details.
Track "state" value and try to map to different the low power mode via function mxc_cpu_lp_set.
Check "mx6_suspend.S" which conduct the detailed operations in suspend:
Ram console will keep one kernel log copy into one certain memory space. You can use the following command to check last time kernel log, if memory power was not cut off during the reboot process.
Eg(if it is the first time boot, you cannot find the /proc/last_kmsg file):
root@sabresd_6dq:/ # cat /proc/last_kmsg
Use getevent/sendevent tool to get power key scan code
#getevent
Correct the Keylayout file
system/usr/keylayout/****.kl
Correct the scandcode with your power key report value to Match the POWE key
We can print the specific module name and time consume details, if the module's suspend/resume time consume more than the threshold parameter by read/write /sys/power/device_suspend_time_threshold file. By default, the parameter is setup to 0, via disabled the function. We can enable it by the following command:
Eg:
root@android:/ # echo 10 > /sys/power/device_suspend_time_threshold
This command means that if the module's suspend/resume time consume more than 10 us, the system will print the module's detail out. If you want to know the more details how to implement it on kernel, please check kernel/power/main.c
Notes:
Can use the shell command to enter different system level low power modes for debug (For more details: you can check Linux_6DQ_RM.pdf):
#echo mem > /sys/power/state
#echo standby > /sys/power/state
root@android:/ # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
root@android:/ # cat /sys/devices/platform/imx_busfreq.0/enable
More details about this, please refer to "Documentation/cpu-freq/ governors.txt” .
For MX6Q:
root@android:/ # cat /sys/kernel/debug/clock/osc_clk/pll2_528_bus_main_clk/periph_clk/mmdc_ch0_axi_clk/rate
root@android:/ # cat /proc/interrupts
Through this command you can check whether some module will trigger interrupt frequently. And consider that whether we have some chances to reduce the interrupt count.
root@android:/ # powerdebug -d -c
Default gpu3DMaxClock is set to 64 in init.rc file, we can tuning a suitable value by ourselves.
diff --git a/imx6/etc/init.rc b/imx6/etc/init.rc
index 8c420b5..eb11ffe 100755
--- a/imx6/etc/init.rc
+++ b/imx6/etc/init.rc
@@ -397,6 +397,9 @@ on boot
# Set GPU 3D minimum clock to 3/64
write /sys/module/galcore/parameters/gpu3DMinClock 3
+# Set GPU 3D maximum clock to 64/64
+ write /sys/module/galcore/parameters/gpu3DMaxClock 64
+
Add debug message in device drivers which may lead high power consumption, catch the waveform from these modules which may impact the high power consumption
Hi,Yuan Zhao
Could you update these tips for Android 5.0+?
Because some tips cannot suitable for it. For example, I cannot find the /proc/wakelocks, the content of wakelock.c has changed.
Thank you !
Yes ~ I also want to know
Thanks.