]> www.infradead.org Git - users/hch/misc.git/commitdiff
HID: intel-ish-hid: fix the length of MNG_SYNC_FW_CLOCK in doorbell
authorZhang Lixu <lixu.zhang@intel.com>
Wed, 22 Jan 2025 01:29:00 +0000 (09:29 +0800)
committerJiri Kosina <jkosina@suse.com>
Mon, 3 Feb 2025 09:53:12 +0000 (10:53 +0100)
The timestamps in the Firmware log and HID sensor samples are incorrect.
They show 1970-01-01 because the current IPC driver only uses the first
8 bytes of bootup time when synchronizing time with the firmware. The
firmware converts the bootup time to UTC time, which results in the
display of 1970-01-01.

In write_ipc_from_queue(), when sending the MNG_SYNC_FW_CLOCK message,
the clock is updated according to the definition of ipc_time_update_msg.
However, in _ish_sync_fw_clock(), the message length is specified as the
size of uint64_t when building the doorbell. As a result, the firmware
only receives the first 8 bytes of struct ipc_time_update_msg.
This patch corrects the length in the doorbell to ensure the entire
ipc_time_update_msg is sent, fixing the timestamp issue.

Signed-off-by: Zhang Lixu <lixu.zhang@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/intel-ish-hid/ipc/ipc.c

index 3cd53fc80634a6d1e5c58a97d3b88c5731a55e31..cb956a8c386cbba7f12b16fdd7f67689268505e3 100644 (file)
@@ -578,14 +578,14 @@ static void fw_reset_work_fn(struct work_struct *work)
 static void _ish_sync_fw_clock(struct ishtp_device *dev)
 {
        static unsigned long    prev_sync;
-       uint64_t        usec;
+       struct ipc_time_update_msg time = {};
 
        if (prev_sync && time_before(jiffies, prev_sync + 20 * HZ))
                return;
 
        prev_sync = jiffies;
-       usec = ktime_to_us(ktime_get_boottime());
-       ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &usec, sizeof(uint64_t));
+       /* The fields of time would be updated while sending message */
+       ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &time, sizeof(time));
 }
 
 /**