A Arnd Bergmann #
Message details and related content
On Sat, Mar 20, 2021 at 12:56 PM Linus Walleij [off-list ref] wrote:
Hi Dipen, thanks for your mail! I involved some other kernel people to get some discussion. I think Kent Gibson can be of great help because he is using GPIOs with high precision. We actually discussed this a bit when adding support for realtime timestamps.
Adding Richard Cochran as well, for drivers/ptp/, he may be able to
identify whether this should be integrated into that framework in some
form.
fullquote below
On Wed, Mar 17, 2021 at 11:29 PM Dipen Patel [off-list ref] wrote:quoted
Nvidia Tegra SoCs have generic timestamping engine (GTE) hardware module which can monitor SoC signals like IRQ lines and GPIO lines for state change, upon detecting the change, it can timestamp and store in its internal hardware FIFO. The advantage of the GTE module can be realized in applications like robotics or autonomous vehicle where it can help record events with precise timestamp.That sounds very useful. Certainly the kernel shall be able to handle this.quoted
============ For GPIO: ============ 1. GPIO has to be configured as input and IRQ must be enabled. 2. Ask GPIO controller driver to set corresponding timestamp bit in the specified GPIO config register. 3. Translate GPIO specified by the client to its internal bitmap. 3.a For example, If client specifies GPIO line 31, it could be bit 13 of GTE register. 4. Set internal bits to enable monitoring in GTE module 5. Additionally GTE driver can open up lanes for the user space application as a client and can send timestamping events directly to the application.I have some concerns: 1. GPIO should for all professional applications be used with the character device /dev/gpiochipN, under no circumstances shall the old sysfs ABI be used for this. In this case it is necessary because the character device provides events in a FIFO to userspace, which is what we need. The timestamp provided to userspace is an opaque 64bit unsigned value. I suppose we assume it is monotonic but you can actually augment the semantics for your specific stamp, as long as 64 bits is gonna work. 2. The timestamp for the chardev is currently obtained in drivers/gpio/gpiolib-cdev.c like this: