cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure pull up/down property of pin in dts

SChen.11
Associate III

Hi I use GT9147 touch IC on my stm32mp157 board. I found the stm32mp157c-ev1.dts use same chip. But the ev1 use GPIO14 of stmfx GPIO expander chip as TP_INT signal. The GPIO14 of stmfx configure as below code.

486                         hog_pins: hog {
487                                 pins = "gpio14";
488                                 drive-push-pull;
489                                 bias-pull-down;
490                         };

Now, my board use PG7 as TP_INT signal. I also want to configure the pull-down property to PG7.Below is my touch panel code.

         gt9147@5d {
                  compatible = "goodix,gt9147";
                  reg = <0x5d>;
                  irq-gpios = <&gpiog 7 GPIO_ACTIVE_HIGH>;
                  irq-flags = <IRQ_TYPE_EDGE_RISING>;
                  reset-gpios = <&gpiog 8 GPIO_ACTIVE_HIGH>;
                  status = "okay";
          };

So, my question is how to configure pull-down property of irq-gpio. I try to add "pinctrl-names" and "pinctrl-0" property to gt9147 section, but kernel shows pinctrl errors. In my opinion, other SoC platform support "hog" to config each gpio pins. Does the gpiog or pinctrl suppor this function in stm32mp1 platform?

1 ACCEPTED SOLUTION

Accepted Solutions
Bernard PUEL
ST Employee

Sorry but I don't see for your use case other means. gt9147 node is expecting a gpio declaration and gpio framework is not able to manage (in this kernel release) the pull down setting. So both pinctrl and gpio framework will be needed to configure completely this pin and it is against strict mode behavior.

Change in "stm32/pinctrl-stm32.c" file is to delete this line:

.strict = true,

if I am not wrong. So should not be a big deal ...

View solution in original post

6 REPLIES 6
Olivier GALLIEN
ST Employee

Hi @Community member​ 

I suspect this can come from "strict mode" of pinctrl controler.

In ST kernel the pintctrl controler is set in "strict mode" meaning you can not reassign some properties to a pin at different location of the device tree. This is to avoid using the same pin for 2 different use by mistake.

Then you have 2 solutions:

  • remove the strict mode in the kernel

or

  • declare all the pinctrl properties in one step (like it is done on ST kernel in "stm32mp157-pinctrl.dtsi" file)

Hope it help

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Thanks for your quick reply. Could you support more detail about "remove the strict mode in kernel"?

And I check the stmfx driver code in file drivers/pinctrl/pinctrl-stmfx.c.​ It is support use "hog" to configure pin before as irq-line. Does the stm32mp157 support this way?

And I think another way, configure the gpio property in uboot, but I doesn't sure the kernel not to modity these register(property).

Bernard PUEL
ST Employee

Hello Steve,

the hog feature will have the same effect if you don't remove the strict mode. In next kernel release, more possibilities will be offer to configure the pins in gpio framework.

Then the only solution I see is to remove the strict mode: see "stm32_pmx_ops" structure in "stm32/pinctrl-stm32.c".

Thank again. I checked the stm32_pmx_ops in "stm32/pinctrl-stm32.c" file. This way will cost our more time to understand it. Can we use the second way( declare all pinctrl properties in one step) to solve it?

Bernard PUEL
ST Employee

Sorry but I don't see for your use case other means. gt9147 node is expecting a gpio declaration and gpio framework is not able to manage (in this kernel release) the pull down setting. So both pinctrl and gpio framework will be needed to configure completely this pin and it is against strict mode behavior.

Change in "stm32/pinctrl-stm32.c" file is to delete this line:

.strict = true,

if I am not wrong. So should not be a big deal ...

Hi Bernard,

Thanks for your advise. I delete the strict code and add pinctrl config with gt9147.Now it is work for me. Thanks again.