summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@crashcourse.ca>2017-09-08 19:17:19 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 21:26:51 -0400
commita2d818030135c293f878fbb772cf40e7a14c5acc (patch)
treeaf11559c0850ae981c5111ce65db42bed117eaca
parentf22ef333c32cc683922d7e3361a83ebc31b2ac6d (diff)
drivers/pps: aesthetic tweaks to PPS-related content
Collection of aesthetic adjustments to various PPS-related files, directories and Documentation, some quite minor just for the sake of consistency, including: * Updated example of pps device tree node (courtesy Rodolfo G.) * "PPS-API" -> "PPS API" * "pps_source_info_s" -> "pps_source_info" * "ktimer driver" -> "pps-ktimer driver" * "ppstest /dev/pps0" -> "ppstest /dev/pps1" to match example * Add missing PPS-related entries to MAINTAINERS file * Other trivialities Link: http://lkml.kernel.org/r/alpine.LFD.2.20.1708261048220.8106@localhost.localdomain Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Acked-by: Rodolfo Giometti <giometti@enneenne.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--Documentation/devicetree/bindings/pps/pps-gpio.txt8
-rw-r--r--Documentation/pps/pps.txt44
-rw-r--r--MAINTAINERS3
-rw-r--r--include/linux/pps-gpio.h2
-rw-r--r--include/linux/pps_kernel.h16
-rw-r--r--include/uapi/linux/pps.h4
-rw-r--r--kernel/time/timekeeping.c2
7 files changed, 43 insertions, 36 deletions
diff --git a/Documentation/devicetree/bindings/pps/pps-gpio.txt b/Documentation/devicetree/bindings/pps/pps-gpio.txt
index 40bf9c3564a5..0de23b793657 100644
--- a/Documentation/devicetree/bindings/pps/pps-gpio.txt
+++ b/Documentation/devicetree/bindings/pps/pps-gpio.txt
@@ -13,8 +13,12 @@ Optional properties:
13 13
14Example: 14Example:
15 pps { 15 pps {
16 compatible = "pps-gpio"; 16 pinctrl-names = "default";
17 gpios = <&gpio2 6 0>; 17 pinctrl-0 = <&pinctrl_pps>;
18 18
19 gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
19 assert-falling-edge; 20 assert-falling-edge;
21
22 compatible = "pps-gpio";
23 status = "okay";
20 }; 24 };
diff --git a/Documentation/pps/pps.txt b/Documentation/pps/pps.txt
index 1fdbd5447216..99f5d8c4c652 100644
--- a/Documentation/pps/pps.txt
+++ b/Documentation/pps/pps.txt
@@ -48,12 +48,12 @@ problem:
48 time_pps_create(). 48 time_pps_create().
49 49
50This implies that the source has a /dev/... entry. This assumption is 50This implies that the source has a /dev/... entry. This assumption is
51ok for the serial and parallel port, where you can do something 51OK for the serial and parallel port, where you can do something
52useful besides(!) the gathering of timestamps as it is the central 52useful besides(!) the gathering of timestamps as it is the central
53task for a PPS-API. But this assumption does not work for a single 53task for a PPS API. But this assumption does not work for a single
54purpose GPIO line. In this case even basic file-related functionality 54purpose GPIO line. In this case even basic file-related functionality
55(like read() and write()) makes no sense at all and should not be a 55(like read() and write()) makes no sense at all and should not be a
56precondition for the use of a PPS-API. 56precondition for the use of a PPS API.
57 57
58The problem can be simply solved if you consider that a PPS source is 58The problem can be simply solved if you consider that a PPS source is
59not always connected with a GPS data source. 59not always connected with a GPS data source.
@@ -88,13 +88,13 @@ Coding example
88-------------- 88--------------
89 89
90To register a PPS source into the kernel you should define a struct 90To register a PPS source into the kernel you should define a struct
91pps_source_info_s as follows: 91pps_source_info as follows:
92 92
93 static struct pps_source_info pps_ktimer_info = { 93 static struct pps_source_info pps_ktimer_info = {
94 .name = "ktimer", 94 .name = "ktimer",
95 .path = "", 95 .path = "",
96 .mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT | \ 96 .mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT |
97 PPS_ECHOASSERT | \ 97 PPS_ECHOASSERT |
98 PPS_CANWAIT | PPS_TSFMT_TSPEC, 98 PPS_CANWAIT | PPS_TSFMT_TSPEC,
99 .echo = pps_ktimer_echo, 99 .echo = pps_ktimer_echo,
100 .owner = THIS_MODULE, 100 .owner = THIS_MODULE,
@@ -108,13 +108,13 @@ initialization routine as follows:
108 108
109The pps_register_source() prototype is: 109The pps_register_source() prototype is:
110 110
111 int pps_register_source(struct pps_source_info_s *info, int default_params) 111 int pps_register_source(struct pps_source_info *info, int default_params)
112 112
113where "info" is a pointer to a structure that describes a particular 113where "info" is a pointer to a structure that describes a particular
114PPS source, "default_params" tells the system what the initial default 114PPS source, "default_params" tells the system what the initial default
115parameters for the device should be (it is obvious that these parameters 115parameters for the device should be (it is obvious that these parameters
116must be a subset of ones defined in the struct 116must be a subset of ones defined in the struct
117pps_source_info_s which describe the capabilities of the driver). 117pps_source_info which describe the capabilities of the driver).
118 118
119Once you have registered a new PPS source into the system you can 119Once you have registered a new PPS source into the system you can
120signal an assert event (for example in the interrupt handler routine) 120signal an assert event (for example in the interrupt handler routine)
@@ -142,8 +142,10 @@ If the SYSFS filesystem is enabled in the kernel it provides a new class:
142Every directory is the ID of a PPS sources defined in the system and 142Every directory is the ID of a PPS sources defined in the system and
143inside you find several files: 143inside you find several files:
144 144
145 $ ls /sys/class/pps/pps0/ 145 $ ls -F /sys/class/pps/pps0/
146 assert clear echo mode name path subsystem@ uevent 146 assert dev mode path subsystem@
147 clear echo name power/ uevent
148
147 149
148Inside each "assert" and "clear" file you can find the timestamp and a 150Inside each "assert" and "clear" file you can find the timestamp and a
149sequence number: 151sequence number:
@@ -154,32 +156,32 @@ sequence number:
154Where before the "#" is the timestamp in seconds; after it is the 156Where before the "#" is the timestamp in seconds; after it is the
155sequence number. Other files are: 157sequence number. Other files are:
156 158
157* echo: reports if the PPS source has an echo function or not; 159 * echo: reports if the PPS source has an echo function or not;
158 160
159* mode: reports available PPS functioning modes; 161 * mode: reports available PPS functioning modes;
160 162
161* name: reports the PPS source's name; 163 * name: reports the PPS source's name;
162 164
163* path: reports the PPS source's device path, that is the device the 165 * path: reports the PPS source's device path, that is the device the
164 PPS source is connected to (if it exists). 166 PPS source is connected to (if it exists).
165 167
166 168
167Testing the PPS support 169Testing the PPS support
168----------------------- 170-----------------------
169 171
170In order to test the PPS support even without specific hardware you can use 172In order to test the PPS support even without specific hardware you can use
171the ktimer driver (see the client subsection in the PPS configuration menu) 173the pps-ktimer driver (see the client subsection in the PPS configuration menu)
172and the userland tools available in your distribution's pps-tools package, 174and the userland tools available in your distribution's pps-tools package,
173http://linuxpps.org , or https://github.com/ago/pps-tools . 175http://linuxpps.org , or https://github.com/redlab-i/pps-tools.
174 176
175Once you have enabled the compilation of ktimer just modprobe it (if 177Once you have enabled the compilation of pps-ktimer just modprobe it (if
176not statically compiled): 178not statically compiled):
177 179
178 # modprobe ktimer 180 # modprobe pps-ktimer
179 181
180and the run ppstest as follow: 182and the run ppstest as follow:
181 183
182 $ ./ppstest /dev/pps0 184 $ ./ppstest /dev/pps1
183 trying PPS source "/dev/pps1" 185 trying PPS source "/dev/pps1"
184 found PPS source "/dev/pps1" 186 found PPS source "/dev/pps1"
185 ok, found 1 source(s), now start fetching data... 187 ok, found 1 source(s), now start fetching data...
@@ -187,7 +189,7 @@ and the run ppstest as follow:
187 source 0 - assert 1186592700.388931295, sequence: 365 - clear 0.000000000, sequence: 0 189 source 0 - assert 1186592700.388931295, sequence: 365 - clear 0.000000000, sequence: 0
188 source 0 - assert 1186592701.389032765, sequence: 366 - clear 0.000000000, sequence: 0 190 source 0 - assert 1186592701.389032765, sequence: 366 - clear 0.000000000, sequence: 0
189 191
190Please, note that to compile userland programs you need the file timepps.h . 192Please note that to compile userland programs, you need the file timepps.h.
191This is available in the pps-tools repository mentioned above. 193This is available in the pps-tools repository mentioned above.
192 194
193 195
diff --git a/MAINTAINERS b/MAINTAINERS
index ff3a349f24e4..109c5d9a04c4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10725,8 +10725,11 @@ W: http://wiki.enneenne.com/index.php/LinuxPPS_support
10725L: linuxpps@ml.enneenne.com (subscribers-only) 10725L: linuxpps@ml.enneenne.com (subscribers-only)
10726S: Maintained 10726S: Maintained
10727F: Documentation/pps/ 10727F: Documentation/pps/
10728F: Documentation/devicetree/bindings/pps/pps-gpio.txt
10729F: Documentation/ABI/testing/sysfs-pps
10728F: drivers/pps/ 10730F: drivers/pps/
10729F: include/linux/pps*.h 10731F: include/linux/pps*.h
10732F: include/uapi/linux/pps.h
10730 10733
10731PPTP DRIVER 10734PPTP DRIVER
10732M: Dmitry Kozlov <xeb@mail.ru> 10735M: Dmitry Kozlov <xeb@mail.ru>
diff --git a/include/linux/pps-gpio.h b/include/linux/pps-gpio.h
index 0035abe41b9a..56f35dd3d01d 100644
--- a/include/linux/pps-gpio.h
+++ b/include/linux/pps-gpio.h
@@ -29,4 +29,4 @@ struct pps_gpio_platform_data {
29 const char *gpio_label; 29 const char *gpio_label;
30}; 30};
31 31
32#endif 32#endif /* _PPS_GPIO_H */
diff --git a/include/linux/pps_kernel.h b/include/linux/pps_kernel.h
index 35ac903956c7..80a980cc8d95 100644
--- a/include/linux/pps_kernel.h
+++ b/include/linux/pps_kernel.h
@@ -22,7 +22,6 @@
22#define LINUX_PPS_KERNEL_H 22#define LINUX_PPS_KERNEL_H
23 23
24#include <linux/pps.h> 24#include <linux/pps.h>
25
26#include <linux/cdev.h> 25#include <linux/cdev.h>
27#include <linux/device.h> 26#include <linux/device.h>
28#include <linux/time.h> 27#include <linux/time.h>
@@ -35,9 +34,9 @@ struct pps_device;
35 34
36/* The specific PPS source info */ 35/* The specific PPS source info */
37struct pps_source_info { 36struct pps_source_info {
38 char name[PPS_MAX_NAME_LEN]; /* simbolic name */ 37 char name[PPS_MAX_NAME_LEN]; /* symbolic name */
39 char path[PPS_MAX_NAME_LEN]; /* path of connected device */ 38 char path[PPS_MAX_NAME_LEN]; /* path of connected device */
40 int mode; /* PPS's allowed mode */ 39 int mode; /* PPS allowed mode */
41 40
42 void (*echo)(struct pps_device *pps, 41 void (*echo)(struct pps_device *pps,
43 int event, void *data); /* PPS echo function */ 42 int event, void *data); /* PPS echo function */
@@ -57,10 +56,10 @@ struct pps_event_time {
57struct pps_device { 56struct pps_device {
58 struct pps_source_info info; /* PSS source info */ 57 struct pps_source_info info; /* PSS source info */
59 58
60 struct pps_kparams params; /* PPS's current params */ 59 struct pps_kparams params; /* PPS current params */
61 60
62 __u32 assert_sequence; /* PPS' assert event seq # */ 61 __u32 assert_sequence; /* PPS assert event seq # */
63 __u32 clear_sequence; /* PPS' clear event seq # */ 62 __u32 clear_sequence; /* PPS clear event seq # */
64 struct pps_ktime assert_tu; 63 struct pps_ktime assert_tu;
65 struct pps_ktime clear_tu; 64 struct pps_ktime clear_tu;
66 int current_mode; /* PPS mode at event time */ 65 int current_mode; /* PPS mode at event time */
@@ -69,7 +68,7 @@ struct pps_device {
69 wait_queue_head_t queue; /* PPS event queue */ 68 wait_queue_head_t queue; /* PPS event queue */
70 69
71 unsigned int id; /* PPS source unique ID */ 70 unsigned int id; /* PPS source unique ID */
72 void const *lookup_cookie; /* pps_lookup_dev only */ 71 void const *lookup_cookie; /* For pps_lookup_dev() only */
73 struct cdev cdev; 72 struct cdev cdev;
74 struct device *dev; 73 struct device *dev;
75 struct fasync_struct *async_queue; /* fasync method */ 74 struct fasync_struct *async_queue; /* fasync method */
@@ -101,7 +100,7 @@ extern struct pps_device *pps_register_source(
101extern void pps_unregister_source(struct pps_device *pps); 100extern void pps_unregister_source(struct pps_device *pps);
102extern void pps_event(struct pps_device *pps, 101extern void pps_event(struct pps_device *pps,
103 struct pps_event_time *ts, int event, void *data); 102 struct pps_event_time *ts, int event, void *data);
104/* Look up a pps device by magic cookie */ 103/* Look up a pps_device by magic cookie */
105struct pps_device *pps_lookup_dev(void const *cookie); 104struct pps_device *pps_lookup_dev(void const *cookie);
106 105
107static inline void timespec_to_pps_ktime(struct pps_ktime *kt, 106static inline void timespec_to_pps_ktime(struct pps_ktime *kt,
@@ -132,4 +131,3 @@ static inline void pps_sub_ts(struct pps_event_time *ts, struct timespec64 delta
132} 131}
133 132
134#endif /* LINUX_PPS_KERNEL_H */ 133#endif /* LINUX_PPS_KERNEL_H */
135
diff --git a/include/uapi/linux/pps.h b/include/uapi/linux/pps.h
index c1cb3825a8bc..c29d6b791c08 100644
--- a/include/uapi/linux/pps.h
+++ b/include/uapi/linux/pps.h
@@ -95,8 +95,8 @@ struct pps_kparams {
95#define PPS_CAPTURECLEAR 0x02 /* capture clear events */ 95#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
96#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */ 96#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
97 97
98#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */ 98#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert event */
99#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */ 99#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear event */
100 100
101#define PPS_CANWAIT 0x100 /* can we wait for an event? */ 101#define PPS_CANWAIT 0x100 /* can we wait for an event? */
102#define PPS_CANPOLL 0x200 /* bit reserved for future use */ 102#define PPS_CANPOLL 0x200 /* bit reserved for future use */
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 8ea4fb315719..2cafb49aa65e 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2316,7 +2316,7 @@ void hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_ts)
2316 raw_spin_unlock_irqrestore(&timekeeper_lock, flags); 2316 raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
2317} 2317}
2318EXPORT_SYMBOL(hardpps); 2318EXPORT_SYMBOL(hardpps);
2319#endif 2319#endif /* CONFIG_NTP_PPS */
2320 2320
2321/** 2321/**
2322 * xtime_update() - advances the timekeeping infrastructure 2322 * xtime_update() - advances the timekeeping infrastructure