Commit 2f4ec154 authored by Zhang Lixu's avatar Zhang Lixu Committed by Jiri Kosina

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: default avatarWei Jiang <wei.w.jiang@intel.com>
Signed-off-by: default avatarWei Jiang <wei.w.jiang@intel.com>
Signed-off-by: default avatarEven Xu <even.xu@intel.com>
Signed-off-by: default avatarZhang Lixu <lixu.zhang@intel.com>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 2e23a70e
...@@ -81,5 +81,6 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev); ...@@ -81,5 +81,6 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev);
int ish_hw_start(struct ishtp_device *dev); int ish_hw_start(struct ishtp_device *dev);
void ish_device_disable(struct ishtp_device *dev); void ish_device_disable(struct ishtp_device *dev);
int ish_disable_dma(struct ishtp_device *dev); int ish_disable_dma(struct ishtp_device *dev);
void ish_set_host_ready(struct ishtp_device *dev);
#endif /* _ISHTP_HW_ISH_H_ */ #endif /* _ISHTP_HW_ISH_H_ */
...@@ -193,6 +193,33 @@ static void ish_clr_host_rdy(struct ishtp_device *dev) ...@@ -193,6 +193,33 @@ static void ish_clr_host_rdy(struct ishtp_device *dev)
ish_reg_write(dev, IPC_REG_HOST_COMM, host_status); ish_reg_write(dev, IPC_REG_HOST_COMM, host_status);
} }
static bool ish_chk_host_rdy(struct ishtp_device *dev)
{
uint32_t host_status = ish_reg_read(dev, IPC_REG_HOST_COMM);
return (host_status & IPC_HOSTCOMM_READY_BIT);
}
/**
* ish_set_host_ready() - reconfig ipc host registers
* @dev: ishtp device pointer
*
* Set host to ready state
* This API is called in some case:
* fw is still on, but ipc is powered down.
* such as OOB case.
*
* Return: 0 for success else error fault code
*/
void ish_set_host_ready(struct ishtp_device *dev)
{
if (ish_chk_host_rdy(dev))
return;
ish_set_host_rdy(dev);
set_host_ready(dev);
}
/** /**
* _ishtp_read_hdr() - Read message header * _ishtp_read_hdr() - Read message header
* @dev: ISHTP device pointer * @dev: ISHTP device pointer
......
...@@ -259,11 +259,15 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work) ...@@ -259,11 +259,15 @@ static void __maybe_unused ish_resume_handler(struct work_struct *work)
{ {
struct pci_dev *pdev = to_pci_dev(ish_resume_device); struct pci_dev *pdev = to_pci_dev(ish_resume_device);
struct ishtp_device *dev = pci_get_drvdata(pdev); struct ishtp_device *dev = pci_get_drvdata(pdev);
uint32_t fwsts = dev->ops->get_fw_status(dev);
int ret; int ret;
if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag) { if (ish_should_leave_d0i3(pdev) && !dev->suspend_flag
&& IPC_IS_ISH_ILUP(fwsts)) {
disable_irq_wake(pdev->irq); disable_irq_wake(pdev->irq);
ish_set_host_ready(dev);
ishtp_send_resume(dev); ishtp_send_resume(dev);
/* Waiting to get resume response */ /* Waiting to get resume response */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment