On Thu, Oct 15, 2020 at 6:53 AM Kent Gibson <warthog618@xxxxxxxxx> wrote: > > Using CLOCK_REALTIME as the source for event timestamps is crucial for > some specific applications, particularly those requiring timetamps > relative to a PTP clock, so provide an option to switch the event > timestamp source from the default CLOCK_MONOTONIC to CLOCK_REALTIME. > > Note that CLOCK_REALTIME was the default source clock for GPIO until > Linux 5.7 when it was changed to CLOCK_MONOTONIC due to issues with the > shifting of the realtime clock. > Providing this option maintains the CLOCK_MONOTONIC as the default, > while also providing a path forward for those dependent on the pre-5.7 > behaviour. ... > GPIO_V2_LINE_DIRECTION_FLAGS | \ > GPIO_V2_LINE_DRIVE_FLAGS | \ > GPIO_V2_LINE_EDGE_FLAGS | \ > + GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME | \ Wondering if we would have something like GPIO_V2_LINE_CLOCK_FLAGS | \ here for the sake of consistency. > GPIO_V2_LINE_BIAS_FLAGS) ... > +static u64 line_event_timestamp(struct line *line) > +{ > + if (test_bit(FLAG_EVENT_CLOCK_REALTIME, &line->desc->flags)) I dunno if we can actually drop the word EVENT from these definitions. I don't think we would have in the near future something similar for the non-event data. > + return ktime_get_real_ns(); > + > + return ktime_get_ns(); > +} In general it looks good, thanks! -- With Best Regards, Andy Shevchenko