mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
port from msm: This fixes the issue where LCD takes a long time to come back up since the execution of backlight on and late_resume works by the suspend worker thread is delayed due to one (or more) of the sys_sync calls in early_suspend and suspend paths taking a long time (sometimes 15sec or more) for the below reported scenario(s): Scenario 1 (copy with usb connected): 1. plug usb 2. adb shell 3. busybox cp /sdcard/file1 /sdcard/file2 (copy >= 100MB file1 in sdcard/emmc to file2 in sdcard/emmc) 4. press end key to suspend 5. press end key again and it takes a long time for LCD to come back up Scenario 2 (background copy): 1. plug usb 2. adb shell 3. busybox cp /sdcard/file1 /sdcard/file2 & (copy >= 100MB file1 in sdcard/emmc to file2 in sdcard/emmc) 4. disconnect usb 5. press end key to suspend 6. press end key again and it takes a long time for LCD to come back up A more common form of Scenario 2 is for the user to just use the copy function on the UI to copy large file(s). We address this by moving sys_sync calls to a separate workqueue and having a timeout polling based mechanism to bail out of suspend in case of user invoking a wakeup event (like end key press) while we are waiting for the sys_sync completion at the synchronization point in suspend worker thread context.