From patchwork Thu May 31 09:40:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10440587 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 55F38603B5 for ; Thu, 31 May 2018 09:40:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42C392909E for ; Thu, 31 May 2018 09:40:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37DA3290B0; Thu, 31 May 2018 09:40:59 +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 D3D762909E for ; Thu, 31 May 2018 09:40:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754293AbeEaJk6 (ORCPT ); Thu, 31 May 2018 05:40:58 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:39433 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754166AbeEaJk5 (ORCPT ); Thu, 31 May 2018 05:40:57 -0400 Received: by mail-lf0-f68.google.com with SMTP id t134-v6so8776149lff.6 for ; Thu, 31 May 2018 02:40:56 -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=1wDmHuu41H26My38+y7oN3y+/HOiv7qPFVsgkCWF1gQ=; b=Kdh+UQkJJM2AA1kVKrYy5gyEFPiEg3OWTYohUHJ0TUlDJPv4QikHU3ctfZTzi7jf72 MMt8rDnV3ptKy3h6JiAGZKD/KBXEFmoV7mAKYyhmaqjFtrP/70JbYShoi67OPVmPzSX5 EDtvAUWweJK67SdMM2xLF/yc0CzgFQVFjgB5U= 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=1wDmHuu41H26My38+y7oN3y+/HOiv7qPFVsgkCWF1gQ=; b=XG2tnl3UTrV9OC1XsWdAEAU8VogFg9/H5p4UkrkWTo+Lccq4/yPZFCLNYiUxJvFOA3 Oq1go8vKXCIdC8m57rKA41W9Vv7WvV8V5yW5r9IXL5ovia4fB2Z9h7CtWtpew/sMp0Yc kpTq/1ZGZWao5UyXeOwrYrN96ieN7keg+r5agpGUIOp4aQ+b3g2RW0v6sCXWfTAm07Dd bR2VwMTxquESEVCokQPVSTNp+8ZAZfQtE5gJi7774KTZwT397ZVVrLkes4yXI76Jscou VkQwWphXMZVYqpClITYNbQBrf8fHNaSuOQ7VHO4Dz9pD+JbHabVaQE3ntKchzqchTSkH dbQQ== X-Gm-Message-State: ALKqPwf/JNheXMqyzx2trVyABGC9Z/xA57+5dddwoY77NnNI9LmH0Fq9 lK3JJntGqwDlPHHHHau/Cm0v0ITI8EI= X-Google-Smtp-Source: ADUXVKKkLhGFuCB8citzjmDZLqzCYHImPPtFxboPk9MakQqi/alWYZ1DfDpRRnP49Lo4vdnZUzz3fA== X-Received: by 2002:a2e:650a:: with SMTP id z10-v6mr4869248ljb.41.1527759655930; Thu, 31 May 2018 02:40:55 -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.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 02:40:55 -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 3/4] mmc: rtsx_usb_sdmmc: Re-work runtime PM support Date: Thu, 31 May 2018 11:40:40 +0200 Message-Id: <20180531094041.27902-4-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 The current implementation uses the runtime PM autosuspend feature with a default timeout set to 50ms. This really doesn't makes sense, as it's a USB driven host device, which needs it rtsx USB device (parent device) to be runtime resumed to provide power to the card. In practise, using the autosuspend or any async runtime PM suspend method, means unnecessary delaying the host device and thus the parent, to be runtime suspended when a card is removed/powered off. For this reasons, let's simply drop the support for runtime PM autosuspend and tell the mmc core to use synced runtime PM suspend methods, via setting MMC_CAP_SYNC_RUNTIME_PM during probe. Moreover, as the mmc core nowadays deploys runtime PM reference counting of the mmc host device, convert ->set_ios() to use the more lightweight pm_runtime_get_noresume() and pm_runtime_put_noidle() APIs. Signed-off-by: Ulf Hansson --- drivers/mmc/host/rtsx_usb_sdmmc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c index 14b4a4e13fe6..ca0ab8eb30c3 100644 --- a/drivers/mmc/host/rtsx_usb_sdmmc.c +++ b/drivers/mmc/host/rtsx_usb_sdmmc.c @@ -1042,9 +1042,9 @@ static int sd_set_power_mode(struct rtsx_usb_sdmmc *host, if (power_mode == MMC_POWER_OFF) { err = sd_power_off(host); - pm_runtime_put(sdmmc_dev(host)); + pm_runtime_put_noidle(sdmmc_dev(host)); } else { - pm_runtime_get_sync(sdmmc_dev(host)); + pm_runtime_get_noresume(sdmmc_dev(host)); err = sd_power_on(host); } @@ -1310,7 +1310,7 @@ static void rtsx_usb_update_led(struct work_struct *work) out: mutex_unlock(&ucr->dev_mutex); - pm_runtime_put(sdmmc_dev(host)); + pm_runtime_put_sync_suspend(sdmmc_dev(host)); } #endif @@ -1324,7 +1324,7 @@ static void rtsx_usb_init_host(struct rtsx_usb_sdmmc *host) mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_BUS_WIDTH_TEST | MMC_CAP_UHS_SDR12 | MMC_CAP_UHS_SDR25 | MMC_CAP_UHS_SDR50 | - MMC_CAP_NEEDS_POLL | MMC_CAP_ERASE; + MMC_CAP_NEEDS_POLL | MMC_CAP_ERASE | MMC_CAP_SYNC_RUNTIME_PM; mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE | MMC_CAP2_NO_SDIO; @@ -1367,8 +1367,6 @@ static int rtsx_usb_sdmmc_drv_probe(struct platform_device *pdev) mutex_init(&host->host_mutex); rtsx_usb_init_host(host); - pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_set_autosuspend_delay(&pdev->dev, 50); pm_runtime_enable(&pdev->dev); #ifdef RTSX_USB_USE_LEDS_CLASS @@ -1423,7 +1421,6 @@ static int rtsx_usb_sdmmc_drv_remove(struct platform_device *pdev) mmc_free_host(mmc); pm_runtime_disable(&pdev->dev); - pm_runtime_dont_use_autosuspend(&pdev->dev); platform_set_drvdata(pdev, NULL); dev_dbg(&(pdev->dev),