From patchwork Mon Oct 17 14:47:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Girish K S X-Patchwork-Id: 4712 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0A9A623DEE for ; Mon, 17 Oct 2011 14:47:24 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id C9676A184C9 for ; Mon, 17 Oct 2011 14:47:23 +0000 (UTC) Received: by ywb6 with SMTP id 6so2022021ywb.11 for ; Mon, 17 Oct 2011 07:47:23 -0700 (PDT) Received: by 10.223.77.69 with SMTP id f5mr24902781fak.3.1318862840776; Mon, 17 Oct 2011 07:47:20 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.1.71 with SMTP id 7cs10385lak; Mon, 17 Oct 2011 07:47:20 -0700 (PDT) Received: by 10.231.44.196 with SMTP id b4mr8983555ibf.82.1318862839034; Mon, 17 Oct 2011 07:47:19 -0700 (PDT) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id jf1si3417710ibb.117.2011.10.17.07.47.18 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 17 Oct 2011 07:47:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of girish.shivananjappa@linaro.org) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of girish.shivananjappa@linaro.org) smtp.mail=girish.shivananjappa@linaro.org Received: by iaqq3 with SMTP id q3so7552410iaq.37 for ; Mon, 17 Oct 2011 07:47:18 -0700 (PDT) Received: by 10.42.151.4 with SMTP id c4mr31743160icw.39.1318862837858; Mon, 17 Oct 2011 07:47:17 -0700 (PDT) Received: from girishks ([115.113.119.130]) by mx.google.com with ESMTPS id jm11sm37017092ibb.1.2011.10.17.07.47.14 (version=SSLv3 cipher=OTHER); Mon, 17 Oct 2011 07:47:17 -0700 (PDT) From: Girish K S To: linux-mmc@vger.kernel.org Cc: kgene.kim@samsung.com, patches@linaro.org, linux-samsung-soc@vger.kernel.org, Girish K S , Chris Ball , Jaehoon Chung Subject: [PATCH V8 RESEND] mmc: core: Add Power Off Notify Feature eMMC 4.5 Date: Mon, 17 Oct 2011 20:17:03 +0530 Message-Id: <1318862823-22909-1-git-send-email-girish.shivananjappa@linaro.org> X-Mailer: git-send-email 1.7.1 This patch adds the support for power off notify feature, available in eMMC 4.5 devices. If the the host has support for this feature, then the mmc core will notify it to the device by setting the POWER_OFF_NOTIFICATION byte in the extended csd register with a value 1(POWER_ON). For suspend mode short timeout is used, whereas for the normal poweroff long timeout is used. cc: Chris Ball Signed-off-by: Girish K S Signed-off-by: Jaehoon Chung --- Changes in V8: Updated with review comments of Chris Ball and rebased to chris-mmc/mmc-next branch. Changes in V7: Rebased to chris-mmc/mmc-next branch. merged to patches to single patch. Changes in V6: Fixes checkpatch errors. The patches are generated after rebasing to chris's mmc-next branch. Changes in V5: This patch version fixes the problem with power off notify function, when called for the first time and card is not yet initialised. Changes in V4: Updated with review comments of Jeon Changes in V2: Adds poweroff notification handling in suspend/normal. drivers/mmc/core/core.c | 6 ++---- include/linux/mmc/host.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index db368b2..b1eca96 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1217,16 +1217,14 @@ void mmc_power_off(struct mmc_host *host) unsigned int timeout; int err; - BUG_ON(!host); - mmc_host_clk_hold(host); card = host->card; host->ios.clock = 0; host->ios.vdd = 0; - if (card != NULL && mmc_card_mmc(card) && - (card->poweroff_notify_state == MMC_POWERED_ON)) { + if (card && mmc_card_mmc(card) && + card->poweroff_notify_state == MMC_POWERED_ON) { if (host->power_notify_type == MMC_HOST_PW_NOTIFY_SHORT) { notify_type = EXT_CSD_POWER_OFF_SHORT; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 65c47fc..a991ae7 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -243,7 +243,7 @@ struct mmc_host { #define MMC_CAP2_POWEROFF_NOTIFY (1 << 2) /* Notify poweroff supported */ mmc_pm_flag_t pm_caps; /* supported pm features */ - unsigned int power_notify_type; + unsigned int power_notify_type; #define MMC_HOST_PW_NOTIFY_NONE 0 #define MMC_HOST_PW_NOTIFY_SHORT 1 #define MMC_HOST_PW_NOTIFY_LONG 2