aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2015-04-14 03:27:26 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-05-24 14:13:10 -0400
commitfe292283c23329218e384bffc6cb4bfa3fd92277 (patch)
tree1fd8bf8cac585ebec397ae1fd793894fbebb14c7
parent620cf787c121f39b5223e43bad3d1b7c66ecead5 (diff)
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: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Barak Yoresh <barak.yoresh@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/mei/hw-txe.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/misc/mei/hw-txe.c b/drivers/misc/mei/hw-txe.c
index 7abafe7d120d..1cd223c96864 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 */
223static int mei_txe_aliveness_poll(struct mei_device *dev, u32 expected) 224static 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");