Commit fe292283 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: txe: reduce suspend/resume time

HW has to be in known state before the initialisation
sequence is started. The polling step for settling aliveness
was set to 200ms while in practise this can be done in up to 30msecs.

Cc: <stable@vger.kernel.org> #3.18+
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarBarak Yoresh <barak.yoresh@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 620cf787
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/ktime.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/irqreturn.h> #include <linux/irqreturn.h>
...@@ -218,26 +219,25 @@ static u32 mei_txe_aliveness_get(struct mei_device *dev) ...@@ -218,26 +219,25 @@ static u32 mei_txe_aliveness_get(struct mei_device *dev)
* *
* Polls for HICR_HOST_ALIVENESS_RESP.ALIVENESS_RESP to be set * Polls for HICR_HOST_ALIVENESS_RESP.ALIVENESS_RESP to be set
* *
* Return: > 0 if the expected value was received, -ETIME otherwise * Return: 0 if the expected value was received, -ETIME otherwise
*/ */
static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected) static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected)
{ {
struct mei_txe_hw *hw = to_txe_hw(dev); struct mei_txe_hw *hw = to_txe_hw(dev);
int t = 0; ktime_t stop, start;
start = ktime_get();
stop = ktime_add(start, ms_to_ktime(SEC_ALIVENESS_WAIT_TIMEOUT));
do { do {
hw->aliveness = mei_txe_aliveness_get(dev); hw->aliveness = mei_txe_aliveness_get(dev);
if (hw->aliveness == expected) { if (hw->aliveness == expected) {
dev->pg_event = MEI_PG_EVENT_IDLE; dev->pg_event = MEI_PG_EVENT_IDLE;
dev_dbg(dev->dev, dev_dbg(dev->dev, "aliveness settled after %lld usecs\n",
"aliveness settled after %d msecs\n", t); ktime_to_us(ktime_sub(ktime_get(), start)));
return t; return 0;
} }
mutex_unlock(&dev->device_lock); usleep_range(20, 50);
msleep(MSEC_PER_SEC / 5); } while (ktime_before(ktime_get(), stop));
mutex_lock(&dev->device_lock);
t += MSEC_PER_SEC / 5;
} while (t < SEC_ALIVENESS_WAIT_TIMEOUT);
dev->pg_event = MEI_PG_EVENT_IDLE; dev->pg_event = MEI_PG_EVENT_IDLE;
dev_err(dev->dev, "aliveness timed out\n"); dev_err(dev->dev, "aliveness timed out\n");
......
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