Commit 28aedd7e authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Jonathan Corbet

docs: pps.txt: convert to ReST and rename to pps.rst

This file is already in a good shape: just its title and
adding some literal block markups is needed for it to be
part of the document.

While it has a small chapter with sysfs stuff, most of
the document is focused on driver development.

As it describes a kernel API, move it to the driver-api
directory.

In order to avoid conflicts, let's add an :orphan: tag
to it, to be removed when added to the driver-api book.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Acked-by: default avatarRodolfo Giometti <giometti@enneenne.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 3bdab16c
:orphan:
PPS - Pulse Per Second ======================
---------------------- PPS - Pulse Per Second
======================
(C) Copyright 2007 Rodolfo Giometti <giometti@enneenne.com> Copyright (C) 2007 Rodolfo Giometti <giometti@enneenne.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -88,7 +90,7 @@ Coding example ...@@ -88,7 +90,7 @@ Coding example
-------------- --------------
To register a PPS source into the kernel you should define a struct To register a PPS source into the kernel you should define a struct
pps_source_info as follows: pps_source_info as follows::
static struct pps_source_info pps_ktimer_info = { static struct pps_source_info pps_ktimer_info = {
.name = "ktimer", .name = "ktimer",
...@@ -101,12 +103,12 @@ pps_source_info as follows: ...@@ -101,12 +103,12 @@ pps_source_info as follows:
}; };
and then calling the function pps_register_source() in your and then calling the function pps_register_source() in your
initialization routine as follows: initialization routine as follows::
source = pps_register_source(&pps_ktimer_info, source = pps_register_source(&pps_ktimer_info,
PPS_CAPTUREASSERT | PPS_OFFSETASSERT); PPS_CAPTUREASSERT | PPS_OFFSETASSERT);
The pps_register_source() prototype is: The pps_register_source() prototype is::
int pps_register_source(struct pps_source_info *info, int default_params) int pps_register_source(struct pps_source_info *info, int default_params)
...@@ -118,7 +120,7 @@ pps_source_info which describe the capabilities of the driver). ...@@ -118,7 +120,7 @@ pps_source_info which describe the capabilities of the driver).
Once you have registered a new PPS source into the system you can Once you have registered a new PPS source into the system you can
signal an assert event (for example in the interrupt handler routine) signal an assert event (for example in the interrupt handler routine)
just using: just using::
pps_event(source, &ts, PPS_CAPTUREASSERT, ptr) pps_event(source, &ts, PPS_CAPTUREASSERT, ptr)
...@@ -134,13 +136,13 @@ Please see the file drivers/pps/clients/pps-ktimer.c for example code. ...@@ -134,13 +136,13 @@ Please see the file drivers/pps/clients/pps-ktimer.c for example code.
SYSFS support SYSFS support
------------- -------------
If the SYSFS filesystem is enabled in the kernel it provides a new class: If the SYSFS filesystem is enabled in the kernel it provides a new class::
$ ls /sys/class/pps/ $ ls /sys/class/pps/
pps0/ pps1/ pps2/ pps0/ pps1/ pps2/
Every directory is the ID of a PPS sources defined in the system and Every directory is the ID of a PPS sources defined in the system and
inside you find several files: inside you find several files::
$ ls -F /sys/class/pps/pps0/ $ ls -F /sys/class/pps/pps0/
assert dev mode path subsystem@ assert dev mode path subsystem@
...@@ -148,7 +150,7 @@ inside you find several files: ...@@ -148,7 +150,7 @@ inside you find several files:
Inside each "assert" and "clear" file you can find the timestamp and a Inside each "assert" and "clear" file you can find the timestamp and a
sequence number: sequence number::
$ cat /sys/class/pps/pps0/assert $ cat /sys/class/pps/pps0/assert
1170026870.983207967#8 1170026870.983207967#8
...@@ -175,11 +177,11 @@ and the userland tools available in your distribution's pps-tools package, ...@@ -175,11 +177,11 @@ and the userland tools available in your distribution's pps-tools package,
http://linuxpps.org , or https://github.com/redlab-i/pps-tools. http://linuxpps.org , or https://github.com/redlab-i/pps-tools.
Once you have enabled the compilation of pps-ktimer just modprobe it (if Once you have enabled the compilation of pps-ktimer just modprobe it (if
not statically compiled): not statically compiled)::
# modprobe pps-ktimer # modprobe pps-ktimer
and the run ppstest as follow: and the run ppstest as follow::
$ ./ppstest /dev/pps1 $ ./ppstest /dev/pps1
trying PPS source "/dev/pps1" trying PPS source "/dev/pps1"
...@@ -204,26 +206,27 @@ nor affordable. The cheap way is to load a PPS generator on one of the ...@@ -204,26 +206,27 @@ nor affordable. The cheap way is to load a PPS generator on one of the
computers (master) and PPS clients on others (slaves), and use very simple computers (master) and PPS clients on others (slaves), and use very simple
cables to deliver signals using parallel ports, for example. cables to deliver signals using parallel ports, for example.
Parallel port cable pinout: Parallel port cable pinout::
pin name master slave
1 STROBE *------ * pin name master slave
2 D0 * | * 1 STROBE *------ *
3 D1 * | * 2 D0 * | *
4 D2 * | * 3 D1 * | *
5 D3 * | * 4 D2 * | *
6 D4 * | * 5 D3 * | *
7 D5 * | * 6 D4 * | *
8 D6 * | * 7 D5 * | *
9 D7 * | * 8 D6 * | *
10 ACK * ------* 9 D7 * | *
11 BUSY * * 10 ACK * ------*
12 PE * * 11 BUSY * *
13 SEL * * 12 PE * *
14 AUTOFD * * 13 SEL * *
15 ERROR * * 14 AUTOFD * *
16 INIT * * 15 ERROR * *
17 SELIN * * 16 INIT * *
18-25 GND *-----------* 17 SELIN * *
18-25 GND *-----------*
Please note that parallel port interrupt occurs only on high->low transition, Please note that parallel port interrupt occurs only on high->low transition,
so it is used for PPS assert edge. PPS clear edge can be determined only so it is used for PPS assert edge. PPS clear edge can be determined only
......
...@@ -12659,7 +12659,7 @@ M: Rodolfo Giometti <giometti@enneenne.com> ...@@ -12659,7 +12659,7 @@ M: Rodolfo Giometti <giometti@enneenne.com>
W: http://wiki.enneenne.com/index.php/LinuxPPS_support W: http://wiki.enneenne.com/index.php/LinuxPPS_support
L: linuxpps@ml.enneenne.com (subscribers-only) L: linuxpps@ml.enneenne.com (subscribers-only)
S: Maintained S: Maintained
F: Documentation/pps/ F: Documentation/driver-api/pps.rst
F: Documentation/devicetree/bindings/pps/pps-gpio.txt F: Documentation/devicetree/bindings/pps/pps-gpio.txt
F: Documentation/ABI/testing/sysfs-pps F: Documentation/ABI/testing/sysfs-pps
F: drivers/pps/ F: drivers/pps/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment