Unimplemented set_config Function: GPIO Pin Configuration Loss on i.MX8MP

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

Unimplemented set_config Function: GPIO Pin Configuration Loss on i.MX8MP

Jump to solution
1,695 Views
alexandreMarquis
Contributor II

Hi everyone,

I'm currently working with the i.MX8MP platform and encountered an issue while configuring a GPIO pin in input/pull-up mode. Here's the scenario:

In one of my drivers, the pin is used in output mode during the probe phase and then switched back to input mode. However, after this process, I found that the pin loses its configuration and is no longer in pull-up mode.

here is the dtb:

gt928@5d {
[...]
pincrtl-0 = <&pinctrl_ts>;
gt928,irq-gpios = <&gpio1 6 GPIO_PULL_UP>;
};

pinctrl_ts: tsgrp {
fsl,pins = <
MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06 0x146 /* 0x146 == pull up, drive strength = 6 */
MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06 0xd6
>;
};

Here's the call stack for reference:

[ 14.630895] gpio_do_set_config+0x24/0x74
[ 14.630905] gpio_set_config_with_argument+0x38/0x44
[ 14.630911] gpio_set_bias+0x84/0xa4
[ 14.643448] gpiod_direction_input+0x198/0x1ac
[ 14.647892] goodix_irq_direction_input+0x40/0xa4 [goodix]
[ 14.653388] goodix_ts_probe+0x3fc/0x5c8 [goodix]

Upon further investigation, I noticed that the set_config function is not implemented (gpiolib.c do the following check):

