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

Commit 53ffc855 authored by Ram Prakash Gupta's avatar Ram Prakash Gupta
Browse files

mmc: core: Add tracepoints to enhance pm debugging



Instrument the mmc core layer with tracepoints to aid in
debugging issues and identifying latencies in the following
paths:

* System suspend/resume
* Runtime suspend/resume

Reference:
26f187512: mmc: core: Add tracepoints to enhance pm debugging.

Change-Id: Ide21936718dd2d63084ab5f0f8e5d04edcd38c9e
Signed-off-by: default avatarKonstantin Dorfman <kdorfman@codeaurora.org>
Signed-off-by: default avatarSubhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: default avatarRam Prakash Gupta <rampraka@codeaurora.org>
parent 9d9648e5
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/mmc/card.h>
#include <linux/mmc/mmc.h>
#include <linux/reboot.h>
#include <trace/events/mmc.h>

#include "core.h"
#include "card.h"
@@ -2499,6 +2500,7 @@ static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
static int mmc_suspend(struct mmc_host *host)
{
	int err;
	ktime_t start = ktime_get();

	err = _mmc_suspend(host, true);
	if (!err) {
@@ -2506,6 +2508,8 @@ static int mmc_suspend(struct mmc_host *host)
		pm_runtime_set_suspended(&host->card->dev);
	}

	trace_mmc_suspend(mmc_hostname(host), err,
			ktime_to_us(ktime_sub(ktime_get(), start)));
	return err;
}

@@ -2615,11 +2619,14 @@ static int mmc_shutdown(struct mmc_host *host)
static int mmc_resume(struct mmc_host *host)
{
	int err = 0;
	ktime_t start = ktime_get();

	err = _mmc_resume(host);
	pm_runtime_set_active(&host->card->dev);
	pm_runtime_mark_last_busy(&host->card->dev);
	pm_runtime_enable(&host->card->dev);
	trace_mmc_resume(mmc_hostname(host), err,
			ktime_to_us(ktime_sub(ktime_get(), start)));

	mmc_log_string(host, "Done\n");

@@ -2649,6 +2656,7 @@ static int mmc_deferred_resume(struct mmc_host *host)
static int mmc_runtime_suspend(struct mmc_host *host)
{
	int err;
	ktime_t start = ktime_get();

	if (!(host->caps & MMC_CAP_AGGRESSIVE_PM))
		return 0;
@@ -2657,6 +2665,9 @@ static int mmc_runtime_suspend(struct mmc_host *host)
	if (err)
		pr_err("%s: error %d doing aggressive suspend\n",
			mmc_hostname(host), err);
	trace_mmc_runtime_suspend(mmc_hostname(host), err,
			ktime_to_us(ktime_sub(ktime_get(), start)));

	mmc_log_string(host, "done err %d\n", err);
	return err;
}
@@ -2667,11 +2678,15 @@ static int mmc_runtime_suspend(struct mmc_host *host)
static int mmc_runtime_resume(struct mmc_host *host)
{
	int err;
	ktime_t start = ktime_get();

	err = _mmc_resume(host);
	if (err && err != -ENOMEDIUM)
		pr_err("%s: error %d doing runtime resume\n",
			mmc_hostname(host), err);

	trace_mmc_runtime_resume(mmc_hostname(host), err,
			ktime_to_us(ktime_sub(ktime_get(), start)));
	mmc_log_string(host, "done err %d\n", err);
	return 0;
}