From ddab0cc7db68ea2e8917ba35ff0cf776bbce7ae6 Mon Sep 17 00:00:00 2001 From: Konstantin Dorfman Date: Wed, 25 Feb 2015 16:23:50 +0200 Subject: [PATCH] mmc: sdhci-msm: Add tracepoints to enhance pm debugging Instrument the sdhci-msm platform driver with tracepoints to aid in debugging issues and identifying latencies in the following paths: * System suspend/resume * Runtime suspend/resume Change-Id: I4fed1c2ccba7d5d7f978f161e7985c98e869d1d8 Signed-off-by: Konstantin Dorfman [xiaonian@codeaurora.org: fixedtrivial merge conflicts] Signed-off-by: Xiaonian Wang --- drivers/mmc/host/sdhci-msm.c | 20 +++++++++++++++++--- include/trace/events/mmc.h | 15 +++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index ddb3f1a209f4..9f4cb3f22437 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "sdhci-pltfm.h" @@ -3309,6 +3310,7 @@ static int sdhci_msm_runtime_suspend(struct device *dev) struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = pltfm_host->priv; + ktime_t start = ktime_get(); disable_irq(host->irq); disable_irq(msm_host->pwr_irq); @@ -3322,6 +3324,8 @@ static int sdhci_msm_runtime_suspend(struct device *dev) if (msm_host->msm_bus_vote.client_handle) sdhci_msm_bus_cancel_work_and_set_vote(host, 0); } + trace_sdhci_msm_runtime_suspend(mmc_hostname(host->mmc), 0, + ktime_to_us(ktime_sub(ktime_get(), start))); return 0; } @@ -3331,10 +3335,13 @@ static int sdhci_msm_runtime_resume(struct device *dev) struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = pltfm_host->priv; + ktime_t start = ktime_get(); enable_irq(msm_host->pwr_irq); enable_irq(host->irq); + trace_sdhci_msm_runtime_resume(mmc_hostname(host->mmc), 0, + ktime_to_us(ktime_sub(ktime_get(), start))); return 0; } @@ -3343,6 +3350,8 @@ static int sdhci_msm_suspend(struct device *dev) struct sdhci_host *host = dev_get_drvdata(dev); struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = pltfm_host->priv; + int ret = 0; + ktime_t start = ktime_get(); if (gpio_is_valid(msm_host->pdata->status_gpio) && (msm_host->mmc->slot.cd_irq >= 0)) @@ -3353,9 +3362,11 @@ static int sdhci_msm_suspend(struct device *dev) mmc_hostname(host->mmc), __func__); goto out; } - return sdhci_msm_runtime_suspend(dev); + ret = sdhci_msm_runtime_suspend(dev); out: - return 0; + trace_sdhci_msm_suspend(mmc_hostname(host->mmc), ret, + ktime_to_us(ktime_sub(ktime_get(), start))); + return ret; } static int sdhci_msm_resume(struct device *dev) @@ -3364,6 +3375,7 @@ static int sdhci_msm_resume(struct device *dev) struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); struct sdhci_msm_host *msm_host = pltfm_host->priv; int ret = 0; + ktime_t start = ktime_get(); if (gpio_is_valid(msm_host->pdata->status_gpio) && (msm_host->mmc->slot.cd_irq >= 0)) @@ -3375,8 +3387,10 @@ static int sdhci_msm_resume(struct device *dev) goto out; } - return sdhci_msm_runtime_resume(dev); + ret = sdhci_msm_runtime_resume(dev); out: + trace_sdhci_msm_resume(mmc_hostname(host->mmc), ret, + ktime_to_us(ktime_sub(ktime_get(), start))); return ret; } diff --git a/include/trace/events/mmc.h b/include/trace/events/mmc.h index 0564dcb2d8bd..917b3f0e0c44 100644 --- a/include/trace/events/mmc.h +++ b/include/trace/events/mmc.h @@ -306,6 +306,21 @@ DEFINE_EVENT(mmc_pm_template, mmc_resume, TP_PROTO(const char *dev_name, int err, s64 usecs), TP_ARGS(dev_name, err, usecs)); +DEFINE_EVENT(mmc_pm_template, sdhci_msm_suspend, + TP_PROTO(const char *dev_name, int err, s64 usecs), + TP_ARGS(dev_name, err, usecs)); + +DEFINE_EVENT(mmc_pm_template, sdhci_msm_resume, + TP_PROTO(const char *dev_name, int err, s64 usecs), + TP_ARGS(dev_name, err, usecs)); + +DEFINE_EVENT(mmc_pm_template, sdhci_msm_runtime_suspend, + TP_PROTO(const char *dev_name, int err, s64 usecs), + TP_ARGS(dev_name, err, usecs)); + +DEFINE_EVENT(mmc_pm_template, sdhci_msm_runtime_resume, + TP_PROTO(const char *dev_name, int err, s64 usecs), + TP_ARGS(dev_name, err, usecs)); #endif /* if !defined(_TRACE_MMC_H) || defined(TRACE_HEADER_MULTI_READ) */ /* This part must be outside protection */