Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp608017ybv; Fri, 7 Feb 2020 05:23:56 -0800 (PST) X-Google-Smtp-Source: APXvYqywu0cBPaZkUrHZzWR0CxbNbiAdn/sOqEOy/ZPDDKsXig6Zr8zbOxLXw0BalDLpGIcVlzBf X-Received: by 2002:a9d:5786:: with SMTP id q6mr2588721oth.164.1581081836666; Fri, 07 Feb 2020 05:23:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581081836; cv=none; d=google.com; s=arc-20160816; b=Ov6htxrWkuyfcDOEJOo8bK/3UfqEL3cQNwf4raNR4RxatknSPrfEPhCPnIVK/VKbSO On1eI8HX/k5lQUNpgtz/w92jtSlEWyDLH50wnvNZvvFcUXGtdMYLZ9lwALVnCCl40S55 Ge0k4il9LQnGLfCab5GbNAbPUigYvTdQHvjBqJRz4xU3Eoq1fVUiE32L+OXxDDuxv2I4 laEtY1vo8Rx/JFUGauP1SZq0AuUQcihMbmRdC9H7cwNAEDG0hhfGGf7FgL+E4WkFeiIU xRDoVYW3hIV4R7XsqX+7PoEjmw1cofg47wLz1rwhGMleMQ8Q3vKSUw+ii1ratu2P4RWM IFdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=tOsRwJ1LTTM/pvnBWE8R23MtTDf0t3V4DKMDErrM0YU=; b=Zvk1zn8o2LEeAe7CR52iBzuDwtQui814vTmOSIgUP3c2YsfZfsbW1I/EjX8m2Llht5 +cYwjalFY55ytEEnjD9R2IxxARAIVGbURUrW3VQIecCdUP0RveBUMGSYgTuFukvYVgWe 67p9NzMLXPp+c2Z51ko8aPWK1b2p1fUvnITKh8TSvJGMNxLR69KcxnoKVaDb+fAvfUR/ +bDlSRR42FA0BgtWjalv7TMdJAu2FsROM2EkAOKGoGGvDykP8m27R4AwpddAxHTKUumK upzPAJeB0UJBjxbYgO0vBBICawkuaM1cYmqMz30Rr2XvXOupPUL09UFqTNuIqhwxQwYc MZww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x20si1636038otq.222.2020.02.07.05.23.43; Fri, 07 Feb 2020 05:23:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727005AbgBGNWt (ORCPT + 99 others); Fri, 7 Feb 2020 08:22:49 -0500 Received: from alexa-out-blr-01.qualcomm.com ([103.229.18.197]:46541 "EHLO alexa-out-blr-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726674AbgBGNWs (ORCPT ); Fri, 7 Feb 2020 08:22:48 -0500 Received: from ironmsg01-blr.qualcomm.com ([10.86.208.130]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 07 Feb 2020 18:52:45 +0530 Received: from c-sbhanu-linux.qualcomm.com ([10.242.50.201]) by ironmsg01-blr.qualcomm.com with ESMTP; 07 Feb 2020 18:52:16 +0530 Received: by c-sbhanu-linux.qualcomm.com (Postfix, from userid 2344807) id 9F5A839EA; Fri, 7 Feb 2020 18:52:14 +0530 (IST) From: Shaik Sajida Bhanu To: adrian.hunter@intel.com, ulf.hansson@linaro.org, robh+dt@kernel.org, mka@chromium.org Cc: asutoshd@codeaurora.org, stummala@codeaurora.org, sayalil@codeaurora.org, cang@codeaurora.org, rampraka@codeaurora.org, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, agross@kernel.org, bjorn.andersson@linaro.org, Shaik Sajida Bhanu Subject: [PATCH V2] mmc: sdhci-msm: Update system suspend/resume callbacks of sdhci-msm platform driver. Date: Fri, 7 Feb 2020 18:50:50 +0530 Message-Id: <1581081650-22228-1-git-send-email-sbhanu@codeaurora.org> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The existing suspend/resume callbacks of sdhci-msm driver are just gating/un-gating the clocks. During suspend cycle more can be done like disabling controller, interrupts and card detection. So updating the system pm callbacks for performing these extra actions besides controlling the clocks. Signed-off-by: Shaik Sajida Bhanu Changes since V1: Addressed review comments --- drivers/mmc/host/sdhci-msm.c | 50 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index c3a160c..e30c8a3 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2159,9 +2159,55 @@ static __maybe_unused int sdhci_msm_runtime_resume(struct device *dev) return 0; } +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 = sdhci_pltfm_priv(pltfm_host); + int ret; + + if (host->mmc->caps2 & MMC_CAP2_CQE) { + ret = cqhci_suspend(host->mmc); + if (ret) + return ret; + } + + ret = sdhci_suspend_host(host); + if (ret) + return ret; + /* Disable pwr-irq since SDHC would be inactive */ + disable_irq(msm_host->pwr_irq); + + return pm_runtime_force_suspend(dev); +} + +static int sdhci_msm_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 = sdhci_pltfm_priv(pltfm_host); + int ret; + + ret = pm_runtime_force_resume(dev); + if (ret) + return ret; + + /* Re-enable pwr irq before SDHC gets reset */ + enable_irq(msm_host->pwr_irq); + + ret = sdhci_resume_host(host); + if (ret < 0) + return ret; + + if (host->mmc->caps2 & MMC_CAP2_CQE) + ret = cqhci_resume(host->mmc); + + return ret; +} + static const struct dev_pm_ops sdhci_msm_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) + SET_SYSTEM_SLEEP_PM_OPS(sdhci_msm_suspend, + sdhci_msm_resume) SET_RUNTIME_PM_OPS(sdhci_msm_runtime_suspend, sdhci_msm_runtime_resume, NULL) -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation