iMX6 Power Button behavior

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

iMX6 Power Button behavior

1,590 Views
konstantyn75
Contributor II

Hello,

I'm working on a project running Yocto Rocko Release 01-4.9.11 build for imx6 quad. I'd like to add some custom processing of the power button event. According to the imx6 specification pressing button between 750msec and 5 second would generate IRQ which is handled by the pwrkey_snvs module in drivers/input/keyboard.

The problem is that i'd like to trap IRQ when button was pressed. However it seems that IRQ is generated only when button is released. It is not really adequate solution for me because if i hold button more than 5 seconds SoC shuts down.

Is there a way around it? Also i understand that >5 second behavior when SoC shuts down is 'hard-wired', so there is no way to disable it, is it true?

In addition, i fired up a kernel timer in the pwrkey_snvs module to check SNVS registers every 100 msec as a test. The SNVS_HPSR status should indicate bits for Button Interrupt and Value of the BTN input. Both bits are off no matter how long i press the power button or if i press and release it multiple times. ISR for the IRQ is entered when button is released.

My device tree entry for the power button (I've tried several IRQ trigger types - nothing works):

snvs_pwrkey: snvs-powerkey {
compatible = "fsl,sec-v4.0-pwrkey";
regmap = <&snvs>;
interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
linux,keycode = <KEY_POWER>;
gpio_white_led = <&gpio2 31 0>;
gpio_red_led = <&gpio3 25 0>;
gpio_green_led = <&gpio3 23 0>;
wakeup-source;
status = "enabled";
};

I've added couple of GPIOs for my custom needs which should not interfere with the power button logic.

Thank you

Regards,

Konstantyn

Labels (4)
2 Replies

1,143 Views
igorpadykov
NXP Employee
NXP Employee

Hi Konstantyn

>i'd like to trap IRQ when button was pressed. However it seems that IRQ is generated only when button is >released. It is not really adequate solution for me because if i hold button more than 5 seconds SoC shuts down.

>Is there a way around it?

behaviour of ONOFF button is described in sect.10.5 ONOFF (Button) i.MX6DQ Reference Manual and

interrupt is generated only for case "button press between 750 ms and 5 seconds". Seems there is no way

to workaround this. Probably one can tie additional gpi and try to process its interrupt.

http://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!
-----------------------------------------------------------------------------------------------------------------------

1,143 Views
konstantyn75
Contributor II

Hi Igor,

Thank you very much for the reply. Yes, I've read the chapter in imx6 specification. I guess there is no way around unless some hardware changes are done on my board to tie the button to a gpio as you suggested.

Regards,

Konstantyn

0 Kudos