[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20201014161727.GA663047@sol>
Date: Thu, 15 Oct 2020 00:17:27 +0800
From: Kent Gibson <warthog618@...il.com>
To: linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
bgolaszewski@...libre.com, linus.walleij@...aro.org
Cc: Jack Winch <sunt.un.morcov@...il.com>
Subject: Re: [PATCH 1/3] gpiolib: cdev: allow edge event timestamps to be
configured as REALTIME
On Wed, Oct 14, 2020 at 02:27:38PM +0800, Kent Gibson 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.
>
[snip]
>
> static void linereq_put_event(struct linereq *lr,
> @@ -535,6 +536,14 @@ static void linereq_put_event(struct linereq *lr,
> pr_debug_ratelimited("event FIFO is full - event dropped\n");
> }
>
> +static unsigned long line_event_timestamp(struct line *line)
> +{
> + if (test_bit(FLAG_EVENT_CLOCK_REALTIME, &line->desc->flags))
> + return ktime_get_real_ns();
> +
> + return ktime_get_ns();
> +
> +}
One minor hitch - that should be returning u64, not unsigned long,
or the time gets reduced to 32bit on 32bit platforms.
It's getting late though, so I'll send out an update tomorrow.
Cheers,
Kent.
Powered by blists - more mailing lists