cancel
Showing results for 
Search instead for 
Did you mean: 

STM32MP1 DTS file pin pull up

scotty
Associate II

I've tried following the examples given here and here, but it will not work. I just want to enable a pull up resistor in the DTS file. Here is my DTS file. If anyone can please tell me why it's not working I would appreciate it.

/dts-v1/;
 
#include "stm32mp157.dtsi"
#include "stm32mp15xa.dtsi"
#include "stm32mp15-pinctrl.dtsi"
#include "stm32mp15xxac-pinctrl.dtsi"
#include "stm32mp15xx-dkx.dtsi"
 
&pinctrl {
	button_pins_a: button-0 {
		pins {
			pinmux = <STM32_PINMUX('B', 12, GPIO)>;
			bias-pull-up;
		};
	};
};
 
/ {
	model = "STMicroelectronics STM32MP157A-DK1 Discovery Board";
	compatible = "st,stm32mp157a-dk1", "st,stm32mp157";
 
	chosen {
		stdout-path = "serial0:115200n8";
	};
 
	button {
		compatible = "test,button";
		pinctrl-names="default";
		pinctrl-0 = <&button_pins_a>;
		status = "okay";
	};
	
	led {
		extern-led {
			compatible = "test,led";
			gpios = <&gpiob 10 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "cpu";
		};
	};
};

5 REPLIES 5
OlivierK
ST Employee

Hi scotty (Community Member)

GPIOs mappings are defined in the consumer device's node, in a property named

<function>-gpios, where <function> is the function the driver will request

through gpiod_get()

Also if the compatible field of DT doesn't match, nothing will happen.

So in your DT, you should add a prefix before "gpios", that is present in your driver.

ie: gpiod_get(&pdev->dev, "led", GPIOD_OUT);

led-gpios = <&gpiob 10 GPIO_ACTIVE_HIGH | GPIO_PULL_UP>;

Unless PB10 is already used by another instance.

Regards,

Olivier

@OlivierK​ 

While this works for the LED, and indeed the pullup can be activated this way, I was asking how to make the button on the pinctrl work with a bias-pull-up. Please let me know how to configure it this was. Thank you.

OlivierK
ST Employee

Hi scotty (Community Member)

bias-pull-up or down should work the same for the button.

&pinctrl {

    goodix_pins_a: goodix-0 {

        pins {

            pinmux = <STM32_PINMUX('F', 5, GPIO)>;

            bias-pull-down;

        };

}

root@stm32mp1:~# cat /sys/kernel/debug/pinctrl/soc:pinctrl@50002000/pinconf-pins | grep PF5                                 

pin 85 (PF5): input - high - pull down 

For button key, you can use also the gpio-keys driver.

    joystick {

        compatible = "gpio-keys";

        pinctrl-0 = <&joystick_pins>;

        pinctrl-names = "default";

        button-0 {

            label = "JoySel";

            linux,code = <KEY_ENTER>;

            interrupt-parent = <&stmfx_pinctrl>;

            interrupts = <0 IRQ_TYPE_EDGE_RISING>;

        };

Rgds,

Olivier

I understand now. I thought this device tree configuration would be immediately used on boot, but I must first load the LKM for the driver to instantiate these pins. Sorry for the confusion.

OlivierK
ST Employee

Hi scotty (Community Member)

Happy to read that this is clearer now.

Best Regards,

Olivier

In order to give better visibility on the answered topics, please click on 'Select as Best' on the reply which solved your issue or answered your question. See also 'Best Answers'