[WP7702][R14.1][Legato19.11.5] RTC alarm set to 1 hour

Hello,

When trying to register a wakeup alarm using rtc0 with wakealarm file to wakeup from suspend to ram I observed that something is setting an alarm more or less each pm resume to usually 1h0m27s once the first wakeup alarm set by sierra_monitor module ends its job according to startup_timer parameter which is be default set to 120sec in devicetree.

I also observed that if we reach this rtc time an alarm is indeed triggered and another one is set 1 hour later.
Just in case I precise that it’s the same behavior with or without our custom app installed.

To see that we enable debug in kernel with :
echo ‘file qpnp-rtc.c +p’>/sys/kernel/debug/dynamic_debug/control

What we observe when first alarm managed by sierra_monitor kernel module expires:
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.526169] PM: late suspend of devices complete after 4.450 msecs
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.529106] PM: noirq suspend of devices complete after 2.897 msecs
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.529223] suspend ns: 147529202793 suspend cycles: 2892121782
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.529202] CPU0:msm_cpu_pm_enter_sleep mode:3 during suspend
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.529202] resume cycles: 4679276074
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.531778] PM: noirq resume of devices complete after 1.978 msecs
Jul 2 08:06:25 0F0DS352653090226184 user.debug kernel: [ 147.532391] qcom,qpnp-rtc qpnp-rtc-5: secs = 244, h:m:s == 0:4:4, d/m/y = 1/0/70
Jul 2 08:06:25 0F0DS352653090226184 user.debug kernel: [ 147.532507] qcom,qpnp-rtc qpnp-rtc-5: secs = 244, h:m:s == 0:4:4, d/m/y = 1/0/70
Jul 2 08:06:25 0F0DS352653090226184 user.debug kernel: [ 147.532588] qcom,qpnp-rtc qpnp-rtc-5: secs = 244, h:m:s == 0:4:4, d/m/y = 1/0/70
Jul 2 08:06:25 0F0DS352653090226184 user.debug kernel: [ 147.532666] qcom,qpnp-rtc qpnp-rtc-5: Alarm Set for h:r:s=1:0:29, d/m/y=1/0/70
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.532717] sierra_rtc_wake
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.532725] sierra_rtc_wake: sierra_rtc_wake
Jul 2 08:06:25 0F0DS352653090226184 user.debug kernel: [ 147.532891] sierra_rtc_wake: error in signaling uevent
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.534917] PM: early resume of devices complete after 1.558 msecs
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.540278] msm_hsic_host 7c00000.hsic_host: HSIC-USB exited from low power mode
Jul 2 08:06:25 0F0DS352653090226184 user.debug kernel: [ 147.544051] qcom,qpnp-rtc qpnp-rtc-5: secs = 244, h:m:s == 0:4:4, d/m/y = 1/0/70
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.551142] PM: resume of devices complete after 16.170 msecs
Jul 2 08:06:25 0F0DS352653090226184 user.debug kernel: [ 147.552786] PM: Finishing wakeup.
Jul 2 08:06:25 0F0DS352653090226184 user.warn kernel: [ 147.552806] Restarting tasks … done.
Jul 2 08:06:25 0F0DS352653090226184 user.info kernel: [ 147.597177] sierra_pm_resume

I would like to know who register this alarm and if possible if we can avoid this alarm registration ?
As it also happens when the system get out of suspend to ram on is own to try to enter it again asap => resume => set alarm again to 1h which erase our alarm registration from user space and in some case erase info from rtc0/wakealarm file whereas we can see in kernel log that the a wakeup alarm has been set.

Regards

How to reproduce your issue?
Please paste the whole procedure.

Btw, are you able to see this issue in r15.1?
https://source.sierrawireless.com/resources/airprime/software/wp77xx/wp77xx-firmware-release-15,-d-,1/

Hello
We could reproduce it with a generic SPK R14.1 on a clean WP7702 module.

Prerequis:

  1. Install SPK generic firmware R14.1
  2. Add following lines in /etc/init.d/startlegato.sh to enable rtc debug and set a wakeup alarm to 180sec since boot:
    echo “file qpnp-rtc.c +p” >/sys/kernel/debug/dynamic_debug/control
    echo 180 > /sys/class/rtc/rtc0/wakealarm
  3. Also put a SIM card with the right apn (didn’t check if there is an impact or not)

