Skip to content

Development Workflows Power Analysis Tools Guide

Alex J Lennon edited this page Oct 5, 2025 · 1 revision

Power Analysis Tools for Development Builds

Overview

This guide covers the comprehensive power analysis and optimization tools available in DEV_MODE builds for Dynamic Devices boards, with specific focus on the i.MX93 Jaguar E-Ink board targeting 5-year battery life.

⚠️ IMPORTANT: These tools are only available in development builds (DEV_MODE=1) and are automatically excluded from production builds for security and size optimization.

Building with Power Analysis Tools

Development Build with Power Tools

# Standard development build (includes all power tools)
DEV_MODE=1 KAS_MACHINE=imx93-jaguar-eink ./scripts/kas-build-base.sh

# Power tools are automatically included when DEV_MODE=1 sets debug-tweaks

Production Build (No Power Tools)

# Production build without development tools
DEV_MODE=0 KAS_MACHINE=imx93-jaguar-eink ./scripts/kas-build-base.sh

Available Power Analysis Tools

Core Power Monitoring Tools

PowerTOP - Industry Standard Power Analyzer

# Interactive power analysis
powertop

# Auto-tune power settings (applies optimizations)
powertop --auto-tune

# Generate HTML report
powertop --html=power-report.html --time=60

# Generate CSV data for analysis
powertop --csv=power-data.csv --time=30

What PowerTOP Shows:

  • CPU frequency and idle state usage
  • Device power consumption estimates
  • Wakeup frequency analysis
  • Power optimization suggestions

IOTop - I/O Activity Monitor

# Monitor I/O activity by process
iotop

# Show accumulated I/O instead of bandwidth
iotop -a

# Non-interactive mode for logging
iotop -b -n 10 > io-analysis.log

HTop - Enhanced Process Monitor

# Interactive process monitoring with power-relevant metrics
htop

# Show CPU frequency and temperature (if available)
htop -d 10

Custom Power Analysis Scripts

power-analysis-suite - Comprehensive i.MX93 Analysis

# Complete power analysis (recommended starting point)
power-analysis-suite --all

# Quick power status summary
power-analysis-suite --summary

# CPU power management analysis
power-analysis-suite --cpu

# Thermal management analysis
power-analysis-suite --thermal

# Wireless power management analysis
power-analysis-suite --wireless

# Power domain analysis
power-analysis-suite --domains

# PowerTOP integration
power-analysis-suite --powertop

What power-analysis-suite Analyzes:

  • i.MX93 LPM driver modes (OD/ND/LD)
  • PCA9451A PMIC voltage regulation
  • CPU idle states and governors
  • Thermal zones and policies
  • WiFi and Bluetooth power management
  • Power domain runtime status
  • DEVFREQ (DDR/bus scaling)

pm-analyzer - Lightweight Power Management Analyzer

# Complete PM analysis
pm-analyzer --all

# Suspend/resume capability analysis
pm-analyzer --suspend

# Current power consumption analysis
pm-analyzer --consumption

# Frequency scaling analysis
pm-analyzer --frequency

# Runtime power management analysis
pm-analyzer --runtime

# Test power transitions (may affect system performance)
pm-analyzer --test

What pm-analyzer Tests:

  • Available suspend states and wakeup sources
  • CPU frequency scaling capabilities
  • i.MX93 LPM mode transitions
  • Runtime PM device status
  • Power transition functionality

System Analysis Tools

Perf - CPU Performance and Power Analysis

# Monitor CPU usage and power events
perf top

# Record power-related events
perf record -e power:cpu_frequency -e power:cpu_idle

# Analyze recorded data
perf report

# Monitor specific process power usage
perf stat -p <PID>

Trace-cmd - Kernel Power Tracing

# Trace power management events
trace-cmd record -e power

# Trace CPU frequency changes
trace-cmd record -e power:cpu_frequency

# Analyze trace data
trace-cmd report

SysStat Tools - System Activity Monitoring

# CPU utilization and frequency
iostat -c 1

# Virtual memory statistics
vmstat 1

# System activity report
sar -u 1 10

# Power-related statistics
mpstat -P ALL 1

Hardware-Specific Tools

Wireless Power Analysis

# Check WiFi power save status
iw dev wlan0 get power_save

# Enable WiFi power saving
iw dev wlan0 set power_save on

# Monitor wireless interface statistics
iwconfig wlan0

# Detailed wireless information
iw dev wlan0 info

I2C Hardware Monitoring

# Detect I2C devices (including PMIC)
i2cdetect -y 2  # PCA9451A PMIC on I2C2

# Read PMIC registers (development only)
i2cget -y 2 0x25 0x00  # Read PMIC device ID

Temperature Monitoring

# Show all temperature sensors
sensors

# Monitor thermal zones
cat /sys/class/thermal/thermal_zone*/temp

# Check thermal policies
cat /sys/class/thermal/thermal_zone*/policy

GPIO and Pin Control

# List GPIO chips and pins
gpioinfo

# Monitor GPIO changes
gpiomon gpiochip0 25

# Control GPIO for power management
gpioset gpiochip0 25=1

i.MX93-Specific Power Analysis

CPU Frequency Scaling (i.MX93 LPM Driver)

The i.MX93 uses a unique LPM (Low Power Management) driver instead of standard CPUFreq:

