Skip to content

Commit a2d8180

Browse files
robertpjdaytorvalds
authored andcommitted
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>
1 parent f22ef33 commit a2d8180

File tree

7 files changed

+43
-36
lines changed

7 files changed

+43
-36
lines changed

Documentation/devicetree/bindings/pps/pps-gpio.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@ Optional properties:
1313

1414
Example:
1515
pps {
16-
compatible = "pps-gpio";
17-
gpios = <&gpio2 6 0>;
16+
pinctrl-names = "default";
17+
pinctrl-0 = <&pinctrl_pps>;
1818

19+
gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>;
1920
assert-falling-edge;
21+
22+
compatible = "pps-gpio";
23+
status = "okay";
2024
};

Documentation/pps/pps.txt

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ problem:
4848
time_pps_create().
4949

5050
This implies that the source has a /dev/... entry. This assumption is
51-
ok for the serial and parallel port, where you can do something
51+
OK for the serial and parallel port, where you can do something
5252
useful besides(!) the gathering of timestamps as it is the central
53-
task for a PPS-API. But this assumption does not work for a single
53+
task for a PPS API. But this assumption does not work for a single
5454
purpose GPIO line. In this case even basic file-related functionality
5555
(like read() and write()) makes no sense at all and should not be a
56-
precondition for the use of a PPS-API.
56+
precondition for the use of a PPS API.
5757

5858
The problem can be simply solved if you consider that a PPS source is
5959
not always connected with a GPS data source.
@@ -88,13 +88,13 @@ Coding example
8888
--------------
8989

9090
To register a PPS source into the kernel you should define a struct
91-
pps_source_info_s as follows:
91+
pps_source_info as follows:
9292

9393
static struct pps_source_info pps_ktimer_info = {
9494
.name = "ktimer",
9595
.path = "",
96-
.mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT | \
97-
PPS_ECHOASSERT | \
96+
.mode = PPS_CAPTUREASSERT | PPS_OFFSETASSERT |
97+
PPS_ECHOASSERT |
9898
PPS_CANWAIT | PPS_TSFMT_TSPEC,
9999
.echo = pps_ktimer_echo,
100100
.owner = THIS_MODULE,
@@ -108,13 +108,13 @@ initialization routine as follows:
108108

109109
The pps_register_source() prototype is:
110110

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)
112112

113113
where "info" is a pointer to a structure that describes a particular
114114
PPS source, "default_params" tells the system what the initial default
115115
parameters for the device should be (it is obvious that these parameters
116116
must be a subset of ones defined in the struct
117-
pps_source_info_s which describe the capabilities of the driver).
117+
pps_source_info which describe the capabilities of the driver).
118118

119119
Once you have registered a new PPS source into the system you can
120120
signal 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:
142142
Every directory is the ID of a PPS sources defined in the system and
143143
inside you find several files:
144144

145-
$ ls /sys/class/pps/pps0/
146-
assert clear echo mode name path subsystem@ uevent
145+
$ ls -F /sys/class/pps/pps0/
146+
assert dev mode path subsystem@
147+
clear echo name power/ uevent
148+
147149

148150
Inside each "assert" and "clear" file you can find the timestamp and a
149151
sequence number:
@@ -154,40 +156,40 @@ sequence number:
154156
Where before the "#" is the timestamp in seconds; after it is the
155157
sequence number. Other files are:
156158

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;
158160

159-
* mode: reports available PPS functioning modes;
161+
* mode: reports available PPS functioning modes;
160162

161-
* name: reports the PPS source's name;
163+
* name: reports the PPS source's name;
162164

163-
* path: reports the PPS source's device path, that is the device the
164-
PPS source is connected to (if it exists).
165+
* path: reports the PPS source's device path, that is the device the
166+
PPS source is connected to (if it exists).
165167

166168

167169
Testing the PPS support
168170
-----------------------
169171

170172
In order to test the PPS support even without specific hardware you can use
171-
the ktimer driver (see the client subsection in the PPS configuration menu)
173+
the pps-ktimer driver (see the client subsection in the PPS configuration menu)
172174
and the userland tools available in your distribution's pps-tools package,
173-
http://linuxpps.org , or https://github.com/ago/pps-tools .
175+
http://linuxpps.org , or https://github.com/redlab-i/pps-tools.
174176

