How to software poweroff using on/off button?

Showing results for 
Search instead for 
Did you mean: 

How to software poweroff using on/off button?

Contributor II


I am making a custom board using imx6ul
I want to change the power off during on / off button operation

Now, if the on / off button is pressed for more than 5 seconds, the power is turned off and turned off. In this case, the file saved immediately before the end of the file may be damaged, and the "poweroff" Just like when you command
 I want to clean up the file system and turn off the power.

The question is,

1. It seems that the BTN_PRESS_TIME of SNVS_LPCR can be changed to 5 seconds, 10 seconds and 15 seconds in the reference manual. Is it possible? (It takes more than 5 seconds to organize file system and driver, so I want to extend the power shutdown in 5 seconds)

2. In snvs_pwrkey.c, I found the location where the on / off button is pressed and the long key that keeps pressing down. I do not see the code to shut down the power. Where is the source code to shut down the power when the on / off button is pressed for more than 5 seconds?

3. When the status changes at the location where the long key is detected, I do an input_event, which seems to be caught by / dev / input / event1. Is there any way to read this event1 while (1) to process it?

I just want to execute the "poweroff" command using call_usermodehelper when I detect the long key of the on / off button at any time, but when I use it in snvs_pwrkey.c, it runs only error and does not power off the software.

Please help me

Labels (1)
0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport

Hi ellie

software power off example can be found on

Q&A: How is mx6 PMIC_ON_REQ under SW control? 

Best regards
Note: If this post answers your question, please click the Correct Answer button. Thank you!

0 Kudos