# Check current LPM mode
cat /sys/devices/platform/imx93-lpm/mode

# Available modes
cat /sys/devices/platform/imx93-lpm/available_modes

# Change to maximum power save mode (Mode 3)
echo 3 > /sys/devices/platform/imx93-lpm/mode

# Verify clock rate
cat /sys/kernel/debug/clk/a55_core/clk_rate

i.MX93 Operating Modes:

  • Mode 0 (OD): 1700 MHz CPU, 3733 MT/s DDR (High Performance)
  • Mode 1 (ND): 1400 MHz CPU, 1866 MT/s DDR (Balanced)
  • Mode 2 (LD): 900 MHz CPU, 1866 MT/s DDR (Power Save)
  • Mode 3 (LD): 900 MHz CPU, 625 MT/s DDR (Maximum Power Save)

PMIC Monitoring (PCA9451A)

# Check PMIC voltage regulators (if available in userspace)
ls /sys/class/regulator/

# Monitor regulator status
cat /sys/class/regulator/regulator.*/microvolts
cat /sys/class/regulator/regulator.*/state

Power Domain Analysis

# Check power domain status
cat /sys/kernel/debug/pm_genpd/pm_genpd_summary

# Runtime PM status for key devices
cat /sys/devices/platform/44000000.mmc/power/runtime_status    # eMMC
cat /sys/devices/platform/42850000.mmc/power/runtime_status    # SDIO WiFi
cat /sys/devices/platform/44320000.spi/power/runtime_status    # SPI

Power Optimization Workflow

1. Baseline Measurement

# Get comprehensive baseline
power-analysis-suite --all > baseline-analysis.log

# Run PowerTOP for detailed analysis
powertop --html=baseline-report.html --time=300

# Check current power consumption estimates
pm-analyzer --consumption

2. Apply Optimizations

# Auto-tune with PowerTOP
powertop --auto-tune

# Set maximum power save mode
echo 3 > /sys/devices/platform/imx93-lpm/mode

# Enable WiFi power saving
iw dev wlan0 set power_save on

3. Validate Changes

# Compare after optimization
power-analysis-suite --all > optimized-analysis.log

# Test power transitions
pm-analyzer --test

# Monitor over time
powertop --csv=monitoring.csv --time=600

4. Suspend/Resume Testing

# Check suspend capabilities
pm-analyzer --suspend

# Test suspend/resume
systemctl suspend

# Check wakeup sources after resume
cat /sys/power/wakeup_count

Interpreting Results

PowerTOP Output

  • "Good": Low power consumption, no action needed
  • "Bad": High power consumption, optimization recommended
  • "Tunables": Settings that can be optimized
  • "Device Stats": Per-device power consumption estimates

Custom Script Output

  • CPU Analysis: Current frequency, governor, idle states
  • Thermal: Temperature readings and thermal policies
  • Power Domains: Runtime PM status of key devices
  • Wireless: Power save status and configuration

Key Metrics to Monitor

  • CPU Frequency: Should scale down during idle periods
  • Idle States: Deeper idle states save more power
  • Device Runtime PM: Devices should suspend when not in use
  • Temperature: Higher temps indicate higher power consumption
  • Wakeup Frequency: Fewer wakeups = better power efficiency

Troubleshooting

Tools Not Available

# Check if this is a development build
echo $DEV_MODE  # Should be "1"

# Check image features
cat /etc/os-release | grep IMAGE_FEATURES

# Verify tools are installed
which powertop power-analysis-suite pm-analyzer

i.MX93 LPM Driver Issues

# Check if LPM driver is loaded
ls /sys/devices/platform/imx93-lpm/

# Check device tree configuration
cat /proc/device-tree/lpm/status

# Check kernel logs for LPM messages
dmesg | grep -i lpm

PMIC Issues

# Check if PMIC is detected
i2cdetect -y 2 | grep 25  # Should show PCA9451A at 0x25

# Check regulator framework
ls /sys/class/regulator/

# Check kernel logs for PMIC messages
dmesg | grep -i pca9450

Best Practices

Development Workflow

  1. Always start with baseline measurements
  2. Make one change at a time and validate
  3. Document power consumption at each step
  4. Test suspend/resume after major changes
  5. Use version control to track configuration changes

Production Considerations

  1. Never deploy development builds to production
  2. Validate all optimizations on production builds
  3. Document final power optimization settings
  4. Create automated power regression tests

Integration with Build System

Automatic Inclusion

Power analysis tools are automatically included when:

  • DEV_MODE=1 is set in build configuration
  • IMAGE_FEATURES contains debug-tweaks
  • Building with development KAS configurations

Manual Control

# Force include power tools
IMAGE_FEATURES += "debug-tweaks"

# Exclude from production builds
DEV_MODE = "0"

Example Analysis Session

# 1. Get baseline
power-analysis-suite --summary

# 2. Detailed analysis
power-analysis-suite --all > power-baseline.log

# 3. Apply optimizations
powertop --auto-tune
echo 3 > /sys/devices/platform/imx93-lpm/mode

# 4. Validate changes
power-analysis-suite --summary
pm-analyzer --frequency

# 5. Long-term monitoring
powertop --csv=power-monitoring.csv --time=3600 &

This comprehensive power analysis capability enables professional-grade power optimization for achieving the 5-year battery life target on the i.MX93 Jaguar E-Ink board.

Clone this wiki locally