Steps:

  1. Power on the board with out USB plugged
  2. Wait for 5min to wait for sierra_monitor to manage its 120sec delay from boot and its wakealarm auto set 120 later at each pm suspend until it reaches 120sec from boot which can be at max 240secs + N secs
  3. Plug USB to the board and check logread, a wakeup alarm should have been set to 1hour from boot once the first alarm expired and system is subject to a pm_resume which was not expected

By the way it would be nice to know what triggers these unexpected wakeup but firstly I would like to know who set this alarm to 1Hour.

I also put the log of my test

LogRtcR14_1.txt (515.4 KB)

are you able to see this issue in r15.1?

Add following lines in /etc/init.d/startlegato.sh to enable rtc debug and set a wakeup alarm to 180sec since boot

What line are you talking about?

Btw, did you set anything in at!powerwake or at!powermode ?

Not tested in R15.1 as our products are already in R14

Lines are in the log file put here they are:
echo “file qpnp-rtc.c +p” >/sys/kernel/debug/dynamic_debug/control
echo 180 > /sys/class/rtc/rtc0/wakealarm

Nothing set with AT command. The logs shared are from a test with a fresh new module which has only been flashed with firmware R14.1 spk Sierra Wireless

Regards

I tried the two commands in USB console.
No problem is found:



root@fx30:~# date
Sun Jan  6 08:23:34 +08 1980
root@fx30:~# date
Sun Jan  6 08:23:45 +08 1980
root@fx30:~# logread -f &
root@fx30:~# echo "file qpnp-rtc.c +p" >/sys/kernel/debug/dynamic_debug/control
root@fx30:~# echo 180 > /sys/class/rtc/rtc0/wakealarm
root@fx30:~# Jan  6 08:24:04 fx30 user.debug kernel: [  219.534448] qcom,qpnp-rtc qpnp-rtc-5: secs = 1445, h:m:s == 0:24:5, d/m/y = 1/0/70

root@fx30:~# date
Sun Jan  6 08:24:30 +08 1980
root@fx30:~# date
Sun Jan  6 08:29:07 +08 1980
root@fx30:~# legato version
19.11.5_72a625aea107a61d15bf615ccf657202
root@fx30:~# cm info
Device:                        WP7702
IMEI:                          352653090612435
IMEISV:                        6
FSN:                           VU213430812345
Firmware Version:              SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
Bootloader Version:            SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
MCU Version:                   002.015
PRI Part Number (PN):          9908741
PRI Revision:                  002.001
Carrier PRI Name:              GENERIC
Carrier PRI Revision:          001.071_001
SKU:                           1104214
Last Reset Cause:              Reset, User Requested
Resets Count:                  Expected: 157    Unexpected: 0

Is that those commands must be put in /etc/init.d/startlegato.sh?
What is the purpose of adding these commands in init script?

BTW, there is no such path /sys/class/rtc/rtc0/wakealarm in FW R15.1…
So not even know if you are testing the correct command

The purpose of adding these commands in init script is to automatically activate rtc debug and to register a wakeup alarm before system tries to go to suspend to ram automatically since USB should not be plugged to the board as I described in the test case scenario

The purpose of the whole test is to show that an rtc alarm is set and modified by the system to expire 1h from boot. And I want/need to know who does this and if it can be modified or stopped.

As I previously tried to explain, following the test case, if no USB is plugged since boot, the system will try to goes into suspend to ram as soon as sierra_monitor kernel module stops to prevent system to go in. When this module is active during the 120secs since boot (which is a parameter) it will erase the first wakealarm set to 180 from the init script and set it to 120sec in the future each time system try to enter in suspend to ram. The module stops to do that once the system is woken up since more than 120sec.
After that at next wakeup/sleep sequence this unexpected wakealarm to 1h is set and I want to know who does that.

To be able to see that on your side it’s mandatory to not plug the usb until you want to check the logs and that no wake_lock are active which should be the case if default R14.1 + default legato is flashed

