From fa9a43a6905187195c9e86a61a906647726c3e55 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 9 May 2022 20:16:22 -0500 Subject: [PATCH 1/2] Add support to set autosuspend delay via hwdb --- hwdb.d/60-autosuspend.hwdb | 4 ++++ hwdb.d/parse_hwdb.py | 1 + rules.d/60-autosuspend.rules | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/hwdb.d/60-autosuspend.hwdb b/hwdb.d/60-autosuspend.hwdb index 1b6c1e1c8f..323611d000 100644 --- a/hwdb.d/60-autosuspend.hwdb +++ b/hwdb.d/60-autosuspend.hwdb @@ -24,8 +24,12 @@ # # Allowed properties are: # ID_AUTOSUSPEND=1 +# ID_AUTOSUSPEND_DELAY_MS=#### # ID_PERSIST=0 # +# ID_AUTOSUSPEND_DELAY_MS adjusts the delay for autosuspend to something +# different than the kernel default of 2000ms. +# # ID_PERSIST=0 allows disabling the kernels USB "persist" feature, which allows # the continued use of devices after a power loss (due to suspend). Disable it # if the device will loose state without a USB power session and the driver diff --git a/hwdb.d/parse_hwdb.py b/hwdb.d/parse_hwdb.py index 93179b675c..7bad559699 100755 --- a/hwdb.d/parse_hwdb.py +++ b/hwdb.d/parse_hwdb.py @@ -135,6 +135,7 @@ def property_grammar(): ('MOUSE_WHEEL_CLICK_COUNT', INTEGER), ('MOUSE_WHEEL_CLICK_COUNT_HORIZONTAL', INTEGER), ('ID_AUTOSUSPEND', Or((Literal('0'), Literal('1')))), + ('ID_AUTOSUSPEND_DELAY_MS', INTEGER), ('ID_AV_PRODUCTION_CONTROLLER', Or((Literal('0'), Literal('1')))), ('ID_PERSIST', Or((Literal('0'), Literal('1')))), ('ID_PDA', Or((Literal('0'), Literal('1')))), diff --git a/rules.d/60-autosuspend.rules b/rules.d/60-autosuspend.rules index 332d052caa..ce31a920ed 100644 --- a/rules.d/60-autosuspend.rules +++ b/rules.d/60-autosuspend.rules @@ -15,4 +15,8 @@ ENV{ID_AUTOSUSPEND}=="1", TEST=="power/control", \ ENV{ID_PERSIST}=="0", TEST=="power/persist", \ ATTR{power/persist}="0" +# Set up an autosuspend delay if hwdb say so +ENV{ID_AUTOSUSPEND_DELAY_MS}!="", TEST=="power/control", \ + ATTR{power/autosuspend_delay_ms}="$env{ID_AUTOSUSPEND_DELAY_MS}" + LABEL="autosuspend_end" From f32049eda3b06deaae3d6d7d06a9dfd16528c443 Mon Sep 17 00:00:00 2001 From: Mario Limonciello Date: Mon, 9 May 2022 20:16:26 -0500 Subject: [PATCH 2/2] Set autosuspend delay for Fibocom LG850-GL It has been shown that the autosuspend delay for this device enacted by modem manager will race with suspend and cause system suspend failures. This occurred in ChromiumOS on a chromebook, but there is no reason it won't happen in regular notebooks with the same WWAN. To avoid the failure delay autosuspend to a frequency longer than the polling rate used by modem manager. Link: https://chromium-review.googlesource.com/c/chromiumos/overlays/board-overlays/+/3635003 Link: https://github.com/freedesktop/ModemManager/blob/43e76bf1bbca8207e37d3fbddfed4bb8578f0170/src/mm-iface-modem.c#L1633 --- hwdb.d/60-autosuspend.hwdb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hwdb.d/60-autosuspend.hwdb b/hwdb.d/60-autosuspend.hwdb index 323611d000..07f7fa9344 100644 --- a/hwdb.d/60-autosuspend.hwdb +++ b/hwdb.d/60-autosuspend.hwdb @@ -75,13 +75,18 @@ usb:v0627p0001:*QEMU USB Tablet* ID_AUTOSUSPEND=1 ######################################### -# Sierra Wireless +# WWAN ######################################### # Sierra Wireless EM7345 4G LTE modem usb:v1199pA001* ID_AUTOSUSPEND=1 +# Fibocom LG850-GL +usb:v2CB7p0007* + ID_AUTOSUSPEND=1 + ID_AUTOSUSPEND_DELAY_MS=7000 + ######################################### # Wacom #########################################