cancel
Showing results for 
Search instead for 
Did you mean: 

pps-gpio failes to request GPIO

thomas987
Associate II

I've enabled pps-gpio and pps in the kernel config and added the following to the device tree:

/{
//...
    pps{
        compatible = "pps-gpio";
        gpios = <&gpiod 13 GPIO_PULL_UP>;
        status = "okay";
    };
};

but this results in the following when starting the system:

[    1.350093] pps-gpio pps: failed to request PPS GPIO
[    1.350132] pps-gpio: probe of pps failed with error -22

do you have any hint for me how i can fix that?

I also tried adding a pinctrl section (which resulted in other problems).

Thanks!

Thomas

1 ACCEPTED SOLUTION

Accepted Solutions
OlivierK
ST Employee

Hi Thomas,

Indeed, documentation is clear on the DT syntax and is apparently not deprecated. So I used the same DT node you used with same pins (exactly as you did), updated the linux menuconfig to enable all the pps options, recompiled the kernel and tested on a STM32MP157C-DK2 board.

did an update of the modules (depmod -a, sync). Everything looks fine.

root@stm32mp1:~# dmesg | grep pps                        

[  0.145980] pps_core: LinuxPPS API ver. 1 registered             

[  0.145998] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giom>

[  12.644460] pps_core: source pps.-1 got cdev (251:0)             

[  12.644496] pps pps0: new PPS source pps.-1                  

[  12.647391] pps pps0: Registered IRQ 88 as PPS source 

root@stm32mp1:~# lsmod | grep pps                        

pps_gpio        16384 0  

root@stm32mp1:~# cat /proc/interrupts | grep pps                 

 88:     0     0 stm32gpio 13 Edge   pps.-1  

Regards,

Olivier

View solution in original post

7 REPLIES 7
OlivierK
ST Employee

Hello thomas987 (Community Member)

 PB5 ou PG8 are the pins for the pps-out signals. Why do you use PD13?

Regards,

Olivier

thomas987
Associate II

Hi,

the pps-gpio module is used for pps input -- to measure and timestamp an incoming PPS signal. It actually should work with any GPIO pin but it always fails here:

https://github.com/STMicroelectronics/linux/blob/v5.10-stm32mp/drivers/pps/clients/pps-gpio.c#L110

at the devm_gpiod_get call.

Best Regards

Thomas

OlivierK
ST Employee

Hi Thomas,

ok I understand now.

data->gpio_pin = devm_gpiod_get(&pdev->dev, NULL, GPIOD_IN);

instead of "NULL" I would expect "pps" instead. (parsing the DT for pps-gpios then extract the gpio pin).

I will check this point.

Best Regards,

Olivier

Hi Oliver,

> instead of "NULL" I would expect "pps" instead. (parsing the DT for pps-gpios then extract the gpio pin).

the second parameter should only specify the name used for the gpio handle, right? so "pps" would look for "pps-gpios" and NULL should look for "gpios" in the device tree like I specified: `gpios = <&gpiod 13 GPIO_PULL_UP>;`.

> I will check this point.

Thanks!

Best Regards,

Thomas

OlivierK
ST Employee

Hi Thomas,

Indeed, documentation is clear on the DT syntax and is apparently not deprecated. So I used the same DT node you used with same pins (exactly as you did), updated the linux menuconfig to enable all the pps options, recompiled the kernel and tested on a STM32MP157C-DK2 board.

did an update of the modules (depmod -a, sync). Everything looks fine.

root@stm32mp1:~# dmesg | grep pps                        

[  0.145980] pps_core: LinuxPPS API ver. 1 registered             

[  0.145998] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giom>

[  12.644460] pps_core: source pps.-1 got cdev (251:0)             

[  12.644496] pps pps0: new PPS source pps.-1                  

[  12.647391] pps pps0: Registered IRQ 88 as PPS source 

root@stm32mp1:~# lsmod | grep pps                        

pps_gpio        16384 0  

root@stm32mp1:~# cat /proc/interrupts | grep pps                 

 88:     0     0 stm32gpio 13 Edge   pps.-1  

Regards,

Olivier

Hi,

thanks for checking!

Yes, indeed, it seems to work now as a kernel module (=m) but fails when i build it into the kernel (=y)

Best Regards and thanks for your help!

Thomas

axel101
Associate III

I have a same problem. The reason is that GPIO controller probes later then PPS. Initialization order is correct, but platrofm_devices are probed in different order. I fixed order by adding

pinctrl-names = "default";
pinctrl-0 = <&pinctrl>;

in y pps node. Note that if you using piz, you should set &pinctrl_z instead of &pinctrl.

I'm not sure is it solution or workaround, because I seen another configuration in iMX devicetree examples:

pps {
	pinctrl-names = "default";
	pinctrl-0 = <&pps_pins>;
	gpios = <&gpioi 10 GPIO_ACTIVE_HIGH>;
	compatible = "pps-gpio";
	status = "okay";
};
 
&pinctrl {
	pps_pins: pps_pins-0 {
		pins {
			pinmux = <STM32_PINMUX('I', 10, GPIO)>;
		};
	};
};
 

But in this case devm_gpiod_get in PPS driver says that this GPIO pin already requested by PPS driver (and after reading the sysfs I was convinced that this was the case ), and I don't know how I can get the gpio descriptor already requested in the driver.