]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
platform: tegra: nvadsp: Fix use of mailbox dumps
authorAjay Nandakumar <anandakumarm@nvidia.com>
Tue, 23 Feb 2016 12:23:13 +0000 (17:53 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Tue, 15 Mar 2016 10:26:20 +0000 (03:26 -0700)
The mailbox dumps needs to be called before runtime suspend is called.
If called after suspend, the register access become invalid and the
device crashes.

Bug 200149702

Change-Id: I0836e2c3eaccdeaaeb3357df6ca4abfc63acff69
Signed-off-by: Ajay Nandakumar <anandakumarm@nvidia.com>
Reviewed-on: http://git-master/r/1031332
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
drivers/platform/tegra/nvadsp/os.c

index d5c182190652b6948e6e5e60add2de806618b6db..3b3e8394e9c3e974cf3e5ada9b33ac30ba7a2688 100644 (file)
@@ -1030,11 +1030,11 @@ int nvadsp_os_start(void)
        if (ret) {
                priv.os_running = drv_data->adsp_os_running = false;
                /* if start fails call pm suspend of adsp driver */
+               dev_err(dev, "adsp failed to boot with ret = %d\n", ret);
+               dump_adsp_sys();
 #ifdef CONFIG_PM_RUNTIME
                pm_runtime_put_sync(&priv.pdev->dev);
 #endif
-               dev_err(dev, "adsp failed to boot with ret = %d\n", ret);
-               dump_adsp_sys();
                goto unlock;
 
        }
@@ -1099,13 +1099,6 @@ static int __nvadsp_os_suspend(void)
 
        assert_adsp(drv_data);
 
-#ifdef CONFIG_PM_RUNTIME
-       ret = pm_runtime_put_sync(&priv.pdev->dev);
-       if (ret) {
-               dev_err(dev, "failed in pm_runtime_put_sync\n");
-               goto out;
-       }
-#endif
  out:
        return ret;
 }
@@ -1206,6 +1199,7 @@ EXPORT_SYMBOL(nvadsp_os_stop);
 
 int nvadsp_os_suspend(void)
 {
+       struct device *dev = &priv.pdev->dev;
        struct nvadsp_drv_data *drv_data;
        int ret = -EINVAL;
 
@@ -1230,9 +1224,14 @@ int nvadsp_os_suspend(void)
                goto unlock;
        }
        ret = __nvadsp_os_suspend();
-       if (!ret)
+       if (!ret) {
+#ifdef CONFIG_PM_RUNTIME
+               ret = pm_runtime_put_sync(&priv.pdev->dev);
+               if (ret)
+                       dev_err(dev, "failed in pm_runtime_put_sync\n");
+#endif
                priv.os_running = drv_data->adsp_os_running = false;
-       else {
+       else {
                dev_err(&priv.pdev->dev, "suspend failed with %d\n", ret);
                dump_adsp_sys();
        }