Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3756964ybl; Tue, 21 Jan 2020 06:32:54 -0800 (PST) X-Google-Smtp-Source: APXvYqxQeV8AXMmEeqEo435slPN4sg1NKODF7DOheO1FwNP53izr5+cs6sgvt7qtYu4uG4m57Wb/ X-Received: by 2002:a05:6830:ce:: with SMTP id x14mr3866208oto.105.1579617174736; Tue, 21 Jan 2020 06:32:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579617174; cv=none; d=google.com; s=arc-20160816; b=tCxKQA5kfQZ5ji8W92uW7CZwYiE6UyGukgak1DelWIwln3GepLxgkJGyhjC9OFE7i8 Gh/2ZegB28AjP8tC23ZdDLrEWxSobFls1F8AUCxgDTvW5lDpatVU9jTt/lZHK6Qcz+gB UDWjGtHQ5mzKS/QJxlBpKi7F3iS8O4tsJqd1Sg7n2abgqrXbFXH9dckKB+Rdd8v938E9 5y3dzJrwfEqUoWqVzgB4v4OzFtSYhK1XBVVJN/Rf/BozRyfE0HIlaZrAG1xutFBOw84c WmC2wnlD6poLNSl0ZmST+dQ+8ALTqmYN4Sa9pX9rLjvt3MTbDAQyW4uGTfi0gPA4QZ/8 z/Cg== 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=bZ7LHzpAi1qWtkRmo2bb6ZQuQYPYjANyBA7iwYpxmxU=; b=M8osiQ+4oVEjxiTSnZaQ+G6+mywP3VbB5MaB8ygrGEIlEn/L9e1W0SFrf7jAdkfPwN QJcd5V1vmVagLs7i5rkgOhRTWv5hUprxWMAqVlDP56gsdPAewvePYOa3r80ULR+Z0CSC eLxUd4AYfdDWTOgwHeAXTV91mGohs/WeWSXmjuCgQYR4WNh8X5OjNVGZMiMDpJrfsCXK AEevD+CT49RPqqyHJ35qV9FkYhfAVCe3F7gPl+CZncFV1uyEXFiRWhR/KGZQjETrVOoY XQzuAZ1W4W1zwZb4LFFC/sQHKwVSjW4vySx3ILKgJ4oJAEsWy25o85EmdnvKBfmuSlTT 34Nw== 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 h11si21567655otr.197.2020.01.21.06.32.40; Tue, 21 Jan 2020 06:32:54 -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 S1729140AbgAUObc (ORCPT + 99 others); Tue, 21 Jan 2020 09:31:32 -0500 Received: from alexa-out-blr-01.qualcomm.com ([103.229.18.197]:65493 "EHLO alexa-out-blr-01.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728779AbgAUObc (ORCPT ); Tue, 21 Jan 2020 09:31:32 -0500 Received: from ironmsg02-blr.qualcomm.com ([10.86.208.131]) by alexa-out-blr-01.qualcomm.com with ESMTP/TLS/AES256-SHA; 21 Jan 2020 20:01:28 +0530 Received: from c-sbhanu-linux.qualcomm.com ([10.242.50.201]) by ironmsg02-blr.qualcomm.com with ESMTP; 21 Jan 2020 20:01:04 +0530 Received: by c-sbhanu-linux.qualcomm.com (Postfix, from userid 2344807) id 1964435B7; Tue, 21 Jan 2020 20:01:03 +0530 (IST) From: Shaik Sajida Bhanu To: ulf.hansson@linaro.org, adrian.hunter@intel.com Cc: asutoshd@codeaurora.org, stummala@codeaurora.org, vbadigan@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, agross@kernel.org, bjorn.andersson@linaro.org, Shaik Sajida Bhanu Subject: [PATCH V1] mmc: sdhci-msm: Add system suspend/resume callbacks Date: Tue, 21 Jan 2020 20:00:22 +0530 Message-Id: <1579617022-13031-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 Add system suspend/resume callbacks to sdhci-msm platform driver. Signed-off-by: Shaik Sajida Bhanu --- drivers/mmc/host/sdhci-msm.c | 47 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c index 71f29ba..4984857 100644 --- a/drivers/mmc/host/sdhci-msm.c +++ b/drivers/mmc/host/sdhci-msm.c @@ -2028,9 +2028,52 @@ 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 = 0; + + if (host->mmc->caps2 & MMC_CAP2_CQE) { + ret = cqhci_suspend(host->mmc); + if (ret) + return ret; + } + + disable_irq(msm_host->pwr_irq); + ret = sdhci_suspend_host(host); + if (ret) + return ret; + + return sdhci_msm_runtime_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 = 0; + + ret = sdhci_msm_runtime_resume(dev); + if (ret) + return ret; + + ret = sdhci_resume_host(host); + if (ret < 0) + return ret; + enable_irq(msm_host->pwr_irq); + + 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