I’m using a Verdin iMX8MP, with the Verdin development board, and a 3rd party LVDS LCD panel attached with a custom MIPI DSI to LVDS adapter board.
I’m testing suspend and resume. Suspend and resume works fine so far. But I want to turn off the lcd backlight before sleeping, and when resuming from sleep, I want the backlight to resume its previous state (on or off). What happens is: 1) I turn off the backlight 2) I sleep the system 3) I wake the system with a RTC event 4) The backlight comes on even though I didn’t prompt it to.
In addition, there is a note that the wifi kernel module should be unloaded before sleep. I have done this in testing on the command line, but is there a preferred method to unload and reload the wifi module before and after sleep?
Here are the commands I’m using for testing:
echo 1 > /sys/class/backlight/backlight/bl_power
echo +20 > /sys/class/rtc/rtc1/wakealarm; echo deep > /sys/power/mem_sleep; echo mem > /sys/power/state
Couple more questions while I’m at it… the system seems to wake up when the wake1 signal detects a rising or falling edge. Is there a way to set it so it only wakes on a rising edge?
And can I have GPIO1 and GPIO2 also act as Wake signals? I would want them both to act the same as Wake1, where the system only wakes on a rising edge only, but the signal could come in on either GPIO.
Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
To address the issues you’re experiencing with the Verdin iMX8MP system, here are some suggestions based on the context provided:
Backlight Control on Resume:
The issue with the backlight turning on automatically upon resume suggests that the backlight control logic during the suspend/resume process might not be correctly handling the previous state. You may need to investigate the kernel’s backlight driver or the power management scripts to ensure they restore the backlight state correctly. This might involve modifying the resume script to check the backlight state before suspend and restore it after resume.
Preferred Method for WiFi Module Management:
To automate the unloading and reloading of the WiFi kernel module during suspend/resume, you can use systemd services or scripts. Create a systemd service that executes a script to unload the module before suspend and reload it after resume. This ensures the WiFi module is managed automatically without manual intervention.
Wake Signal Configuration:
To configure the system to wake only on a rising edge of the wake1 signal, you will need to adjust the device tree or GPIO settings. This involves setting the GPIO edge detection to rising edge only. You can modify the device tree source (DTS) file to specify the desired edge detection for the wake1 signal.
GPIO Wake Signals:
To configure GPIO1 and GPIO2 as wake signals that trigger only on a rising edge, similar modifications in the device tree or kernel configuration are required. Ensure that these GPIOs are set up with the correct edge detection settings in the DTS file.
By addressing these areas, you should be able to achieve the desired behavior for the backlight and manage the WiFi module and wake signals effectively.
Please, also check if these links can help you solve your problem:
For removing a kernel module, I don’t know if there is a preferred method, but integrating into a systemd service for suspend/resume seems like it would work.
In order to set wak1 as rising/falling edge the device tree needs to be modified. Specificly for the imx8mp-verdin on BSP 6. This node.
I believe interrupts = <&gpio4 0 IRQ_TYPE_EDGE_RISING>; should be added to the button-wakeup child node.
Any GPIO can be used to wake up the Verdin module, but only pin 225 (WAKE1_MICO) is only this pin is guaranteed to be wakeup compatible with other Verdin modules. So device tree changes would need to be made to mimic wake1_mico.
Still working through the customizations of our power supply, and power state management. Thanks for the information and link. We will try it soon.
-Chris