Hi, @Terry
It’s work perfect on VIMs board only. It does not work on EDGE board.
How to go into deep sleep and ignore an active Bluetooth connection, playing music, and a network connection on EDGE?
Thank you!
Hi, @Terry
It’s work perfect on VIMs board only. It does not work on EDGE board.
How to go into deep sleep and ignore an active Bluetooth connection, playing music, and a network connection on EDGE?
Thank you!
@davemf
Edge android 10.0
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -205,6 +205,7 @@ static struct wakelock *wakelock_lookup_add(const char *name, size_t len,
int pm_wake_lock(const char *buf)
{
+#if 0
const char *str = buf;
struct wakelock *wl;
u64 timeout_ns = 0;
@@ -249,6 +250,8 @@ int pm_wake_lock(const char *buf)
out:
mutex_unlock(&wakelocks_lock);
return ret;
+#endif
+ return 0;
}
I can not use Linux-uart port, because it is disable after this changes
Some time EDGE go to deep sleep fast.
But usually it does not sleep.
And it has many messages: Could not find 'android.hardware.radio@1.1 Do you know what is the masseges? Why do you have not this massages?
Then you can restore it and catch log to find out the reason why you can’t sleep there.
Or send me your firmware for verification.
Please check my ROM https://cloud.mail.ru/public/kDmu/jM4Vc4KCT
Good! Thank you!
My boot.img was patched via magisk manager…
When does Boot.img build?
In this step or not?
$ cd PATH_YOUR_PROJECT $ cd u-boot $ make mrproper $ ./make.sh kedge
Yes, I mean not generate img file, I mean build source for boot.
Ok, It look like that magisk manager makes some changes, and after that EDGE can not go to deep sleep fast. I’ll chek it late.
Thank you!
Do you know, how to get root for EDGE without Magisk manager? Like VIMs board.
RKDocs/android/patches/box/rootservice_for_android10.rar
I deleted all my changes from u-boot and kernel, add only this change.
And checked kernel messages.
[ 39.491750] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 39.493445] done.
[ 39.494572] PM: suspend exit
[ 39.596158] PM: suspend entry (deep)
[ 39.596235] PM: Syncing filesystems ... done.
[ 39.838040] Freezing user space processes ... (elapsed 0.004 seconds) done.
[ 39.842897] OOM killer disabled.
[ 39.842952] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
[ 39.845994] Suspending console(s) (use no_console_suspend to debug)
INFO: sleep mode config[0xde]:
INFO: AP_PWROFF
INFO: SLP_ARMPD
INFO: SLP_PLLPD
INFO: DDR_RET
INFO: SLP_CENTER_PD
INFO: wakeup source config[0x804]:
INFO: GPIO interrupt can wakeup system
INFO: PWM interrupt can wakeup system
INFO: PWM CONFIG[0x4]:
INFO: PWM: PWM2D_REGULATOR_EN
INFO: APIOS info[0x0]:
INFO: not config
INFO: GPIO POWER INFO:
INFO: GPIO0_B5
INFO: GPIO1_B5
INFO: PMU_MODE_CONG: 0x1466bf51
after that sometime LED flash on EDGE board and terminal has this messages, but I didn’t push any buttons and USB power was disabled:
[ 45.620275] Suspending console(s) (use no_console_suspend to debug)
INFO: sleep mode config[0xde]:
INFO: AP_PWROFF
INFO: SLP_ARMPD
INFO: SLP_PLLPD
INFO: DDR_RET
INFO: SLP_CENTER_PD
INFO: wakeup source config[0x804]:
INFO: GPIO interrupt can wakeup system
INFO: PWM interrupt can wakeup system
INFO: PWM CONFIG[0x4]:
INFO: PWM: PWM2D_REGULATOR_EN
INFO: APIOS info[0x0]:
INFO: not config
INFO: GPIO POWER INFO:
INFO: GPIO0_B5
INFO: GPIO1_B5
INFO: PMU_MODE_CONG: 0x1466bf51
Then I pressed button to wake up.
[ 117.920995] PM: suspend entry (deep)
[ 117.921037] PM: Syncing filesystems ... done.
[ 117.927542] Freezing user space processes ... (elapsed 0.003 seconds) done.
[ 117.931219] OOM killer disabled.
[ 117.931227] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
[ 117.934105] Suspending console(s) (use no_console_suspend to debug)
INFO: sleep mode config[0xde]:
INFO: AP_PWROFF
INFO: SLP_ARMPD
INFO: SLP_PLLPD
INFO: DDR_RET
INFO: SLP_CENTER_PD
INFO: wakeup source config[0x804]:
INFO: GPIO interrupt can wakeup system
INFO: PWM interrupt can wakeup system
INFO: PWM CONFIG[0x4]:
INFO: PWM: PWM2D_REGULATOR_EN
INFO: APIOS info[0x0]:
INFO: not config
INFO: GPIO POWER INFO:
INFO: GPIO0_B5
INFO: GPIO1_B5
INFO: PMU_MODE_CONG: 0x1466bf51
INFO: RK3399 the wake up information:
INFO: wake up status: 0x4
INFO: GPIO interrupt wakeup
INFO: GPIO0: 0x0
INFO: GPIO1: 0x400000
INFO: GPIO2: 0x0
INFO: GPIO3: 0x0
INFO: GPIO4: 0x0
after that sometime LED flash on EDGE board and enable USB power.
Why does EDGE power up the USB?
When EDGE does not power off USB, USB mouse can wake up EDGE and it never sleep.
BUT SOME TIME, AFTER DEEP SLEEP, I WAKE UP BOARD. IT WAKE UP AND GO TO SLEEP AGAIN!
Why is it happened???
This is my new ROM with one change only.
davemf@i7-8700-64gb-ram:~/EDGE_Qt/kernel$ git diff diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c index 105df4d..ec8ecb9 100644 --- a/kernel/power/wakelock.c +++ b/kernel/power/wakelock.c @@ -205,6 +205,7 @@ static struct wakelock *wakelock_lookup_add(const char *name, size_t len, int pm_wake_lock(const char *buf) { +#if 0 const char *str = buf; struct wakelock *wl; u64 timeout_ns = 0; @@ -249,6 +250,8 @@ int pm_wake_lock(const char *buf) out: mutex_unlock(&wakelocks_lock); return ret; +#endif + return 0; } int pm_wake_unlock(const char *buf) davemf@i7-8700-64gb-ram:~/EDGE_Qt/kernel$ cd ../u-boot/ davemf@i7-8700-64gb-ram:~/EDGE_Qt/u-boot$ git status Not currently on any branch. nothing to commit, working directory clean davemf@i7-8700-64gb-ram:~/EDGE_Qt/u-boot$
Well, it’s not feasible to use this crude method. We have to use other methods. Where do you need to go into deep sleep? If it is a screen saver, do you need to enter deep sleep?
The deepsleep needs when I short press Power button only or XPWR Pads (like on VIMs).
After short press EDGE ignores an active Bluetooth connection, playing music, and a network connection, it go to deepsleep fast (1-2seconds) and power off USB ports.
This mechanism is realize on VIMs boards with this change. Need to realize it on EDGE too.
I have some comment about VIMs board. I use this change on all VIMs boards. And USB port is short enable (0.1sec) and disable again periodically. But it works fine.
Remove all the previous changes, and Make the following changes:
hlm@Server:/users/hlm/10_Edge_backup/kernel$ git diff
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 6bcb47d3..415dd7a1
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -594,11 +594,16 @@ static suspend_state_t decode_state(const char *buf, size_t n)
return PM_SUSPEND_ON;
}
+extern void release_whole_wake_lock(void);
static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t n)
{
suspend_state_t state;
int error;
+ if(strncmp(buf, "all_wake_unlock", 15) == 0){
+ release_whole_wake_lock();
+ return 1;
+ }
error = pm_autosleep_lock();
if (error)
diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index 105df4d..7b16763
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -286,3 +286,18 @@ int pm_wake_unlock(const char *buf)
mutex_unlock(&wakelocks_lock);
return ret;
}
+
+void release_whole_wake_lock(void)
+{
+ struct rb_node *node;
+ struct wakelock *wl;
+
+ for (node = rb_first(&wakelocks_tree); node; node = rb_next(node)) {
+ wl = rb_entry(node, struct wakelock, node);
+ if (wl->ws->active == true){
+ //printk("hlm wake lock =%s \n", wl->name);
+ pm_wake_unlock(wl->name);
+ }
+ }
+
+}
hlm@Server:/users/hlm/10_Edge_backup/frameworks/base$ git diff
diff --git a/core/java/android/os/PowerManager.java b/core/java/android/os/PowerManager.java
index 6e71f912..c6164b6
--- a/core/java/android/os/PowerManager.java
+++ b/core/java/android/os/PowerManager.java
@@ -37,6 +37,13 @@ import com.android.internal.util.Preconditions;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.concurrent.Executor;
+import java.io.IOException;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
/**
* This class gives you control of the power state of the device.
@@ -1070,6 +1077,14 @@ public final class PowerManager {
*/
@UnsupportedAppUsage
public void goToSleep(long time, int reason, int flags) {
+ try{
+ FileWriter fw = new FileWriter("/sys/power/state");
+ fw.write("all_wake_unlock");
+ fw.close();
+ } catch (IOException e){
+ Log.e(TAG, e.toString());
+ }
+
try {
mService.goToSleep(time, reason, flags);
I apply this changes and rebuilt kernel and android “make -jN”.
Sometime EDGE go to deepsleep fast (3-5 sec) and disable USB power, but sometime EDGE go to deepsleep not fast (20 sec) and does not disable USB power. When EDGE does not disable USB, I can touch USB mouse and it wakes up EDGE board without press power button and after that I try to press power button, but EDGE can not go to deepsleep.
No way. Did you plug in a USB connection to the computer for verification?
No, I plug in a AC-DC power supply.
Then you post the corresponding log。。。。。。。。
This is kernel log:
[ 36.455696] OOM killer disabled.
[ 36.455758] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done.
[ 36.458636] Suspending console(s) (use no_console_suspend to debug)
INFO: sleep mode config[0xde]:
INFO: AP_PWROFF
INFO: SLP_ARMPD
INFO: SLP_PLLPD
INFO: DDR_RET
INFO: SLP_CENTER_PD
INFO: wakeup source config[0x804]:
INFO: GPIO interrupt can wakeup system
INFO: PWM interrupt can wakeup system
INFO: PWM CONFIG[0x4]:
INFO: PWM: PWM2D_REGULATOR_EN
INFO: APIOS info[0x0]:
INFO: not config
INFO: GPIO POWER INFO:
INFO: GPIO0_B5
INFO: GPIO1_B5
INFO: PMU_MODE_CONG: 0x1466bf51
[ 88.419214] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 88.419305] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 88.420692] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 88.420774] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 88.588226] type=1400 audit(1597931063.090:123): avc: denied { ioctl } for comm="allocator@2.0-s" path="/dev/binder" dev="tmpfs" ino=19647 ioctlcmd=0x6201 scontext=u:r:hal_graphics_allocator_default:s0 tcontext=u:object_r:binder_device:s0 tclass=chr_file permissive=1
[ 88.588300] type=1400 audit(1597931063.603:124): avc: denied { getattr } for comm="ndroid.settings" path="/sys/devices/platform/pwm-fan/hwmon/hwmon1/enable" dev="sysfs" ino=22266 scontext=u:r:system_app:s0 tcontext=u:object_r:sysfs:s0 tclass=file permissive=1
[ 88.967264] PM: suspend entry (deep)
[ 88.967302] PM: Syncing filesystems ... done.
[ 88.986320] Freezing user space processes ...
[ 89.509914] cec-dw_hdmi: message 88 timed out
[ 91.167208] Freezing of tasks aborted after 2.180 seconds
[ 91.167363] OOM killer enabled.
[ 91.167463] Restarting tasks ... done.
[ 91.173790] PM: suspend exit
[ 91.176108] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 91.176236] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 91.621672] cec-dw_hdmi: message bb timed out
[ 92.176673] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 92.176807] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 93.178637] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 93.178764] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 93.733676] cec-dw_hdmi: message bb timed out
[ 93.822238] PM: suspend entry (deep)
[ 93.822256] PM: Syncing filesystems ... done.
[ 93.827235] Freezing user space processes ... (elapsed 0.003 seconds) done.
[ 93.830724] OOM killer disabled.
[ 93.830729] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 93.832464] Suspending console(s) (use no_console_suspend to debug)
INFO: sleep mode config[0xde]:
INFO: AP_PWROFF
INFO: SLP_ARMPD
INFO: SLP_PLLPD
INFO: DDR_RET
INFO: SLP_CENTER_PD
INFO: wakeup source config[0x804]:
INFO: GPIO interrupt can wakeup system
INFO: PWM interrupt can wakeup system
INFO: PWM CONFIG[0x4]:
INFO: PWM: PWM2D_REGULATOR_EN
INFO: APIOS info[0x0]:
INFO: not config
INFO: GPIO POWER INFO:
INFO: GPIO0_B5
INFO: GPIO1_B5
INFO: PMU_MODE_CONG: 0x1466bf51
[ 102.873574] PM: Syncing filesystems ... done.
[ 102.926216] Freezing user space processes ...
[ 102.927087] Freezing of tasks aborted after 0.000 seconds
[ 102.927095] OOM killer enabled.
[ 102.927100] Restarting tasks ... done.
[ 102.957154] PM: suspend exit
[ 103.271654] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 103.271890] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 103.827789] sensors 7-0068: set sensor poll time to 66ms
[ 103.903511] sensors 7-0068: sensor on: starting poll sensor data 62ms
[ 103.922887] rockchip-vop ff8f0000.vop: [drm:vop_crtc_atomic_enable] Update mode to 1088x1920p47, type: 16
[ 103.923064] rockchip-vop ff900000.vop: [drm:vop_crtc_atomic_enable] Update mode to 1920x1080p60, type: 11
[ 103.952598] dw-mipi-dsi ff960000.dsi: [drm:dw_mipi_dsi_encoder_enable] final DSI-Link bandwidth: 996 x 4 Mbps
[ 104.268710] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 104.268761] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 104.293394] cec-dw_hdmi: message 88 timed out
[ 104.740489] rockchip-vop ff8f0000.vop: [drm:vop_crtc_atomic_enable] Update mode to 1088x1920p47, type: 16
[ 104.740810] dw-mipi-dsi ff960000.dsi: [drm:dw_mipi_dsi_encoder_enable] final DSI-Link bandwidth: 996 x 4 Mbps
[ 105.269871] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 105.269960] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 106.272632] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 106.272812] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 106.405619] cec-dw_hdmi: message 88 timed out
[ 107.273555] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 107.273648] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 108.275826] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 108.276002] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 108.517704] cec-dw_hdmi: message bb timed out
[ 109.277023] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 109.277120] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 216.596050] PM: Syncing filesystems ... done.
[ 216.598420] Freezing user space processes ... (elapsed 0.005 seconds) done.
[ 216.603556] OOM killer disabled.
[ 216.603576] Freezing remaining freezable tasks ... (elapsed 0.003 seconds) done.
[ 216.607164] Suspending console(s) (use no_console_suspend to debug)
INFO: sleep mode config[0xde]:
INFO: AP_PWROFF
INFO: SLP_ARMPD
INFO: SLP_PLLPD
INFO: DDR_RET
INFO: SLP_CENTER_PD
INFO: wakeup source config[0x804]:
INFO: GPIO interrupt can wakeup system
INFO: PWM interrupt can wakeup system
INFO: PWM CONFIG[0x4]:
INFO: PWM: PWM2D_REGULATOR_EN
INFO: APIOS info[0x0]:
INFO: not config
INFO: GPIO POWER INFO:
INFO: GPIO0_B5
INFO: GPIO1_B5
INFO: PMU_MODE_CONG: 0x1466bf51
[ 235.907613] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 236.522746] PM: suspend entry (deep)
[ 236.522820] PM: Syncing filesystems ... done.
[ 236.529240] Freezing user space processes ...
[ 236.837857] cec-dw_hdmi: message 44 timed out
[ 238.949602] cec-dw_hdmi: message 44 timed out
[ 241.061600] cec-dw_hdmi: message 88 timed out
[ 241.637543] Freezing of tasks aborted after 5.108 seconds
[ 241.637700] OOM killer enabled.
[ 241.637767] Restarting tasks ...
[ 241.648020] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 241.648323] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 241.653240] done.
[ 241.653523] PM: suspend exit
[ 241.855029] PM: suspend entry (deep)
[ 241.855115] PM: Syncing filesystems ... done.
[ 241.858286] Freezing user space processes ...
[ 243.173325] cec-dw_hdmi: message 88 timed out
[ 245.022015] Freezing of tasks aborted after 3.163 seconds
[ 245.022099] OOM killer enabled.
[ 245.022115] Restarting tasks ... done.
[ 245.025870] PM: suspend exit
[ 245.032312] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 245.032497] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 245.285590] cec-dw_hdmi: message bb timed out
[ 246.032765] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 246.032951] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 247.035345] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 247.035527] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 247.397578] cec-dw_hdmi: message bb timed out
[ 248.037407] init: Received control message 'interface_start' for 'android.hardware.radio@1.1::IRadio/slot1' from pid: 153 (/system/bin/hwservicemanager)
[ 248.037593] init: Could not find 'android.hardware.radio@1.1::IRadio/slot1' for ctl.interface_start
[ 249.039753] init: Received control message 'interface_start' for 'a
EDGE turn on usb power and off again periodically.
Please post the corresponding log。。。。。。。。
LOG....