All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC v3 00/12] Intro to Hardware timestamping engine
@ 2021-11-23 19:30 Dipen Patel
  2021-11-23 19:30 ` [RFC v3 01/12] Documentation: Add HTE subsystem guide Dipen Patel
                   ` (11 more replies)
  0 siblings, 12 replies; 33+ messages in thread
From: Dipen Patel @ 2021-11-23 19:30 UTC (permalink / raw)
  To: thierry.reding, jonathanh, linux-kernel, linux-tegra, linux-gpio,
	linus.walleij, bgolaszewski, warthog618, devicetree, linux-doc,
	robh+dt
  Cc: Dipen Patel

This patch series introduces new subsystem called hardware timestamping
engine (HTE). It offers functionality such as timestamping through hardware
means in realtime. The HTE subsystem centralizes HTE provider and consumers
where providers can register themselves and the consumers can request
interested entity which could be lines, GPIO, signals or buses. The
HTE subsystem provides timestamp in nano seconds, having said that the provider
need to convert the timestamp if its not in that unit. There was upstream
discussion about the HTE at
https://lore.kernel.org/lkml/4c46726d-fa35-1a95-4295-bca37c8b6fe3@nvidia.com/

To summarize upstream discussion:
- It was heavily favoured by Linus and Kent to extend GPIOLIB and supporting
GPIO drivers to add HTE functionality and I agreed to experiment with it.
This patch series implements and extends GPIOLIB, GPIOLIB-CDEV and GPIO tegra
driver.
- Discussed possibility to add HTE provider as irqchip instead which
was argued against as HTE devices are not necessarily event emitting
devices. This RFC version 2 however tries to emulate threaded irq style
implementation.
- Discussed other possibility if HTE device can be added as posix clock
type like PTP clocks. That was also argues against since HTE devices
are not necessarily tightly coupled with hardware clock.

Typical HTE provider does following:
- Register itself with HTE subsystem
- Provide request, release, enable, disable timestamp and
get_clk_src_info callbacks to HTE subsystem.
- Provide optional xlate callback to the subsystem which can translate
consumer provided logical ids into actual ids of the entity, where entity here
is the provider dependent and could be GPIO, in chip lines or signals, buses
etc...This converted id will be used between HTE subsystem and the provider for
below bullet point.
- Push timestamps to the subsystem. This happens when HTE provider has
timestamp data available and willing to push it to HTE subsystem.
- Unregister itself on exit.

Typical HTE consumer does following:
- Request interested entity it wishes to timestamp in realtime to the
subsystem.
- The subsystem does necessary communications with the provider to
complete the request, which includes translating logical id of the entity to
provider dependent physical/actual id and enabling hardware timestamping on
requested id.
- The request includes callbacks, it will be used to push timestamps.
Optionally, the consumer can provided threaded callback, if specified, the HTE
subsystem will create kernel thread responsible executing the threaded callback.
- Release entity and its resources.

HTE and GPIOLIB:
- For the HTE provider which can timestamp GPIO lines.
- For the GPIO consumers, either in kernel or userspace, The GPIOLIB and its
CDEV framework are extended as frontend to the HTE by introducing new APIs.
- Tegra194 AON GPIO controller has HTE support known as GTE
(Generic Timestamping Engine). The tegra gpio driver is modified to accommodate
HTE functionality.

Changes in V2:
- Removed buffer management and related APIs from the HTE core.
- Removed timestamp retrieve APIs from the HTE core.
- Modified request API with two callbacks, second callback is invoked in thread
context and is optional, while first callback is mandatory and used to push
timestamp data to consumers.
- Replaced hte with hardware-timestamping in DT bindings as hte appeared too
short according to review comments.

Changes in V3:
- Corrected grammatical errors in HTE documentation and its bindings documents
- Removed multi-plural words in the HTE DT bindings
- Reflected changes done in DT bindings in the respective source codes
- Separated previous patch 07 into two patches in this series as 07 and 08
- Corrections in MAINTAINERS file

