]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
hwmon: (pmbus/adm1266) seed timestamp from the real-time clock
authorAbdurrahman Hussain <abdurrahman@nexthop.ai>
Fri, 15 May 2026 22:11:47 +0000 (15:11 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Thu, 21 May 2026 13:55:34 +0000 (06:55 -0700)
commitb86095e3d7dcf2bf80c747349a35912a87a85098
treeb119694b72136638754b5730a6e66d853bf6c685
parente6056b1f5a38bbe57ccbbba2609efecbd87ae08c
hwmon: (pmbus/adm1266) seed timestamp from the real-time clock

adm1266_set_rtc() seeds the chip's SET_RTC register from
ktime_get_seconds(), which returns CLOCK_MONOTONIC -- i.e. seconds
since the host last booted, not seconds since the Unix epoch.

The chip stamps that value into every blackbox record it captures.
Userspace reading those timestamps back expects wall-clock seconds:
that's what the SET_RTC frame layout documents (datasheet Rev. D,
Table 84) and what every other consumer of "seconds since epoch"
assumes.  Seeding from CLOCK_MONOTONIC gives blackbox records a
timestamp that is only meaningful within a single boot of the host
and silently resets to small values on every reboot.

Switch to ktime_get_real_seconds() so the seed matches what the
register is documented to hold.

Fixes: 15609d189302 ("hwmon: (pmbus/adm1266) read blackbox")
Cc: stable@vger.kernel.org
Signed-off-by: Abdurrahman Hussain <abdurrahman@nexthop.ai>
Link: https://lore.kernel.org/r/20260515-adm1266-fixes-v1-1-1c1ea1349cfe@nexthop.ai
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/pmbus/adm1266.c