80 lines · plain
1.. SPDX-License-Identifier: GPL-2.0+2 3============================================4The Linux Hardware Timestamping Engine (HTE)5============================================6 7:Author: Dipen Patel8 9Introduction10------------11 12Certain devices have built in hardware timestamping engines which can13monitor sets of system signals, lines, buses etc... in realtime for state14change; upon detecting the change they can automatically store the timestamp at15the moment of occurrence. Such functionality may help achieve better accuracy16in obtaining timestamps than using software counterparts i.e. ktime and17friends.18 19This document describes the API that can be used by hardware timestamping20engine provider and consumer drivers that want to use the hardware timestamping21engine (HTE) framework. Both consumers and providers must include22``#include <linux/hte.h>``.23 24The HTE framework APIs for the providers25----------------------------------------26 27.. kernel-doc:: drivers/hte/hte.c28 :functions: devm_hte_register_chip hte_push_ts_ns29 30The HTE framework APIs for the consumers31----------------------------------------32 33.. kernel-doc:: drivers/hte/hte.c34 :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_info35 36The HTE framework public structures37-----------------------------------38.. kernel-doc:: include/linux/hte.h39 40More on the HTE timestamp data41------------------------------42The ``struct hte_ts_data`` is used to pass timestamp details between the43consumers and the providers. It expresses timestamp data in nanoseconds in44u64. An example of the typical timestamp data life cycle, for the GPIO line is45as follows::46 47 - Monitors GPIO line change.48 - Detects the state change on GPIO line.49 - Converts timestamps in nanoseconds.50 - Stores GPIO raw level in raw_level variable if the provider has that51 hardware capability.52 - Pushes this hte_ts_data object to HTE subsystem.53 - HTE subsystem increments seq counter and invokes consumer provided callback.54 Based on callback return value, the HTE core invokes secondary callback in55 the thread context.56 57HTE subsystem debugfs attributes58--------------------------------59HTE subsystem creates debugfs attributes at ``/sys/kernel/debug/hte/``.60It also creates line/signal-related debugfs attributes at61``/sys/kernel/debug/hte/<provider>/<label or line id>/``. Note that these62attributes are read-only.63 64`ts_requested`65 The total number of entities requested from the given provider,66 where entity is specified by the provider and could represent67 lines, GPIO, chip signals, buses etc...68 The attribute will be available at69 ``/sys/kernel/debug/hte/<provider>/``.70 71`total_ts`72 The total number of entities supported by the provider.73 The attribute will be available at74 ``/sys/kernel/debug/hte/<provider>/``.75 76`dropped_timestamps`77 The dropped timestamps for a given line.78 The attribute will be available at79 ``/sys/kernel/debug/hte/<provider>/<label or line id>/``.80