All of lore.kernel.org
 help / color / mirror / Atom feed
* getting a PHC reference in a kernel module?
@ 2018-09-17 17:09 Spruyt, Randy
  0 siblings, 0 replies; 3+ messages in thread
From: Spruyt, Randy @ 2018-09-17 17:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: john.stultz, tglx, sboyd

I'm new to kernel driver development, so I hope you bear with me on the question. 

I'd like to timestamp an IRQ event in a kernel module using a PTP synchronized clock (e.g. the PHC from eth0 = /dev/ptp0). E.g. a GPIO pin goes high, I'd like to keep track of when this happened as accurate as we can. One option is to use getnstimeofday() and have phc2sys synchronize /dev/ptp0 with the system  clock. 

This seems to work but I feel like there is a more direct way to just query the PHC clock e.g. using struct ptp_clock* and gettime64(). The question is how to get this pointer, find_driver()? Or something else? Perhaps this is not exposed for a reason?
 
If this is the wrong way to go about this, by all means, I'm open to suggestions.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: getting a PHC reference in a kernel module?
  2018-09-06 14:00 Spruyt, Randy
@ 2018-09-17 16:34 ` Stephen Boyd
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2018-09-17 16:34 UTC (permalink / raw)
  To: Spruyt, Randy, linux-clk

Quoting Spruyt, Randy (2018-09-06 07:00:07)
> I'm new to kernel driver development, so I hope you bear with me on the q=
uestion. =

> =

> I'd like to timestamp an IRQ event in a kernel moudle using a PTP synchro=
nized clock (e.g. the PHC from eth0 =3D /dev/ptp0). E.g. a GPIO pin goes hi=
gh, I'd like to keep track of when this happened. Low latency is important.=
 One option is to use getnstimeofday() and have phc2sys synchronize /dev/pt=
p0 with the system=C2=A0 clock. =

> =

> This seems to work but I feel like there is a more direct way to just que=
ry the PHC clock e.g. using struct ptp_clock* and gettime64(). The question=
 is how to get this pointer, find_driver()? Or something else?
> =

> If this is the wrong way to go about this, by all means, I'm open to sugg=
estions.
> =


linux-clk is for discussion about clk hardware that is used for power
management and frequency scaling, not timekeeping hardware used for
things like PTP. Please move your discussion to the linux-kernel mailing
list and Cc the Timekeeping maintainers:

TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
M:      John Stultz <john.stultz@linaro.org>
M:      Thomas Gleixner <tglx@linutronix.de>
R:      Stephen Boyd <sboyd@codeaurora.org>
L:      linux-kernel@vger.kernel.org
T:      git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timer=
s/core
S:      Supported
F:      include/linux/clocksource.h
F:      include/linux/time.h
F:      include/linux/timex.h
F:      include/uapi/linux/time.h
F:      include/uapi/linux/timex.h
F:      kernel/time/clocksource.c
F:      kernel/time/time*.c
F:      kernel/time/alarmtimer.c
F:      kernel/time/ntp.c
F:      tools/testing/selftests/timers/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* getting a PHC reference in a kernel module?
@ 2018-09-06 14:00 Spruyt, Randy
  2018-09-17 16:34 ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Spruyt, Randy @ 2018-09-06 14:00 UTC (permalink / raw)
  To: linux-clk

I'm new to kernel driver development, so I hope you bear with me on the question. 

I'd like to timestamp an IRQ event in a kernel moudle using a PTP synchronized clock (e.g. the PHC from eth0 = /dev/ptp0). E.g. a GPIO pin goes high, I'd like to keep track of when this happened. Low latency is important. One option is to use getnstimeofday() and have phc2sys synchronize /dev/ptp0 with the system  clock. 

This seems to work but I feel like there is a more direct way to just query the PHC clock e.g. using struct ptp_clock* and gettime64(). The question is how to get this pointer, find_driver()? Or something else?

If this is the wrong way to go about this, by all means, I'm open to suggestions.

Randy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-09-17 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-17 17:09 getting a PHC reference in a kernel module? Spruyt, Randy
  -- strict thread matches above, loose matches on Subject: below --
2018-09-06 14:00 Spruyt, Randy
2018-09-17 16:34 ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.