Faield to wakeup from suspend state

Hi,
I am trying to test suspend and wake-up functionality in dragon 410c board.
using
Linux linaro-alip 4.14.0-qcom-ifc6309-arm64 #2 SMP PREEMPT Mon Oct 29 19:20:34 IST 2018 aarch64 GNU/Linux
suspend is working with this command echo mem > /sys/power/state
After that trying to wake-up from suspend state is not working I have tried below methods

Enable configuration CONFIG_RTC_DRV_PL031
echo +10 > /sys/class/rtc/rtc0/wakealarm; echo mem > /sys/power/state
and Gpio interrupt based wakeup

both cases I can see heartbeat LED will start but no UART and UI

Please help me
Thank you

Hi Santosh,

Suspend/Resume is not a tested feature. It is probably some peripheral driver that needs fixing but it’ll need investigation.

If you’re interested in helping out, you could try to find out the buggy bits by referring to Documentation/power/s2ram.txt and file a bug.

Regards,
Amit

Hi Amit,
Thank you for your quick replay.
I will look into this feature .
If you have any more source available related this feature please direct me.

Hi Amit,
I am getting these crash when wake-up interrupt used

root@linaro-alip:~# insmod /home/linaro/gpio-wakeup.ko
[ 43.160268] gpio_wakeup: loading out-of-tree module taints kernel.
[ 43.161247] Adding GPIO 53 (IRQ 86) to wakeup sources
root@linaro-alip:~# echo mem > /sys/power/state
[ 60.456862] DBG file:kernel/power/suspend.c fun:pm_suspend line:607
[ 60.456914] PM: suspend entry (s2idle)
[ 60.462083] PM: Syncing filesystems … done.
[ 60.621419] Freezing user space processes … (elapsed 0.005 seconds) done.
[ 60.627352] OOM killer disabled.
[ 60.633136] Freezing remaining freezable tasks … (elapsed 0.001 seconds) done.
[ 60.636615] DBG Not suspending file:kernel/power/suspend.c fun:suspend_devices_and_enter line:485
[ 60.675434] smsc75xx 1-1.3:1.0 enx58fcdb410250: entering SUSPEND2 mode
[ 60.738482] PM: suspend devices took 0.092 seconds

[ 79.361121] irq event 11: bogus return value fffffff3
[ 79.361146] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 4.14.0-qcom-ifc6309-arm64 #6
[ 79.361558] Received wakeup interrupt
[ 79.373991] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 79.377551] Call trace:
[ 79.384327] [] dump_backtrace+0x0/0x3f0
[ 79.386494] [] show_stack+0x14/0x20
[ 79.392049] [] dump_stack+0x98/0xb8
[ 79.397085] [] __report_bad_irq+0x38/0xe8
[ 79.402117] [] note_interrupt+0x148/0x2e8
[ 79.407500] [] handle_irq_event_percpu+0x44/0x58
[ 79.413055] [] handle_irq_event+0x48/0x78
[ 79.419306] [] handle_fasteoi_irq+0xa0/0x180
[ 79.424774] [] generic_handle_irq+0x24/0x38
[ 79.430677] [] __handle_domain_irq+0x5c/0xb8
[ 79.436493] [] gic_handle_irq+0x58/0xb0
[ 79.442221] Exception stack(0xffff000009063dd0 to 0xffff000009063f10)
[ 79.447692] 3dc0: 0000000000000020 ffff80003c156800
[ 79.454117] 3de0: 0000000000000001 0000000000000000 0000000000000000 ffff000009063f10
[ 79.461930] 3e00: 0000800036ded000 0000000000000001 0000000000000002 ffff000009063e70
[ 79.469742] 3e20: 0000000000000a80 0000000000000000 0000000000000000 0000000000000000
[ 79.477554] 3e40: 00003d0918623000 0000000000000000 0000000000000000 0000000000000000
[ 79.485368] 3e60: 0000000000000000 ffff000009048000 ffff000009069df0 ffff000009069000
[ 79.493181] 3e80: ffff0000090534d8 ffff80003c156800 ffff80003c159000 ffff000009073080
[ 79.500992] 3ea0: 0000000000000000 0000000000000000 0000000080f40018 ffff000009063f10
[ 79.508804] 3ec0: ffff000008085384 ffff000009063f10 ffff000008085388 0000000000000145
[ 79.516617] 3ee0: 0000000000000000 0000000000000000 ffffffffffffffff ffff000008148334
[ 79.524428] 3f00: ffff000009063f10 ffff000008085388
[ 79.532238] [] el1_irq+0xb0/0x124
[ 79.536926] [] arch_cpu_idle+0x10/0x18
[ 79.541788] [] do_idle+0x10c/0x1d8
[ 79.547343] [] cpu_startup_entry+0x24/0x28
[ 79.552295] [] rest_init+0xd0/0xe0
[ 79.557935] [] start_kernel+0x398/0x3ac
[ 79.562879] handlers:
[ 79.568173] [] bam_dma_irq

