All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Kent Gibson <warthog618@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Jack Winch <sunt.un.morcov@gmail.com>
Subject: Re: [PATCH v2 1/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME
Date: Fri, 16 Oct 2020 17:13:22 +0300	[thread overview]
Message-ID: <CAHp75VcAf8i=jEdDFntpDfLBDMWoJh+ykHBTBRX53B9L+yFNUA@mail.gmail.com> (raw)
In-Reply-To: <20201014231158.34117-2-warthog618@gmail.com>

On Thu, Oct 15, 2020 at 6:53 AM Kent Gibson <warthog618@gmail.com> 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

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

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 23:11 [PATCH v2 0/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME Kent Gibson
2020-10-14 23:11 ` [PATCH v2 1/3] " Kent Gibson
2020-10-16 14:13   ` Andy Shevchenko [this message]
2020-10-16 23:27     ` Kent Gibson
2020-10-14 23:11 ` [PATCH v2 2/3] tools: gpio: add support for reporting realtime event clock to lsgpio Kent Gibson
2020-10-14 23:11 ` [PATCH v2 3/3] tools: gpio: add option to report wall-clock time to gpio-event-mon Kent Gibson
2020-10-28 16:01 ` [PATCH v2 0/3] gpiolib: cdev: allow edge event timestamps to be configured as REALTIME Linus Walleij
2020-10-28 23:22   ` Kent Gibson
2020-10-30 14:49     ` Bartosz Golaszewski
2020-10-30 14:52       ` Bartosz Golaszewski
2020-10-31  0:01         ` Kent Gibson
2020-11-02  8:56           ` Bartosz Golaszewski
2020-11-06 13:49           ` Linus Walleij
2020-12-01 18:20             ` Bartosz Golaszewski
2020-12-05 22:23 ` Linus Walleij

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='CAHp75VcAf8i=jEdDFntpDfLBDMWoJh+ykHBTBRX53B9L+yFNUA@mail.gmail.com' \
    --to=andy.shevchenko@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 \
    --cc=warthog618@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.