Hi Team,
We are using the i.MX8qm SOC for the project.
Here, We are using the SCU_GPIO0_04 to wakeup from the low power mode.(ignition detection).
We have first tried to use the gpio-keys (Not working) from linux kernel just like used in other chipset like (i.MX8MN)(Working proiperly in i.MX8MN directly from linux kernel).
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_keys>;
status = "okay";
power {
label = "Ignition";
gpios = <&lsio_gpio1 0 GPIO_ACTIVE_LOW>;
linux,code = <BTN_0>;
wakeup-source;
debounce-interval = <5>;
wakeup-event-action = <1>;
};
};
pinctrl_gpio_keys: gpio-keysgrp {
fsl,pins = <
IMX8QM_SCU_GPIO0_04_LSIO_GPIO1_IO00 0xDE700020
>;
};
Above approche is not working.
Then, I come across the changes required in SCFW in i.MX8qm chipset for wakeup on gpio press when in low power mode.
I have updated changes in the SCFW but that is not enabling the wakeup as well.
I have used following apis to enable wakeup
(void) rm_set_resource_movable(pt_sc, SC_R_GPIO_4, SC_R_GPIO_4,
SC_FALSE);
(void) rm_set_pad_movable(pt_sc, SC_P_SCU_GPIO0_04, SC_P_SCU_GPIO0_04,
SC_FALSE);
err = pad_set(pt_sc, SC_P_SCU_GPIO0_04, 0x600043);
/* Here, after reading we see output value is 0x200043 expected 0x600043 */
err = pad_get(pt_sc, SC_P_SCU_GPIO0_04,&value);
Here, We are setting wakeup enable and also set the wakeup on low level but We cann't see Wakeup enable.
Details of pads and mux get from the TRM as proivided earlier.
Can you please let me know what we are doing wrong to enable wakeup on gpio from SCFW?
I have also checked the ON_OFF_BUTTON related apis in SCFW where SNVS_Config and other api available to control power management but I cann't same to control using the wakeup on GPIO.
NOTE
But those api are also not helpful
Thanks & Regards,
Dhaval
Hi @DhavalS , the thread seems old. However for anyone who visits this page, encountering a similar issue.
2 things you can check:-
1. Assuming, you have ensured that you are connecting the right GPIO to test the functionality, On your board's linux console, you may test the change in event on your GPIO via evtest
Example:-
evtest /dev/input/event1
then connect your gpio to GND to trigger an event and see if you see any EVENT logs such as the below:-
Event: time 16777464737.9746, type 1(EV_KEY), .....(BTN_0)
that would mean that the gpio input functionality is working fine.
2. The other thing what you can do is, that you could configure your GPIO as an interrupt and then try it.
by adding this to your DTS and see if it works:-
interrupt-parent = <&lsio_gpio1>;
interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
In my case the below dts changes worked for imx93evk:-
/ {
gpio-keys {
compatible = "gpio-keys";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpio_keys>;
power {
label = "GPIO Key Power";
linux,code = <KEY_POWER>;
gpios = <&gpio2 7 GPIO_ACTIVE_LOW>;
wakeup-source;
debounce-interval = <20>;
interrupt-parent = <&gpio2>;
interrupts = <7 IRQ_TYPE_LEVEL_LOW>;
};
};
};
&iomuxc {
pinctrl_gpio_keys: gpio_keys_grp {
fsl,pins = <
MX93_PAD_GPIO_IO07__GPIO2_IO07 0x31e
>;
};
};