gpio_do_set_config(struct gpio_chip *gc, unsigned int offset, unsigned long config) {
{
if (!gc->set_config)
return -ENOTSUPP;
[...]
}
I'm curious as to why set_config hasn't been implemented.
I've seen that other have done it :
 

 

​gc->set_config = pca953x_gpio_set_config;
or
gc->set_config = ep93xx_gpio_set_config;

 

 

 
Any insights or suggestions on how to address this issue would be greatly appreciated.

Thank you in advance for your help!

Best regards,
Alexandre

0 Kudos
Reply
1 Solution
1,544 Views
alexandreMarquis
Contributor II

This is how I resolved my problem.
Based on my findings, placing <&pinctrl_ts> under the touchscreen node doesn't apply the pin function correctly.

 

&i2c3 {
	clock-frequency = <400000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c3>,<&pinctrl_ts>;
	status = "okay";

	ov5640_0: ov5640_mipi@3c {
		status = "disabled";
	};

	gt928@5d {
		compatible = "goodix,gt928";
		reg = <0x5d>;
		pincrtl-names = "default";
		pincrtl-0 = <&pinctrl_ts>;
		interrupt-parent = <&gpio1>;
		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
		gt928,irq-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
		gt928,reset-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
		touchscreen-inverted-x; 
		status = "okay";
	};
};

[...]

&iomuxc {
	pinctrl_ts: tsgrp {
		fsl,pins = <
			MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06		0x146 /* 0x146 == pull up, drive strength = 6 */
			MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06		0xd6
		>;
	};
};

 


However, when I move it to the &i2c3 node, the pins are configured properly.

Thank you for your time!

View solution in original post

0 Kudos
Reply
4 Replies
1,545 Views
alexandreMarquis
Contributor II

This is how I resolved my problem.
Based on my findings, placing <&pinctrl_ts> under the touchscreen node doesn't apply the pin function correctly.

 

&i2c3 {
	clock-frequency = <400000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c3>,<&pinctrl_ts>;
	status = "okay";

	ov5640_0: ov5640_mipi@3c {
		status = "disabled";
	};

	gt928@5d {
		compatible = "goodix,gt928";
		reg = <0x5d>;
		pincrtl-names = "default";
		pincrtl-0 = <&pinctrl_ts>;
		interrupt-parent = <&gpio1>;
		interrupts = <6 IRQ_TYPE_LEVEL_LOW>;
		gt928,irq-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
		gt928,reset-gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
		touchscreen-inverted-x; 
		status = "okay";
	};
};

[...]

&iomuxc {
	pinctrl_ts: tsgrp {
		fsl,pins = <
			MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06		0x146 /* 0x146 == pull up, drive strength = 6 */
			MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06		0xd6
		>;
	};
};

 


However, when I move it to the &i2c3 node, the pins are configured properly.

Thank you for your time!

0 Kudos
Reply
1,654 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @alexandreMarquis 

The gpio iomux value has been written with imx_pmx_set before gpio driver probe, so there is no need to use set_config function in gpio driver. The imx_pinctrl_probe

For gpio io expander driver, this function is need, because there is no another driver setting pull up/down.

 

Best Regards

Zhiming

0 Kudos
Reply
1,638 Views
alexandreMarquis
Contributor II
I see, but then my question would be, why do i lose the pin configuration from the device-tree when I change my pin direction?

Scenario:



My pin is configure with a pull-up.
My driver load, set the pin in output. There is no more pull-up.
Put it back in input

expectation : the pin is set input, pull-up
current behaviour: the pin is set in input but the is no more pull-up on it.



From what i can see, when we call
gpiod_direction_input()


the function set the pin in input and then call the function
gpio_set_bias(struct gpio_desc *desc)


Which seem to try to restore the pull/pull down state of the pin, but as mention earlier, the no function seem to be implemented to reapply the device tree flag.

0 Kudos
Reply
1,607 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Hi @alexandreMarquis 

I test such behavior on GPIO3_IO16(gpio-80). The iomux value in device tree will not be covered. There is no such issue using sysfs to control gpio.

NXP i.MX Release Distro 6.6-nanbield imx8mp-lpddr4-evk ttymxc1

imx8mp-lpddr4-evk login: [   14.532349] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control off

imx8mp-lpddr4-evk login: root
root@imx8mp-lpddr4-evk:~# echo 80 > /sys/class/gpio/export
root@imx8mp-lpddr4-evk:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/30200000.gpio, 30200000.gpio:
 gpio-10  (                    |reset               ) out hi ACTIVE LOW
 gpio-14  (                    |regulator-vbus      ) out hi

gpiochip1: GPIOs 32-63, parent: platform/30210000.gpio, 30210000.gpio:
 gpio-38  (                    |regulator-pcie      ) out hi
 gpio-39  (                    |PCIe reset          ) out hi
 gpio-44  (                    |cd                  ) in  hi ACTIVE LOW
 gpio-51  (                    |regulator-usdhc2    ) out lo

gpiochip2: GPIOs 64-95, parent: platform/30220000.gpio, 30220000.gpio:
 gpio-80  (                    |sysfs               ) out hi

gpiochip3: GPIOs 96-127, parent: platform/30230000.gpio, 30230000.gpio:
 gpio-98  (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-116 (                    |switch              ) out hi ACTIVE LOW
 gpio-118 (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-123 (                    |regulator-can2-stby ) out lo
 gpio-124 (                    |Headphone detection ) in  lo
 gpio-125 (                    |regulator-audio-pwr ) out hi

gpiochip4: GPIOs 128-159, parent: platform/30240000.gpio, 30240000.gpio:
 gpio-133 (                    |regulator-can1-stby ) out lo
 gpio-141 (                    |spi1 CS0            ) out hi ACTIVE LOW
 gpio-149 (                    |host-wake           ) in  hi ACTIVE LOW

gpiochip5: GPIOs 512-527, parent: i2c/2-0020, 2-0020, can sleep:
 gpio-512 (EXT_PWREN1          )
 gpio-513 (EXT_PWREN2          )
 gpio-514 (CAN1/I2C5_SEL       )
 gpio-515 (PDM/CAN2_SEL        )
 gpio-516 (FAN_EN              )
 gpio-517 (PWR_MEAS_IO1        )
 gpio-518 (PWR_MEAS_IO2        )
 gpio-519 (EXP_P0_7            )
 gpio-520 (EXP_P1_0            )
 gpio-521 (EXP_P1_1            )
 gpio-522 (EXP_P1_2            )
 gpio-523 (EXP_P1_3            )
 gpio-524 (EXP_P1_4            )
 gpio-525 (EXP_P1_5            )
 gpio-526 (EXP_P1_6            )
 gpio-527 (EXP_P1_7            )
root@imx8mp-lpddr4-evk:~# memtool -32 30330380 1
E
Reading 0x1 count starting at address 0x30330380

0x30330380:  00000140

root@imx8mp-lpddr4-evk:~# echo in > /sys/class/gpio/gpio80/direction
root@imx8mp-lpddr4-evk:~# memtool -32 30330380 1
E
Reading 0x1 count starting at address 0x30330380

0x30330380:  00000140

root@imx8mp-lpddr4-evk:~# cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/30200000.gpio, 30200000.gpio:
 gpio-10  (                    |reset               ) out hi ACTIVE LOW
 gpio-14  (                    |regulator-vbus      ) out hi

gpiochip1: GPIOs 32-63, parent: platform/30210000.gpio, 30210000.gpio:
 gpio-38  (                    |regulator-pcie      ) out hi
 gpio-39  (                    |PCIe reset          ) out hi
 gpio-44  (                    |cd                  ) in  hi ACTIVE LOW
 gpio-51  (                    |regulator-usdhc2    ) out lo

gpiochip2: GPIOs 64-95, parent: platform/30220000.gpio, 30220000.gpio:
 gpio-80  (                    |sysfs               ) in  hi

gpiochip3: GPIOs 96-127, parent: platform/30230000.gpio, 30230000.gpio:
 gpio-98  (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-116 (                    |switch              ) out hi ACTIVE LOW
 gpio-118 (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-123 (                    |regulator-can2-stby ) out lo
 gpio-124 (                    |Headphone detection ) in  lo
 gpio-125 (                    |regulator-audio-pwr ) out hi

gpiochip4: GPIOs 128-159, parent: platform/30240000.gpio, 30240000.gpio:
 gpio-133 (                    |regulator-can1-stby ) out lo
 gpio-141 (                    |spi1 CS0            ) out hi ACTIVE LOW
 gpio-149 (                    |host-wake           ) in  hi ACTIVE LOW

gpiochip5: GPIOs 512-527, parent: i2c/2-0020, 2-0020, can sleep:
 gpio-512 (EXT_PWREN1          )
 gpio-513 (EXT_PWREN2          )
 gpio-514 (CAN1/I2C5_SEL       )
 gpio-515 (PDM/CAN2_SEL        )
 gpio-516 (FAN_EN              )
 gpio-517 (PWR_MEAS_IO1        )
 gpio-518 (PWR_MEAS_IO2        )
 gpio-519 (EXP_P0_7            )
 gpio-520 (EXP_P1_0            )
 gpio-521 (EXP_P1_1            )
 gpio-522 (EXP_P1_2            )
 gpio-523 (EXP_P1_3            )
 gpio-524 (EXP_P1_4            )
 gpio-525 (EXP_P1_5            )
 gpio-526 (EXP_P1_6            )
 gpio-527 (EXP_P1_7            )

 

I think maybe you miss some code in your driver, you can refer the sysfs code, have you add mutex during your operation?

Zhiming_Liu_0-1715147008336.png

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-1859981%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EUnimplemented%20set_config%20Function%3A%20GPIO%20Pin%20Configuration%20Loss%20on%20i.MX8MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1859981%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3EI'm%20currently%20working%20with%20the%20i.MX8MP%20platform%20and%20encountered%20an%20issue%20while%20configuring%20a%20GPIO%20pin%20in%20input%2Fpull-up%20mode.%20Here's%20the%20scenario%3A%3C%2FP%3E%3CP%3EIn%20one%20of%20my%20drivers%2C%20the%20pin%20is%20used%20in%20output%20mode%20during%20the%20probe%20phase%20and%20then%20switched%20back%20to%20input%20mode.%20However%2C%20after%20this%20process%2C%20I%20found%20that%20the%20pin%20loses%20its%20configuration%20and%20is%20no%20longer%20in%20pull-up%20mode.%3C%2FP%3E%3CP%3Ehere%20is%20the%20dtb%3A%3C%2FP%3E%3CPRE%3Egt928%405d%20%7B%3CBR%20%2F%3E%5B...%5D%3CBR%20%2F%3Epincrtl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_ts%26gt%3B%3B%3CBR%20%2F%3Egt928%2Cirq-gpios%20%3D%20%26lt%3B%26amp%3Bgpio1%206%20GPIO_PULL_UP%26gt%3B%3B%3CBR%20%2F%3E%7D%3B%3CBR%20%2F%3E%3CBR%20%2F%3Epinctrl_ts%3A%20tsgrp%20%7B%3CBR%20%2F%3Efsl%2Cpins%20%3D%20%26lt%3B%3CBR%20%2F%3EMX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06%200x146%20%2F*%200x146%20%3D%3D%20pull%20up%2C%20drive%20strength%20%3D%206%20*%2F%3CBR%20%2F%3EMX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06%200xd6%3CBR%20%2F%3E%26gt%3B%3B%3CBR%20%2F%3E%7D%3B%3C%2FPRE%3E%3CP%3EHere's%20the%20call%20stack%20for%20reference%3A%3C%2FP%3E%3CPRE%3E%5B%2014.630895%5D%20gpio_do_set_config%2B0x24%2F0x74%3CBR%20%2F%3E%5B%2014.630905%5D%20gpio_set_config_with_argument%2B0x38%2F0x44%3CBR%20%2F%3E%5B%2014.630911%5D%20gpio_set_bias%2B0x84%2F0xa4%3CBR%20%2F%3E%5B%2014.643448%5D%20gpiod_direction_input%2B0x198%2F0x1ac%3CBR%20%2F%3E%5B%2014.647892%5D%20goodix_irq_direction_input%2B0x40%2F0xa4%20%5Bgoodix%5D%3CBR%20%2F%3E%5B%2014.653388%5D%20goodix_ts_probe%2B0x3fc%2F0x5c8%20%5Bgoodix%5D%3C%2FPRE%3E%3CP%3EUpon%20further%20investigation%2C%20I%20noticed%20that%20the%20set_config%20function%20is%20not%20implemented%20(gpiolib.c%20do%20the%20following%20check)%3A%3C%2FP%3E%3CPRE%3Egpio_do_set_config(struct%20gpio_chip%20*gc%2C%20unsigned%20int%20offset%2C%20unsigned%20long%20config)%20%7B%3CBR%20%2F%3E%7B%3CBR%20%2F%3E%20if%20(!gc-%26gt%3Bset_config)%3CBR%20%2F%3E%20%20%20%20return%20-ENOTSUPP%3B%3CBR%20%2F%3E%5B...%5D%3CBR%20%2F%3E%7D%3C%2FPRE%3E%3CDIV%20class%3D%22%22%3E%3CDIV%20class%3D%22%22%3EI'm%20curious%20as%20to%20why%20set_config%20hasn't%20been%20implemented.%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EI've%20seen%20that%20other%20have%20done%20it%20%3A%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3E%E2%80%8Bgc-%26gt%3Bset_config%20%3D%20pca953x_gpio_set_config%3B%0Aor%0Agc-%26gt%3Bset_config%20%3D%20ep93xx_gpio_set_config%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3C%2FDIV%3E%3CDIV%20class%3D%22%22%3EAny%20insights%20or%20suggestions%20on%20how%20to%20address%20this%20issue%20would%20be%20greatly%20appreciated.%3C%2FDIV%3E%3CP%3EThank%20you%20in%20advance%20for%20your%20help!%3C%2FP%3E%3CP%3EBest%20regards%2C%3CBR%20%2F%3EAlexandre%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1868239%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Unimplemented%20set_config%20Function%3A%20GPIO%20Pin%20Configuration%20Loss%20on%20i.MX8MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1868239%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThis%20is%20how%20I%20resolved%20my%20problem.%3CBR%20%2F%3EBased%20on%20my%20findings%2C%20placing%20%26lt%3B%26amp%3Bpinctrl_ts%26gt%3B%20under%20the%20touchscreen%20node%20doesn't%20apply%20the%20pin%20function%20correctly.%3C%2FP%3E%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%26amp%3Bi2c3%20%7B%0A%09clock-frequency%20%3D%20%26lt%3B400000%26gt%3B%3B%0A%09pinctrl-names%20%3D%20%22default%22%3B%0A%09pinctrl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_i2c3%26gt%3B%2C%26lt%3B%26amp%3Bpinctrl_ts%26gt%3B%3B%0A%09status%20%3D%20%22okay%22%3B%0A%0A%09ov5640_0%3A%20ov5640_mipi%403c%20%7B%0A%09%09status%20%3D%20%22disabled%22%3B%0A%09%7D%3B%0A%0A%09gt928%405d%20%7B%0A%09%09compatible%20%3D%20%22goodix%2Cgt928%22%3B%0A%09%09reg%20%3D%20%26lt%3B0x5d%26gt%3B%3B%0A%09%09pincrtl-names%20%3D%20%22default%22%3B%0A%09%09pincrtl-0%20%3D%20%26lt%3B%26amp%3Bpinctrl_ts%26gt%3B%3B%0A%09%09interrupt-parent%20%3D%20%26lt%3B%26amp%3Bgpio1%26gt%3B%3B%0A%09%09interrupts%20%3D%20%26lt%3B6%20IRQ_TYPE_LEVEL_LOW%26gt%3B%3B%0A%09%09gt928%2Cirq-gpios%20%3D%20%26lt%3B%26amp%3Bgpio1%206%20GPIO_ACTIVE_HIGH%26gt%3B%3B%0A%09%09gt928%2Creset-gpios%20%3D%20%26lt%3B%26amp%3Bgpio2%206%20GPIO_ACTIVE_HIGH%26gt%3B%3B%0A%09%09touchscreen-inverted-x%3B%20%0A%09%09status%20%3D%20%22okay%22%3B%0A%09%7D%3B%0A%7D%3B%0A%0A%5B...%5D%0A%0A%26amp%3Biomuxc%20%7B%0A%09pinctrl_ts%3A%20tsgrp%20%7B%0A%09%09fsl%2Cpins%20%3D%20%26lt%3B%0A%09%09%09MX8MP_IOMUXC_GPIO1_IO06__GPIO1_IO06%09%090x146%20%2F*%200x146%20%3D%3D%20pull%20up%2C%20drive%20strength%20%3D%206%20*%2F%0A%09%09%09MX8MP_IOMUXC_SD1_DATA4__GPIO2_IO06%09%090xd6%0A%09%09%26gt%3B%3B%0A%09%7D%3B%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CBR%20%2F%3E%3CP%3E%3CBR%20%2F%3EHowever%2C%20when%20I%20move%20it%20to%20the%20%26amp%3Bi2c3%20node%2C%20the%20pins%20are%20configured%20properly.%3C%2FP%3E%3CP%3EThank%20you%20for%20your%20time!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1861073%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Unimplemented%20set_config%20Function%3A%20GPIO%20Pin%20Configuration%20Loss%20on%20i.MX8MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1861073%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F223632%22%20target%3D%22_blank%22%3E%40alexandreMarquis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EI%20test%20such%20behavior%20on%20GPIO3_IO16(gpio-80).%20The%20iomux%20value%20in%20device%20tree%20will%20not%20be%20covered.%20There%20is%20no%20such%20issue%20using%20sysfs%20to%20control%20gpio.%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3ENXP%20i.MX%20Release%20Distro%206.6-nanbield%20imx8mp-lpddr4-evk%20ttymxc1%0A%0Aimx8mp-lpddr4-evk%20login%3A%20%5B%20%20%2014.532349%5D%20fec%2030be0000.ethernet%20eth0%3A%20Link%20is%20Up%20-%201Gbps%2FFull%20-%20flow%20control%20off%0A%0Aimx8mp-lpddr4-evk%20login%3A%20root%0Aroot%40imx8mp-lpddr4-evk%3A~%23%20echo%2080%20%26gt%3B%20%2Fsys%2Fclass%2Fgpio%2Fexport%0Aroot%40imx8mp-lpddr4-evk%3A~%23%20cat%20%2Fsys%2Fkernel%2Fdebug%2Fgpio%0Agpiochip0%3A%20GPIOs%200-31%2C%20parent%3A%20platform%2F30200000.gpio%2C%2030200000.gpio%3A%0A%20gpio-10%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Creset%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-14%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-vbus%20%20%20%20%20%20)%20out%20hi%0A%0Agpiochip1%3A%20GPIOs%2032-63%2C%20parent%3A%20platform%2F30210000.gpio%2C%2030210000.gpio%3A%0A%20gpio-38%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-pcie%20%20%20%20%20%20)%20out%20hi%0A%20gpio-39%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CPCIe%20reset%20%20%20%20%20%20%20%20%20%20)%20out%20hi%0A%20gpio-44%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Ccd%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20in%20%20hi%20ACTIVE%20LOW%0A%20gpio-51%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-usdhc2%20%20%20%20)%20out%20lo%0A%0Agpiochip2%3A%20GPIOs%2064-95%2C%20parent%3A%20platform%2F30220000.gpio%2C%2030220000.gpio%3A%0A%20gpio-80%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Csysfs%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%0A%0Agpiochip3%3A%20GPIOs%2096-127%2C%20parent%3A%20platform%2F30230000.gpio%2C%2030230000.gpio%3A%0A%20gpio-98%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CPHY%20reset%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-116%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cswitch%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-118%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CPHY%20reset%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-123%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-can2-stby%20)%20out%20lo%0A%20gpio-124%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CHeadphone%20detection%20)%20in%20%20lo%0A%20gpio-125%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-audio-pwr%20)%20out%20hi%0A%0Agpiochip4%3A%20GPIOs%20128-159%2C%20parent%3A%20platform%2F30240000.gpio%2C%2030240000.gpio%3A%0A%20gpio-133%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-can1-stby%20)%20out%20lo%0A%20gpio-141%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cspi1%20CS0%20%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-149%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Chost-wake%20%20%20%20%20%20%20%20%20%20%20)%20in%20%20hi%20ACTIVE%20LOW%0A%0Agpiochip5%3A%20GPIOs%20512-527%2C%20parent%3A%20i2c%2F2-0020%2C%202-0020%2C%20can%20sleep%3A%0A%20gpio-512%20(EXT_PWREN1%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-513%20(EXT_PWREN2%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-514%20(CAN1%2FI2C5_SEL%20%20%20%20%20%20%20)%0A%20gpio-515%20(PDM%2FCAN2_SEL%20%20%20%20%20%20%20%20)%0A%20gpio-516%20(FAN_EN%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-517%20(PWR_MEAS_IO1%20%20%20%20%20%20%20%20)%0A%20gpio-518%20(PWR_MEAS_IO2%20%20%20%20%20%20%20%20)%0A%20gpio-519%20(EXP_P0_7%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-520%20(EXP_P1_0%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-521%20(EXP_P1_1%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-522%20(EXP_P1_2%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-523%20(EXP_P1_3%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-524%20(EXP_P1_4%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-525%20(EXP_P1_5%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-526%20(EXP_P1_6%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-527%20(EXP_P1_7%20%20%20%20%20%20%20%20%20%20%20%20)%0Aroot%40imx8mp-lpddr4-evk%3A~%23%20memtool%20-32%2030330380%201%0AE%0AReading%200x1%20count%20starting%20at%20address%200x30330380%0A%0A0x30330380%3A%20%2000000140%0A%0Aroot%40imx8mp-lpddr4-evk%3A~%23%20echo%20in%20%26gt%3B%20%2Fsys%2Fclass%2Fgpio%2Fgpio80%2Fdirection%0Aroot%40imx8mp-lpddr4-evk%3A~%23%20memtool%20-32%2030330380%201%0AE%0AReading%200x1%20count%20starting%20at%20address%200x30330380%0A%0A0x30330380%3A%20%2000000140%0A%0Aroot%40imx8mp-lpddr4-evk%3A~%23%20cat%20%2Fsys%2Fkernel%2Fdebug%2Fgpio%0Agpiochip0%3A%20GPIOs%200-31%2C%20parent%3A%20platform%2F30200000.gpio%2C%2030200000.gpio%3A%0A%20gpio-10%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Creset%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-14%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-vbus%20%20%20%20%20%20)%20out%20hi%0A%0Agpiochip1%3A%20GPIOs%2032-63%2C%20parent%3A%20platform%2F30210000.gpio%2C%2030210000.gpio%3A%0A%20gpio-38%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-pcie%20%20%20%20%20%20)%20out%20hi%0A%20gpio-39%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CPCIe%20reset%20%20%20%20%20%20%20%20%20%20)%20out%20hi%0A%20gpio-44%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Ccd%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20in%20%20hi%20ACTIVE%20LOW%0A%20gpio-51%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-usdhc2%20%20%20%20)%20out%20lo%0A%0Agpiochip2%3A%20GPIOs%2064-95%2C%20parent%3A%20platform%2F30220000.gpio%2C%2030220000.gpio%3A%0A%20gpio-80%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Csysfs%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20in%20%20hi%0A%0Agpiochip3%3A%20GPIOs%2096-127%2C%20parent%3A%20platform%2F30230000.gpio%2C%2030230000.gpio%3A%0A%20gpio-98%20%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CPHY%20reset%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-116%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cswitch%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-118%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CPHY%20reset%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-123%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-can2-stby%20)%20out%20lo%0A%20gpio-124%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7CHeadphone%20detection%20)%20in%20%20lo%0A%20gpio-125%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-audio-pwr%20)%20out%20hi%0A%0Agpiochip4%3A%20GPIOs%20128-159%2C%20parent%3A%20platform%2F30240000.gpio%2C%2030240000.gpio%3A%0A%20gpio-133%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cregulator-can1-stby%20)%20out%20lo%0A%20gpio-141%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Cspi1%20CS0%20%20%20%20%20%20%20%20%20%20%20%20)%20out%20hi%20ACTIVE%20LOW%0A%20gpio-149%20(%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Chost-wake%20%20%20%20%20%20%20%20%20%20%20)%20in%20%20hi%20ACTIVE%20LOW%0A%0Agpiochip5%3A%20GPIOs%20512-527%2C%20parent%3A%20i2c%2F2-0020%2C%202-0020%2C%20can%20sleep%3A%0A%20gpio-512%20(EXT_PWREN1%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-513%20(EXT_PWREN2%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-514%20(CAN1%2FI2C5_SEL%20%20%20%20%20%20%20)%0A%20gpio-515%20(PDM%2FCAN2_SEL%20%20%20%20%20%20%20%20)%0A%20gpio-516%20(FAN_EN%20%20%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-517%20(PWR_MEAS_IO1%20%20%20%20%20%20%20%20)%0A%20gpio-518%20(PWR_MEAS_IO2%20%20%20%20%20%20%20%20)%0A%20gpio-519%20(EXP_P0_7%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-520%20(EXP_P1_0%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-521%20(EXP_P1_1%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-522%20(EXP_P1_2%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-523%20(EXP_P1_3%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-524%20(EXP_P1_4%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-525%20(EXP_P1_5%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-526%20(EXP_P1_6%20%20%20%20%20%20%20%20%20%20%20%20)%0A%20gpio-527%20(EXP_P1_7%20%20%20%20%20%20%20%20%20%20%20%20)%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CBR%20%2F%3E%0A%3CP%3EI%20think%20maybe%20you%20miss%20some%20code%20in%20your%20driver%2C%20you%20can%20refer%20the%20sysfs%20code%2C%20have%20you%20add%20mutex%20during%20your%20operation%3F%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Zhiming_Liu_0-1715147008336.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22Zhiming_Liu_0-1715147008336.png%22%20style%3D%22width%3A%20393px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F277631i5F99A1DB6BE5E07E%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Zhiming_Liu_0-1715147008336.png%22%20alt%3D%22Zhiming_Liu_0-1715147008336.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1860517%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Unimplemented%20set_config%20Function%3A%20GPIO%20Pin%20Configuration%20Loss%20on%20i.MX8MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1860517%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EI%20see%2C%20but%20then%20my%20question%20would%20be%2C%20why%20do%20i%20lose%20the%20pin%20configuration%20from%20the%20device-tree%20when%20I%20change%20my%20pin%20direction%3F%3CBR%20%2F%3E%3CBR%20%2F%3EScenario%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EMy%20pin%20is%20configure%20with%20a%20pull-up.%3CBR%20%2F%3EMy%20driver%20load%2C%20set%20the%20pin%20in%20output.%20There%20is%20no%20more%20pull-up.%3CBR%20%2F%3EPut%20it%20back%20in%20input%3CBR%20%2F%3E%3CBR%20%2F%3Eexpectation%20%3A%20the%20pin%20is%20set%20input%2C%20pull-up%3CBR%20%2F%3Ecurrent%20behaviour%3A%20the%20pin%20is%20set%20in%20input%20but%20the%20is%20no%20more%20pull-up%20on%20it.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EFrom%20what%20i%20can%20see%2C%20when%20we%20call%3CBR%20%2F%3Egpiod_direction_input()%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3Ethe%20function%20set%20the%20pin%20in%20input%20and%20then%20call%20the%20function%3CBR%20%2F%3Egpio_set_bias(struct%20gpio_desc%20*desc)%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3EWhich%20seem%20to%20try%20to%20restore%20the%20pull%2Fpull%20down%20state%20of%20the%20pin%2C%20but%20as%20mention%20earlier%2C%20the%20no%20function%20seem%20to%20be%20implemented%20to%20reapply%20the%20device%20tree%20flag.%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1860037%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20Unimplemented%20set_config%20Function%3A%20GPIO%20Pin%20Configuration%20Loss%20on%20i.MX8MP%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1860037%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F223632%22%20target%3D%22_blank%22%3E%40alexandreMarquis%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20gpio%20iomux%20value%20has%20been%20written%20with%26nbsp%3B%3CSPAN%3Eimx_pmx_set%3C%2FSPAN%3E%26nbsp%3Bbefore%20gpio%20driver%20probe%2C%20so%20there%20is%20no%20need%20to%20use%20set_config%20function%20in%20gpio%20driver.%20The%26nbsp%3B%3CSPAN%3Eimx_pinctrl_probe%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3EFor%20gpio%20io%20expander%20driver%2C%20this%20function%20is%20need%2C%20because%20there%20is%20no%20another%20driver%20setting%20pull%20up%2Fdown.%3C%2FP%3E%0A%3CBR%20%2F%3E%0A%3CP%3EBest%20Regards%3C%2FP%3E%0A%3CP%3EZhiming%3C%2FP%3E%3C%2FLINGO-BODY%3E