diff options
author | 2024-11-08 08:31:14 +0100 | |
---|---|---|
committer | 2025-01-08 13:18:09 +0100 | |
commit | b14aea0ce0c78db53f2a42c8595d51c63cf0079a (patch) | |
tree | c64543c8469831500a8bbfc8987b3edb9479a2f7 | |
parent | drivers pps/generators: add dummy PPS generator (diff) | |
download | wireguard-linux-b14aea0ce0c78db53f2a42c8595d51c63cf0079a.tar.xz wireguard-linux-b14aea0ce0c78db53f2a42c8595d51c63cf0079a.zip |
Documentation pps.rst: add PPS generators documentation
This patch adds some examples about how to register a new PPS
generator in the system, and how to manage it.
Signed-off-by: Rodolfo Giometti <giometti@enneenne.com>
Reviewed-by: Bagas Sanjaya <bagasdotme@gmail.com>
Link: https://lore.kernel.org/r/20241108073115.759039-4-giometti@enneenne.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | Documentation/driver-api/pps.rst | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/Documentation/driver-api/pps.rst b/Documentation/driver-api/pps.rst index 78dded03e5d8..71ad04c82d6c 100644 --- a/Documentation/driver-api/pps.rst +++ b/Documentation/driver-api/pps.rst @@ -202,6 +202,46 @@ Sometimes one needs to be able not only to catch PPS signals but to produce them also. For example, running a distributed simulation, which requires computers' clock to be synchronized very tightly. +To do so the class pps-gen has been added. PPS generators can be +registered in the kernel by defining a struct pps_gen_source_info as +follows:: + + static struct pps_gen_source_info pps_gen_dummy_info = { + .name = "dummy", + .use_system_clock = true, + .get_time = pps_gen_dummy_get_time, + .enable = pps_gen_dummy_enable, + }; + +Where the use_system_clock states if the generator uses the system +clock to generate its pulses, or they are from a peripheral device +clock. Method get_time() is used to query the time stored into the +generator clock, while the method enable() is used to enable or +disable the PPS pulse generation. + +Then calling the function pps_gen_register_source() in your +initialization routine as follows creates a new generator in the +system:: + + pps_gen = pps_gen_register_source(&pps_gen_dummy_info); + +Generators SYSFS support +------------------------ + +If the SYSFS filesystem is enabled in the kernel it provides a new class:: + + $ ls /sys/class/pps-gen/ + pps-gen0/ pps-gen1/ pps-gen2/ + +Every directory is the ID of a PPS generator defined in the system and +inside of it you find several files:: + + $ ls -F /sys/class/pps-gen/pps-gen0/ + dev enable name power/ subsystem@ system time uevent + +To enable the PPS signal generation you can use the command below:: + + $ echo 1 > /sys/class/pps-gen/pps-gen0/enable Parallel port generator ------------------------ |