diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2015-04-14 03:27:26 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-07-21 13:10:03 -0400 |
commit | 6bc62fd9b8493bd6a07bb73a5d63ed28fea40b78 (patch) | |
tree | fd175535c3e654a6070505f387b636871d3b5579 /drivers/misc | |
parent | 5acb6674291b15ea45d5bd65baff96a896f11ec6 (diff) |
mei: txe: reduce suspend/resume time
commit fe292283c23329218e384bffc6cb4bfa3fd92277 upstream.
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.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Barak Yoresh <barak.yoresh@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/mei/hw-txe.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c index 964136b35733..bae680c648ff 100644 --- a/drivers/misc/mei/hw-txe.c +++ b/drivers/misc/mei/hw-txe.c | |||
@@ -16,6 +16,7 @@ | |||
16 | 16 | ||
17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
18 | #include <linux/jiffies.h> | 18 | #include <linux/jiffies.h> |
19 | #include <linux/ktime.h> | ||
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
20 | #include <linux/kthread.h> | 21 | #include <linux/kthread.h> |
21 | #include <linux/irqreturn.h> | 22 | #include <linux/irqreturn.h> |
@@ -218,26 +219,25 @@ static u32 mei_txe_aliveness_get(struct mei_device *dev) | |||
218 | * | 219 | * |
219 | * Polls for HICR_HOST_ALIVENESS_RESP.ALIVENESS_RESP to be set | 220 | * Polls for HICR_HOST_ALIVENESS_RESP.ALIVENESS_RESP to be set |
220 | * | 221 | * |
221 | * Return: > 0 if the expected value was received, -ETIME otherwise | 222 | * Return: 0 if the expected value was received, -ETIME otherwise |
222 | */ | 223 | */ |
223 | static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected) | 224 | static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected) |
224 | { | 225 | { |
225 | struct mei_txe_hw *hw = to_txe_hw(dev); | 226 | struct mei_txe_hw *hw = to_txe_hw(dev); |
226 | int t = 0; | 227 | ktime_t stop, start; |
227 | 228 | ||
229 | start = ktime_get(); | ||
230 | stop = ktime_add(start, ms_to_ktime(SEC_ALIVENESS_WAIT_TIMEOUT)); | ||
228 | do { | 231 | do { |
229 | hw->aliveness = mei_txe_aliveness_get(dev); | 232 | hw->aliveness = mei_txe_aliveness_get(dev); |
230 | if (hw->aliveness == expected) { | 233 | if (hw->aliveness == expected) { |
231 | dev->pg_event = MEI_PG_EVENT_IDLE; | 234 | dev->pg_event = MEI_PG_EVENT_IDLE; |
232 | dev_dbg(dev->dev, | 235 | dev_dbg(dev->dev, "aliveness settled after %lld usecs\n", |
233 | "aliveness settled after %d msecs\n", t); | 236 | ktime_to_us(ktime_sub(ktime_get(), start))); |
234 | return t; | 237 | return 0; |
235 | } | 238 | } |
236 | mutex_unlock(&dev->device_lock); | 239 | usleep_range(20, 50); |
237 | msleep(MSEC_PER_SEC / 5); | 240 | } while (ktime_before(ktime_get(), stop)); |
238 | mutex_lock(&dev->device_lock); | ||
239 | t += MSEC_PER_SEC / 5; | ||
240 | } while (t < SEC_ALIVENESS_WAIT_TIMEOUT); | ||
241 | 241 | ||
242 | dev->pg_event = MEI_PG_EVENT_IDLE; | 242 | dev->pg_event = MEI_PG_EVENT_IDLE; |
243 | dev_err(dev->dev, "aliveness timed out\n"); | 243 | dev_err(dev->dev, "aliveness timed out\n"); |