linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
	bgolaszewski@baylibre.com, linus.walleij@linaro.org
Cc: Jack Winch <sunt.un.morcov@gmail.com>
Subject: Re: [PATCH 1/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME
Date: Thu, 15 Oct 2020 00:17:27 +0800	[thread overview]
Message-ID: <20201014161727.GA663047@sol> (raw)
In-Reply-To: <20201014062740.78977-2-warthog618@gmail.com>

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.


  reply	other threads:[~2020-10-14 16:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14  6:27 [PATCH 0/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME Kent Gibson
2020-10-14  6:27 ` [PATCH 1/3] " Kent Gibson
2020-10-14 16:17   ` Kent Gibson [this message]
2020-10-14  6:27 ` [PATCH 2/3] tools: gpio: add support for reporting realtime event clock to lsgpio Kent Gibson
2020-10-14  6:27 ` [PATCH 3/3] tools: gpio: add option to report wall-clock time to gpio-event-mon Kent Gibson
2020-10-14  7:59 ` [PATCH 0/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201014161727.GA663047@sol \
    --to=warthog618@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sunt.un.morcov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).