torer1 Posted January 4, 2021 Share Posted January 4, 2021 Hello, Someone up for this? I am trying my best to extend the PPS device tree overlay in order to support additional capabilities of the PPS kernel driver. In particukar, I want to have the "echo" pin working. (The echo pin is supposed to be an output that makes it possible to measure the latency between the pps pulse and the actual kernel timestamp). I have (tried my best) to modify the existing overlay as follows (the PD14 pin in the overlay is modified by the fixup script to be PA6): /dts-v1/; /plugin/; / { compatible = "allwinner,sun8i-h3"; fragment@0 { target = <&pio>; __overlay__ { pps_pins: pps_pins { pins = "PD14","PC7"; function = "pps_gpio"; }; }; }; fragment@2 { target-path = "/"; __overlay__ { pps@0 { compatible = "pps-gpio"; pinctrl-names = "default"; pinctrl-0 = <&pps_pins>; gpios = <&pio 3 14 0>; /* PD14 */ echo-gpios = <&pio 2 7 32>; /* PC7 */ echo-active-ms = <25>; status = "okay"; }; }; }; }; After reboot, I try to verify what is accomplished. First, I notice that the "echo" entity exist for the driver. torer1@time3:~$ ls /sys/class/pps/pps1/ assert clear dev echo mode name path power subsystem uevent torer1@time3:~$ cat /sys/class/pps/pps0/echo 1 When checking the driver mode, however, I get the following (compare with RFC 2783) it is supposed to read something like 1153 or 1193 or so - depending on the polarity of the "echo" pin logic - in order to confirm that the "echo" functionality. torer1@time3:~$ sudo cat /sys/class/pps/pps1/mode 1133 Again, however, when checking the actual gpio configuration, I can see that the "echo" pin is claimed by the PPS driver. torer1@time3:~$ sudo cat /sys/kernel/debug/gpio [sudo] password for torer1: gpiochip0: GPIOs 0-223, parent: platform/1c20800.pinctrl, 1c20800.pinctrl: gpio-6 ( |pps@0 ) in lo IRQ gpio-15 ( |orangepi:red:status ) out lo gpio-71 ( |echo ) out lo gpio-166 ( |cd ) in hi ACTIVE LOW gpio-204 ( |usb0_id_det ) in hi IRQ gpiochip1: GPIOs 352-383, parent: platform/1f02c00.pinctrl, 1f02c00.pinctrl: gpio-354 ( |usb0-vbus ) out lo gpio-355 ( |sw4 ) in hi IRQ ACTIVE LOW gpio-359 ( |reset ) out hi ACTIVE LOW gpio-362 ( |orangepi:green:pwr ) out hi Finally, when checking the physical "echo" pin using an oscilloscope, it flatlines at 0/GND level. Since I am really utterly confused by DT in genberal and by the DT overlays in particular, I expect that there is something wrong with my attempt to modify it. So, anyone with a less confused understanding of overlays and/or PPS driver, is there something I can do better? Link to comment Share on other sites More sharing options...
Recommended Posts