Skip to content

Commit 2f4ec15

Browse files
lixuzhaJiri Kosina
authored andcommitted
HID: intel-ish-hid: ipc: Address EHL Sx resume issues
When OOB is disabled, FW will be power gated when system is in S3/S4/S5 which is the same behavior with legacy ISH FW. When OOB is enabled, FW will always power on which is totally different comparing to legacy ISH FW. So NO_D3 flag is not enough to check FW's status after resume. Here we can use IPC FW status register to check host link status. If it is false, it means FW get reset after power gated, need go through the whole initialization flow; If it is true, it means FW is alive, just set host ready bit to let fw know host is up. Co-developed-by: Wei Jiang <wei.w.jiang@intel.com> Signed-off-by: Wei Jiang <wei.w.jiang@intel.com> Signed-off-by: Even Xu <even.xu@intel.com> Signed-off-by: Zhang Lixu <lixu.zhang@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
1 parent 2e23a70 commit 2f4ec15

3 files changed

Lines changed: 33 additions & 1 deletion

File tree

drivers/hid/intel-ish-hid/ipc/hw-ish.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,5 +81,6 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev);
8181
int ish_hw_start(struct ishtp_device *dev);
8282
void ish_device_disable(struct ishtp_device *dev);
8383
int ish_disable_dma(struct ishtp_device *dev);
84+
void ish_set_host_ready(struct ishtp_device *dev);
8485

8586
#endif /* _ISHTP_HW_ISH_H_ */

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,33 @@ static void ish_clr_host_rdy(struct ishtp_device *dev)
193193
ish_reg_write(dev, IPC_REG_HOST_COMM, host_status);
194194
}
195195

196+
static bool ish_chk_host_rdy(struct ishtp_device *dev)
197+
{
198+
uint32_t host_status = ish_reg_read(dev, IPC_REG_HOST_COMM);
199+
200+
return (host_status & IPC_HOSTCOMM_READY_BIT);
201+
}
202+
203+
/**
204+
* ish_set_host_ready() - reconfig ipc host registers
205+
* @dev: ishtp device pointer
206+
*
207+
* Set host to ready state
208+
* This API is called in some case:
209+
* fw is still on, but ipc is powered down.
210+
* such as OOB case.
211+
*
212+
* Return: 0 for success else error fault code
213+
*/
214+
void ish_set_host_ready(struct ishtp_device *dev)
215+
{
216+
if (ish_chk_host_rdy(dev))
217+
return;
218+
219+
ish_set_host_rdy(dev);
220+
set_host_ready(dev);
221+
}
222+
196223
/**
197224
* _ishtp_read_hdr() - Read message header
198225
* @dev: ISHTP device pointer

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,15 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work)
259259
{
260260
struct pci_dev *pdev = to_pci_dev(ish_resume_device);
261261
struct ishtp_device *dev = pci_get_drvdata(pdev);
262+
uint32_t fwsts = dev->ops->get_fw_status(dev);
262263
int ret;
263264

264-
if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag) {
265+
if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag
266+
&& IPC_IS_ISH_ILUP(fwsts)) {
265267
disable_irq_wake(pdev->irq);
266268

269+
ish_set_host_ready(dev);
270+
267271
ishtp_send_resume(dev);
268272

269273
/* Waiting to get resume response */

0 commit comments

Comments
 (0)