.. _user-space-guide: .. _nxp-bsp-features: .. _mainline-bsp-features: Linux ===== What you can do with a Yocto-built image on your module (user space), independent of the BSP. It applies to images built with our BSPs — see the :doc:`Yocto Guide ` for building the images. General ------- CPU Temperature ~~~~~~~~~~~~~~~ The SoC provides the internal temperature. The resolution is 1000ths of °C, therefore you must **divide it by 1000** to obtain °C. .. prompt:: :prompts: # cat /sys/class/thermal/thermal_zone0/temp Sleep Mode / Low Power ---------------------- .. _stm32-sleepmode: .. _stm32mp2-sleepmode: All our modules support suspend-to-RAM. **Suspending the system** This command suspends the device: .. prompt:: :prompts: # echo mem > /sys/power/state **Selecting the suspend mode (s2idle vs. deep)** ``mem`` can enter different sleep modes. The available modes are listed in ``/sys/power/mem_sleep`` — the currently selected one is enclosed in brackets: .. prompt:: :prompts: # cat /sys/power/mem_sleep .. code-block:: text [s2idle] deep * **deep** — suspend-to-RAM: the SoC enters the low-power modes. This is the default on our modules. * **s2idle** — suspend-to-idle: only the CPUs are put to idle, peripherals keep running; much faster to enter/resume, but far less power saving. Switch the mode (example: select ``deep``) before suspending: .. prompt:: :prompts: # echo deep > /sys/power/mem_sleep **Wakeup** To wake up the system after suspend, different wakeup sources can be defined. To find all possible wakeup properties run: .. prompt:: :prompts: # find /sys/devices -name wakeup *EXAMPLE* - Enabling a peripheral as wakeup source: .. prompt:: :prompts: # echo enabled > /sys/devices/platform/soc//power/wakeup *EXAMPLE* - Enabling the serial UART as wakeup source: .. prompt:: :prompts: # echo enabled > /sys/devices/platform/soc//power/wakeup *EXAMPLE* - Waking up after 15 seconds using the RTC wakealarm: .. prompt:: :prompts: # echo +15 > /sys/class/rtc/rtc0/wakealarm **SoC-specific low-power modes** On all our modules, ``echo mem > /sys/power/state`` triggers suspend-to-RAM (Linux exposes ``freeze`` and ``mem`` in ``/sys/power/state``). The SoC-specific mode the system actually enters depends on the devicetree configuration and on the defined wakeup sources. The official *ST Wiki* gives a detailed overview for the STM32MP1/MP2: https://wiki.st.com/stm32mpu/wiki/Category:Platform_power (see also ST application note AN5726 for the STM32MP2 low-power modes). .. hint:: If ``no_console_suspend`` is set on the kernel command line, the trusted firmware will tell you which mode is entered (STM32MP): .. code-block:: text NOTICE: Entering CStop Mode. .. admonition:: Known Issues (STM32MP1) :class: hint - **USB-OHCI**: * Suspend/resume only working when defined as Wakeup-Source, meaning *CStandby* mode not supported when active. * Suspend fails with hang-up when not defined as Wakeup-Source. * If *CStandby* desired you have to modify devicetree: .. code-block:: text &usbh_ohci { status = "disabled"; }; - **LCD**: * Suspend/resume to *CStandby* destroys display. Display does not come back when resuming (only LCD, DSI displays work fine). Graphics -------- .. note:: The topics in this section require an image with the **Weston desktop** installed, e.g. ``karo-image-weston`` or ``karo-image-qt6`` (both BSPs) — see the image tables in the :doc:`Yocto Guide `. Test the GPU ~~~~~~~~~~~~ GLmark2 will only run smooth on processors having a GPU (e.g. NXP i.MX8/9, STM32MP25). .. prompt:: :prompts: # XDG_RUNTIME_DIR=/run/user/$UID glmark2-es2-wayland --fullscreen Play a Video ~~~~~~~~~~~~ Play the file named *test.mp4*: .. prompt:: :prompts: # XDG_RUNTIME_DIR=/run/user/$UID gst-play-1.0 --videosink=waylandsink test.mp4 Run the gstreamer test screen: .. prompt:: :prompts: # XDG_RUNTIME_DIR=/run/user/$UID gst-launch-1.0 videotestsrc ! waylandsink