change gpio pin from output to input

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

change gpio pin from output to input

2,294 Views
Ketki
Contributor I

I am using EDM1-iMXQ board with Android 9.0 .
I added touchscreen driver to the kernel. My touch driver is set to use Interrupt at GPIO_4.

I get the following console message:

gpio-4 (?): _gpiod_direction_output_raw: tried to set a GPIO tied to an IRQ as output

I realise that I have to change the gpio pin direction from output to input to use it for interrupt.
I want to know the file where the direction of gpio is defined.

Regards,
Ketki K.

0 Kudos
5 Replies

2,204 Views
Theresa
Contributor I

What would be the best way to reconfigure a pin from Input to Output and vice versa on the flight?  The STM function HAL_GPIO_Init() is quite long so I would rather not use that function just to change a mode Input/Output.

 What would be the most efficient way to change a pin I/O mode once it has been initially configured?

0 Kudos

2,254 Views
jianfeichang
Contributor IV

hello,I have the same problem,imx8 kernel4.14.88 ,Pin configuration 0x80000000  also does not work

0 Kudos

2,283 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ketki

 

one can set it in uboot and in dts file set bit31 as described in imx-pinctrl

documentation:   CONFIG: NO_PAD_CTL(1 << 31): indicate this pin does not need config

 

https://source.codeaurora.org/external/imx/linux-imx/tree/Documentation/devicetree/bindings/pinctrl/...

 

Best regards
igor

0 Kudos

2,270 Views
Ketki
Contributor I

Hi Igor,
Thank You for your reply.
Can you please help me understand this in detail .
I am working on pin 263 which is with iMX pin name GPIO_19 i.e. GPIO(4,5).
I find the pin driver added in the hog group in one of my dtsi files as :

 

&iomuxc {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_hog_1>;

imx6qdl-edm {
pinctrl_hog_1: hoggrp-1 {
fsl,pins = <
MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x130b0
MX6QDL_PAD_EIM_D22__USB_OTG_PWR 0x80000000 /* USB Power Enable */
MX6QDL_PAD_GPIO_2__GPIO1_IO02 0x80000000 /* USDHC1 CD */
MX6QDL_PAD_EIM_DA9__GPIO3_IO09 0x80000000 /* uSDHC3 CD */
MX6QDL_PAD_GPIO_0__CCM_CLKO1 0x000b0 /* SGTL5000 sys_mclk */
MX6QDL_PAD_GPIO_6__GPIO1_IO06 0x0b0b0 /* ov5640 mipi powerdown */
MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x0b0b0 /* ov5640 mipi reset */
MX6QDL_PAD_GPIO_3__CCM_CLKO2 0x000b0 /* ov5640 mclk */
MX6QDL_PAD_EIM_D29__GPIO3_IO29 0x1f0b1 /* RGMII PHY reset */
MX6QDL_PAD_ENET_RXD0__XTALOSC_REF_CLK_32K 0x000b0 /* wifi LPO 32K Hz clock */
MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x4001b0b5 /* GPIO1_04 EDM pin 263 touch irq */
MX6QDL_PAD_SD3_RST__GPIO7_IO08 0x4001b0b5 /* GPIO7_08 EDM pin 264, touch reset */
MX6QDL_PAD_CSI0_DAT13__GPIO5_IO31 0x4001b0b5 /* GPIO5_31 LVDS POWER */
MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x4001b0b5 /* GPIO7_12 USB Hub reset*/
MX6QDL_PAD_EIM_BCLK__GPIO6_IO31 0x4001b0b5 /* GPIO6_31 EDM pin 260 */
MX6QDL_PAD_EIM_D26__GPIO3_IO26 0x4001b0b5 /* GPIO3_26 EDM pin 259 */
MX6QDL_PAD_ENET_RX_ER__GPIO1_IO24 0x4001b0b5 /* GPIO1_24 EDM pin 262 */
>;
};

Why it still gives me the following message ?
gpio-4 (?): _gpiod_direction_output_raw: tried to set a GPIO tied to an IRQ as output

@igorpadykovwaiting for your reply.
Thank you !

Regards,

Ketki K.

 

0 Kudos

2,262 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ketki

 

one can try to set direction as input in uboot:

https://source.codeaurora.org/external/imx/uboot-imx/tree/board/freescale/mx6sabresd/mx6sabresd.c?h=...

 

Best regards
igor

 

0 Kudos