| <!-- |
| Documentation/_templates/layout.html |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. The |
| ASF licenses this file to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance with the |
| License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| License for the specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| <!DOCTYPE html> |
| <html class="writer-html5" lang="en" > |
| <head> |
| <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> |
| |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| <title>Power Management — NuttX latest documentation</title> |
| <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/tabs.css" type="text/css" /> |
| <link rel="stylesheet" href="../_static/custom.css" type="text/css" /> |
| <link rel="shortcut icon" href="../_static/favicon.ico"/> |
| <!--[if lt IE 9]> |
| <script src="../_static/js/html5shiv.min.js"></script> |
| <![endif]--> |
| |
| <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script> |
| <script src="../_static/jquery.js"></script> |
| <script src="../_static/underscore.js"></script> |
| <script src="../_static/doctools.js"></script> |
| <script src="../_static/js/theme.js"></script> |
| <link rel="index" title="Index" href="../genindex.html" /> |
| <link rel="search" title="Search" href="../search.html" /> |
| <link rel="next" title="Binary Loader" href="binfmt.html" /> |
| <link rel="prev" title="OS Components" href="index.html" /> |
| </head> |
| |
| <body class="wy-body-for-nav"> |
| <div class="wy-grid-for-nav"> |
| <nav data-toggle="wy-nav-shift" class="wy-nav-side"> |
| <div class="wy-side-scroll"> |
| <div class="wy-side-nav-search" > |
| |
| <a href="../index.html" class="icon icon-home"> NuttX |
| |
| |
| |
| |
| <img src="../_static/NuttX.png" class="logo" alt="Logo"/> |
| |
| </a> |
| |
| <!-- this version selector is quite ugly, should be probably replaced by something |
| more modern --> |
| |
| <div class="version-selector"> |
| <select onchange="javascript:location.href = this.value;"> |
| |
| <option value="../../latest" selected="selected">latest</option> |
| |
| <option value="../../10.0.0" >10.0.0</option> |
| |
| <option value="../../10.0.1" >10.0.1</option> |
| |
| <option value="../../10.1.0" >10.1.0</option> |
| |
| <option value="../../10.2.0" >10.2.0</option> |
| |
| <option value="../../10.3.0" >10.3.0</option> |
| |
| <option value="../../11.0.0" >11.0.0</option> |
| |
| <option value="../../12.0.0" >12.0.0</option> |
| |
| <option value="../../12.1.0" >12.1.0</option> |
| |
| <option value="../../12.2.0" >12.2.0</option> |
| |
| <option value="../../12.2.1" >12.2.1</option> |
| |
| <option value="../../12.3.0" >12.3.0</option> |
| |
| <option value="../../12.4.0" >12.4.0</option> |
| |
| <option value="../../12.5.0" >12.5.0</option> |
| |
| <option value="../../12.5.1" >12.5.1</option> |
| |
| <option value="../../12.6.0" >12.6.0</option> |
| |
| <option value="../../12.7.0" >12.7.0</option> |
| |
| <option value="../../12.8.0" >12.8.0</option> |
| |
| <option value="../../12.9.0" >12.9.0</option> |
| |
| <option value="../../12.10.0" >12.10.0</option> |
| |
| <option value="../../12.11.0" >12.11.0</option> |
| |
| </select> |
| </div> |
| |
| |
| <div role="search"> |
| <form id="rtd-search-form" class="wy-form" action="../search.html" method="get"> |
| <input type="text" name="q" placeholder="Search docs" /> |
| <input type="hidden" name="check_keywords" value="yes" /> |
| <input type="hidden" name="area" value="default" /> |
| </form> |
| </div> |
| |
| </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> |
| <p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p> |
| <ul class="current"> |
| <li class="toctree-l1"><a class="reference internal" href="../index.html">Home</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../introduction/index.html">Introduction</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../quickstart/index.html">Getting Started</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../platforms/index.html">Supported Platforms</a></li> |
| <li class="toctree-l1 current"><a class="reference internal" href="index.html">OS Components</a><ul class="current"> |
| <li class="toctree-l2 current"><a class="current reference internal" href="#">Power Management</a><ul> |
| <li class="toctree-l3"><a class="reference internal" href="#interfaces">Interfaces</a></li> |
| <li class="toctree-l3"><a class="reference internal" href="#callbacks">Callbacks</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l2"><a class="reference internal" href="binfmt.html">Binary Loader</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="drivers/index.html">Device Drivers</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="filesystem.html">NuttX File System</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="nxflat.html">NXFLAT</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="nxgraphics/index.html">NX Graphics Subsystem</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="nxwidgets.html">NxWidgets</a></li> |
| <li class="toctree-l2"><a class="reference internal" href="paging.html">On-Demand Paging</a></li> |
| </ul> |
| </li> |
| <li class="toctree-l1"><a class="reference internal" href="../applications/index.html">Applications</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../reference/index.html">API Reference</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">FAQ</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../guides/index.html">Guides</a></li> |
| <li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| </nav> |
| |
| <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > |
| <i data-toggle="wy-nav-top" class="fa fa-bars"></i> |
| <a href="../index.html">NuttX</a> |
| </nav> |
| |
| <div class="wy-nav-content"> |
| <div class="rst-content"> |
| <div role="navigation" aria-label="Page navigation"> |
| <ul class="wy-breadcrumbs"> |
| <li><a href="../index.html" class="icon icon-home"></a> »</li> |
| <li><a href="index.html">OS Components</a> »</li> |
| <li>Power Management</li> |
| <li class="wy-breadcrumbs-aside"> |
| <a href="../_sources/components/power.rst.txt" rel="nofollow"> View page source</a> |
| </li> |
| </ul> |
| <hr/> |
| </div> |
| <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> |
| <div itemprop="articleBody"> |
| |
| <section id="power-management"> |
| <h1>Power Management<a class="headerlink" href="#power-management" title="Permalink to this headline"></a></h1> |
| <div class="admonition-todo admonition" id="id1"> |
| <p class="admonition-title">Todo</p> |
| <p>This needs to be updated to account for the different governors |
| besides the activity-based one.</p> |
| </div> |
| <p>NuttX supports a simple power management (PM) sub-system which:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p>Monitors activity from drivers (and from other parts of the |
| system), and</p></li> |
| <li><p>Provides hooks to place drivers (and the whole system) into |
| reduce power modes of operation.</p></li> |
| </ul> |
| </div></blockquote> |
| <p><img alt="figure" src="../_images/pm.png" /></p> |
| <p>The PM sub-system integrates the MCU idle loop with a collection |
| of device drivers to support:</p> |
| <blockquote> |
| <div><ul class="simple"> |
| <li><p>Reports of relevant driver or other system activity.</p></li> |
| <li><p>Registration and callback mechanism to interface with |
| individual device drivers.</p></li> |
| <li><p>IDLE time polling of overall driver activity.</p></li> |
| <li><p>Coordinated, global, system-wide transitions to lower power |
| usage states.</p></li> |
| </ul> |
| </div></blockquote> |
| <p><strong>Low Power Consumption States</strong>. Various “sleep” and low power |
| consumption states have various names and are sometimes used in |
| conflicting ways. In the NuttX PM logic, we will use the following |
| terminology:</p> |
| <blockquote> |
| <div><dl class="simple"> |
| <dt><code class="docutils literal notranslate"><span class="pre">NORMAL</span></code></dt><dd><p>The normal, full power operating mode.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">IDLE</span></code></dt><dd><p>This is still basically normal operational mode, the system is, |
| however, <code class="docutils literal notranslate"><span class="pre">IDLE</span></code> and some simple simple steps to reduce power |
| consumption provided that they do not interfere with normal |
| Operation. Simply dimming the a backlight might be an example |
| some that that would be done when the system is idle.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">STANDBY</span></code></dt><dd><p>Standby is a lower power consumption mode that may involve more |
| extensive power management steps such has disabling clocking or |
| setting the processor into reduced power consumption modes. In |
| this state, the system should still be able to resume normal |
| activity almost immediately.</p> |
| </dd> |
| <dt><code class="docutils literal notranslate"><span class="pre">SLEEP</span></code></dt><dd><p>The lowest power consumption mode. The most drastic power |
| reduction measures possible should be taken in this state. It |
| may require some time to get back to normal operation from |
| <code class="docutils literal notranslate"><span class="pre">SLEEP</span></code> (some MCUs may even require going through reset).</p> |
| </dd> |
| </dl> |
| </div></blockquote> |
| <dl class="c enum"> |
| <dt class="sig sig-object c" id="c.pm_state_e"> |
| <span class="k"><span class="pre">enum</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_state_e</span></span></span><a class="headerlink" href="#c.pm_state_e" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>These various states are represented with type <a class="reference internal" href="#c.pm_state_e" title="pm_state_e"><code class="xref c c-enum docutils literal notranslate"><span class="pre">pm_state_e</span></code></a> |
| in <code class="docutils literal notranslate"><span class="pre">include/nuttx/power/pm.h</span></code>.</p> |
| </dd></dl> |
| |
| <p><strong>Power Management Domains</strong>. Each PM interfaces includes a |
| integer <em>domain</em> number. By default, only a single power domain is |
| supported (<code class="docutils literal notranslate"><span class="pre">CONFIG_PM_NDOMAINS=1</span></code>). But that is configurable; |
| any number of PM domains can be supported. Multiple PM domains |
| might be useful, for example, if you would want to control power |
| states associated with a network separately from power states |
| associated with a user interface.</p> |
| <section id="interfaces"> |
| <h2>Interfaces<a class="headerlink" href="#interfaces" title="Permalink to this headline"></a></h2> |
| <p>All PM interfaces are declared in the file <code class="docutils literal notranslate"><span class="pre">include/nuttx/power/pm.h</span></code>.</p> |
| <dl class="c function"> |
| <dt class="sig sig-object c" id="c.pm_initialize"> |
| <span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_initialize</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">void</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.pm_initialize" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>Called by MCU-specific one-time logic |
| at power-on-reset in order to initialize the power management |
| capabilities. This function must be called <em>very</em> early in the |
| initialization sequence <em>before</em> any other device drivers are |
| initialized (since they may attempt to register with the power |
| management subsystem).</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt class="sig sig-object c" id="c.pm_register"> |
| <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_register</span></span></span><span class="sig-paren">(</span><span class="pre">FAR</span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_callback_s" title="pm_callback_s"><span class="n"><span class="pre">pm_callback_s</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">callbacks</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.pm_register" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>Called by a device driver in |
| order to register to receive power management event callbacks. |
| Refer to the <a class="reference internal" href="#callbacks"><span class="std std-ref">Callbacks</span></a> section for more |
| details.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>callbacks</strong> – An instance of <a class="reference internal" href="#c.pm_callback_s" title="pm_callback_s"><code class="xref c c-struct docutils literal notranslate"><span class="pre">pm_callback_s</span></code></a> |
| providing the driver callback functions.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>Zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) on success; otherwise a negated |
| <code class="docutils literal notranslate"><span class="pre">errno</span></code> value is returned.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt class="sig sig-object c" id="c.pm_unregister"> |
| <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_unregister</span></span></span><span class="sig-paren">(</span><span class="pre">FAR</span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_callback_s" title="pm_callback_s"><span class="n"><span class="pre">pm_callback_s</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">callbacks</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.pm_unregister" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>Called by a device driver in |
| order to unregister previously registered power management event |
| callbacks. Refer to the <a class="reference internal" href="#callbacks"><span class="std std-ref">Callbacks</span></a> section for |
| more details.</p> |
| <p><strong>Input Parameters:</strong></p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>callbacks</strong> – An instance of <a class="reference internal" href="#c.pm_callback_s" title="pm_callback_s"><code class="xref c c-struct docutils literal notranslate"><span class="pre">pm_callback_s</span></code></a> |
| providing the driver callback functions.</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>Zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) on success; otherwise a negated |
| <code class="docutils literal notranslate"><span class="pre">errno</span></code> value is returned.</p> |
| </dd> |
| </dl> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt class="sig sig-object c" id="c.pm_activity"> |
| <span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_activity</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">domain</span></span>, <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">priority</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.pm_activity" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>Called by a device driver to |
| indicate that it is performing meaningful activities (non-idle). |
| This increment an activity count and/or will restart a idle timer |
| and prevent entering reduced power states.</p> |
| <blockquote> |
| <div><dl class="field-list simple"> |
| <dt class="field-odd">param domain</dt> |
| <dd class="field-odd"><p>Identifies the domain of the new PM activity</p> |
| </dd> |
| <dt class="field-even">param priority</dt> |
| <dd class="field-even"><p>Activity priority, range 0-9. Larger values correspond to |
| higher priorities. Higher priority activity can prevent the |
| system from entering reduced power states for a longer period |
| of time. As an example, a button press might be higher priority |
| activity because it means that the user is actively interacting |
| with the device.</p> |
| </dd> |
| </dl> |
| </div></blockquote> |
| <p><strong>Assumptions:</strong> This function may be called from an interrupt |
| handler (this is the ONLY PM function that may be called from an |
| interrupt handler!).</p> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt class="sig sig-object c" id="c.pm_checkstate"> |
| <span class="k"><span class="pre">enum</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_state_e" title="pm_state_e"><span class="n"><span class="pre">pm_state_e</span></span></a><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_checkstate</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">domain</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.pm_checkstate" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>Called from the MCU-specific |
| IDLE loop to monitor the power management conditions. This |
| function returns the “recommended” power management state based on |
| the PM configuration and activity reported in the last sampling |
| periods. The power management state is not automatically changed, |
| however. The IDLE loop must call <a class="reference internal" href="#c.pm_changestate" title="pm_changestate"><code class="xref c c-func docutils literal notranslate"><span class="pre">pm_changestate()</span></code></a> in order to |
| make the state change.</p> |
| <p>These two steps are separated because the platform-specific IDLE |
| loop may have additional situational information that is not |
| available to the PM sub-system. For example, the IDLE loop may |
| know that the battery charge level is very low and may force lower |
| power states even if there is activity.</p> |
| <p>NOTE: That these two steps are separated in time and, hence, the |
| IDLE loop could be suspended for a long period of time between |
| calling <a class="reference internal" href="#c.pm_checkstate" title="pm_checkstate"><code class="xref c c-func docutils literal notranslate"><span class="pre">pm_checkstate()</span></code></a> and <a class="reference internal" href="#c.pm_changestate" title="pm_changestate"><code class="xref c c-func docutils literal notranslate"><span class="pre">pm_changestate()</span></code></a>. The IDLE |
| loop may need to make these calls atomic by either disabling |
| interrupts until the state change is completed.</p> |
| <blockquote> |
| <div><dl class="field-list simple"> |
| <dt class="field-odd">param domain</dt> |
| <dd class="field-odd"><p>Identifies the PM domain to check</p> |
| </dd> |
| <dt class="field-even">return</dt> |
| <dd class="field-even"><p>The recommended power management state.</p> |
| </dd> |
| </dl> |
| </div></blockquote> |
| </dd></dl> |
| |
| <dl class="c function"> |
| <dt class="sig sig-object c" id="c.pm_changestate"> |
| <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_changestate</span></span></span><span class="sig-paren">(</span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">domain</span></span>, <span class="k"><span class="pre">enum</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_state_e" title="pm_state_e"><span class="n"><span class="pre">pm_state_e</span></span></a><span class="w"> </span><span class="n"><span class="pre">newstate</span></span><span class="sig-paren">)</span><a class="headerlink" href="#c.pm_changestate" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>This function is used by platform-specific power |
| management logic. It will announce the power management power |
| management state change to all drivers that have registered for |
| power management event callbacks.</p> |
| <dl class="field-list simple"> |
| <dt class="field-odd">Parameters</dt> |
| <dd class="field-odd"><ul class="simple"> |
| <li><p><strong>domain</strong> – Identifies the domain of the new PM state</p></li> |
| <li><p><strong>newstate</strong> – Identifies the new PM state</p></li> |
| </ul> |
| </dd> |
| <dt class="field-even">Returns</dt> |
| <dd class="field-even"><p>0 (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) means that the callback function |
| for all registered drivers returned <code class="docutils literal notranslate"><span class="pre">OK</span></code> (meaning that they |
| accept the state change). Non-zero means that one of the drivers |
| refused the state change. In this case, the system will revert to |
| the preceding state.</p> |
| </dd> |
| </dl> |
| <p><strong>Assumptions:</strong> It is assumed that interrupts are disabled when |
| this function is called. This function is probably called from the |
| IDLE loop… the lowest priority task in the system. Changing |
| driver power management states may result in renewed system |
| activity and, as a result, can suspend the IDLE thread before it |
| completes the entire state change unless interrupts are disabled |
| throughout the state change.</p> |
| </dd></dl> |
| |
| </section> |
| <section id="callbacks"> |
| <h2>Callbacks<a class="headerlink" href="#callbacks" title="Permalink to this headline"></a></h2> |
| <dl class="c struct"> |
| <dt class="sig sig-object c" id="c.pm_callback_s"> |
| <span class="k"><span class="pre">struct</span></span><span class="w"> </span><span class="sig-name descname"><span class="n"><span class="pre">pm_callback_s</span></span></span><a class="headerlink" href="#c.pm_callback_s" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>This struct includes the pointers to the driver |
| callback functions. This structure is defined |
| <code class="docutils literal notranslate"><span class="pre">include/nuttx/power/pm.h</span></code>. These callback functions can be used |
| to provide power management information to the driver.</p> |
| </dd></dl> |
| |
| <dl class="c var"> |
| <dt class="sig sig-object c" id="c.prepare"> |
| <span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="p"><span class="pre">(</span></span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">prepare</span></span></span><span class="p"><span class="pre">)</span></span><span class="p"><span class="pre">(</span></span><span class="pre">FAR</span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_callback_s" title="pm_callback_s"><span class="n"><span class="pre">pm_callback_s</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">cb</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">domain</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_state_e" title="pm_state_e"><span class="n"><span class="pre">pm_state_e</span></span></a><span class="w"> </span><span class="n"><span class="pre">pmstate</span></span><span class="p"><span class="pre">)</span></span><a class="headerlink" href="#c.prepare" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>Request the driver to prepare for a new power |
| state. This is a warning that the system is about to enter into a |
| new power state. The driver should begin whatever operations that |
| may be required to enter power state. The driver may abort the |
| state change mode by returning a non-zero value from the callback |
| function.</p> |
| <blockquote> |
| <div><dl class="field-list simple"> |
| <dt class="field-odd">param cb</dt> |
| <dd class="field-odd"><p>Returned to the driver. The driver version of the callback |
| structure may include additional, driver-specific state data at |
| the end of the structure.</p> |
| </dd> |
| <dt class="field-even">param domain</dt> |
| <dd class="field-even"><p>Identifies the activity domain of the state change</p> |
| </dd> |
| <dt class="field-odd">param pmstate</dt> |
| <dd class="field-odd"><p>Identifies the new PM state</p> |
| </dd> |
| <dt class="field-even">return</dt> |
| <dd class="field-even"><p>Zero (<code class="docutils literal notranslate"><span class="pre">OK</span></code>) means the event was successfully |
| processed and that the driver is prepared for the PM state change. |
| Non-zero means that the driver is not prepared to perform the |
| tasks needed achieve this power setting and will cause the state |
| change to be aborted. NOTE: The <code class="docutils literal notranslate"><span class="pre">prepare()</span></code> method will also be |
| called when reverting from lower back to higher power consumption |
| modes (say because another driver refused a lower power state |
| change). Drivers are not permitted to return non-zero values when |
| reverting back to higher power consumption modes!</p> |
| </dd> |
| </dl> |
| </div></blockquote> |
| </dd></dl> |
| |
| <dl class="c var"> |
| <dt class="sig sig-object c" id="c.notify"> |
| <span class="kt"><span class="pre">void</span></span><span class="w"> </span><span class="p"><span class="pre">(</span></span><span class="p"><span class="pre">*</span></span><span class="sig-name descname"><span class="n"><span class="pre">notify</span></span></span><span class="p"><span class="pre">)</span></span><span class="p"><span class="pre">(</span></span><span class="pre">FAR</span><span class="w"> </span><span class="k"><span class="pre">struct</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_callback_s" title="pm_callback_s"><span class="n"><span class="pre">pm_callback_s</span></span></a><span class="w"> </span><span class="p"><span class="pre">*</span></span><span class="n"><span class="pre">cb</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="kt"><span class="pre">int</span></span><span class="w"> </span><span class="n"><span class="pre">domain</span></span><span class="p"><span class="pre">,</span></span><span class="w"> </span><span class="k"><span class="pre">enum</span></span><span class="w"> </span><a class="reference internal" href="#c.pm_state_e" title="pm_state_e"><span class="n"><span class="pre">pm_state_e</span></span></a><span class="w"> </span><span class="n"><span class="pre">pmstate</span></span><span class="p"><span class="pre">)</span></span><a class="headerlink" href="#c.notify" title="Permalink to this definition"></a><br /></dt> |
| <dd><p>Notify the driver of new power state. This |
| callback is called after all drivers have had the opportunity to |
| prepare for the new power state.</p> |
| <blockquote> |
| <div><dl class="field-list simple"> |
| <dt class="field-odd">param cb</dt> |
| <dd class="field-odd"><p>Returned to the driver. The driver version of the callback |
| structure may include additional, driver-specific state data at |
| the end of the structure.</p> |
| </dd> |
| <dt class="field-even">param domain</dt> |
| <dd class="field-even"><p>Identifies the activity domain of the state change</p> |
| </dd> |
| <dt class="field-odd">param pmstate</dt> |
| <dd class="field-odd"><p>Identifies the new PM state</p> |
| </dd> |
| </dl> |
| </div></blockquote> |
| <p>The driver already agreed to transition |
| to the low power consumption state when when it returned <code class="docutils literal notranslate"><span class="pre">OK</span></code> to |
| the <a class="reference internal" href="#c.prepare" title="prepare"><code class="xref c c-var docutils literal notranslate"><span class="pre">prepare</span></code></a> call.</p> |
| </dd></dl> |
| |
| </section> |
| </section> |
| |
| |
| </div> |
| </div> |
| <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> |
| <a href="index.html" class="btn btn-neutral float-left" title="OS Components" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> |
| <a href="binfmt.html" class="btn btn-neutral float-right" title="Binary Loader" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a> |
| </div> |
| |
| <hr/> |
| |
| <div role="contentinfo"> |
| <p>© Copyright 2020, The Apache Software Foundation.</p> |
| </div> |
| |
| |
| |
| </footer> |
| </div> |
| </div> |
| </section> |
| </div> |
| <script> |
| jQuery(function () { |
| SphinxRtdTheme.Navigation.enable(true); |
| }); |
| </script> |
| |
| </body> |
| </html> |