]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
timekeeping: Add CLOCK ID to system_device_crosststamp
authorThomas Gleixner <tglx@kernel.org>
Fri, 29 May 2026 20:00:32 +0000 (22:00 +0200)
committerThomas Gleixner <tglx@kernel.org>
Thu, 4 Jun 2026 09:04:16 +0000 (11:04 +0200)
The normal capture for system/device cross timestamps is CLOCK_REALTIME,
but that's meaningless for AUX clocks.

Add a clock_id field to struct system_device_crosststamp and initialize it
with CLOCK_REALTIME at the two places which prepare for cross
timestamps.

After the related code has been cleaned up, the core code will honor the
clock_id field when calculating the system time from the system counter
snapshot.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Tested-by: David Woodhouse <dwmw@amazon.co.uk>
Tested-by: Arthur Kiyanovski <akiyano@amazon.com>
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://patch.msgid.link/20260529195557.482153523@kernel.org
drivers/ptp/ptp_chardev.c
include/linux/timekeeping.h
sound/hda/common/controller.c

index c61cf9edac48b85f6ed509a496ca525b97731b46..da964c3778fbf2df220df3c962c52afbb08b6799 100644 (file)
@@ -317,8 +317,8 @@ typedef int (*ptp_crosststamp_fn)(struct ptp_clock_info *,
 static long ptp_sys_offset_precise(struct ptp_clock *ptp, void __user *arg,
                                   ptp_crosststamp_fn crosststamp_fn)
 {
+       struct system_device_crosststamp xtstamp = { .clock_id = CLOCK_REALTIME };
        struct ptp_sys_offset_precise precise_offset;
-       struct system_device_crosststamp xtstamp;
        struct timespec64 ts;
        int err;
 
index 3867db65f391a4a18b7c39597294d4f66b5442be..fff6d9e319c44b1692ec52738ff1a2fa56ecaee4 100644 (file)
@@ -315,12 +315,14 @@ struct system_counterval_t {
 /**
  * struct system_device_crosststamp - system/device cross-timestamp
  *                                   (synchronized capture)
+ * @clock_id:          System time Clock ID to capture
  * @device:            Device time
  * @sys_counter:       Clocksource counter value simultaneous with device time
  * @sys_realtime:      Realtime simultaneous with device time
  * @sys_monoraw:       Monotonic raw simultaneous with device time
  */
 struct system_device_crosststamp {
+       clockid_t                       clock_id;
        ktime_t                         device;
        struct system_counterval_t      sys_counter;
        ktime_t                         sys_realtime;
index 5934e5cdfdfd81c2a79a555b9dec5d072e1e000c..a880dcd8f2e83f823cdb1d81f84438f34e6c4dd0 100644 (file)
@@ -489,9 +489,9 @@ static int azx_get_time_info(struct snd_pcm_substream *substream,
                        struct snd_pcm_audio_tstamp_config *audio_tstamp_config,
                        struct snd_pcm_audio_tstamp_report *audio_tstamp_report)
 {
+       struct system_device_crosststamp xtstamp = { .clock_id = CLOCK_REALTIME };
        struct azx_dev *azx_dev = get_azx_dev(substream);
        struct snd_pcm_runtime *runtime = substream->runtime;
-       struct system_device_crosststamp xtstamp;
        int ret;
        u64 nsec;