Add support for Intel PPS Generator
Subsystems (2)
v12 cover Add support for Intel PPS Generator
From: Subramanian Mohan <[email protected]>
The goal of the PPS (Pulse Per Second) hardware/software is to generate a signal from the system on a wire so that some third-party hardware can observe that signal and judge how close the system's time is to another system or piece of hardware.
Existing methods (like parallel ports) require software to flip a bit at just the right time to create a PPS signal. Many things can prevent software from doing this precisely. This (Timed I/O) method is better because software only "arms" the hardware in advance and then depends on the hardware to "fire" and flip the signal at just the right time.
To generate a PPS signal with this new hardware, the kernel wakes up twice a second, once for 1->0 edge and other for the 0->1 edge. It does this shortly (~10ms) before the actual change in the signal needs to be made. It computes the TSC value at which edge will happen, convert to a value hardware understands and program this value to Timed I/O hardware. The actual edge transition happens without any further action from the kernel.
The result here is a signal coming out of the system that is roughly 1,000 times more accurate than the old methods. If the system is heavily loaded, the difference in accuracy is larger in old methods.
Application Interface:
The API to use Timed I/O is very simple. It is enabled and disabled by writing a '1' or '0' value to the sysfs enable attribute associated with the Timed I/O PPS device. Each Timed I/O pin is represented by a PPS device. When enabled, a pulse-per-second (PPS) synchronized with the system clock is continuously produced on the Timed I/O pin, otherwise it is pulled low.
The Timed I/O signal on the motherboard is enabled in the BIOS setup. Intel Advanced Menu -> PCH IO Configuration -> Timed I/O <Enable>
References:
https://en.wikipedia.org/wiki/Pulse-per-second_signal
https://drive.google.com/file/d/1vkBRRDuELmY8I3FlfOZaEBp-DxLW6t_V/view
https://youtu.be/JLUTT-lrDqw
Patch 1 adds the pps(pulse per second) generator tio driver to the pps subsystem.
Patch 2 documentation and usage of the pps tio generator module. Patch 3 includes documentation for sysfs interface.
These patches are based on the timers/core branch:
[1] https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git/?h=timers/core
These changes are dependent on patches that are merged in [1].
Please help to review the changes.
Thanks in advance,
Subramanian Mohan
Changes from v2:
- Split patch 1 to remove the functions in later stages.
- Include required headers in pps_gen_tio.
Changes from v3:
- Corrections in Documentation.
- Introducing non-RFC version of the patch series.
Changes from v4:
- Setting id in ice_ptp
- Modified conversion logic in convert_base_to_cs.
- Included the usage of the APIs in the commit message of 2nd patch.
Changes from v5:
- Change nsecs variable to use_nsecs.
- Change order of 1&2 patches and modify the commit message.
- Add sysfs abi file entry in MAINTAINERS file.
- Add check to find if any event is missed and disable hardware accordingly.
Changes from v6:
- Split patch 1 into 1&2 patches.
- Add check for overflow in convert_ns_to_cs().
- Refine commit messages.
Changes from v7:
- Split the if condition and return error if current time exceeds expire time.
- Update kernel version and month in ABI file.
Changes from v8:
- Add function to enable Timed I/O.
- Changed the updating of tio->enabled to a centralized place in disable and enable functions.
Changes from v9:
- use tio->enabled instead of reading ctrl register.
- change error code in enable_store to -ENODEV.
Changes from v10:
- Rebased to latest codebase.
Changes from v11:
- Rebased to latest codebase.
Subramanian Mohan (3):
pps: generators: Add PPS Generator TIO Driver
Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
ABI: pps: Add ABI documentation for Intel TIO
.../ABI/testing/sysfs-platform-pps-tio | 8 + Documentation/driver-api/pps.rst | 24 ++ MAINTAINERS | 1 + drivers/pps/generators/Kconfig | 16 ++ drivers/pps/generators/Makefile | 1 + drivers/pps/generators/pps_gen_tio.c | 262 ++++++++++++++++++ 6 files changed, 312 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-pps-tio create mode 100644 drivers/pps/generators/pps_gen_tio.c
Signature · 1 line
2.35.3
PATCH v12 1/3 pps: generators: Add PPS Generator TIO Driver
From: Subramanian Mohan <[email protected]>
The Intel Timed IO PPS generator driver outputs a PPS signal using dedicated hardware that is more accurate than software actuated PPS. The Timed IO hardware generates output events using the ART timer. The ART timer period varies based on platform type, but is less than 100 nanoseconds for all current platforms. Timed IO output accuracy is within 1 ART period.
PPS output is enabled by writing '1' the 'enable' sysfs attribute. The driver uses hrtimers to schedule a wake-up 10 ms before each event (edge) target time. At wakeup, the driver converts the target time in terms of CLOCK_REALTIME to ART trigger time and writes this to the Timed IO hardware. The Timed IO hardware generates an event precisely at the requested system time without software involvement.
--- drivers/pps/generators/Kconfig | 16 ++ drivers/pps/generators/Makefile | 1 + drivers/pps/generators/pps_gen_tio.c | 262 +++++++++++++++++++++++++++ 3 files changed, 279 insertions(+) create mode 100644 drivers/pps/generators/pps_gen_tio.c
drivers/pps/generators/Kconfig +16 -0
@@ -12,3 +12,19 @@ config PPS_GENERATOR_PARPORT If you say yes here you get support for a PPS signal generator which utilizes STROBE pin of a parallel port to send PPS signals. It uses parport abstraction layer and hrtimers to precisely control the signal. + +config PPS_GENERATOR_TIO + tristate "TIO PPS signal generator" + depends on X86 && CPU_SUP_INTEL + help + If you say yes here you get support for a PPS TIO signal generator + which generates a pulse at a prescribed time based on the system clock. + It uses time translation and hrtimers to precisely generate a pulse. + This hardware is present on 2019 and newer Intel CPUs. However, this + driver is not useful without adding highly specialized hardware outside + the Linux system to observe these pulses. + + To compile this driver as a module, choose M here: the module + will be called pps_gen_tio. + + If unsure, say N.
drivers/pps/generators/Makefile +1 -0
@@ -4,5 +4,6 @@ # obj-$(CONFIG_PPS_GENERATOR_PARPORT) += pps_gen_parport.o +obj-$(CONFIG_PPS_GENERATOR_TIO) += pps_gen_tio.o ccflags-$(CONFIG_PPS_DEBUG) := -DDEBUG
drivers/pps/generators/pps_gen_tio.c new file +262 -0
262 lines not on this page · raw message
Signature · 1 line
2.35.3
Re: [PATCH v12 1/3] pps: generators: Add PPS Generator TIO Driver
Quoted 15 lines · On Fri, Aug 23, 2024 at 12:31:06PM +0530, [email protected] wrote:
From: Subramanian Mohan <[email protected]>
The Intel Timed IO PPS generator driver outputs a PPS signal using dedicated hardware that is more accurate than software actuated PPS. The Timed IO hardware generates output events using the ART timer. The ART timer period varies based on platform type, but is less than 100 nanoseconds for all current platforms. Timed IO output accuracy is within 1 ART period.
PPS output is enabled by writing '1' the 'enable' sysfs attribute. The driver uses hrtimers to schedule a wake-up 10 ms before each event (edge) target time. At wakeup, the driver converts the target time in terms of
CLOCK_REALTIMEto ART trigger time and writes this to the Timed IO hardware. The Timed IO hardware generates an event precisely at the requested system time without software involvement.
...
drivers/pps/generators/pps_gen_tio.c line 9
Quoted 2 lines
drivers/pps/generators/pps_gen_tio.c new file +2
-0+#include <linux/bits.h> +#include <linux/bitfield.h>
These two should be swapped in ordering
Quoted 15 lines
drivers/pps/generators/pps_gen_tio.c new file +15
-0+#include <linux/cleanup.h> +#include <linux/container_of.h> +#include <linux/cpu.h> +#include <linux/device.h> +#include <linux/err.h> +#include <linux/hrtimer.h> +#include <linux/io-64-nonatomic-hi-lo.h> +#include <linux/kstrtox.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/spinlock.h> +#include <linux/sysfs.h> +#include <linux/timekeeping.h> +#include <linux/types.h>
...
Quoted 1 line
+#define
SAFE_TIME_NS(10 *NSEC_PER_MSEC) /* Safety time to set hrtimer early */
It's better to have
/* ...comment... */
...definition...
...
drivers/pps/generators/pps_gen_tio.c line 136
Quoted 9 lines
drivers/pps/generators/pps_gen_tio.c new file +9
-0+static enum hrtimer_restart hrtimer_callback (struct hrtimer *timer) +{ + struct pps_tio *tio = container_of(timer, struct pps_tio, timer); +ktime_t expires, now; +u32 event_count; + +guard (spinlock)(&tio->lock); + +/* Check if any event is missed. If an event is missed, TIO will be disabled*/
/*
* Missing space at the of the comment. But since it's two-sentences comment,
* make it multi-line like in this example.
*/
drivers/pps/generators/pps_gen_tio.c line 140
Quoted 4 lines
drivers/pps/generators/pps_gen_tio.c new file +4
-0+ event_count =pps_tio_read (tio,TIOEC ); +if (tio->prev_count && tio->prev_count == event_count) + goto err; + tio->prev_count = event_count;
+ Blank line.
drivers/pps/generators/pps_gen_tio.c line 141
Quoted 1 line
drivers/pps/generators/pps_gen_tio.c new file +1
-0+ expires =hrtimer_get_expires (timer);
(1)
Review
Quoted 2 lines
(quoted diff) +2
-0+ now = ktime_get_real(); +
The location of this blank line seems incorrect and should be moved to (1) above.
drivers/pps/generators/pps_gen_tio.c line 152
Quoted 9 lines
drivers/pps/generators/pps_gen_tio.c new file +9
-0+if (now - expires >=SAFE_TIME_NS ) + goto err; + + tio->enabled =pps_generate_next_pulse (tio, expires +SAFE_TIME_NS ); +if (!tio->enabled) +return HRTIMER_NORESTART ; + +hrtimer_forward (timer, now,NSEC_PER_SEC /2 ); +return HRTIMER_RESTART ;
+ Blank line.
drivers/pps/generators/pps_gen_tio.c line 157
Quoted 5 lines
drivers/pps/generators/pps_gen_tio.c new file +5
-0+err: +dev_err (tio->dev,"Event missed, Disabling Timed I/O" ); +pps_tio_disable (tio); +return HRTIMER_NORESTART ; +}
...
Note, the above are nit-picks and may be applied if you ever need a v13 to be sent. For now let's wait for the more serious comments against the series.
Signature · 2 lines
With Best Regards, Andy Shevchenko
PATCH v12 2/3 Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
In reply to [email protected]From: Subramanian Mohan <[email protected]>
Add Intel Timed I/O PPS usage instructions.
--- Documentation/driver-api/pps.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
Documentation/driver-api/pps.rst +24 -0
@@ -246,3 +246,27 @@ delay between assert and clear edge as small as possible to reduce system latencies. But if it is too small slave won't be able to capture clear edge transition. The default of 30us should be good enough in most situations. The delay can be selected using 'delay' pps_gen_parport module parameter. + + +Intel Timed I/O PPS signal generator +------------------------------------ + +Intel Timed I/O is a high precision device, present on 2019 and newer Intel +CPUs, that can generate PPS signals. + +Timed I/O and system time are both driven by same hardware clock. The signal +is generated with a precision of ~20 nanoseconds. The generated PPS signal +is used to synchronize an external device with system clock. For example, +it can be used to share your clock with a device that receives PPS signal, +generated by Timed I/O device. There are dedicated Timed I/O pins to deliver +the PPS signal to an external device. + +Usage of Intel Timed I/O as PPS generator: + +Start generating PPS signal:: + + $echo 1 > /sys/devices/platform/INTCxxxx\:00/enable + +Stop generating PPS signal:: + + $echo 0 > /sys/devices/platform/INTCxxxx\:00/enable
Signature · 1 line
2.35.3
Re: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 36 lines · On Fri, Aug 23, 2024 at 12:31:07PM +0530, [email protected] wrote:
From: Subramanian Mohan <[email protected]>
Add Intel Timed I/O PPS usage instructions.
Co-developed-by Pandith N <[email protected]>Signed-off-by Pandith N <[email protected]>Signed-off-by Lakshmi Sowjanya D <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Acked-by Rodolfo Giometti <[email protected]>Signed-off-by Subramanian Mohan <[email protected]>--- Documentation/driver-api/pps.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)Documentation/driver-api/pps.rst +14
-0@@ -246,3 +246,27 @@ delay between assert and clear edge as small as possible to reduce system latencies. But if it is too small slave won't be able to capture clear edge transition. The default of 30us should be good enough in most situations. The delay can be selected using 'delay' pps_gen_parport module parameter. + + +Intel Timed I/O PPS signal generator +------------------------------------ + +Intel Timed I/O is a high precision device, present on 2019 and newer Intel +CPUs, that can generate PPS signals. + +Timed I/O and system time are both driven by same hardware clock. The signal +is generated with a precision of ~20 nanoseconds. The generated PPS signal +is used to synchronize an external device with system clock. For example, +it can be used to share your clock with a device that receives PPS signal, +generated by Timed I/O device. There are dedicated Timed I/O pins to deliver +the PPS signal to an external device.
Documentation/driver-api/pps.rst delay between assert and clear edge as small as possible to reduce system · line 272
Quoted 10 lines
Documentation/driver-api/pps.rst +10
-0+ +Usage of Intel Timed I/O as PPS generator: + +Start generating PPS signal:: + + $echo 1 > /sys/devices/platform/INTCxxxx\:00/enable + +Stop generating PPS signal:: + + $echo 0 > /sys/devices/platform/INTCxxxx\:00/enable
As I mentioned on the sysfs documentation, why isn't this just a generic pps class attribute instead? Why did you make it only-this-one-special-driver type of thing?
thanks,
greg k-h
Rodolfo Giometti
maintainerRe: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 43 lines · Greg KH
Quoted 42 lines · On Fri, Aug 23, 2024 at 12:31:07PM +0530, [email protected] wrote:
From: Subramanian Mohan <[email protected]>
Add Intel Timed I/O PPS usage instructions.
Co-developed-by Pandith N <[email protected]>Signed-off-by Pandith N <[email protected]>Signed-off-by Lakshmi Sowjanya D <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Acked-by Rodolfo Giometti <[email protected]>Signed-off-by Subramanian Mohan <[email protected]>--- Documentation/driver-api/pps.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)Documentation/driver-api/pps.rst +20
-0@@ -246,3 +246,27 @@ delay between assert and clear edge as small as possible to reduce system latencies. But if it is too small slave won't be able to capture clear edge transition. The default of 30us should be good enough in most situations. The delay can be selected using 'delay' pps_gen_parport module parameter. + + +Intel Timed I/O PPS signal generator +------------------------------------ + +Intel Timed I/O is a high precision device, present on 2019 and newer Intel +CPUs, that can generate PPS signals. + +Timed I/O and system time are both driven by same hardware clock. The signal +is generated with a precision of ~20 nanoseconds. The generated PPS signal +is used to synchronize an external device with system clock. For example, +it can be used to share your clock with a device that receives PPS signal, +generated by Timed I/O device. There are dedicated Timed I/O pins to deliver +the PPS signal to an external device. + +Usage of Intel Timed I/O as PPS generator: + +Start generating PPS signal:: + + $echo 1 > /sys/devices/platform/INTCxxxx\:00/enable
Quoted 8 lines
Documentation/driver-api/pps.rst delay between assert and clear edge as small as possible to reduce system · line 272
Quoted 4 lines
Documentation/driver-api/pps.rst +4
-0+ +Stop generating PPS signal:: + + $echo 0 > /sys/devices/platform/INTCxxxx\:00/enableAs I mentioned on the sysfs documentation, why isn't this just a generic pps class attribute instead? Why did you make it only-this-one-special-driver type of thing?
This is an Original Sin when PPS generators were introduced. :-(
In 2011 a patch from Alexander Gordeev <[email protected]> (which introduced the "parallel port PPS signal generator") was committed in the main kernel.
At the time it was something exotic and doing a PPS generator interface for it was not considered (since it actually has no controlling inputs), but now several Ethernet cards have such PPS generator functionalities, and they are enabled in a per-driver way or via the PTP API.
This code is a pure PPS generator and it cannot use any other way to enable such functionality than the one above since the PPS layer misses a proper implementation for PPS generator.
If you are willing to stop the inclusion due this fact maybe its time to add such PPS generators interface... on the other hand, if you agree for inclusion we can do this job as soon as the code has been included, in order to fix this anomalous status.
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming
Re: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 64 lines · Rodolfo Giometti
Quoted 43 lines · Greg KH
Quoted 42 lines · On Fri, Aug 23, 2024 at 12:31:07PM +0530, [email protected] wrote:
From: Subramanian Mohan <[email protected]>
Add Intel Timed I/O PPS usage instructions.
Co-developed-by Pandith N <[email protected]>Signed-off-by Pandith N <[email protected]>Signed-off-by Lakshmi Sowjanya D <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>Acked-by Rodolfo Giometti <[email protected]>Signed-off-by Subramanian Mohan <[email protected]>--- Documentation/driver-api/pps.rst | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)Documentation/driver-api/pps.rst +20
-0@@ -246,3 +246,27 @@ delay between assert and clear edge as small as possible to reduce system latencies. But if it is too small slave won't be able to capture clear edge transition. The default of 30us should be good enough in most situations. The delay can be selected using 'delay' pps_gen_parport module parameter. + + +Intel Timed I/O PPS signal generator +------------------------------------ + +Intel Timed I/O is a high precision device, present on 2019 and newer Intel +CPUs, that can generate PPS signals. + +Timed I/O and system time are both driven by same hardware clock. The signal +is generated with a precision of ~20 nanoseconds. The generated PPS signal +is used to synchronize an external device with system clock. For example, +it can be used to share your clock with a device that receives PPS signal, +generated by Timed I/O device. There are dedicated Timed I/O pins to deliver +the PPS signal to an external device. + +Usage of Intel Timed I/O as PPS generator: + +Start generating PPS signal:: + + $echo 1 > /sys/devices/platform/INTCxxxx\:00/enableQuoted 8 lines
Documentation/driver-api/pps.rst delay between assert and clear edge as small as possible to reduce system · line 272
Quoted 4 lines
Documentation/driver-api/pps.rst +4
-0+ +Stop generating PPS signal:: + + $echo 0 > /sys/devices/platform/INTCxxxx\:00/enableAs I mentioned on the sysfs documentation, why isn't this just a generic pps class attribute instead? Why did you make it only-this-one-special-driver type of thing?
This is an Original Sin when PPS generators were introduced. :-(
In 2011 a patch from Alexander Gordeev <[email protected]> (which introduced the "parallel port PPS signal generator") was committed in the main kernel.
At the time it was something exotic and doing a PPS generator interface for it was not considered (since it actually has no controlling inputs), but now several Ethernet cards have such PPS generator functionalities, and they are enabled in a per-driver way or via the PTP API.
Quoted 8 lines
This code is a pure PPS generator and it cannot use any other way to enable such functionality than the one above since the PPS layer misses a proper implementation for PPS generator.
If you are willing to stop the inclusion due this fact maybe its time to add such PPS generators interface... on the other hand, if you agree for inclusion we can do this job as soon as the code has been included, in order to fix this anomalous status.
Please make a generic pps subsystem for this, it would make it simpler for everyone.
thanks,
greg k-h
RE: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Hi Rodolfo,
Quoted 8 lines
From: Greg KH <[email protected]>
Sent: Tuesday, September 03, 2024 3:25 AM
To: Rodolfo Giometti <[email protected]>Subject: Re: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 7 lines
Quoted 4 lines
If you are willing to stop the inclusion due this fact maybe its time to add such PPS generators interface... on the other hand, if you agree for inclusion we can do this job as soon as the code has been included, in order to fix this anomalous status.
Please make a generic pps subsystem for this, it would make it simpler for everyone.
What is required to move this? We can certainly test the code and do some of this work, but I would look to you to define the interface.
Thanks,
Chris
Rodolfo Giometti
maintainerRe: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 1 line · Christopher S
Hi Rodolfo,
Hello.
Quoted 13 lines
Quoted 13 lines
From: Greg KH <[email protected]>
Sent: Tuesday, September 03, 2024 3:25 AM
To: Rodolfo Giometti <[email protected]>Subject: Re: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 4 lines
If you are willing to stop the inclusion due this fact maybe its time to add such PPS generators interface... on the other hand, if you agree for inclusion we can do this job as soon as the code has been included, in order to fix this anomalous status.
Quoted 5 lines
Quoted 2 lines
Please make a generic pps subsystem for this, it would make it simpler for everyone.
What is required to move this? We can certainly test the code and do some of this work, but I would look to you to define the interface.
The problem is that a pps-generator has no related device, then no sysfs entries.
I think the right-thing(TM) to do is adding a new class named "pps-generator", so we will get the directory /sys/class/pps-generator with several devices as pps-generator0, pps-generator1, etc. For each device we should add at least these sysfs entries:
- system : This file return "1" if the generator takes the timing from
the system clock, while it returns "0" if not (i.e. from a peripheral device clock).
- time : This file contains the current time stored into the generator
clock as two integers representing the current time seconds and nanoseconds.
- enable : This write-only file enables or disables generation of the
PPS signal.
- period : This file defines the period for the generator signal. When
read, by default, it returns "1 0" which represent the period second and nanoseconds (i.e. a PPS signal). When written, it sets the period accordingly or ENOTSUPP if not supported.
- start_time : This file defines the starting time for the the generator
signal. When read, by default, it returns "0 0" which means "now". When written, it sets the starting time accordingly or ENOTSUPP if not supported.
Please, let me know what do you think about this proposal. I'm going to provide a draft in the next weeks since I'm stuck on another project right now. :(
Ciao,
Rodolfo
Signature · 4 lines
GNU/Linux Solutions e-mail: [email protected] Linux Device Driver [email protected] Embedded Systems phone: +39 349 2432127 UNIX programming
Re: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 47 lines · Rodolfo Giometti
Quoted 1 line · Christopher S
Hi Rodolfo,
Hello.
Quoted 13 lines
Quoted 13 lines
From: Greg KH <[email protected]>
Sent: Tuesday, September 03, 2024 3:25 AM
To: Rodolfo Giometti <[email protected]>Subject: Re: [PATCH v12 2/3] Documentation: driver-api: pps: Add Intel Timed I/O PPS generator
Quoted 4 lines
If you are willing to stop the inclusion due this fact maybe its time to add such PPS generators interface... on the other hand, if you agree for inclusion we can do this job as soon as the code has been included, in order to fix this anomalous status.
Quoted 5 lines
Quoted 2 lines
Please make a generic pps subsystem for this, it would make it simpler for everyone.
What is required to move this? We can certainly test the code and do some of this work, but I would look to you to define the interface.
The problem is that a pps-generator has no related device, then no sysfs entries.
I think the right-thing(TM) to do is adding a new class named "pps-generator", so we will get the directory
/sys/class/pps-generatorwith several devices as pps-generator0, pps-generator1, etc. For each device we should add at least these sysfs entries:- system : This file return "1" if the generator takes the timing from
the system clock, while it returns "0" if not (i.e. from a peripheral device clock).- time : This file contains the current time stored into the generator
clock as two integers representing the current time seconds and nanoseconds.- enable : This write-only file enables or disables generation of the
PPS signal.- period : This file defines the period for the generator signal. When
read, by default, it returns "1 0" which represent the period second and nanoseconds (i.e. a PPS signal). When written, it sets the period accordingly or ENOTSUPP if not supported.
Quoted 4 lines
-
start_time: This file defines the starting time for the the generator
signal. When read, by default, it returns "0 0" which means "now". When written, it sets the starting time accordingly or ENOTSUPP if not supported.
This seems sane to me, thanks for writing it up!
greg k-h
PATCH v12 3/3 ABI: pps: Add ABI documentation for Intel TIO
In reply to [email protected]From: Subramanian Mohan <[email protected]>
Document sysfs interface for Intel Timed I/O PPS driver.
--- Documentation/ABI/testing/sysfs-platform-pps-tio | 8 ++++++++ MAINTAINERS | 1 + 2 files changed, 9 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-pps-tio
Documentation/ABI/testing/sysfs-platform-pps-tio new file +8 -0
@@ -0,0 +1,8 @@ +What: /sys/devices/platform/INTCxxxx/enable +Date: September 2024 +KernelVersion: 6.12 +Contact: Christopher Hall <[email protected]> + Subramanian Mohan<[email protected]> +Description: + (RW) Enable or disable PPS TIO generator output, read to + see the status of hardware (Enabled/Disabled).
MAINTAINERS +1 -0
@@ -18263,6 +18263,7 @@ M: Rodolfo Giometti <[email protected]> L: [email protected] (subscribers-only) S: Maintained W: http://wiki.enneenne.com/index.php/LinuxPPS_support +F: Documentation/ABI/testing/sysfs-platform-pps-tio F: Documentation/ABI/testing/sysfs-pps F: Documentation/devicetree/bindings/pps/pps-gpio.yaml F: Documentation/driver-api/pps.rst
Signature · 1 line
2.35.3
Re: [PATCH v12 3/3] ABI: pps: Add ABI documentation for Intel TIO
Quoted 3 lines · On Fri, Aug 23, 2024 at 12:31:08PM +0530, [email protected] wrote:
From: Subramanian Mohan <[email protected]>
Document sysfs interface for Intel Timed I/O PPS driver.
...
Documentation/ABI/testing/sysfs-platform-pps-tio line 5
Quoted 2 lines
Documentation/ABI/testing/sysfs-platform-pps-tio new file +2
-0+Contact: Christopher Hall <[email protected]> + Subramanian Mohan<[email protected]>
Missing space. This seems like a warrant for v13, but again, let's wait a bit for others to comment.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v12 3/3] ABI: pps: Add ABI documentation for Intel TIO
In reply to [email protected]Quoted 19 lines · On Fri, Aug 23, 2024 at 12:31:08PM +0530, [email protected] wrote:
From: Subramanian Mohan <[email protected]>
Document sysfs interface for Intel Timed I/O PPS driver.
Signed-off-by Lakshmi Sowjanya D <[email protected]>Acked-by Christopher Hall <[email protected]>Signed-off-by Subramanian Mohan <[email protected]>--- Documentation/ABI/testing/sysfs-platform-pps-tio | 8 ++++++++ MAINTAINERS | 1 + 2 files changed, 9 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-platform-pps-tioDocumentation/ABI/testing/sysfs-platform-pps-tio new file +0
-0
Documentation/ABI/testing/sysfs-platform-pps-tio line 4
Quoted 4 lines
Documentation/ABI/testing/sysfs-platform-pps-tio new file +4
-0@@ -0,0 +1,8 @@ +What: /sys/devices/platform/INTCxxxx/enable +Date: September 2024 +KernelVersion: 6.12 +Contact: Christopher Hall <[email protected]>
Why are you adding a random person here who did not sign off on this commit as being responsible for it?
Documentation/ABI/testing/sysfs-platform-pps-tio line 5
Quoted 1 line
Documentation/ABI/testing/sysfs-platform-pps-tio new file +1
-0+ Subramanian Mohan<[email protected]>
Do you really need 2 people for a sysfs attribute?
MAINTAINERS M: Rodolfo Giometti <[email protected]> · line 18266
Quoted 12 lines
Documentation/ABI/testing/sysfs-platform-pps-tio new file +3
-0+Description: + (RW) Enable or disable PPS TIO generator output, read to + see the status of hardware (Enabled/Disabled).MAINTAINERS +1
-0@@ -18263,6 +18263,7 @@ M: Rodolfo Giometti <[email protected]> L: [email protected] (subscribers-only) S: Maintained W: http://wiki.enneenne.com/index.php/LinuxPPS_support +F: Documentation/ABI/testing/sysfs-platform-pps-tio
Why are you saying that Rodolfo is now responsible for this file?
MAINTAINERS M: Rodolfo Giometti <[email protected]> · line 18267
Quoted 1 line
MAINTAINERS +0
-0F: Documentation/ABI/testing/sysfs-pps
Wait, there already is default pps sysfs attributes? Why aren't you adding your attribute to them instead? Doing a "driver-specific" attribute for a generic class device is not a good idea as userspace tools will never know to look for it.
thanks,
greg k-h