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

Commit a332b945 authored by Mukesh Kumar Savaliya's avatar Mukesh Kumar Savaliya Committed by Gerrit - the friendly Code Review server
Browse files

spi: spi-msm-geni: Put device to suspend if PM status is active



This change is to keep the device to autosuspend only if runtime PM
status is not suspended. SPI driver resumes only if runtime PM is
active, if framework calls unprepare_message/unprepare_hardware and
if we try to keep driver to autosuspend, it may result into negative
usage count.

Also ensure for the PM calls, runtime is always enabled and if not, do
not call PM.

Change-Id: I8cf3f6deb776e282edce4b488e80c639d697374e
Signed-off-by: default avatarMukesh Kumar Savaliya <msavaliy@codeaurora.org>
parent 1fc0fad0
Loading
Loading
Loading
Loading
+4 −2
Original line number Original line Diff line number Diff line
@@ -1106,7 +1106,8 @@ static int spi_geni_unprepare_message(struct spi_master *spi_mas,
				GENI_SE_ERR(mas->ipc, false, NULL,
				GENI_SE_ERR(mas->ipc, false, NULL,
					"suspend usage count mismatch:%d",
					"suspend usage count mismatch:%d",
								count);
								count);
		} else if (!pm_runtime_suspended(mas->dev)) {
		} else if (!pm_runtime_status_suspended(mas->dev) &&
				pm_runtime_enabled(mas->dev)) {
			pm_runtime_mark_last_busy(mas->dev);
			pm_runtime_mark_last_busy(mas->dev);
			pm_runtime_put_autosuspend(mas->dev);
			pm_runtime_put_autosuspend(mas->dev);
		}
		}
@@ -1421,7 +1422,8 @@ static int spi_geni_unprepare_transfer_hardware(struct spi_master *spi)
		if (count < 0)
		if (count < 0)
			GENI_SE_ERR(mas->ipc, false, NULL,
			GENI_SE_ERR(mas->ipc, false, NULL,
				"suspend usage count mismatch:%d", count);
				"suspend usage count mismatch:%d", count);
	} else {
	} else if (!pm_runtime_status_suspended(mas->dev) &&
			pm_runtime_enabled(mas->dev)) {
		pm_runtime_mark_last_busy(mas->dev);
		pm_runtime_mark_last_busy(mas->dev);
		pm_runtime_put_autosuspend(mas->dev);
		pm_runtime_put_autosuspend(mas->dev);
	}
	}