[ 79.607906] usb 1-1: reset high-speed USB device number 2 using ci_hdrc
[ 80.059901] usb 1-1.3: reset high-speed USB device number 4 using ci_hdrc
[ 80.171932] smsc75xx 1-1.3:1.0 enx58fcdb410250: resuming from SUSPEND2
[ 80.435852] usb 1-1.1: reset low-speed USB device number 3 using ci_hdrc
[ 81.004987] wcn36xx: firmware WLAN version ‘WCN v2.0 RadioPhy vRhea_GF_1.12 with 19.2MHz XO’ and CRM version ‘CNSS-PR-2-0-1-2-c1-74-130449-3’
[ 81.005018] wcn36xx: firmware API 1.5.1.2, 41 stations, 2 bssids
[ 81.017731] wcn36xx: FW Cap MCC
[ 81.022780] wcn36xx: FW Cap P2P
[ 81.025650] wcn36xx: FW Cap SLM_SESSIONIZATION
[ 81.028766] wcn36xx: FW Cap DOT11AC_OPMODE
[ 81.033317] wcn36xx: FW Cap SAP32STA
[ 81.037358] wcn36xx: FW Cap TDLS
[ 81.041098] wcn36xx: FW Cap P2P_GO_NOA_DECOUPLE_INIT_SCAN
[ 81.044304] wcn36xx: FW Cap WLANACTIVE_OFFLOAD
[ 81.049607] wcn36xx: FW Cap BEACON_OFFLOAD
[ 81.053937] wcn36xx: FW Cap SCAN_OFFLOAD
[ 81.058026] wcn36xx: FW Cap BCN_MISS_OFFLOAD
[ 81.062097] wcn36xx: FW Cap STA_POWERSAVE
[ 81.066359] wcn36xx: FW Cap STA_ADVANCED_PWRSAVE
[ 81.070258] wcn36xx: FW Cap BCN_FILTER
[ 81.074951] wcn36xx: FW Cap RTT
[ 81.078504] wcn36xx: FW Cap RATECTRL
[ 81.081549] wcn36xx: FW Cap WOW
[ 81.085360] wcn36xx: FW Cap WLAN_ROAM_SCAN_OFFLOAD
[ 81.088233] wcn36xx: FW Cap SPECULATIVE_PS_POLL
[ 81.093088] wcn36xx: FW Cap IBSS_HEARTBEAT_OFFLOAD
[ 81.097524] wcn36xx: FW Cap WLAN_SCAN_OFFLOAD
[ 81.102375] wcn36xx: FW Cap WLAN_PERIODIC_TX_PTRN
[ 81.106810] wcn36xx: FW Cap ADVANCE_TDLS
[ 81.111490] wcn36xx: FW Cap BATCH_SCAN
[ 81.115491] wcn36xx: FW Cap FW_IN_TX_PATH
[ 81.119043] wcn36xx: FW Cap EXTENDED_NSOFFLOAD_SLOT
[ 81.123131] wcn36xx: FW Cap CH_SWITCH_V1
[ 81.127817] wcn36xx: FW Cap HT40_OBSS_SCAN
[ 81.131978] wcn36xx: FW Cap UPDATE_CHANNEL_LIST
[ 81.135888] wcn36xx: FW Cap WLAN_MCADDR_FLT
[ 81.140311] wcn36xx: FW Cap WLAN_CH144
[ 81.144484] wcn36xx: FW Cap TDLS_SCAN_COEXISTENCE
[ 81.148298] wcn36xx: FW Cap LINK_LAYER_STATS_MEAS
[ 81.153075] wcn36xx: FW Cap EXTENDED_SCAN
[ 81.157760] wcn36xx: FW Cap DYNAMIC_WMM_PS
[ 81.161755] wcn36xx: FW Cap MAC_SPOOFED_SCAN
[ 81.165745] wcn36xx: FW Cap FW_STATS
[ 81.170177] wcn36xx: FW Cap WPS_PRBRSP_TMPL
[ 81.173731] wcn36xx: FW Cap BCN_IE_FLT_DELTA
[ 81.188011] wlan0: invalid CW_min/CW_max: 0/0
[ 81.188078] ------------[ cut here ]------------
[ 81.191431] WARNING: CPU: 0 PID: 2234 at net/mac80211/driver-ops.c:175 drv_conf_tx+0xd4/0xf8 [mac80211]
[ 81.196023] Modules linked in: gpio_wakeup(O) rfcomm aes_neon_blk bnep arc4 wcn36xx mac80211 btqcomsmd btqca bluetooth cfg80211 ecdh_generic snd_soc_hdmi_codec ov5640 v4l2_common venus_dec venus_enc crc32_ce smsc75xx qcom_wcnss_pil qcom_common remoteproc adv7511 qcom_camss snd_soc_lpass_apq8016 snd_soc_lpass_cpu snd_soc_lpass_platform snd_soc_msm8916_analog snd_soc_msm8916_digital videobuf2_dma_sg v4l2_fwnode msm snd_soc_apq8016_sbc venus_core v4l2_mem2mem videobuf2_memops videobuf2_v4l2 mdt_loader videobuf2_core drm_kms_helper videodev drm msm_rng rng_core media i2c_qcom_cci ip_tables x_tables
[ 81.235684] CPU: 0 PID: 2234 Comm: kworker/u8:5 Tainted: G O 4.14.0-qcom-ifc6309-arm64 #6
[ 81.257914] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[ 81.267121] Workqueue: events_unbound async_run_entry_fn
[ 81.273970] task: ffff80003d1cba00 task.stack: ffff00000a5e8000
[ 81.279350] PC is at drv_conf_tx+0xd4/0xf8 [mac80211]
[ 81.284988] LR is at drv_conf_tx+0xd4/0xf8 [mac80211]
[ 81.290116] pc : [] lr : [] pstate: 00000145
[ 81.295151] sp : ffff00000a5ebc10
[ 81.302613] x29: ffff00000a5ebc10 x28: 0000000000000000
[ 81.305827] x27: ffff80003d406880 x26: ffff80003d384cf0
[ 81.311209] x25: ffff80003d384cc0 x24: ffff80003d406dd0
[ 81.316503] x23: 0000000000000000 x22: 0000000000000001
[ 81.321799] x21: 0000000000000001 x20: ffff80003d384fd8
[ 81.327093] x19: 00000000ffffffea x18: 0000000000000010
[ 81.332389] x17: 0000000000000000 x16: 0000000000000040
[ 81.337685] x15: 0000000000000006 x14: ffff0000891f2507
[ 81.342980] x13: ffff0000091f2515 x12: ffff0000090846e0
[ 81.348274] x11: ffff00000a5eb910 x10: 0000000005f5e0ff
[ 81.353570] x9 : 00000000ffffffd0 x8 : 0000000000000032
[ 81.358865] x7 : 000000000000000d x6 : 0000000000000244
[ 81.364161] x5 : 0000000000000000 x4 : 0000000000000000
[ 81.369455] x3 : 0000000000000000 x2 : ffff80003d1cba00
[ 81.374751] x1 : ffff80003d1cba00 x0 : 0000000000000021
[ 81.380046] Call trace:
[ 81.385339] Exception stack(0xffff00000a5ebad0 to 0xffff00000a5ebc10)
[ 81.387513] bac0: 0000000000000021 ffff80003d1cba00
[ 81.394113] bae0: ffff80003d1cba00 0000000000000000 0000000000000000 0000000000000000
[ 81.401925] bb00: 0000000000000244 000000000000000d 0000000000000032 00000000ffffffd0
[ 81.409739] bb20: 0000000005f5e0ff ffff00000a5eb910 ffff0000090846e0 ffff0000091f2515
[ 81.417551] bb40: ffff0000891f2507 0000000000000006 0000000000000040 0000000000000000
[ 81.425363] bb60: 0000000000000010 00000000ffffffea ffff80003d384fd8 0000000000000001
[ 81.433175] bb80: 0000000000000001 0000000000000000 ffff80003d406dd0 ffff80003d384cc0
[ 81.440989] bba0: ffff80003d384cf0 ffff80003d406880 0000000000000000 ffff00000a5ebc10
[ 81.448802] bbc0: ffff000000ee7344 ffff00000a5ebc10 ffff000000ee7344 0000000000000145
[ 81.456614] bbe0: 0000000000000000 0000000000000000 ffffffffffffffff 0000000000000000
[ 81.464425] bc00: ffff00000a5ebc10 ffff000000ee7344
[ 81.472314] [] drv_conf_tx+0xd4/0xf8 [mac80211]
[ 81.477003] [] ieee80211_reconfig+0x4fc/0xb18 [mac80211]
[ 81.483253] [] ieee80211_resume+0x44/0x68 [mac80211]
[ 81.490025] [] wiphy_resume+0x48/0x78 [cfg80211]
[ 81.496459] [] dpm_run_callback+0x50/0xd0
[ 81.502617] [] device_resume+0x94/0x1c0
[ 81.508087] [] async_resume+0x24/0x58
[ 81.513643] [] async_run_entry_fn+0x40/0x160
[ 81.518677] [] process_one_work+0x1cc/0x328
[ 81.524580] [] worker_thread+0x50/0x450
[ 81.530396] [] kthread+0xfc/0x128
[ 81.535778] [] ret_from_fork+0x10/0x18
[ 81.540463] —[ end trace 7fb2e4c2f12a6d07 ]—
[ 81.570957] qcom-wcnss-pil a204000.wcnss: fatal error received: halMsg.c:4964:halMsg_DelBss: Invalid BSSIndex 0
[ 81.570984] remoteproc remoteproc0: crash detected in a204000.wcnss: type fatal error
[ 81.579866] remoteproc remoteproc0: handling crash #1 in a204000.wcnss
[ 81.587831] remoteproc remoteproc0: recovering a204000.wcnss
[ 82.058441] random: crng init done

