File tree Expand file tree Collapse file tree 3 files changed +39
-0
lines changed
Expand file tree Collapse file tree 3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,8 @@ zephyr_sources(soc.c)
66
77zephyr_sources_ifdef(CONFIG_PM power.c)
88
9+ zephyr_sources_ifdef(CONFIG_POWEROFF poweroff.c)
10+
911zephyr_include_directories(./)
1012
1113set (SOC_LINKER_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR} /linker.ld CACHE INTERNAL "" )
Original file line number Diff line number Diff line change 11# Copyright 2025 NXP
22#
33# SPDX-License-Identifier: Apache-2.0
4+
5+ config SOC_SERIES_MCXW2XX
6+ select HAS_POWEROFF
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 NXP
3+ *
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ #include <zephyr/devicetree.h>
8+ #include <zephyr/sys/poweroff.h>
9+ #include <zephyr/toolchain.h>
10+ #include <zephyr/drivers/gpio.h>
11+ #include <fsl_power.h>
12+
13+ #if CONFIG_GPIO && DT_NODE_EXISTS (DT_NODELABEL (btn_wk ))
14+
15+ #if (DT_GPIO_FLAGS (DT_NODELABEL (btn_wk ), gpios )) & GPIO_ACTIVE_LOW
16+ #define POWEROFF_WAKEUP (kWAKEUP_PIN_ENABLE | \
17+ kWAKEUP_PIN_PUP_EN | \
18+ kWAKEUP_PIN_WAKEUP_LOW_LVL)
19+ #else /* !GPIO_ACTIVE_LOW */
20+ #define POWEROFF_WAKEUP (kWAKEUP_PIN_ENABLE | \
21+ kWAKEUP_PIN_PDN_EN | \
22+ kWAKEUP_PIN_WAKEUP_HIGH_LVL)
23+ #endif /* GPIO_ACTIVE_LOW */
24+
25+ #else
26+ #define POWEROFF_WAKEUP kWAKEUP_PIN_DISABLE
27+ #endif /* CONFIG_GPIO && DT_NODE_EXISTS(DT_NODELABEL(btn_wk)) */
28+
29+ void z_sys_poweroff (void )
30+ {
31+ POWER_EnterPowerOff (0 , POWEROFF_WAKEUP );
32+
33+ CODE_UNREACHABLE ;
34+ }
You can’t perform that action at this time.
0 commit comments