WakeAlarm command is working fine until unexpected wakeup/sleep sequence happen because it reconfigure the rtc wakeup alarm

The use case is quite complicated…
suggest you to see if it has been fixed in FW R15

BTW, if you just want to set up a wake up alarm, can at!powerwake or at!powermode help on this?

Lastly, have you also tried to set up a 1 hour timer in legato application?

I just found something in the firmware ReleaseNote

Are you able to say where is done this and if it can be modified ?

As previously said, it’s not possible for us to update the firmware of already living products. So either we are able to do something on R14.1 or we are going to find another way on side.

AT!POWERWAKE and AT!POWERMODE are only returning error even if we send the ENTERCND command first

i don’t see problem on those AT commands:

ati3
Manufacturer: Sierra Wireless, Incorporated
Model: WP7702
Revision: SWI9X06Y_02.36.06.00 63d944 jenkins 2020/12/10 19:12:28
IMEI: 352653090612345
IMEI SV:  6
FSN: VU213430812345
+GCAP: +CGSM

OK
at!powerwake?
!POWERWAKE:
ULPM TIMER: 14400
PSM TIMER: 14400,ACTIVE TIMER:20,SYNC: 2

OK
at!powermode?
!POWERMODE: No request, status=9-PSM disabled

OK
ati8
Legato Ver: 19.11.5_72a625aea107a61d15bf615ccf657202
Yocto Ver:  SWI9X06Y_02.36.07.00 2021-01-23_01:18:05
OS Ver: Linux version 3.18.140 (oe-user@oe-host) () #1 PREEMPT Sat Jan 23 00:54:49 UTC 2021
LK Ver: SWI9X06Y_02.36.07.00
RootFS Ver: SWI9X06Y_02.36.07.00 2021-01-23_01:18:05
UserFS Ver: unknown
MCU Ver: 002.015

OK

Can you tell us where and in which file QTI9X06-410 has been fixed please ?

you might have a look on /etc/init.d/lowtempfix


Jan  6 00:00:17 swi-mdm9x28-wp user.debug kernel: [   13.713308] LE_KPI: start initscript /etc/rcS.d/S31lowtempfix
Jan  6 00:00:17 swi-mdm9x28-wp user.warn kernel: [   13.723786] starting lowtempfix
Jan  6 00:00:17 swi-mdm9x28-wp user.debug kernel: [   13.758220] LE_KPI: end initscript /etc/rcS.d/S31lowtempfix
Jan  6 00:00:17 swi-mdm9x28-wp daemon.info dnsmasq[816]: started, version 2.83 cachesize 150
Jan  6 00:00:17 swi-mdm9x28-wp daemon.info dnsmasq[816]: compile time options: IPv6 GNU-getopt no-DBus no-UBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-nettlehash no-DNSSEC loop-detect inotify dumpfile
Jan  6 00:00:17 swi-mdm9x28-wp daemon.info dnsmasq-dhcp[816]: DHCP, IP range 192.168.2.3 -- 192.168.2.3, lease time 12h
Jan  6 00:00:17 swi-mdm9x28-wp daemon.warn dnsmasq[816]: no servers found in /etc/resolv.conf, will retry
Jan  6 00:00:17 swi-mdm9x28-wp daemon.info dnsmasq[816]: read /etc/hosts - 6 addresses
Jan  6 00:00:17 swi-mdm9x28-wp user.debug lowtempfix: enabled 1
Jan  6 00:00:17 swi-mdm9x28-wp user.debug kernel: [   13.820859] LE_KPI: start initscript /etc/rcS.d/S31swiapplaunch.sh
Jan  6 00:00:17 swi-mdm9x28-wp user.info kernel: [   13.822638] IPv6: ADDRCONF(NETDEV_UP): ecm0: link is not ready
Jan  6 00:00:17 swi-mdm9x28-wp user.debug lowtempfix: period 30
Jan  6 00:00:17 swi-mdm9x28-wp user.debug lowtempfix: stay_awake_temp -22
Jan  6 00:00:17 swi-mdm9x28-wp user.debug lowtempfix: relax_temp -20