Is the pps-gpio broken in toradex_5.4-2.3.x-imx kernel?

Hello,
I tried to use the pps kernel driver with pps-gpio client in a verdin imx8mm module. I did the following additions in the dts files:

In the {/ section:

*pps: pps {
	compatible = "pps-gpio";
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_gpio8>;
	gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
	status = "okay";
};*	

In the kernel boot the driver failed to load with this message:
“failed to request PPS GPIO”

I did some debugging and the devm_gpiod_get function call in the pps-gpio.c file returned with this error:
“No GPIO consumer found”

I modified the pps_gpio_probe function in the pps-gpio.c like this:

/* GPIO setup */
if (pdata) {
	data->gpio_pin = pdata->gpio_pin;
	data->echo_pin = pdata->echo_pin;

	data->assert_falling_edge = pdata->assert_falling_edge;
	data->capture_clear = pdata->capture_clear;
	data->echo_active_ms = pdata->echo_active_ms;
} else {

	struct device_node *np = pdev->dev.of_node;

	ret = of_get_gpio(np, 0);
	if (ret < 0) {
		dev_err(&pdev->dev, "failed to get GPIO from device tree\n");
		return ret;
	}
	data->gpio_pin = gpio_to_desc(ret);

	if (of_get_property(np, "assert-falling-edge", NULL))
		data->assert_falling_edge = true;	

//	ret = pps_gpio_setup(pdev);
//	if (ret)
//		return -EINVAL;
}

and now the pps-gpio is working.
It seems that the driver does not work with the kernel’s gpiolib framework.
Is this true, or am I missing something in the pps configuration? The gpiolib is enabled in the kernel configuration.

Best Regards,

Giannis

Hello @grag,

This feature of GPIO PPS is expected to work out-of-the-box in the BSP 5 and beyond.
It’s enabled by default.

Are you sure that the corresponding pin is not being used or defined anywhere else?

Commenting the pps_gpio_setup is not the proper solution…

Can you also confirm precisely which version of Toradex BSP are you using?
And which Verdin module?

Best regards,
André Curvello

Hi Andre,
the BSB version is 5.2.0, the kernel version is:

VERSION = 5
PATCHLEVEL = 4
SUBLEVEL = 115
EXTRAVERSION =

and the Verdin module is V1.1A. Additionally all the bootloaders are from Toradex following the instuctions from this page:
Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center.

The gpio is not used by other module (confirmed with gpioinfo and by searching the dts files).

The strange thing is that it works if the pps_gpio_setup() is replaced with the older style of_get_gpio() and then converted to gpio struct by the gpio_to_desc() function.

Best Regards,
Giannis

Hi @grag,

Thanks for the information.

We are analyzing this issue internally.

Best regards,
André Curvello