Skip to content

Commit

Permalink
include: pinctrl.h: Make PINCTRL_SKIP_SLEEP available with CONFIG_PM
Browse files Browse the repository at this point in the history
In some cases, PINCTRL_STATE_SLEEP may be required even when
CONFIG_PM_DEVICE is not defined.
One example is the possibility/need to put JTAG pins to analog when
CONIG_PM=y and CONFIG_DEBUG=n.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
  • Loading branch information
erwango committed Jan 24, 2024
1 parent 432ed28 commit 8fbf9bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions doc/hardware/pinctrl/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,10 @@ In most situations, the states defined in Devicetree will be the ones used in
the compiled firmware. However, there are some cases where certain states will
be conditionally used depending on a compilation flag. A typical case is the
``sleep`` state. This state is only used in practice if
:kconfig:option:`CONFIG_PM_DEVICE` is enabled. If a firmware variant without device
power management is needed, one should in theory remove the ``sleep`` state from
Devicetree to not waste ROM space storing such unused state.
:kconfig:option:`CONFIG_PM` or :kconfig:option:`CONFIG_PM_DEVICE` is enabled.
If a firmware variant without these power management configurations is needed,
one should in theory remove the ``sleep`` state from Devicetree to not waste ROM
space storing such unused state.

States can be skipped by the ``pinctrl`` Devicetree macros if a definition named
``PINCTRL_SKIP_{STATE_NAME}`` expanding to ``1`` is present when pin control
Expand All @@ -157,8 +158,8 @@ management:

.. code-block:: c
#ifndef CONFIG_PM_DEVICE
/** If device power management is not enabled, "sleep" state will be ignored. */
#if !defined(CONFIG_PM) && !defined(CONFIG_PM_DEVICE)
/** Out of power management configurations, ignore "sleep" state. */
#define PINCTRL_SKIP_SLEEP 1
#endif
Expand Down
4 changes: 2 additions & 2 deletions include/zephyr/drivers/pinctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ struct pinctrl_dev_config {

/** @cond INTERNAL_HIDDEN */

#ifndef CONFIG_PM_DEVICE
/** If device power management is not enabled, "sleep" state will be ignored. */
#if !defined(CONFIG_PM) && !defined(CONFIG_PM_DEVICE)
/** Out of power management configurations, ignore "sleep" state. */
#define PINCTRL_SKIP_SLEEP 1
#endif

Expand Down

0 comments on commit 8fbf9bd

Please sign in to comment.