175-
Once you have enabled the compilation of ktimer just modprobe it (if
177+
Once you have enabled the compilation of pps-ktimer just modprobe it (if
176178
not statically compiled):
177179

178-
# modprobe ktimer
180+
# modprobe pps-ktimer
179181

180182
and the run ppstest as follow:
181183

182-
$ ./ppstest /dev/pps0
184+
$ ./ppstest /dev/pps1
183185
trying PPS source "/dev/pps1"
184186
found PPS source "/dev/pps1"
185187
ok, found 1 source(s), now start fetching data...
186188
source 0 - assert 1186592699.388832443, sequence: 364 - clear 0.000000000, sequence: 0
187189
source 0 - assert 1186592700.388931295, sequence: 365 - clear 0.000000000, sequence: 0
188190
source 0 - assert 1186592701.389032765, sequence: 366 - clear 0.000000000, sequence: 0
189191

190-
Please, note that to compile userland programs you need the file timepps.h .
192+
Please note that to compile userland programs, you need the file timepps.h.
191193
This is available in the pps-tools repository mentioned above.
192194

193195

MAINTAINERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10725,8 +10725,11 @@ W: http://wiki.enneenne.com/index.php/LinuxPPS_support
1072510725
L: linuxpps@ml.enneenne.com (subscribers-only)
1072610726
S: Maintained
1072710727
F: Documentation/pps/
10728+
F: Documentation/devicetree/bindings/pps/pps-gpio.txt
10729+
F: Documentation/ABI/testing/sysfs-pps
1072810730
F: drivers/pps/
1072910731
F: include/linux/pps*.h
10732+
F: include/uapi/linux/pps.h
1073010733

1073110734
PPTP DRIVER
1073210735
M: Dmitry Kozlov <xeb@mail.ru>

include/linux/pps-gpio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ struct pps_gpio_platform_data {
2929
const char *gpio_label;
3030
};
3131

32-
#endif
32+
#endif /* _PPS_GPIO_H */

include/linux/pps_kernel.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#define LINUX_PPS_KERNEL_H
2323

2424
#include <linux/pps.h>
25-
2625
#include <linux/cdev.h>
2726
#include <linux/device.h>
2827
#include <linux/time.h>
@@ -35,9 +34,9 @@ struct pps_device;
3534

3635
/* The specific PPS source info */
3736
struct pps_source_info {
38-
char name[PPS_MAX_NAME_LEN]; /* simbolic name */
37+
char name[PPS_MAX_NAME_LEN]; /* symbolic name */
3938
char path[PPS_MAX_NAME_LEN]; /* path of connected device */
40-
int mode; /* PPS's allowed mode */
39+
int mode; /* PPS allowed mode */
4140

4241
void (*echo)(struct pps_device *pps,
4342
int event, void *data); /* PPS echo function */
@@ -57,10 +56,10 @@ struct pps_event_time {
5756
struct pps_device {
5857
struct pps_source_info info; /* PSS source info */
5958

60-
struct pps_kparams params; /* PPS's current params */
59+
struct pps_kparams params; /* PPS current params */
6160

62-
__u32 assert_sequence; /* PPS' assert event seq # */
63-
__u32 clear_sequence; /* PPS' clear event seq # */
61+
__u32 assert_sequence; /* PPS assert event seq # */
62+
__u32 clear_sequence; /* PPS clear event seq # */
6463
struct pps_ktime assert_tu;
6564
struct pps_ktime clear_tu;
6665
int current_mode; /* PPS mode at event time */
@@ -69,7 +68,7 @@ struct pps_device {
6968
wait_queue_head_t queue; /* PPS event queue */
7069

7170
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 */
7372
struct cdev cdev;
7473
struct device *dev;
7574
struct fasync_struct *async_queue; /* fasync method */
@@ -101,7 +100,7 @@ extern struct pps_device *pps_register_source(
101100
extern void pps_unregister_source(struct pps_device *pps);
102101
extern void pps_event(struct pps_device *pps,
103102
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 */
105104
struct pps_device *pps_lookup_dev(void const *cookie);
106105

107106
static 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
132131
}
133132

134133
#endif /* LINUX_PPS_KERNEL_H */
135-

include/uapi/linux/pps.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ struct pps_kparams {
9595
#define PPS_CAPTURECLEAR 0x02 /* capture clear events */
9696
#define PPS_CAPTUREBOTH 0x03 /* capture assert and clear events */
9797

98-
#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert ev. */
99-
#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear ev. */
98+
#define PPS_OFFSETASSERT 0x10 /* apply compensation for assert event */
99+
#define PPS_OFFSETCLEAR 0x20 /* apply compensation for clear event */
100100

101101
#define PPS_CANWAIT 0x100 /* can we wait for an event? */
102102
#define PPS_CANPOLL 0x200 /* bit reserved for future use */

kernel/time/timekeeping.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2316,7 +2316,7 @@ void hardpps(const struct timespec64 *phase_ts, const struct timespec64 *raw_ts)
23162316
raw_spin_unlock_irqrestore(&timekeeper_lock, flags);
23172317
}
23182318
EXPORT_SYMBOL(hardpps);
2319-
#endif
2319+
#endif /* CONFIG_NTP_PPS */
23202320

23212321
/**
23222322
* xtime_update() - advances the timekeeping infrastructure

0 commit comments

Comments
 (0)