Dipen Patel (12):
  Documentation: Add HTE subsystem guide
  drivers: Add hardware timestamp engine (HTE)
  hte: Add tegra194 HTE kernel provider
  dt-bindings: Add HTE bindings
  hte: Add Tegra194 IRQ HTE test driver
  gpiolib: Add HTE support
  dt-bindings: gpio: Add hardware-timestamp-engine property
  gpio: tegra186: Add HTE in gpio-tegra186 driver
  gpiolib: cdev: Add hardware timestamp clock type
  tools: gpio: Add new hardware clock type
  hte: Add tegra GPIO HTE test driver
  MAINTAINERS: Added HTE Subsystem

 .../devicetree/bindings/gpio/gpio.txt         |   8 +
 .../bindings/gpio/nvidia,tegra186-gpio.txt    |   7 +
 .../hte/hardware-timestamps-common.yaml       |  29 +
 .../devicetree/bindings/hte/hte-consumer.yaml |  48 +
 .../bindings/hte/nvidia,tegra194-hte.yaml     |  80 ++
 Documentation/hte/hte.rst                     |  84 ++
 Documentation/hte/index.rst                   |  22 +
 Documentation/hte/tegra194-hte.rst            |  57 ++
 Documentation/index.rst                       |   1 +
 MAINTAINERS                                   |   8 +
 drivers/Kconfig                               |   2 +
 drivers/Makefile                              |   1 +
 drivers/gpio/gpio-tegra186.c                  |  89 ++
 drivers/gpio/gpiolib-cdev.c                   | 161 +++-
 drivers/gpio/gpiolib.c                        |  73 ++
 drivers/gpio/gpiolib.h                        |  12 +
 drivers/hte/Kconfig                           |  50 +
 drivers/hte/Makefile                          |   5 +
 drivers/hte/hte-tegra194-gpio-test.c          | 252 +++++
 drivers/hte/hte-tegra194-irq-test.c           | 169 ++++
 drivers/hte/hte-tegra194.c                    | 545 +++++++++++
 drivers/hte/hte.c                             | 907 ++++++++++++++++++
 include/linux/gpio/consumer.h                 |  19 +-
 include/linux/gpio/driver.h                   |  14 +
 include/linux/hte.h                           | 248 +++++
 include/uapi/linux/gpio.h                     |   1 +
 tools/gpio/gpio-event-mon.c                   |   6 +-
 27 files changed, 2886 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/hte/hardware-timestamps-common.yaml
 create mode 100644 Documentation/devicetree/bindings/hte/hte-consumer.yaml
 create mode 100644 Documentation/devicetree/bindings/hte/nvidia,tegra194-hte.yaml
 create mode 100644 Documentation/hte/hte.rst
 create mode 100644 Documentation/hte/index.rst
 create mode 100644 Documentation/hte/tegra194-hte.rst
 create mode 100644 drivers/hte/Kconfig
 create mode 100644 drivers/hte/Makefile
 create mode 100644 drivers/hte/hte-tegra194-gpio-test.c
 create mode 100644 drivers/hte/hte-tegra194-irq-test.c
 create mode 100644 drivers/hte/hte-tegra194.c
 create mode 100644 drivers/hte/hte.c
 create mode 100644 include/linux/hte.h


base-commit: 5191249f880367a4cd675825cd721a8d78f26a45
-- 
2.17.1


^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2022-01-05 22:57 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-23 19:30 [RFC v3 00/12] Intro to Hardware timestamping engine Dipen Patel
2021-11-23 19:30 ` [RFC v3 01/12] Documentation: Add HTE subsystem guide Dipen Patel
2021-11-23 19:30 ` [RFC v3 02/12] drivers: Add hardware timestamp engine (HTE) Dipen Patel
2021-11-26  1:30   ` Kent Gibson
2021-12-08  0:36     ` Dipen Patel
2021-12-08  1:21       ` Kent Gibson
2021-12-08  1:59         ` Dipen Patel
2021-11-23 19:30 ` [RFC v3 03/12] hte: Add tegra194 HTE kernel provider Dipen Patel
2021-11-24  0:45   ` Randy Dunlap
2021-11-23 19:30 ` [RFC v3 04/12] dt-bindings: Add HTE bindings Dipen Patel
2021-11-24  2:59   ` Rob Herring
2021-11-23 19:30 ` [RFC v3 05/12] hte: Add Tegra194 IRQ HTE test driver Dipen Patel
2021-11-23 19:30 ` [RFC v3 06/12] gpiolib: Add HTE support Dipen Patel
2021-11-26  1:31   ` Kent Gibson
2021-11-23 19:30 ` [RFC v3 07/12] dt-bindings: gpio: Add hardware-timestamp-engine property Dipen Patel
2021-11-30 22:32   ` Rob Herring
2021-11-23 19:30 ` [RFC v3 08/12] gpio: tegra186: Add HTE in gpio-tegra186 driver Dipen Patel
2021-11-23 19:30 ` [RFC v3 09/12] gpiolib: cdev: Add hardware timestamp clock type Dipen Patel
2021-11-26  1:31   ` Kent Gibson
2021-12-01  3:29     ` Dipen Patel
2021-12-01 17:16       ` Kent Gibson
2021-12-01 18:01         ` Dipen Patel
2021-12-02  0:53           ` Kent Gibson
2021-12-03 23:24             ` Dipen Patel
2021-12-08  1:42             ` Dipen Patel
2021-12-08 20:14               ` Dipen Patel
2021-12-08 22:24                 ` Kent Gibson
2021-12-08 22:28               ` Kent Gibson
2022-01-05 23:00             ` Dipen Patel
2021-12-01 17:18       ` Dipen Patel
2021-11-23 19:30 ` [RFC v3 10/12] tools: gpio: Add new hardware " Dipen Patel
2021-11-23 19:30 ` [RFC v3 11/12] hte: Add tegra GPIO HTE test driver Dipen Patel
2021-11-23 19:30 ` [RFC v3 12/12] MAINTAINERS: Added HTE Subsystem Dipen Patel

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.