Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ea522a8 authored by Dilip Kota's avatar Dilip Kota
Browse files

slimbus: slim-msm: Handle system suspend while active slimbus transfers



If system suspend happens during active slimbus transfers
or before runtime pm suspend, return error so that system
suspend gets abort and re-runs after slimbus finishes
transfers or rutime pm calls execution.

Change-Id: Icf355f162fd1a69c35565c31aa478c4987932b39
Signed-off-by: default avatarDilip Kota <dkota@codeaurora.org>
parent 01697ba5
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
/* Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -2110,7 +2110,7 @@ static int ngd_slim_runtime_suspend(struct device *device)
#ifdef CONFIG_PM_SLEEP
static int ngd_slim_suspend(struct device *dev)
{
	int ret = -EBUSY;
	int ret = 0;
	struct platform_device *pdev = to_platform_device(dev);
	struct msm_slim_ctrl *cdev;

@@ -2119,6 +2119,13 @@ static int ngd_slim_suspend(struct device *dev)
		return 0;

	cdev = platform_get_drvdata(pdev);

	if (cdev->state == MSM_CTRL_AWAKE) {
		ret = -EBUSY;
		SLIM_INFO(cdev, "system suspend: %d\n", ret);
		return ret;

	}
	if (!pm_runtime_enabled(dev) ||
		(!pm_runtime_suspended(dev) &&
			cdev->state == MSM_CTRL_IDLE)) {
@@ -2136,17 +2143,6 @@ static int ngd_slim_suspend(struct device *dev)
			cdev->qmi.deferred_resp = false;
		}
	}
	if (ret == -EBUSY) {
		/*
		 * There is a possibility that some audio stream is active
		 * during suspend. We dont want to return suspend failure in
		 * that case so that display and relevant components can still
		 * go to suspend.
		 * If there is some other error, then it should be passed-on
		 * to system level suspend
		 */
		ret = 0;
	}
	SLIM_INFO(cdev, "system suspend\n");
	return ret;
}