HID: intel-ish-hid: consolidate ish wake up operation
Same operations are done in ish_hw_start() and _ish_hw_reset() to wakeup ISH device. Consolidate them by introducing a new function ish_wakeup() and move the code there. Signed-off-by: Even Xu <even.xu@intel.com> Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
cf0ea4da4c
commit
c2ed83f542
@ -637,6 +637,28 @@ eoi:
|
|||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ish_wakeup() - wakeup ishfw from waiting-for-host state
|
||||||
|
* @dev: ishtp device pointer
|
||||||
|
*
|
||||||
|
* Set the dma enable bit and send a void message to FW,
|
||||||
|
* it wil wakeup FW from waiting-for-host state.
|
||||||
|
*/
|
||||||
|
static void ish_wakeup(struct ishtp_device *dev)
|
||||||
|
{
|
||||||
|
/* Set dma enable bit */
|
||||||
|
ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Send 0 IPC message so that ISH FW wakes up if it was already
|
||||||
|
* asleep.
|
||||||
|
*/
|
||||||
|
ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
|
||||||
|
|
||||||
|
/* Flush writes to doorbell and REMAP2 */
|
||||||
|
ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* _ish_hw_reset() - HW reset
|
* _ish_hw_reset() - HW reset
|
||||||
* @dev: ishtp device pointer
|
* @dev: ishtp device pointer
|
||||||
@ -690,16 +712,8 @@ static int _ish_hw_reset(struct ishtp_device *dev)
|
|||||||
csr |= PCI_D0;
|
csr |= PCI_D0;
|
||||||
pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr);
|
pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr);
|
||||||
|
|
||||||
ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
|
/* Now we can enable ISH DMA operation and wakeup ISHFW */
|
||||||
|
ish_wakeup(dev);
|
||||||
/*
|
|
||||||
* Send 0 IPC message so that ISH FW wakes up if it was already
|
|
||||||
* asleep
|
|
||||||
*/
|
|
||||||
ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
|
|
||||||
|
|
||||||
/* Flush writes to doorbell and REMAP2 */
|
|
||||||
ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -758,16 +772,9 @@ static int _ish_ipc_reset(struct ishtp_device *dev)
|
|||||||
int ish_hw_start(struct ishtp_device *dev)
|
int ish_hw_start(struct ishtp_device *dev)
|
||||||
{
|
{
|
||||||
ish_set_host_rdy(dev);
|
ish_set_host_rdy(dev);
|
||||||
/* After that we can enable ISH DMA operation */
|
|
||||||
ish_reg_write(dev, IPC_REG_ISH_RMP2, IPC_RMP2_DMA_ENABLED);
|
|
||||||
|
|
||||||
/*
|
/* After that we can enable ISH DMA operation and wakeup ISHFW */
|
||||||
* Send 0 IPC message so that ISH FW wakes up if it was already
|
ish_wakeup(dev);
|
||||||
* asleep
|
|
||||||
*/
|
|
||||||
ish_reg_write(dev, IPC_REG_HOST2ISH_DRBL, IPC_DRBL_BUSY_BIT);
|
|
||||||
/* Flush write to doorbell */
|
|
||||||
ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
|
|
||||||
|
|
||||||
set_host_ready(dev);
|
set_host_ready(dev);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user