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: 137345 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6373730lji; Thu, 31 May 2018 02:40:56 -0700 (PDT) X-Received: by 2002:a19:e450:: with SMTP id b77-v6mr3992865lfh.76.1527759656113; Thu, 31 May 2018 02:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527759656; cv=none; d=google.com; s=arc-20160816; b=STlKmLgSBs7gvOqrFDnlXfQK0H+IQ1J8eMweQmDLD2WCQS72gJYAVyrIW4BNyEHDLH onjnVQ8KaVeBcIRqhikRsZn70Lbzl4jR/QTiQ+KTnell7NoV7zBjkWcBqG0BR5aZCTvW xV9DNZSOIHhFtc9zk+Cj7l8Mlh1TVuulVEf3zD4YMuoXvx6666lly+DK/86G+TTBdvFw llobkkoFNWchT23taU4p5f/rXmW9jqXZReHT8XAmR4b0qemnHBjvGxP+gp+mMk/39Sy/ nfe6khADmkC8ME/Cz3AJLr/ANQzHWOZgQF/1UtzoYfyFGqS1cbp1X9kfOMJEoJnAWYG7 764g== 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=1wDmHuu41H26My38+y7oN3y+/HOiv7qPFVsgkCWF1gQ=; b=z0uJKeAlCXDoIH+1dcn3aWwVBuitsB9JEfHOMeoJm+MzZ9Gvk65MChmd59Ioyg6bLz w6P5++EbgFNYp+1ZZQrerzp39vX/Pwd0qPiVm0wE+oTPtsdCI+sAyvE21/FEu9pcDG0e 0bdOvMrSggT6VRMIRIKlXn7iQjWrF1mLdUXV0ZVJxqSKQEFR079rLYusm8gszMwx5PRc i+HyIfZFAMr59SqdGTtXgkBSOUhmSJRecFnmkf+DNwAzibAE2Tiy9k6MZZpy8z7WVM5s vi5wlZ2igL8VB62EKYKvc4Hyd8cCgW24g0HrD9c2JLZF5tBtS3wUC/flUnzvaFqgrRzX jY2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Kdh+UQkJ; 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 p27-v6sor8740187ljb.48.2018.05.31.02.40.56 for (Google Transport Security); Thu, 31 May 2018 02:40:56 -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=Kdh+UQkJ; 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=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=mmmz6ydF6JkFyaRzP4oZQ8tpZje0yLK4AYe0z8171wGSi4KLp02zeGy2OK1Lfv2dHj 9dIe1/l8r8ukr/K/XRzv5yA0MwSdeLx71y7KSVh4BADsvGYesVXnMtFnBMI8iYWYF5QU 0JUOJvrSO2jMQ7RYbX9+A95HoSAeqZdLTSjdUbbAppBbI61juzPPHpfeAtnbsj6vIdT7 Mi6mxacwD+tXst/FT1BERYAPokdQutvIZNDwrePyLwZF0Dbk1gUOzRCnjFi1ymdXbrr3 lRWgPUX9p2EYNMcK835ZZliOeREtf82eIQhpXw++rJJ3jaLi9rn9EcCjtLP5+TPE2Psn +XzQ== X-Gm-Message-State: ALKqPwevJKid9uT0sKZFkVZKwBXgnj5zMPx/oO/urR8cysY11HN4dkXX MULN1rFRxBrT6G2HMRWwzumGlA63S+1/xg== 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) 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.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> 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(-) -- 2.17.0 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),