do you have any idea about this?

We are getting similar kernel warning on wakeup. Any solution?

If your kernel is 4.14.96, try the following patch. It fixed the issue related to screen not waking up.

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 2d51405a791b..b1e88c5c477f 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -358,6 +358,7 @@ static int adreno_suspend(struct device *dev)
 #endif
 
 static const struct dev_pm_ops adreno_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) /* https://patchwork.kernel.org/patch/10403985/ */
 	SET_RUNTIME_PM_OPS(adreno_suspend, adreno_resume, NULL)
 };
 
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 0a3ea3034e39..07bdf915723a 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -907,19 +907,33 @@ static struct drm_driver msm_driver = {
 static int msm_pm_suspend(struct device *dev)
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
+	struct msm_drm_private *priv = ddev->dev_private;
+	if (WARN_ON(priv->pm_state))
+		drm_atomic_state_put(priv->pm_state);
 
-	drm_kms_helper_poll_disable(ddev);
-
+	priv->pm_state = drm_atomic_helper_suspend(ddev);
+	if (IS_ERR(priv->pm_state)) {
+		int ret = PTR_ERR(priv->pm_state);
+		DRM_ERROR("Failed to suspend dpu, %d\n", ret);
+		return ret;
+	}
 	return 0;
 }
 
 static int msm_pm_resume(struct device *dev)
 {
 	struct drm_device *ddev = dev_get_drvdata(dev);
+	struct msm_drm_private *priv = ddev->dev_private;
+	int ret;
 
-	drm_kms_helper_poll_enable(ddev);
+	if (WARN_ON(!priv->pm_state))
+		return -ENOENT;
 
-	return 0;
+	ret = drm_atomic_helper_resume(ddev, priv->pm_state);
+	if (!ret)
+		priv->pm_state = NULL;
+
+	return ret;
 }
 #endif
 
diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 0a653dd2e618..459d06a1ab9f 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -155,6 +155,7 @@ struct msm_drm_private {
 	struct shrinker shrinker;
 
 	struct msm_vblank_ctrl vblank_ctrl;
+	struct drm_atomic_state *pm_state;
 };
 
 struct msm_format {