Zynq-7000 Power Management

This page gives an overview of power management features and frameworks used in Zynq Linux solutions. Paths to files and documentation on this page are given relative to the Linux kernel source directory.

Table of Contents


cpufreq

The cpufreq framework is used to scale the CPU frequency. Full documentation is found in Documentation/cpu-freq/.

Summary
The framework exposes a control interface through sysfs in /sys/devices/system/cpu/cpu0/cpufreq/. This interface provides statistics (if enabled) and allows to choose a scaling governor and in case of the userspace governor is used to manually set a frequency.
To enable the cpufreq framework enable the following config options in your kernel configuration:
  • CONFIG_THERMAL
  • CONFIG_CPU_THERMAL
  • CONFIG_CPU_FREQ
  • CONFIG_CPU_FREQ_GOV_PERFORMANCE
  • CONFIG_CPU_FREQ_GOV_POWERSAVE
  • CONFIG_CPU_FREQ_GOV_USERSPACE
  • CONFIG_CPU_FREQ_GOV_ONDEMAND
  • CONFIG_CPU_FREQ_GOV_CONSERVATIVE
  • CONFIG_CPU_FREQ_STAT
  • CONFIG_CPU_FREQ_STAT_DETAILS
  • CONFIG_CPUFREQ_DT

Zynq uses the generic cpufreq-dt driver is found in drivers/cpufreq/cpufreq-dt.c. The OPPs are specified in the device tree.

The default config for Zynq has the driver and its governors enabled. The default governor is userpsace, i.e. the frequency can be scaled using the sysfs interface and to leverage automatic frequency scaling a different governor has to be selected - either through sysfs or the kernel configuration option.

Known Issues

  • When running at a too low frequency, USB breaks. The lowest tested and working frequency is 222.222 MHz. Highest frequency where it is known broken is 111.111 MHz
  • Suspend breaks on reduced frequencies
  • Due to dependencies between the CPU frequency and timers, the range of valid frequencies is limited/frequency changes may fail (see: https://github.com/Xilinx/linux-xlnx/commit/356cbded4131b067ec5fa4430c15c2fac867fa2b)
  • cpufreq statistics don't work
  • System clock runs slower proportionately to the difference between the default clock rate and that set by cpufreq if a timer other than the TTC (e.g. arm_global_timer) is used as clocksource

cpuidle

The cpuidle framework manages CPU idle levels. Full documentation is found in Documentation/cpuidle/.

Summary
The cpuidle drivers puts idle CPUs in a low power state when a CPU becomes idle, which means executing wfi on Zynq. The framework works fully autonomous and does not require the user to interact.
To enable the cpuidle framework enable the following config options in your kernel configuration:
  • CONFIG_CPU_IDLE
  • CONFIG_CPU_IDLE_GOV_LADDER
  • CONFIG_CPU_IDLE_GOV_MENU

Zynq's cpuidle driver is found in arch/arm/mach-zynq/cpuidle.c.

Suspend

The suspend framework provides the interface to enter sleep states, like the well known 'suspend to disk/RAM' on laptops. Documentation is found in Documentation/power/. In particular the files swsusp.txt and states.txt. And devices.txt for interaction with device drivers.

Summary
The architecture specific callbacks and initialization is located in arch/arm/mach-zynq/pm.c. In order to shut down the DDR subsystem the final suspend call — mach-zynq/suspend.S:zynq_sys_suspend() — is moved into OCM and executed from there. Below is a list of tested wakeup devices. Depending on the requirements of the wakeup device enabled, the IOPLL might not be bypassed. All Zynq peripheral drivers employ clock gating during suspend. The current implementation supports suspend to RAM only, which can be entered by executing
echo mem > /sys/power/state

To enable the suspend framework enable the following config options in your kernel configuration:
  • CONFIG_PM_SLEEP

Wake on UART

Suspend works with and without the 'no_console_suspend' kernel parameter. The UART console can also be used as wakeup device
echo enabled > /sys/devices/amba.0/e0001000.serial/tty/ttyPS0/power/wakeup

Wake on GPIO

Export the wanted GPIOs
echo <n> > /sys/class/gpio/export
Use <n> = 12 and 14 for the push buttons on a zc702

Enable interrupts for the wanted GPIO pins
echo (rising|falling|both) > /sys/class/gpio/gpio<n>/edge

Make GPIO the wake-up device
echo enabled > /sys/devices/amba.0/e000a000.gpio/power/wakeup

Wake on Debugger

Suspend can be left through xmd by connecting, stopping and starting CPU0.
xmd% connect arm hw
xmd% stop
xmd% continue

Removable Media

Removable media (USB devices, sdcard, etc.) are usually ejected from the system before suspend is entered. Therefore it is highly discouraged to suspend the system while a file system on such a removable device is mounted. To make suspend work anyway when running with a rootfs from sdcard the config option MMC_UNSAFE_RESUME can be enabled. This prevents the removable MMC device from being ejected, but NEVER exchange removable devices during suspend with this config option set.

Known Issues

  • suspend breaks when cpufreq is used to scale the CPU frequency
  • the DDR PLL is bypassed without taking into account possible peripherals sourced by it
  • HW running independent from Linux is not taken into account when DDR is shut down. I.e. additional means have to be employed to make sure it is safe to shut down DDR before suspend is triggered.

Hardware Monitoring

XADC

The Xilinx analog mixed signal module, referred to as the XADC, allows temperature and voltage monitoring.
To compile a kernel with a driver for the XADC enable the following kernel config option:
  • CONFIG_XILINX_XADC

The driver exposes an interface through sysfs in /sys/devices/amba.0/f8007100.ps7-xadc/iio:device0.
A to scale measurement is retrieved by the following calculation:
(foo_raw + foo_offset) * foo_scale

Further information is available in:

UCD9248

TI's UCD9248 PWM controllers are commonly used on Xilinx platforms like the zc702. The Linux driver for these controllers allows voltage and current monitoring through a sysfs interface exposed in /sys/devices/amba.0/e0004000.ps7-i2c/i2c-0/i2c-8/8-003(4|5|6). The driver is documented in Documentation/hwmon/ucd9200
To compile a kernel with this driver enable the following kernel config option:
  • CONFIG_PMBUS
  • CONFIG_SENSORS_PMBUS
  • CONFIG_SENSORS_UCD9200

UCD90120

TI's UCD90120 power supply sequencer and monitors are commonly used on Xilinx platforms like the zc706. The Linux driver for these controllers allows voltage and current monitoring through a sysfs interface exposed in /sys/devices/amba.0/e0004000.ps7-i2c/i2c-0/i2c-8/8-0065. The driver is documented in Documentation/hwmon/ucd9000
To compile a kernel with this driver enable the following kernel config option:
  • CONFIG_PMBUS
  • CONFIG_SENSORS_PMBUS
  • CONFIG_SENSORS_UCD9000

Changelogs

2017.2
No change

2017.3
No change

Related Links

Controlling FCLKs in Linux
Zynq-7000 AP SoC Measuring ZC702 Power using Linux Application Tech Tip
Zynq-7000 AP SoC Measuring ZC702 Power using TI Fusion Power Designer Tech Tip
Zynq-7000 AP SoC Measuring ZC702 Power using Standalone Application Tech Tip

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy