Suspend - Resume in Hikey960 platform

How to put hikey 960 platform in suspend mode, similar to phones by pressing power button?
Is there any software/hardware option to put hikey960 board in suspend mode?

I tried ‘rtcwake’ and ‘input keyevent’ method, both are not working.

rtcwake -m mem -s 20
Error - rtcwake: write short

input keyevent POWER

  • No effect.

Can someone please guide on this.

Hi,

  • I usually use RTC as waken up source, so use below command for testing suspend/resume
    echo +10 > /sys/class/rtc/rtc0/wakealarm; echo mem > /sys/power/state

  • Currently hikey960 doesn’t support suspend/resume flow. I can see the system can enter into suspend state, but it cannot be waken up. The main reason is Hikey960 has not configured waken up source properly (like Watchdog, timer, GPIO, etc)

  • There have another block issue is: all peripheral device drivers should support suspend/resume state, otherwise they also introduce the hang issue for suspend/resume.

BTW, I found RTC has permission issue, will check later. FYI.

Thanks leo-yan, will try echo +10 > /sys/class/rtc/rtc0/wakealarm; echo mem > /sys/power/state and let you know.

I could not see hikey960 entering into suspend state. How did you see the system can enter into suspend state?

when I enter “cat /sys/power/state”, nothings could be shown.
Also, there is no effect when entering “echo mem>/sys/power/state” or “echo standby>/sys/power/state” or “echo freeze>/sys/power/state”.

When I traced this kernel, no one call “suspend_set_ops” to init the pm_states.

How could I enter suspend and resume operations on HiKey960?

This is info from my side:

hikey960:/ # cat /sys/power/state
freeze mem
hikey960:/ #

I am using Android 4.4 kernel. Please note, so far, the suspend flow is partially enabled, there have hooked function in ARM-TF PSCI for suspend; but the suspend/resume flow doesn’t work due we now have not supported waken up source configuration, so I log one bug for tracking: https://bugs.96boards.org/show_bug.cgi?id=550

I am also using Android 4.4 kernel which is built from source as below

https://source.android.com/source/devices#hikey960
$ git clone kernel/hikey-linaro - Git at Google
$ cd hikey-linaro
$ git checkout -b android-hikey-linaro-4.4 origin/android-hikey-linaro-4.4
$ make ARCH=arm64 hikey960_defconfig
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-android- -j24

I also tried to use the built image at http://builds.96boards.org/snapshots/hikey960/linaro/aosp-master/latest/hikey960-img-191.zip

Unfortunately, it outputs nothings when “cat /sys/power/state”. How did you build your Android 4.4 kernel?

Thanks for your config file (kenrel version is 4.4.74 ) but I still could not build a kernel without this suspend issue. I tried both kernel version 4.4.66 and 4.4.76 without any modifications.

Could you try to use the pre-built image at http://builds.96boards.org/snapshots/hikey960/linaro/aosp-master/latest/hikey960-img-191.zip? Using this pre-built image, could you repeat the issue I encoutered?

Ah, I missed one important thing is: I suppose you are using default boot images from Hisilicon, so the legacy ARM-TF doesn’t support system suspend/resume callback for PSCI.

The difference between our two sides is I am using UEFI+ARM-TF as booting images, in the latest open source ARM-TF we have supported PSCI for system level: https://github.com/ARM-software/arm-trusted-firmware/blob/master/plat/hisilicon/hikey960/hikey960_pm.c#L225

Be honest, so far the suspend/resume functionality is not ready, so I don’t think it’s deserved to ask you to switch to UEFI+ARM-TF booting images, usually this will take 1~2 hours to familiar the booting images to burn related images: https://github.com/96boards-hikey/tools-images-hikey960/blob/master/build-from-source/README-ATF-UEFI-build-from-source.md

I followed “README-ATF-UEFI-build-from-source.md” and could built image and setup console at ttyUSB0. However, when I plugged-in USB in my Ubuntu. It could not install its driver correctly. I could not observe it via lsusb commands.

Therefore, I could not executed “sudo ./hikey_idt -c config -p /dev/ttyUSB1”

I could observe message “The connection for the USB device ‘Huawei USB SER’ was unsuccessful”

Do I need to install specified driver from Huawei? If yes, could you share the link for my download? Thanks!

I followed “README-ATF-UEFI-build-from-source.md” and could built image and setup console at ttyUSB0. However, when I plugged-in USB in my Ubuntu. It could not install its driver correctly. I could not observe it via lsusb commands.

Have you change the Link3-4 / switch 2 on the back of board? http://www.96boards.org/documentation/ConsumerEdition/HiKey960/GettingStarted/

Therefore, I could not executed “sudo ./hikey_idt -c config -p /dev/ttyUSB1”

