From patchwork Thu May 31 09:40:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10440583 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 490A76035E for ; Thu, 31 May 2018 09:40:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 364CD2909E for ; Thu, 31 May 2018 09:40:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2AF26290B0; Thu, 31 May 2018 09:40:56 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 C6EF92909E for ; Thu, 31 May 2018 09:40:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754212AbeEaJkz (ORCPT ); Thu, 31 May 2018 05:40:55 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35815 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754166AbeEaJky (ORCPT ); Thu, 31 May 2018 05:40:54 -0400 Received: by mail-lf0-f66.google.com with SMTP id y72-v6so8765141lfd.2 for ; Thu, 31 May 2018 02:40:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=W1SRBFn/gdnSVACY7EkMb9DeGS0PM23CHrziIOkLPl4=; b=Nj1R9dxm9WmXpEV3WnL75V+hTk9epD0yMoQTXsMyLm9kuQrJkHBinQ+wXnCMy+bL1s 6wBvy8nVzChXQMVf6mGkMYLkl93lGpJujiY62twB67xcLqrORHVyFaSL01+vX631OLwp HUtN10LSdCsnqb9lCVfR4pw3es3U2UKiMDW9w= 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:in-reply-to :references; bh=W1SRBFn/gdnSVACY7EkMb9DeGS0PM23CHrziIOkLPl4=; b=RksYHdL/g5O7kXitwEg3LxGp9qhg0IqjEaMHV14MgGE+hlh7CGoz8jfCgk2KeS2c+K gnDKwQU9A0/lqSnnnWcTycmI9iNwzeaeJG2qQ3z3cau5D10x+W+Yr8qdD9EY/q08Vnu4 VRClo8omjLr1bao2wGqMT0mtPdVZXuKUpCntQ65/r3qngOva+8sUwerwDgASeUCFDDel bSufjGu7QS1m/WBbxxY2jwB1tsQThxrvSbi1itaf6M8eGfQ7Cz9gHwi9T/N11PNdIG73 RpiwxC04QJmtzFxEQFa7jhShTHJCRtIv/0TJJVLfDXqJvwTBpO97ukpYYh4vy8JtFiVV wyQA== X-Gm-Message-State: ALKqPwd29Ckw6XmPVGG8j4EENcSQLomTQ65CfwStnn0JyfMAgaOoonen mrPqKn6Xzpopakh2bleXYVCedPaWEqw= X-Google-Smtp-Source: ADUXVKIohzSmXQRn0+jfwh0cXoPEFdixwSymX3VDpuFHGq5KfXOS8mknSIOLxsS9+SCv/8s+2aDSdA== X-Received: by 2002:a19:6915:: with SMTP id e21-v6mr3709245lfc.8.1527759652911; Thu, 31 May 2018 02:40:52 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id y12-v6sm7496302lji.34.2018.05.31.02.40.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 02:40:52 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson , Kai-Heng Feng Cc: michal.pecio@gmail.com, Ritesh Raj Sarraf , Bauer Chen , Alan Stern Subject: [PATCH 1/4] mmc: core: Introduce MMC_CAP_SYNC_RUNTIME_PM Date: Thu, 31 May 2018 11:40:38 +0200 Message-Id: <20180531094041.27902-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531094041.27902-1-ulf.hansson@linaro.org> References: <20180531094041.27902-1-ulf.hansson@linaro.org> 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 To allow mmc host drivers to inform the mmc core about rather using pm_runtime_put_sync_suspend() instead of pm_runtime_put_autosuspend(), let's introduce MMC_CAP_SYNC_RUNTIME_PM. This is especially useful for those mmc host drivers that don't benefit from using the runtime PM autosuspend feature. Typically this is those that relies on parent devices to power the card via runtime PM, like some USB host drivers for example. Signed-off-by: Ulf Hansson --- drivers/mmc/core/core.c | 5 ++++- include/linux/mmc/host.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 281826d1fcca..fd366b3677b6 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -887,7 +887,10 @@ void mmc_release_host(struct mmc_host *host) spin_unlock_irqrestore(&host->lock, flags); wake_up(&host->wq); pm_runtime_mark_last_busy(mmc_dev(host)); - pm_runtime_put_autosuspend(mmc_dev(host)); + if (host->caps & MMC_CAP_SYNC_RUNTIME_PM) + pm_runtime_put_sync_suspend(mmc_dev(host)); + else + pm_runtime_put_autosuspend(mmc_dev(host)); } } EXPORT_SYMBOL(mmc_release_host); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 64300a48dcce..f029675b9a52 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -324,7 +324,7 @@ struct mmc_host { #define MMC_CAP_UHS (MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | \ MMC_CAP_UHS_SDR50 | MMC_CAP_UHS_SDR104 | \ MMC_CAP_UHS_DDR50) -/* (1 << 21) is free for reuse */ +#define MMC_CAP_SYNC_RUNTIME_PM (1 << 21) /* Synced runtime PM suspends. */ #define MMC_CAP_DRIVER_TYPE_A (1 << 23) /* Host supports Driver Type A */ #define MMC_CAP_DRIVER_TYPE_C (1 << 24) /* Host supports Driver Type C */ #define MMC_CAP_DRIVER_TYPE_D (1 << 25) /* Host supports Driver Type D */