Skip to content

Commit b14aea0

Browse files
giomettigregkh
authored andcommitted
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 <[email protected]> Reviewed-by: Bagas Sanjaya <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 580afe4 commit b14aea0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

Documentation/driver-api/pps.rst

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,46 @@ Sometimes one needs to be able not only to catch PPS signals but to produce
202202
them also. For example, running a distributed simulation, which requires
203203
computers' clock to be synchronized very tightly.
204204

205+
To do so the class pps-gen has been added. PPS generators can be
206+
registered in the kernel by defining a struct pps_gen_source_info as
207+
follows::
208+
209+
static struct pps_gen_source_info pps_gen_dummy_info = {
210+
.name = "dummy",
211+
.use_system_clock = true,
212+
.get_time = pps_gen_dummy_get_time,
213+
.enable = pps_gen_dummy_enable,
214+
};
215+
216+
Where the use_system_clock states if the generator uses the system
217+
clock to generate its pulses, or they are from a peripheral device
218+
clock. Method get_time() is used to query the time stored into the
219+
generator clock, while the method enable() is used to enable or
220+
disable the PPS pulse generation.
221+
222+
Then calling the function pps_gen_register_source() in your
223+
initialization routine as follows creates a new generator in the
224+
system::
225+
226+
pps_gen = pps_gen_register_source(&pps_gen_dummy_info);
227+
228+
Generators SYSFS support
229+
------------------------
230+
231+
If the SYSFS filesystem is enabled in the kernel it provides a new class::
232+
233+
$ ls /sys/class/pps-gen/
234+
pps-gen0/ pps-gen1/ pps-gen2/
235+
236+
Every directory is the ID of a PPS generator defined in the system and
237+
inside of it you find several files::
238+
239+
$ ls -F /sys/class/pps-gen/pps-gen0/
240+
dev enable name power/ subsystem@ system time uevent
241+
242+
To enable the PPS signal generation you can use the command below::
243+
244+
$ echo 1 > /sys/class/pps-gen/pps-gen0/enable
205245

206246
Parallel port generator
207247
------------------------

0 commit comments

Comments
 (0)