zephyr power management
play

Zephyr Power Management Ramesh Thomas OTC, Intel Zephyr is a - PowerPoint PPT Presentation

Zephyr Power Management Ramesh Thomas OTC, Intel Zephyr is a trademark of the Linux Foundation. *Other names and brands may be claimed as the property of others. Agenda Why Power Management? The core concepts behind Zephyr RTOS PM Power


  1. Zephyr™ Power Management Ramesh Thomas OTC, Intel Zephyr is a trademark of the Linux Foundation. *Other names and brands may be claimed as the property of others.

  2. Agenda Why Power Management? The core concepts behind Zephyr RTOS PM Power Management Infrastructures Future direction

  3. Think Possible…

  4. Zephyr RTOS PM – Core Concepts Multi architecture/board/SOC Designed for IoT/embedded Customizable for different needs Flexibility and variety of options Scalable design Follow open source process

  5. Zephyr RTOS components (partial) Application API HAL Device Management Power Management Device Drivers Kernel Peripherals Boot … Timers UART SPI I2C ROM

  6. PM high level layout SOC Interface Application … Thread Thread Thread Boot ROM 1 2 3 SOC PM Device Interface PM Management Subsystem HAL Device Drivers SHIM Kernel

  7. Zephyr RTOS PM Deep Dive

  8. Zephyr RTOS PM features Event based kernel idling System power management Device power management

  9. First a quick intro to the scheduler…

  10. Kernel scheduling and idling Equal Priority Priority based scheduling High Threads wait on semaphore or Thread 1 Thread 2 Thread 3 Priority yield Thread 4 Thread 5 Thread 6 Idle Thread scheduled when no other thread can run Thread 7 Thread 8 Thread 9 Idle Thread is lowest priority Low thread Idle Thread Priority System Power Management happens in Idle Thread

  11. Inside the Idle Thread Periodic mode timer ticks CPU Wait for event Kernel scheduler gets invoked from ISR of timer or other event If no thread is ready to run, schedules Idle Thread again

  12. Event Based Idling Ordered list of thread wait/timeout periods Turn off periodic mode 15 secs 2 secs 5 secs 10 secs timer Set one shot No ticks until a thread is ready to run timer CPU Wait Power saved by avoiding unnecessary for event wake events ISR turns periodic mode timer on again

  13. System Power Management

  14. Hooks into the Kernel Idle Thread _sys_soc_suspend(idle time) Going to idle _sys_soc_resume() Notify low power state exit or wake event SOC implementation dependent Simple and intuitive When idle - save power When active - real-time performance

  15. Triggered from Idle Thread Turn off Set one Call hook function periodic _sys_soc_suspend(idle time) shot timer mode timer No CPU Wait Handled? for event Yes _sys_soc_suspend() sets wake event Wake -> ISR -> Periodic Mode On -> Scheduler

  16. Inside _sys_soc_suspend

  17. Quick look into HW PM features…

  18. Categories based on HW PM features CPU Low Power State CPU SRAM CPU clock gated Peripherals active Internal SOC Deep Sleep Clocks CPU power gated Selective RAM retention Most peripherals lose power Peripherals Different power savings Timers … SPI I2C Different wake latencies Different resume paths

  19. _sys_soc_suspend(<idle time>) Setup wake event If short idle time Any PM operation that takes less time Enter a CPU low power state If long idle time Save states of devices that will lose power Any PM operation that saves more power Enter SOC Deep Sleep

  20. _sys_soc_resume() Deep Sleep wake notification Depends on SOC specific implementation Wake event notification Optionally called from ISR of wake events Before Kernel schedules other tasks or process nested interrupts Call _sys_soc_disable_wake_event_notification() if not required

  21. Device Power Management

  22. Device Power States Classified based on device state retention DEVICE_PM_ACTIVE_STATE DEVICE_PM_LOW_POWER_STATE DEVICE_PM_SUSPEND_STATE DEVICE_PM_OFF_STATE

  23. Device Power Management Overview Integrated with Device Management Drivers maintain per device power states Device APIs to set and get state Application, Driver or SOC interface can set states Multiple design options to manage device PM Central – Only in _sys_soc_suspend() Distributed – By Applications, Drivers, SOC Interface.

  24. Device PM APIs device_list_get ( struct device ** device_list , int * device_count) device_get_power_state ( struct device * device , uint32_t * device_power_state ) device_set_power_state ( struct device * device , uint32_t device_power_state ) device_busy_set(), device_busy_clear(), device_any_busy_check(), device_busy_check()

  25. Device Driver PM Interface int (*device_pm_control)( PM Control Function struct device *device, Control codes uint32_t command, void *context); DEVICE_PM_SET_POWER_STATE DEVICE_PM_GET_POWER_STATE static int example_control_fn (…) { Part of Device Interface switch (ctrl_command) { Access only through Device case DEVICE_PM_SET_POWER_STATE: APIs set state code case DEVICE_PM_GET_POWER_STATE: get state code } return 0; }

  26. Power Management Examples

  27. PM Example 1 (Distributed Device PM) SOC Idle App UART SPI HW Interface Thread set_state SUSPEND Yield _sys_soc_suspend set_state SUSPEND Yield _sys_soc_suspend SOC Deep Sleep

  28. PM Example 2 (Central Device PM) SOC Idle App UART SPI HW Interface Thread Yield set_state _sys_soc_suspend SUSPEND set_state SUSPEND SOC Deep Sleep set_state Resume ACTIVE set_state ACTIVE

  29. PM Example 3 (Flash on SPI) SPI App Flash set_state SUSPEND set_state SUSPEND set_state ACTIVE set_state ACTIVE

  30. Adding PM Support Configure Board, SOC, CPU, Arch (If not done already…) Enable/Disable PM feature configs _sys_soc_suspend / _sys_soc_resume PM support in device drivers PM support in application

  31. Summary

  32. Future direction New PM features derived from kernel updates Tick-less kernel Different time unit options Add ARC* and ARM* examples Distributed Device PM examples *Other names and brands may be claimed as the property of others.

  33. Summary Multi Arch, CPU, SOC, Board support Simple and Intuitive hook interface Versatile Device PM options Configurable, Scalable, Portable Open Source

  34. Questions

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend