Verdin Suspend/Resume - resume to previous state

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.

Thanks,
-Chris

Hi, I’m the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!

Did you like my answer?

:+1: :-1:


To address the issues you’re experiencing with the Verdin iMX8MP system, here are some suggestions based on the context provided:

  1. 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.
  2. 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.
  3. 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.
  4. 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:

Verdin imx8mm: suspend/resume of panel-simple failed.

Hey @strandtc,

I believe you may want to introduce some customization for your resume services. We have a reference guide here : Suspend/Resume (Linux) | Toradex Developer Center

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.

-Eric

Hey @strandtc,

How are you going with this topic?

-Eric

Still working through the customizations of our power supply, and power state management. Thanks for the information and link. We will try it soon. :slight_smile:
-Chris