mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 19:29:37 +00:00
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
1 changed files with 26 additions and 19 deletions
|
@ -637,6 +637,28 @@ irqreturn_t ish_irq_handler(int irq, void *dev_id)
|
|||
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
|
||||
* @dev: ishtp device pointer
|
||||
|
@ -690,16 +712,8 @@ static int _ish_hw_reset(struct ishtp_device *dev)
|
|||
csr |= PCI_D0;
|
||||
pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr);
|
||||
|
||||
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);
|
||||
/* Now we can enable ISH DMA operation and wakeup ISHFW */
|
||||
ish_wakeup(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -758,16 +772,9 @@ static int _ish_ipc_reset(struct ishtp_device *dev)
|
|||
int ish_hw_start(struct ishtp_device *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);
|
||||
|
||||
/*
|
||||
* 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 write to doorbell */
|
||||
ish_reg_read(dev, IPC_REG_ISH_HOST_FWSTS);
|
||||
/* After that we can enable ISH DMA operation and wakeup ISHFW */
|
||||
ish_wakeup(dev);
|
||||
|
||||
set_host_ready(dev);
|
||||
|
||||
|
|
Loading…
Reference in a new issue