Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6113866yba; Thu, 11 Apr 2019 12:20:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFn4oduFZMAxBhhW3nFIaVCdgqK7hW9Fj7MOIIjxL20pzmYJiMG15wFqVEEvDkgNJ+11WT X-Received: by 2002:a62:6490:: with SMTP id y138mr51779825pfb.230.1555010422034; Thu, 11 Apr 2019 12:20:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555010422; cv=none; d=google.com; s=arc-20160816; b=AX0H2U8XNSZt0uw6XLdF4kF/Nblf9tDK9A524CJA3MWp0JbEiQ8cwMEa7aBuhAsWTO EYUve8mgW44YvqJDlSKfNdXW5jCv89b0ZDX1Xaph2seK6+zhecbP/zrKvnFyxw9rLQC3 f/sjfSdvdz5CJ01ad9vSpD1VUEi71uwRY0fFb2MSUvS7zOtoVTlC22adbsN0CfN06e0o GQ2dxbai0jT1xRm6Qddnsz4NJnNGO6/YCa5IzVqHFM+He3jYqxA2xkS2u0mD18Xx/1tA jYRcXu8YufqhiuGmkBwMRBtly7aej4+Rm0NPUBHR+p8/3hEAZO/huMI3dg/Wqeu795kW dHaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:message-id :date:subject:cc:to:from; bh=EzqXe8EIS6+c4hrJgaK3KbfTxED6BK/NCfoTo6wKTvk=; b=z9fqjrVuhhC0Hnf6gp9Umsn+TyUHAft7ig+fwZorqbFfW9dHcEpPVM4AqfoB3/JmF+ UIdl46prMJ5nX4al7Qiuz956y5OOvXX3uBsu1oZx5ewgkD7yrN2HewatOaRSzZFz0xo7 8+dIwh6b+39tfQlPsSmvFJ3kjKQrq1NCXL93DxGFjVoktIsovxV6W89jBlGWs5iIRVeL BYmVhNfmPGN9IpR8pV46pYfIZyGG0B8MfkgSPIXo/XVseJh68c36M/7QeLQfCOCNNHJm 3vh8yivmtZnCYjUJ2YOCM6YyE3fTB3MGjhhyb+5s8G3IQQeKfcoB+8HSPB8HaLWiLaTu KfPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ij4qDino; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj1si27389264plb.214.2019.04.11.12.20.06; Thu, 11 Apr 2019 12:20:22 -0700 (PDT) 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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=ij4qDino; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726836AbfDKTSY (ORCPT + 99 others); Thu, 11 Apr 2019 15:18:24 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:18688 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbfDKTSX (ORCPT ); Thu, 11 Apr 2019 15:18:23 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 11 Apr 2019 12:18:27 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 11 Apr 2019 12:18:22 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 11 Apr 2019 12:18:22 -0700 Received: from HQMAIL102.nvidia.com (172.18.146.10) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 11 Apr 2019 19:18:22 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL102.nvidia.com (172.18.146.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 11 Apr 2019 19:18:22 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 11 Apr 2019 19:18:22 +0000 Received: from skomatineni-linux.nvidia.com (Not Verified[10.110.103.48]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 11 Apr 2019 12:18:22 -0700 From: Sowjanya Komatineni To: , , , CC: , , , , , , Subject: [PATCH V4] mmc: tegra: add sdhci tegra suspend and resume Date: Thu, 11 Apr 2019 12:18:19 -0700 Message-ID: <1555010299-19141-1-git-send-email-skomatineni@nvidia.com> X-Mailer: git-send-email 2.7.4 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1555010307; bh=EzqXe8EIS6+c4hrJgaK3KbfTxED6BK/NCfoTo6wKTvk=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=ij4qDino/ShdScl/+BV4NYsWUDixFhJfs7nJWXDGEuR2EjRIODeo1FEOMwukP4Nw8 ei0ee0auglJLZj4lwFvtgUjQoSIO5bOWgz9LtBXR+s2F9TuBxXPtl4FuwQVUqEgB5/ qcZOqa1Qe15zF92MlgtSxx8E60WTp3sRpc/rUJhj2rCQ3Ho+kxuRMNx9aPgs3zf8/2 P+6qNPV5WPwDoBFj3u9r4RgRLN8P2FihjGlJT4N0rRIn/I660wR0zyUZR38YDC3ZgH apKDDwzVXKe7fhceH9dZwtxes7PglTh0Qn/ZXjZtrbiea3AqX7boZbkqoAxAJKnL+U NPQuu3qIO5eNA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds suspend and resume PM ops for tegra SDHCI. Acked-by: Thierry Reding Signed-off-by: Sowjanya Komatineni --- drivers/mmc/host/sdhci-tegra.c | 58 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c index eafaaefab4a6..f608417ae967 100644 --- a/drivers/mmc/host/sdhci-tegra.c +++ b/drivers/mmc/host/sdhci-tegra.c @@ -1611,11 +1611,67 @@ static int sdhci_tegra_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP +static int __maybe_unused sdhci_tegra_suspend(struct device *dev) +{ + struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(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) { + cqhci_resume(host->mmc); + return ret; + } + + clk_disable_unprepare(pltfm_host->clk); + return 0; +} + +static int __maybe_unused sdhci_tegra_resume(struct device *dev) +{ + struct sdhci_host *host = dev_get_drvdata(dev); + struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); + int ret; + + ret = clk_prepare_enable(pltfm_host->clk); + if (ret) + return ret; + + ret = sdhci_resume_host(host); + if (ret) + goto disable_clk; + + if (host->mmc->caps2 & MMC_CAP2_CQE) { + ret = cqhci_resume(host->mmc); + if (ret) + goto suspend_host; + } + + return 0; + +suspend_host: + sdhci_suspend_host(host); +disable_clk: + clk_disable_unprepare(pltfm_host->clk); + return ret; +} +#endif + +static SIMPLE_DEV_PM_OPS(sdhci_tegra_dev_pm_ops, sdhci_tegra_suspend, + sdhci_tegra_resume); + static struct platform_driver sdhci_tegra_driver = { .driver = { .name = "sdhci-tegra", .of_match_table = sdhci_tegra_dt_match, - .pm = &sdhci_pltfm_pmops, + .pm = &sdhci_tegra_dev_pm_ops, }, .probe = sdhci_tegra_probe, .remove = sdhci_tegra_remove, -- 2.7.4