From patchwork Thu Dec 21 13:22:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Nazzareno Trimarchi X-Patchwork-Id: 10127649 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D80160318 for ; Thu, 21 Dec 2017 13:22:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57C532684F for ; Thu, 21 Dec 2017 13:22:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C97727E63; Thu, 21 Dec 2017 13:22:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C02FA2684F for ; Thu, 21 Dec 2017 13:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751887AbdLUNWc (ORCPT ); Thu, 21 Dec 2017 08:22:32 -0500 Received: from mail-wr0-f195.google.com ([209.85.128.195]:42833 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbdLUNWb (ORCPT ); Thu, 21 Dec 2017 08:22:31 -0500 Received: by mail-wr0-f195.google.com with SMTP id s66so25149823wrc.9 for ; Thu, 21 Dec 2017 05:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=MLMzklq1YJAalw5fVahQ3Tfu2rwpGH5IPuEvtO4aZJM=; b=YLvLOx29wH7P2/jb+suNTSpSKZ+TuDGpjwggYOndAd+Z5AjbONfpCNv3x8ez0SCdVd h0YVjwegU2Ug/zB9UBe48UvQthpgyk5ji/dQ5SUM6LnbmkyvjQJO/j0R345qXfyvUv/5 5/aJgKUw7OPNrzFPRpCRWDAIBxCKugT6KLtz8PJ+EINePsj65Jjhxmh/vjSmwxTjIBJ9 54XXO10WNFgWcs6Zh1Qv+PEfEfDwQ6Ov0DuQy+95UZf4o2NWiQTiuNVwWi4z0/DYJ+41 Li8NZ05AK0qUzke/qy5MHHYZdVWD+58OYcyYgh9I8GZB4HwnH7cjH1diAY0ZaYJcCn2p XrLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MLMzklq1YJAalw5fVahQ3Tfu2rwpGH5IPuEvtO4aZJM=; b=sMIoIaLgyp/TGV1YrXz7jw5c/KTmDgk7V9CXadm7rvgcYDxOQwXsy0dwr+/xIjjNxB 3uYut0INe1VEVgfXzVYKMrcW53lggYw3ASxCR0riLR29f4SPK+FgazR/7JcWEoNrTAhn 8UX0wYJ0sQxaftBjebwJkBmGo88A2fPshslQSW3rQhawC8h0sTEVmzsE6/zlHWKn6Ad/ eJT742ipV6WCEAvxnoME9y22N/t/wvIxeVGeLFaDUiWYAtrO5ucBj0pp9JI56gC3CQwY Q4Gekflt5jebiZl5ghStxfnA47BirQEhn4mmD4QbA4KCqBuAvK2OoHvS9PTvQ+9f7f/0 B5ig== X-Gm-Message-State: AKGB3mILMJTVt4cQJM/4nonf3RjM5+LKBudqarcTrYKqJUP7xViasXLs UAsUSNFTWbtxxp0IcCU5rEBZSg== X-Google-Smtp-Source: ACJfBoswXUUA87JNL/jxTnpIEj7rPS3W9z1uk4FrECLTZ3ZfekMCd6E4eHYV5IZBc8itacHV7hBnIQ== X-Received: by 10.223.196.6 with SMTP id v6mr11679220wrf.236.1513862549790; Thu, 21 Dec 2017 05:22:29 -0800 (PST) Received: from localhost.localdomain (host66-36-static.22-80-b.business.telecomitalia.it. [80.22.36.66]) by smtp.gmail.com with ESMTPSA id 90sm1542040wrp.39.2017.12.21.05.22.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 21 Dec 2017 05:22:29 -0800 (PST) From: Michael Trimarchi To: Adrian Hunter Cc: Ulf Hansson , linux-mmc@vger.kernel.org Subject: [PATCH] mmc: sdhci-esdhc-imx: Enable/Disable mmc clock during runtime suspend Date: Thu, 21 Dec 2017 14:22:26 +0100 Message-Id: <1513862546-20221-1-git-send-email-michael@amarulasolutions.com> X-Mailer: git-send-email 2.7.4 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP mmc clock can be stopped during runtime suspend and restart during runtime resume. This let us know to not have any clock running and this reduce the EMI of the device when the bus is not in use Signed-off-by: Michael Trimarchi --- drivers/mmc/host/sdhci-esdhc-imx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 7123ef9..9a5e96f 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -196,6 +196,7 @@ struct pltfm_imx_data { struct clk *clk_ipg; struct clk *clk_ahb; struct clk *clk_per; + unsigned int actual_clock; enum { NO_CMD_PENDING, /* no multiblock command pending*/ MULTIBLK_IN_PROCESS, /* exact multiblock cmd in process */ @@ -1346,6 +1347,9 @@ static int sdhci_esdhc_runtime_suspend(struct device *dev) ret = sdhci_runtime_suspend_host(host); + imx_data->actual_clock = host->mmc->actual_clock; + esdhc_pltfm_set_clock(host, 0); + if (!sdhci_sdio_irq_enabled(host)) { clk_disable_unprepare(imx_data->clk_per); clk_disable_unprepare(imx_data->clk_ipg); @@ -1366,6 +1370,7 @@ static int sdhci_esdhc_runtime_resume(struct device *dev) clk_prepare_enable(imx_data->clk_ipg); } clk_prepare_enable(imx_data->clk_ahb); + esdhc_pltfm_set_clock(host, imx_data->actual_clock); return sdhci_runtime_resume_host(host); }