imx6q: can I detect power button pressed?

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

imx6q: can I detect power button pressed?

883 Views
anr
Contributor I

In my application I would like to detect that the power button has been pressed. The snvs_pwrkey driver only gives interrupts when the key is released, however.

From the manual:

When the chip main power supply is On, a button press between 750 ms and 5 seconds will send an interrupt to the core to request that software bring down the SoC safely. Software may respond to the interrupt by saving the processor state and then setting a control bit that requests to the power IC the removal of the main power supply.

From the snvs_pwrkey.c commit log:

input: keyboard: imx: snvs_pwrkey: Add support for imx6qdl

On imx6qdl the interrupt only triggers on the release of the key.
Normally, the driver is looking for a change in the state of the key,
but since the interrupt triggers on release the key value is always 0,
so there was no event.

Add release-key-only boolean dts property to address this issue,
and create both key press and key release events when the key
is actually released.

Is the decision to only give interrupt when the key is released a deliberate one? Is there a way I can detect that the button has been pressed?

Tags (2)
0 Kudos
2 Replies

612 Views
igorpadykov
NXP Employee
NXP Employee

Hi Anders

yes seems it can be detected using SNVS_LPSR bit SPO,

described in sect.57.9.11 SNVS_LP Status Register (SNVS_LPSR)

i.MX6DQ Reference Manual
https://www.nxp.com/docs/en/reference-manual/IMX6DQRM.pdf

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

0 Kudos

612 Views
anr
Contributor I

Thanks, but I'm not sure that is the case. SPO is set when the interrupt is triggered, and that only happens when the power key is released.

From an answer over at ONOFF button doesn't interrupt it seems that MX6Q-SABRESD has worked around it by routing ONOFF to a gpio as well.

0 Kudos