Disable power key in Android 12.1 in imx8mp

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

Disable power key in Android 12.1 in imx8mp

Jump to solution
1,595 Views
dgeier315
Contributor III

I need to disable the power button function when our unit enters a certain state and enable it when it leaves that state.

Does Android have a function call for that(imx_snvs_pwrkey_pm_ops?), or do I need to disable the interrupt?

Thanks

 

                snvs_pwrkey: snvs-powerkey {
                    compatible = "fsl,sec-v4.0-pwrkey";
                    regmap = <&snvs>;
                    interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
                    clocks = <&clk IMX8MP_CLK_SNVS_ROOT>;
                    clock-names = "snvs-pwrkey";
                    linux,keycode = <KEY_POWER>;
                    debounce-interval = <2000>;

                    wakeup-source;
                    status = "okay";
                };
 
0 Kudos
Reply
1 Solution
1,525 Views
dgeier315
Contributor III
echo \"30370000.snvs:snvs-powerkey\" > /sys/bus/platform/drivers/snvs_pwrkey/bind
echo \"30370000.snvs:snvs-powerkey\" > /sys/bus/platform/drivers/snvs_pwrkey/unbind
 
These commands were able to disable the power button.
 

View solution in original post

0 Kudos
Reply
3 Replies
1,526 Views
dgeier315
Contributor III
echo \"30370000.snvs:snvs-powerkey\" > /sys/bus/platform/drivers/snvs_pwrkey/bind
echo \"30370000.snvs:snvs-powerkey\" > /sys/bus/platform/drivers/snvs_pwrkey/unbind
 
These commands were able to disable the power button.
 
0 Kudos
Reply
1,523 Views
dgeier315
Contributor III
 
0 Kudos
Reply
1,578 Views
Manuel_Salas
NXP TechSupport
NXP TechSupport

Hello @dgeier315 

 

As you mentioned, disabling the IRQ can works, and re-enabling again. Take a look to the ICR1, ICR2 and IMR registers on Reference Manual.

 

Best regards,

Salas.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1880831%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EDisable%20power%20key%20in%20Android%2012.1%20in%20imx8mp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1880831%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20need%20to%20disable%20the%20power%20button%20function%20when%20our%20unit%20enters%20a%20certain%20state%20and%20enable%20it%20when%20it%20leaves%20that%20state.%3C%2FP%3E%3CP%3EDoes%20Android%20have%20a%20function%20call%20for%20that(%3CSPAN%3Eimx_snvs_pwrkey_pm_ops%3C%2FSPAN%3E%3CSPAN%3E%3F)%3C%2FSPAN%3E%3CSPAN%3E%2C%20or%20do%20I%20need%20to%20disable%20the%20interrupt%3F%3C%2FSPAN%3E%3C%2FP%3E%3CP%3EThanks%3C%2FP%3E%3CBR%20%2F%3E%3CDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%3C%2FSPAN%3E%3CSPAN%3Esnvs_pwrkey%3C%2FSPAN%3E%3CSPAN%3E%3A%20%3C%2FSPAN%3E%3CSPAN%3Esnvs-powerkey%3C%2FSPAN%3E%3CSPAN%3E%20%7B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20compatible%20%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22fsl%2Csec-v4.0-pwrkey%22%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20regmap%20%3D%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%3E%26amp%3Bsnvs%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20interrupts%20%3D%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%3EGIC_SPI%3C%2FSPAN%3E%20%3CSPAN%3E4%3C%2FSPAN%3E%20%3CSPAN%3EIRQ_TYPE_LEVEL_HIGH%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20clocks%20%3D%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%3E%26amp%3Bclk%3C%2FSPAN%3E%20%3CSPAN%3EIMX8MP_CLK_SNVS_ROOT%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20clock-names%20%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22snvs-pwrkey%22%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20linux%2Ckeycode%20%3D%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%3EKEY_POWER%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20debounce-interval%20%3D%20%26lt%3B%3C%2FSPAN%3E%3CSPAN%3E2000%3C%2FSPAN%3E%3CSPAN%3E%26gt%3B%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20wakeup-source%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20status%20%3D%20%3C%2FSPAN%3E%3CSPAN%3E%22okay%22%3C%2FSPAN%3E%3CSPAN%3E%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%3CSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%7D%3B%3C%2FSPAN%3E%3C%2FDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1880831%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CLINGO-LABEL%3EAndroid%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3Ei.MX%208M%20%7C%20i.MX%208M%20Mini%20%7C%20i.MX%208M%20Nano%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELinux%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1886151%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Disable%20power%20key%20in%20Android%2012.1%20in%20imx8mp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1886151%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1880966%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Disable%20power%20key%20in%20Android%2012.1%20in%20imx8mp%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1880966%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F195631%22%20target%3D%22_blank%22%3E%40dgeier315%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EAs%20you%20mentioned%2C%20disabling%20the%20IRQ%20can%20works%2C%20and%20re-enabling%20again.%20Take%20a%20look%20to%20the%26nbsp%3BICR1%2C%20ICR2%20and%26nbsp%3BIMR%20registers%20on%20Reference%20Manual.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20regards%2C%3C%2FP%3E%0A%3CP%3ESalas.%3C%2FP%3E%3C%2FLINGO-BODY%3E