hikey_idt has to work when board is in recovery mode.

I could observe message “The connection for the USB device ‘Huawei USB SER’ was unsuccessful”

leoy@leoy-ThinkPad-T440:~/work3/android-common-kernel$ lsusb
Bus 002 Device 067: ID 12d1:3609 Huawei Technologies Co., Ltd.

Do I need to install specified driver from Huawei? If yes, could you share the link for my download?

Usually we don’t need any specific driver. But before we found on old Ubuntu release (8.x), ubuntu doesn’t automatically create USB device node. So need manually input below commands to create device node, but this doesn’t happen with latest Ubuntu version.

After enter the force download mode, if Ubuntu PC cannot recognize the
device ttyUSBx; this issue can be fixed by input below commands:
sudo echo 12D1 3609 > /sys/bus/usb-serial/drivers/option1/new_id
sudo makenod /dev/ttyUSB1 c 188 0

1.Yes, I already changed to recovery mode by switch 2. Actually, my WIN7 also prompt USB SER but “unknown driver”. It VID is 12d1 and PID is 3609 as you mentioned.
2. My Ubuntu is 14.04
3. I could not observe folder /sys/bus/usb-serial. Therefore, I could not execute “sudo echo 12D1 3609 > /sys/bus/usb-serial/drivers/option1/new_id” and makenod

Could you check dmesg at your side?

leoy@leoy-ThinkPad-T440:~/work3/android-common-kernel$ sudo dmesg -c
[1346251.761871] usb 2-1.4: USB disconnect, device number 69
[1346251.762138] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
[1346251.762154] option 2-1.4:1.0: device disconnected
[1346252.057616] usb 2-1.4: new full-speed USB device number 70 using xhci_hcd
[1346252.147752] usb 2-1.4: New USB device found, idVendor=12d1, idProduct=3609
[1346252.147757] usb 2-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[1346252.147760] usb 2-1.4: Product: USB SER
[1346252.147762] usb 2-1.4: Manufacturer: HISILICON
[1346252.148803] option 2-1.4:1.0: GSM modem (1-port) converter detected
[1346252.148949] usb 2-1.4: GSM modem (1-port) converter now attached to ttyUSB1

When I plug-in USB cable during recovery mode, nothings output from dmesg.

BTW, when I plug-in console (i.e. UART->USB for ttyUSB0), I could get the following dmesg
[ 406.158913] usb 2-2.1: new full-speed USB device number 4 using uhci_hcd
[ 406.466470] usb 2-2.1: New USB device found, idVendor=0403, idProduct=6015
[ 406.466473] usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 406.466474] usb 2-2.1: Product: FT230X Basic UART
[ 406.466475] usb 2-2.1: Manufacturer: FTDI
[ 406.466476] usb 2-2.1: SerialNumber: DA014TD1
[ 406.527104] usbcore: registered new interface driver usbserial
[ 406.527111] usbcore: registered new interface driver usbserial_generic
[ 406.527117] usbserial: USB Serial support registered for generic
[ 406.533918] usbcore: registered new interface driver ftdi_sio
[ 406.533953] usbserial: USB Serial support registered for FTDI USB Serial Device
[ 406.533977] ftdi_sio 2-2.1:1.0: FTDI USB Serial Device converter detected
[ 406.534009] usb 2-2.1: Detected FT-X
[ 406.539353] usb 2-2.1: FTDI USB Serial Device converter now attached to ttyUSB0

Sounds like you’re using virtual linux in windows host, right?
Usually that’s not recommended exactly because of issues like the one you’re facing right now. Most of the time windows cannot recognize the console and/or usb connection, so the virtual linux will not be able to ‘see’ it too.
In your case, it seems like the console connection is ok, which is good. For the usb connection, do you see an unrecognized device in Device Manager? If so, try installing a driver for it using the google usb driver - Get the Google USB Driver  |  Android Developers.

Yes, I am using VMWare in WIN7.
However, I still could not find the approximate USB driver from Google USB driver as shown in attached jpg.
I also could not get a correct one from http://consumer.huawei.com/en/support/index.htm

I could install the driver on WIN7 now as below. After that, I could get ttyUSBx. Thanks for your help!!

Hi Leo,

I encounterd problem in step 6
=> 6.Build Android kernel image
=> •Now gzipped kernel isn’t supported yet. Only support Image + DTB format in abootimg.
=> The script file cc in l-loader git repository describes how to build an abootimg on HiKey960 for UEFI.

Within script file cc,
RAMDISK=/opt/workspace/96/960/aosp_49/hikey960-linaro-2017.02.28/flatten_image/initrd.img
Where could I found initrd.img?

You could try this ramdisk: http://people.linaro.org/~leo.yan/hikey960/ramdisk.img