i.MX53 poweroff -blog archive

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX53 poweroff -blog archive

714 Views
JayTu
NXP Employee
NXP Employee

There is no power off command on i.MX53 and how to do it?

In linux, there is a standard interface for power off. It is a system call.

In kernel/sys.c,

SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd,
                void __user *, arg)
{
        ...

                case LINUX_REBOOT_CMD_POWER_OFF:
                kernel_power_off();
                do_exit(0);
                break;
}

kernel_power_off will invoke pm_power_off which is a function pointer. It is defined to be da9053_power_off on i.MX53.

It will cut off PMIC power directly.

So, in user space, we just need to issue a system call with correct magic number and command.

The sample code is quite easy and list below:

#include <unistd.h>
#include <sys/reboot.h>

int main(void)
{
    return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
                    LINUX_REBOOT_CMD_POWER_OFF, NULL);
}

The code can be found at:
reboot.c

Tags (1)
0 Replies