Skip to content

Commit 7e0d1cf

Browse files
lixuzhaJiri Kosina
authored andcommitted
HID: intel-ish-hid: Send clock sync message immediately after reset
The ISH driver performs a clock sync with the firmware once at system startup and then every 20 seconds. If a firmware reset occurs right after a clock sync, the driver would wait 20 seconds before performing another clock sync with the firmware. This is particularly problematic with the introduction of the "load firmware from host" feature, where the driver performs a clock sync with the bootloader and then has to wait 20 seconds before syncing with the main firmware. This patch clears prev_sync immediately upon receiving an IPC reset, so that the main firmware and driver will perform a clock sync immediately after completing the IPC handshake. Signed-off-by: Zhang Lixu <[email protected]> Acked-by: Srinivas Pandruvada <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
1 parent 4b54ae6 commit 7e0d1cf

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

drivers/hid/intel-ish-hid/ipc/ipc.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,10 @@ static int ish_fw_reset_handler(struct ishtp_device *dev)
517517
/* ISH FW is dead */
518518
if (!ish_is_input_ready(dev))
519519
return -EPIPE;
520+
521+
/* Send clock sync at once after reset */
522+
ishtp_dev->prev_sync = 0;
523+
520524
/*
521525
* Set HOST2ISH.ILUP. Apparently we need this BEFORE sending
522526
* RESET_NOTIFY_ACK - FW will be checking for it
@@ -577,13 +581,12 @@ static void fw_reset_work_fn(struct work_struct *work)
577581
*/
578582
static void _ish_sync_fw_clock(struct ishtp_device *dev)
579583
{
580-
static unsigned long prev_sync;
581584
struct ipc_time_update_msg time = {};
582585

583-
if (prev_sync && time_before(jiffies, prev_sync + 20 * HZ))
586+
if (dev->prev_sync && time_before(jiffies, dev->prev_sync + 20 * HZ))
584587
return;
585588

586-
prev_sync = jiffies;
589+
dev->prev_sync = jiffies;
587590
/* The fields of time would be updated while sending message */
588591
ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &time, sizeof(time));
589592
}

drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ struct ishtp_device {
253253
unsigned int ipc_tx_cnt;
254254
unsigned long long ipc_tx_bytes_cnt;
255255

256+
/* Time of the last clock sync */
257+
unsigned long prev_sync;
256258
const struct ishtp_hw_ops *ops;
257259
size_t mtu;
258260
uint32_t ishtp_msg_hdr;

0 commit comments

Comments
 (0)