Hello,
I'm trying to toggle the IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 GPIO by exporting it, but when the device enters sleep mode, the GPIO doesn't retain its state when we probed.
Processor - IMX8DXL
Kernel version - 5.15.52
commands used- echo 113 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio113/direction
echo 1 > /sys/class/gpio/gpio113/value
echo mem > /sys/power/state
Regards,
Tanushree
I think gidame's answer is completely correct. There is such an example in NXP BSP.
modem_reset: modem-reset {
compatible = "gpio-reset";
pinctrl-names = "default", "sleep";
pinctrl-0 = <&pinctrl_modem_reset>;
pinctrl-1 = <&pinctrl_modem_reset_sleep>;
reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>;
reset-delay-us = <2000>;
reset-post-delay-ms = <40>;
#reset-cells = <0>;
};
pinctrl_modem_reset: modemresetgrp {
fsl,pins = <
SC_P_QSPI1A_DQS_LSIO_GPIO4_IO22 0x06000021
>;
};
pinctrl_modem_reset_sleep: modemreset_sleepgrp {
fsl,pins = <
SC_P_QSPI1A_DQS_LSIO_GPIO4_IO22 0x07800021
>;
};
We have connected the GPIO(QSPI0B_SCLK) for regulator switch to the modem. By default, the GPIO is in a low state, which keeps the modem powered on. To save power, we set the GPIO to a high state, causing the modem to disconnect during sleep. However, when the device enters sleep mode, the GPIO automatically changed to a low state.
We also attempted to set the GPIO configuration to "latch." But we are not able to toggle the GPIO it is in low state only.
Accoding to gidame and matato' inputs, and you need to control the gpio from use space. The follow should be tried.
Replacing IMX8DXL_SNVS_TAMPER_OUT1_LSIO_GPIO2_IO05_IN with the pin you are using.
The Linux will switch the the "sleep" pin configuration automatically, when gets into suspend.
&iomuxc {
pinctrl-names = "default" "sleep";
pinctrl-0 = <&pinctrl_hog>;
pinctrl-1 = <&pinctrl_hog_sleep>;
pinctrl_hog: hoggrp {
fsl,pins = <
IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHB_PAD 0x000514a0
IMX8DXL_COMP_CTL_GPIO_1V8_3V3_GPIORHK_PAD 0x000014a0
IMX8DXL_SPI3_CS0_ADMA_ACM_MCLK_OUT1 0x0600004c
IMX8DXL_SNVS_TAMPER_OUT1_LSIO_GPIO2_IO05_IN 0x0600004c
>;
};
pinctrl_hog_sleep: hogsleepgrp {
fsl,pins = <
IMX8DXL_SNVS_TAMPER_OUT1_LSIO_GPIO2_IO05_IN 0x0780004c
>;
};
Hello All,
Thank you for the inputs.
Even after adding the configurations below in the DTS file, the GPIO state still does not retain.
pinctrl-names = "default","sleep";
pinctrl-0 = <&pinctrl_hog>;
pinctrl-1 = <&pinctrl_hog_sleep>;
pinctrl_hog: hoggrp {
fsl,pins = <
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x2600004c
>;
};
pinctrl_hog_sleep: hogsleepgrp {
fsl,pins = <
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x2780004c
>;
};
During boot-up, the GPIO is in a low state, and in userspace, it is setting to high. However, when the device enters sleep mode, the GPIO does not retain its state and defaults back to low.
Regards,
Tanushree
I don't know the specific hardware design of your board, but it is usually pull up. xakira just gave an example, you still have to make corresponding modifications according to your own hardware design.
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x26000021
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x27800021
Hello @xacov
In our hardware design, we have not connected any pull-up or pull-down resistors to the GPIOs. However, based on the general i.MX documentation, it mentions that there are two types of GPIOs, and some of them may not retain their state. I also observed that when I tried using GPIOs other than the QSPI0B signal, the state of those GPIOs was retained during the sleep state. If that is the case, how can we identify those GPIOs, since the i.MX8DXL reference manual does not mention this information?
1. the pull up/pull down settings is not related to the extenal design. it is related to the power domain supply. The external pull-up only increases the driving strength.
2. To my knowledge, iMX8ULP is quite different design to iMX8DXL.
Hello,
Have you tested it on the EVK? Could you please provide the working configurations? I'm having trouble retaining the GPIO state during sleep.
Below is the dts and GPIO configuration.
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0xA6000020
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0xA7800020
Is your board hardware designed to pull down? If not, then it is generally necessary to pull up.
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x26000021
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x27800021
or
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x26000020
IMX8DXL_QSPI0B_SCLK_LSIO_GPIO3_IO17 0x27800020