From patchwork Fri Jan 11 08:30:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1023446 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="gUS1wXc0"; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43bbfb2qBqz9sN9; Fri, 11 Jan 2019 19:30:47 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1ghsDC-0005FK-Cm; Fri, 11 Jan 2019 08:30:42 +0000 Received: from mail-pl1-f193.google.com ([209.85.214.193]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ghsDA-0005Bs-5p for kernel-team@lists.ubuntu.com; Fri, 11 Jan 2019 08:30:40 +0000 Received: by mail-pl1-f193.google.com with SMTP id e11so6464095plt.11 for ; Fri, 11 Jan 2019 00:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=iVTM8Eq5bx2mz1zn3U9h6fkss/8NfXDRjicBrs2RnuQ=; b=gUS1wXc0ddgt4Oir5g0n0x38DDPM7t40/+vV2F2SeOwPeDrWkEuoMaJqCx9U/6Emlq EtCd8xce67Gl9UU2zOpbnjWXIup5IQrLWIx3kZ6gSIB+kf4J7MdLsMHft2g7CV27K98P e6ZladRo4X/diCn5ew3mQafr6T/6q/LwtCifQzN0s71uiHvPmtKAfCz8MNZK8eL74LST isqiYMfxgfhYN1yIJQUnpX8ortkOxiMtjhHQzOLHKDrTy4I5fGHzwpWDCHCjRd8PTnml 625kIYjA60JOeGbciajpiwM0k1fXo3kYXaIV+DdKYQSYM8ZIi4VFTYPffttutFVcJanA ZLSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=iVTM8Eq5bx2mz1zn3U9h6fkss/8NfXDRjicBrs2RnuQ=; b=tjee9xhQF6SvvRQ2dKLqlkLnqkbO9nuMK9coVaQ0sL7CFxrDmWKGrs3qOomJhnSCXY 2Efjizh4LJfSxLhzHducx4rUrJn7aCG9ZbvHZ39bWxTPVkr+ey3NpnmQeFTY8dcmmg60 ZqUyYsajUb8ut348ewdZ6STtiMgWyN77pSMcLH7YrdiTKzoDbgbeqU37E+jrZ7drI3Pd 0AZY5j+xIJXhuivUzeG1G2ogtuRO3d7Vg0cMVQcyXrjThE1OzOAXmluz3K3mJJQaPmKJ 8pqYk4Q6ZVTz8Nt2m4KUu7MhikzWvWhpynx+ase857VZrjYjsK21RVHHU5qawCQjKsdX /J/Q== X-Gm-Message-State: AJcUukdAwt6OAq2j4Lyypt0R14FhYywpxSoIKMXi2Y5plA7T+Nn9m1Af J8qk1IKx69SnQCbGVsNeTUPFAWIAGww= X-Google-Smtp-Source: ALg8bN6oifcQZ1oOq9h8zErDPCpT5q8h3JiEsY0Kr3ay6GNRhFpCcPUhrpwexnLEkOQDaFsl4Be9Ow== X-Received: by 2002:a17:902:bc44:: with SMTP id t4mr13631271plz.260.1547195438126; Fri, 11 Jan 2019 00:30:38 -0800 (PST) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id z191sm98685692pgd.74.2019.01.11.00.30.36 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jan 2019 00:30:37 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 06/12][SRU][B][C][D][OEM-B] mmc: rtsx_usb_sdmmc: Re-work runtime PM support Date: Fri, 11 Jan 2019 16:30:13 +0800 Message-Id: <20190111083019.32135-7-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190111083019.32135-1-acelan.kao@canonical.com> References: <20190111083019.32135-1-acelan.kao@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Ulf Hansson BugLink: https://bugs.launchpad.net/bugs/1811337 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 Tested-by: Kai-Heng Feng Tested-by: Oleksandr Natalenko (cherry picked from commit f275179f7bdcf08f4c74c2d1d19c4e8269be3454) Signed-off-by: AceLan Kao --- 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 86ac77bd3e9e..5ba66396a8ae 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),