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: 137343 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6373670lji; Thu, 31 May 2018 02:40:53 -0700 (PDT) X-Received: by 2002:a2e:21c6:: with SMTP id h67-v6mr4568846lji.132.1527759653128; Thu, 31 May 2018 02:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527759653; cv=none; d=google.com; s=arc-20160816; b=fjRlHYSlnSKNq+ieOqTItKBeHpTOr+UgaEtZ9shHdEiOVh331m2dMknK2eaiKDOSDK ZuxfOizee+5LhcYhlVOzXu75kst/C+gWQkaEFfrwfxyroQee19p6ecAFHPT8Tdjq991Z uusqyORI0veMQobdBL0iNIZBbb6YL3GsYYRCw72NQ5K84m+whZj0Z4xDegndmxl92bCT +B39TmAuB19DT8v9GbYJ+asp1UP+U1fv1BaLA4yJZL92bgw0Tl5JYf+7b4O0yjL2LsKI nWMc9JyTh+F9BBgElEGpN8wHhXbGfAOpecTGk9uybh0WVNTsoGD+dYzwkLVTed/pulgT v6pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=W1SRBFn/gdnSVACY7EkMb9DeGS0PM23CHrziIOkLPl4=; b=Z/tHPo5U31rrQcHsQV/JYyqw0bm3fOch0QJ5XR6bkpbkdrG+NQdlhrLB3XzTHdVLlG OadBaeMekAZ12bP2A6oDR8ZZra24PT3FYzPD+i7Pu1eaNLVBtGMMzEDX0am7ZcAn936+ n+hpYcWksKb/N/lBwY4VFk7FtjIYSDtAFJh9Cy7Elp3J0cotp+QHc2NbEUtXGjcRUbef LqGxg9UyiPjWFhImVQd9SOj+2gBwPMryRmcmNQpDxTnqFeizI+SVTKI2QcPBTghDBeiY Ur2qS6SVx9x+wDc4/SvXHZsDd2fyAILtN1NcdvHA204Q0C++2UZIKQI6LcYnU0MyM1sS vc9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nj1R9dxm; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d82-v6sor8514208lfl.22.2018.05.31.02.40.53 for (Google Transport Security); Thu, 31 May 2018 02:40:53 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nj1R9dxm; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=aXWOp/Se27WVzonMemT/Hrz/06+0I8cPlLHBKhg+hWJBBXEfDJL6x8Yx2W+71xGYBW 6hSqbQxjcqus3CqrkAe/lknrAxC7E01CJkaDKWvOlD/FbqMUAIUF1F0vemZ1mgjFWLZi +YAsEXEXOi0IijsHAugkWQrd0+55rEwr6sebhJq0yZFNYLG2KjdWgm3sHIE0fRY+UiXW wxbwTU4PaM9O5imv88agfZMqBJ50YkTpoDh6Q13XioKhXWSSxyyIB0RcAZf8bxYNy+2s WJZ9hMXgoZ9RjkQoHv/CcQyegAHAOC8xbeOhQHXp8ognPryy1lIJwaxonJv+21hw1uRt V4zw== X-Gm-Message-State: ALKqPwfkeAt4tswa3Vz9OPOcTe8u/F1yGaSvjCgPZGZ0rt8qpiwqQxts 5BKVq3wSxFjBUfO7BuSEu7E5MxKP 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) Return-Path: 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> 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(-) -- 2.17.0 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 */