From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: jikos@kernel.org
Cc: linux-input@vger.kernel.org, Even Xu <even.xu@intel.com>
Subject: [PATCH 3/4] hid: intel-ish-hid: ipc: Fix driver reinit failure
Date: Sat, 15 Oct 2016 09:22:43 -0700 [thread overview]
Message-ID: <1476548564-20202-4-git-send-email-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <1476548564-20202-1-git-send-email-srinivas.pandruvada@linux.intel.com>
From: Even Xu <even.xu@intel.com>
When built as a module, modprobe followed by rmmod can fail because
DMA was still active. So to fix this, DMA needs to be disabled during
module exit.
This change disables DMA during modules exit and change the ISH PCI
device status to D3.
Signed-off-by: Even Xu <even.xu@intel.com>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
drivers/hid/intel-ish-hid/ipc/ipc.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/hid/intel-ish-hid/ipc/ipc.c b/drivers/hid/intel-ish-hid/ipc/ipc.c
index 0e0dfa6..66c6755 100644
--- a/drivers/hid/intel-ish-hid/ipc/ipc.c
+++ b/drivers/hid/intel-ish-hid/ipc/ipc.c
@@ -905,6 +905,26 @@ struct ishtp_device *ish_dev_init(struct pci_dev *pdev)
*/
void ish_device_disable(struct ishtp_device *dev)
{
+ struct pci_dev *pdev = dev->pdev;
+ uint16_t csr;
+
+ if (!pdev)
+ return;
+
+ /* Disable dma communication between FW and host */
+ if (ish_disable_dma(dev)) {
+ dev_err(&pdev->dev,
+ "Can't reset - stuck with DMA in-progress\n");
+ return;
+ }
+
+ /* Put ISH to D3 state for power saving */
+ pci_read_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, &csr);
+
+ csr &= ~PCI_PM_CTRL_STATE_MASK;
+ csr |= PCI_D3hot;
+ pci_write_config_word(pdev, pdev->pm_cap + PCI_PM_CTRL, csr);
+
dev->dev_state = ISHTP_DEV_DISABLED;
ish_clr_host_rdy(dev);
}
--
2.7.4
next prev parent reply other threads:[~2016-10-15 16:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-15 16:22 [PATCH 0/4] intel-ish-hid: Fixes for loading failures Srinivas Pandruvada
2016-10-15 16:22 ` [PATCH 1/4] hid: intel-ish-hid: ipc: consolidate ish wake up operation Srinivas Pandruvada
2016-10-15 16:22 ` [PATCH 2/4] hid: intel-ish-hid: ipc: Move DMA disable code to new function Srinivas Pandruvada
2016-10-15 16:22 ` Srinivas Pandruvada [this message]
[not found] ` <9577C59DB499174B9340876B077C2E9566FF6E12@SHSMSX101.ccr.corp.intel.com>
2016-10-19 9:58 ` [PATCH 3/4] hid: intel-ish-hid: ipc: Fix driver reinit failure Ooi, Joyce
2016-10-19 12:43 ` Pandruvada, Srinivas
2016-10-15 16:22 ` [PATCH 4/4] hid: intel-ish-hid: request_irq failure Srinivas Pandruvada
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=1476548564-20202-4-git-send-email-srinivas.pandruvada@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=even.xu@intel.com \
--cc=jikos@kernel.org \
--cc=linux-input@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).