From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Zhang Lixu <lixu.zhang@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Jiri Kosina <jkosina@suse.com>, Sasha Levin <sashal@kernel.org>,
jikos@kernel.org, bentiss@kernel.org,
andriy.shevchenko@intel.com, linux@treblig.org,
linux-input@vger.kernel.org
Subject: [PATCH AUTOSEL 6.13 03/31] HID: intel-ish-hid: Send clock sync message immediately after reset
Date: Tue, 18 Feb 2025 15:24:23 -0500 [thread overview]
Message-ID: <20250218202455.3592096-3-sashal@kernel.org> (raw)
In-Reply-To: <20250218202455.3592096-1-sashal@kernel.org>
From: Zhang Lixu <lixu.zhang@intel.com>
[ Upstream commit 7e0d1cff12b895f44f4ddc8cf50311bc1f775201 ]
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 <lixu.zhang@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/hid/intel-ish-hid/ipc/ipc.c | 9 ++++++---
drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h | 2 ++
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index cb956a8c386cb..4c861119e97aa 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -517,6 +517,10 @@ static int ish_fw_reset_handler(struct ishtp_device *dev)
/* ISH FW is dead */
if (!ish_is_input_ready(dev))
return -EPIPE;
+
+ /* Send clock sync at once after reset */
+ ishtp_dev->prev_sync = 0;
+
/*
* Set HOST2ISH.ILUP. Apparently we need this BEFORE sending
* RESET_NOTIFY_ACK - FW will be checking for it
@@ -577,13 +581,12 @@ 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;
struct ipc_time_update_msg time = {};
- if (prev_sync && time_before(jiffies, prev_sync + 20 * HZ))
+ if (dev->prev_sync && time_before(jiffies, dev->prev_sync + 20 * HZ))
return;
- prev_sync = jiffies;
+ dev->prev_sync = jiffies;
/* The fields of time would be updated while sending message */
ipc_send_mng_msg(dev, MNG_SYNC_FW_CLOCK, &time, sizeof(time));
}
diff --git a/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h b/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
index effbb442c7277..dfc8cfd393532 100644
--- a/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
+++ b/drivers/hid/intel-ish-hid/ishtp/ishtp-dev.h
@@ -254,6 +254,8 @@ struct ishtp_device {
unsigned int ipc_tx_cnt;
unsigned long long ipc_tx_bytes_cnt;
+ /* Time of the last clock sync */
+ unsigned long prev_sync;
const struct ishtp_hw_ops *ops;
size_t mtu;
uint32_t ishtp_msg_hdr;
--
2.39.5
next prev parent reply other threads:[~2025-02-18 20:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250218202455.3592096-1-sashal@kernel.org>
2025-02-18 20:24 ` [PATCH AUTOSEL 6.13 02/31] HID: intel-ish-hid: fix the length of MNG_SYNC_FW_CLOCK in doorbell Sasha Levin
2025-02-18 20:24 ` Sasha Levin [this message]
2025-02-18 20:24 ` [PATCH AUTOSEL 6.13 04/31] HID: ignore non-functional sensor in HP 5MP Camera Sasha Levin
2025-02-18 20:24 ` [PATCH AUTOSEL 6.13 05/31] HID: hid-steam: Fix issues with disabling both gamepad mode and lizard mode Sasha Levin
2025-02-18 20:24 ` [PATCH AUTOSEL 6.13 07/31] HID: intel-ish-hid: ipc: Add Panther Lake PCI device IDs Sasha Levin
2025-02-18 20:24 ` [PATCH AUTOSEL 6.13 08/31] HID: topre: Fix n-key rollover on Realforce R3S TKL boards Sasha Levin
2025-02-18 20:24 ` [PATCH AUTOSEL 6.13 10/31] HID: hid-apple: Apple Magic Keyboard a3203 USB-C support Sasha Levin
2025-02-18 20:24 ` [PATCH AUTOSEL 6.13 11/31] HID: apple: fix up the F6 key on the Omoton KB066 keyboard Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250218202455.3592096-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=andriy.shevchenko@intel.com \
--cc=bentiss@kernel.org \
--cc=jikos@kernel.org \
--cc=jkosina@suse.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@treblig.org \
--cc=lixu.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).