Commit 77537ad2 authored by Alexander Usyskin's avatar Alexander Usyskin Committed by Greg Kroah-Hartman

mei: recover after errors in runtime pm flow

Schedule link reset if failed to perform runtime suspend or resume.
Set active runtime pm stte on link reset
to clean runtimr pm error, if present.
Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aab3b1a3
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/pm_runtime.h>
#include "mei_dev.h" #include "mei_dev.h"
#include "hbm.h" #include "hbm.h"
...@@ -1063,6 +1064,8 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable) ...@@ -1063,6 +1064,8 @@ static int mei_me_hw_reset(struct mei_device *dev, bool intr_enable)
} }
} }
pm_runtime_set_active(dev->dev);
hcsr = mei_hcsr_read(dev); hcsr = mei_hcsr_read(dev);
/* H_RST may be found lit before reset is started, /* H_RST may be found lit before reset is started,
* for example if preceding reset flow hasn't completed. * for example if preceding reset flow hasn't completed.
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/irqreturn.h> #include <linux/irqreturn.h>
#include <linux/pm_runtime.h>
#include <linux/mei.h> #include <linux/mei.h>
...@@ -935,6 +936,8 @@ static int mei_txe_hw_start(struct mei_device *dev) ...@@ -935,6 +936,8 @@ static int mei_txe_hw_start(struct mei_device *dev)
return ret; return ret;
} }
pm_runtime_set_active(dev->dev);
/* enable input ready interrupts: /* enable input ready interrupts:
* SEC_IPC_HOST_INT_MASK.IPC_INPUT_READY_INT_MASK * SEC_IPC_HOST_INT_MASK.IPC_INPUT_READY_INT_MASK
*/ */
......
...@@ -400,6 +400,9 @@ static int mei_me_pm_runtime_suspend(struct device *device) ...@@ -400,6 +400,9 @@ static int mei_me_pm_runtime_suspend(struct device *device)
dev_dbg(&pdev->dev, "rpm: me: runtime suspend ret=%d\n", ret); dev_dbg(&pdev->dev, "rpm: me: runtime suspend ret=%d\n", ret);
if (ret && ret != -EAGAIN)
schedule_work(&dev->reset_work);
return ret; return ret;
} }
...@@ -423,6 +426,9 @@ static int mei_me_pm_runtime_resume(struct device *device) ...@@ -423,6 +426,9 @@ static int mei_me_pm_runtime_resume(struct device *device)
dev_dbg(&pdev->dev, "rpm: me: runtime resume ret = %d\n", ret); dev_dbg(&pdev->dev, "rpm: me: runtime resume ret = %d\n", ret);
if (ret)
schedule_work(&dev->reset_work);
return ret; return ret;
} }
......
...@@ -347,6 +347,10 @@ static int mei_txe_pm_runtime_suspend(struct device *device) ...@@ -347,6 +347,10 @@ static int mei_txe_pm_runtime_suspend(struct device *device)
dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret); dev_dbg(&pdev->dev, "rpm: txe: runtime suspend ret=%d\n", ret);
mutex_unlock(&dev->device_lock); mutex_unlock(&dev->device_lock);
if (ret && ret != -EAGAIN)
schedule_work(&dev->reset_work);
return ret; return ret;
} }
...@@ -372,6 +376,9 @@ static int mei_txe_pm_runtime_resume(struct device *device) ...@@ -372,6 +376,9 @@ static int mei_txe_pm_runtime_resume(struct device *device)
dev_dbg(&pdev->dev, "rpm: txe: runtime resume ret = %d\n", ret); dev_dbg(&pdev->dev, "rpm: txe: runtime resume ret = %d\n", ret);
if (ret)
schedule_work(&dev->reset_work);
return ret; return ret;
} }
......
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