From: Dipen Patel <dipenp@nvidia.com>
To: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
<smangipudi@nvidia.com>, <linux-kernel@vger.kernel.org>,
<linux-tegra@vger.kernel.org>, <linux-gpio@vger.kernel.org>,
<linus.walleij@linaro.org>, <bgolaszewski@baylibre.com>,
<warthog618@gmail.com>, <devicetree@vger.kernel.org>,
<linux-doc@vger.kernel.org>, <robh+dt@kernel.org>
Cc: Dipen Patel <dipenp@nvidia.com>
Subject: [PATCH v6 01/10] Documentation: Add HTE subsystem guide
Date: Fri, 22 Apr 2022 13:52:12 -0700 [thread overview]
Message-ID: <20220422205221.952-2-dipenp@nvidia.com> (raw)
In-Reply-To: <20220422205221.952-1-dipenp@nvidia.com>
Adding hte document which can help understand various APIs implemented
in HTE framework for the HTE producers and the consumers.
Signed-off-by: Dipen Patel <dipenp@nvidia.com>
---
Changes in v2:
- Removed explanation, instead added kernel-doc references.
Changes in v3:
- Addressed grammatical errors.
Changes in v4:
- Added new API hte_req_ts_by_linedata_ns description.
- Removed hte_req_ts_by_hte_name.
Changes in v6:
- Added hte_init_line_attr, hte_ts_get, of_hte_req_count.
- Removed devm_of_hte_request_ts_ns, hte_req_ts_by_linedata_ns, hte_release_ts.
- Replaced above with devm_hte_request_ts_ns, hte_request_ts_ns, hte_ts_put.
- Addressed review comments.
Documentation/hte/hte.rst | 77 +++++++++++++++++++++++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100644 Documentation/hte/hte.rst
diff --git a/Documentation/hte/hte.rst b/Documentation/hte/hte.rst
new file mode 100644
index 000000000000..75100a9bc35f
--- /dev/null
+++ b/Documentation/hte/hte.rst
@@ -0,0 +1,77 @@
+============================================
+The Linux Hardware Timestamping Engine (HTE)
+============================================
+
+:Author: Dipen Patel
+
+Introduction
+------------
+
+Certain devices have built in hardware timestamping engines which can
+monitor sets of system signals, lines, buses etc... in realtime for state
+change; upon detecting the change they can automatically store the timestamp at
+the moment of occurrence. Such functionality may help achieve better accuracy
+in obtaining timestamps than using software counterparts i.e. ktime and
+friends.
+
+This document describes the API that can be used by hardware timestamping
+engine provider and consumer drivers that want to use the hardware timestamping
+engine (HTE) framework. Both consumers and providers must include
+``#include <linux/hte.h>``.
+
+The HTE framework APIs for the providers
+----------------------------------------
+
+.. kernel-doc:: drivers/hte/hte.c
+ :functions: devm_hte_register_chip hte_push_ts_ns
+
+The HTE framework APIs for the consumers
+----------------------------------------
+
+.. kernel-doc:: drivers/hte/hte.c
+ :functions: hte_init_line_attr hte_ts_get hte_ts_put devm_hte_request_ts_ns hte_request_ts_ns hte_enable_ts hte_disable_ts of_hte_req_count hte_get_clk_src_info
+
+The HTE framework public structures
+-----------------------------------
+.. kernel-doc:: include/linux/hte.h
+
+More on the HTE timestamp data
+------------------------------
+The ``struct hte_ts_data`` is used to pass timestamp details between the
+consumers and the providers. It expresses timestamp data in nanoseconds in
+u64. An example of the typical timestamp data life cycle, for the GPIO line is
+as follows::
+
+ - Monitors GPIO line change.
+ - Detects the state change on GPIO line.
+ - Converts timestamps in nanoseconds.
+ - Stores GPIO raw level in raw_level variable if the provider has that
+ hardware capability.
+ - Pushes this hte_ts_data object to HTE subsystem.
+ - HTE subsystem increments seq counter and invokes consumer provided callback.
+ Based on callback return value, the HTE core invokes secondary callback in
+ the thread context.
+
+HTE subsystem debugfs attributes
+--------------------------------
+HTE subsystem creates debugfs attributes at ``/sys/kernel/debug/hte/``.
+It also creates line/signal-related debugfs attributes at
+``/sys/kernel/debug/hte/<provider>/<label or line id>/``. Note that these
+attributes are read-only.
+
+`ts_requested`
+ The total number of entities requested from the given provider,
+ where entity is specified by the provider and could represent
+ lines, GPIO, chip signals, buses etc...
+ The attribute will be available at
+ ``/sys/kernel/debug/hte/<provider>/``.
+
+`total_ts`
+ The total number of entities supported by the provider.
+ The attribute will be available at
+ ``/sys/kernel/debug/hte/<provider>/``.
+
+`dropped_timestamps`
+ The dropped timestamps for a given line.
+ The attribute will be available at
+ ``/sys/kernel/debug/hte/<provider>/<label or line id>/``.
--
2.17.1
next prev parent reply other threads:[~2022-04-22 22:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-22 20:52 [PATCH v6 00/10] Intro to Hardware timestamping engine Dipen Patel
2022-04-22 20:52 ` Dipen Patel [this message]
2022-04-22 20:52 ` [PATCH v6 02/10] drivers: Add hardware timestamp engine (HTE) Dipen Patel
2022-04-22 20:52 ` [PATCH v6 03/10] hte: Add tegra194 HTE kernel provider Dipen Patel
2022-04-22 20:52 ` [PATCH v6 04/10] dt-bindings: Add HTE bindings Dipen Patel
2022-04-25 21:54 ` Rob Herring
2022-04-22 20:52 ` [PATCH v6 05/10] gpiolib: Add HTE support Dipen Patel
2022-04-22 20:52 ` [PATCH v6 06/10] gpio: tegra186: Add HTE in gpio-tegra186 driver Dipen Patel
2022-04-22 20:52 ` [PATCH v6 07/10] gpiolib: cdev: Add hardware timestamp clock type Dipen Patel
2022-04-22 20:52 ` [PATCH v6 08/10] tools: gpio: Add new hardware " Dipen Patel
2022-04-22 20:52 ` [PATCH v6 09/10] hte: Add tegra HTE test driver Dipen Patel
2022-04-22 20:52 ` [PATCH v6 10/10] MAINTAINERS: Added HTE Subsystem Dipen Patel
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=20220422205221.952-2-dipenp@nvidia.com \
--to=dipenp@nvidia.com \
--cc=bgolaszewski@baylibre.com \
--cc=devicetree@vger.kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=smangipudi@nvidia.com \
--cc=thierry.reding@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 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).