Skip to content

Commit 8243a2a

Browse files
committed
soc: mspm0: add poweroff support
Add support for SHUTDOWN mode in TI MSPM0 series for power-off operation. Signed-off-by: Sanjay Vallimanalan <[email protected]>
1 parent 7e6b6ad commit 8243a2a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

soc/ti/mspm0/common/poweroff.c

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright (c) 2025 Linumiz GmbH
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/kernel.h>
8+
#include <zephyr/sys/poweroff.h>
9+
#include <zephyr/toolchain.h>
10+
#include <zephyr/drivers/hwinfo.h>
11+
#include <soc.h>
12+
13+
#include <ti/driverlib/driverlib.h>
14+
15+
void z_sys_poweroff(void)
16+
{
17+
DL_SYSCTL_setPowerPolicySHUTDOWN();
18+
__WFI();
19+
20+
CODE_UNREACHABLE;
21+
}
22+
23+
static int ti_mspm0l2xxx_poweroff_init(void)
24+
{
25+
int ret;
26+
uint32_t rst_cause;
27+
28+
ret = hwinfo_get_reset_cause(&rst_cause);
29+
if (ret != 0) {
30+
return ret;
31+
}
32+
33+
if (RESET_LOW_POWER_WAKE == rst_cause) {
34+
DL_SYSCTL_releaseShutdownIO();
35+
}
36+
37+
return 0;
38+
}
39+
SYS_INIT(ti_mspm0l2xxx_poweroff_init, POST_KERNEL, 0);

0 commit comments

Comments
 (0)