AnsweredAssumed Answered

imx6q: can I detect power button pressed?

Question asked by Anders Rønningen on Mar 5, 2018
Latest reply on Mar 6, 2018 by Anders Rønningen

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?

Outcomes