From patchwork Thu May 31 09:40:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137344 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6373703lji; Thu, 31 May 2018 02:40:54 -0700 (PDT) X-Received: by 2002:a2e:3503:: with SMTP id z3-v6mr4816691ljz.95.1527759654841; Thu, 31 May 2018 02:40:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527759654; cv=none; d=google.com; s=arc-20160816; b=eJVMB22k0oVZrLZmagQd+Nx3LyAdbK+RIPXZo5M7GOLVfdGnid2xoW7BFAVzxefVUp y7Z9yWAnDdkZOSs37ATAsmjsfBiHA8qRWwZvIOKIJ4HkgEWQX3YuGHFmfd2cuG/Rs5Xt mylyKTDq2qnNfBTCdzsP881MH8jt9NqMoH1h8qS307cbbNWnkQtG6BDW6uG2XQ/uI/k4 h+2L2isv+5t1pqaqrcN2gHhw9oI6jNFqphA0dVULLpNsFZV5pjAcBWoTls6/kUDK8u9h M/e9s6Ds3+UM0cLEW5kYjfxkIbCiMELUVYSrgSZff+VaPdETfLGpHXqKdhvx+UfuQ5Jb BbUQ== 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=CBKeFwqAQWYhqKSnKc7kFvjDVkbadO7fnW1Kzv+8VQA=; b=FV1mKPTBVtOdAIPmQ3Iru1N9L9fm4c5oTZmn5A6HpOtbHND/Y+i3ZlgmDzrQgYFfl/ B+mEAfPlyR7QDMY2gIHAQY3WrgVK6HIrlDGEt9A8+bcj1khj+qzj9SxyxhA6t01mCAsT vX3FY/dzoD/c1Xi/CBo3a57ar3h+68dnljM+hMFTR4voPdNSsswlo3IWTlboxg0VY3KD 376oL/C9sqoOnWNr7DX/JcGEiTIHcVEMzy7Old8aG5Ye1UqdR0P6Um210k5A2PtE1SD/ TFVKNFpr8nUN3nVlyYajxqUcZVI3zP9Vcn5b3FERnSD+iaTLBW0B2Ng/dwbxapRBcVUC g39Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LUnEOhzh; 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 a26-v6sor4702165lfc.56.2018.05.31.02.40.54 for (Google Transport Security); Thu, 31 May 2018 02:40:54 -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=LUnEOhzh; 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=CBKeFwqAQWYhqKSnKc7kFvjDVkbadO7fnW1Kzv+8VQA=; b=LUnEOhzh0dZxRzHuUnYoyP2KwsPoeGbeVeh9FTDBlvTzUmhCc/j9l3aP2rFg0kG8mv gEFkEIae6AgY/HOSNbaVDygxYDJB2Ophupa9TCOL7MVX0hmPIRqfO8IYw0SoCQaGWxi0 BdGiSMaZhfCHkv/yLi4Xif9cw0R3qfPqZl+hY= 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=CBKeFwqAQWYhqKSnKc7kFvjDVkbadO7fnW1Kzv+8VQA=; b=j8lp2WgBimjx7EtJws81+21Anq+vm6JFuAIqBiN5ituZmNtVPm+0bfkCWlH4KHvoNS neUFMLE+QgGkupRy/jI4OQsnR0KKW8UwKMPVf+CqYpBWKU8bT5fSj9f7MJiMhOHZAaeI 4hLnXp/HWjn9LUxdb4k2KRClZ5ux/aAgIhytYWY0u5MIuFxnGzD/zzC4B6YW5jJn78E0 R2N7BsDfEDg2Kw96SfAlA6GK98B87mK8MZhvCRqN4Pga3frwjXIMZ7FNUJnwimC347If 5jL9LTRv4PkGIFb5AovCupVeZuEGx4mZvLeLuz1YUY7tOwDvuLAw0u7IaR1PG/eeH3FW tS4A== X-Gm-Message-State: ALKqPwdRj1z8+Jwu/WwauJukLekIJi7u9amQFRSw2SVlnwoCFcDQ2hgM rgeD4VtRrAl12d4tGXjXZSRY/yWF X-Google-Smtp-Source: ADUXVKJwZjaPxXz81KLCeiLWHmr9LVY/v8O12MFrp2ZuqsiaKITcatIgccnAnE9XDYVqXDFBUm3rOw== X-Received: by 2002:a19:b2c2:: with SMTP id t63-v6mr4060072lfk.27.1527759654582; Thu, 31 May 2018 02:40:54 -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.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 02:40:53 -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 2/4] mmc: rtsx_usb_sdmmc: Don't runtime resume the device while changing led Date: Thu, 31 May 2018 11:40:39 +0200 Message-Id: <20180531094041.27902-3-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> In case the card has been powered off, it seems silly to continue to allow the led to be updated. Instead let's forbid that, as it enables us to prevent runtime resuming the device and thus avoids wasting energy. Signed-off-by: Ulf Hansson --- drivers/mmc/host/rtsx_usb_sdmmc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.17.0 diff --git a/drivers/mmc/host/rtsx_usb_sdmmc.c b/drivers/mmc/host/rtsx_usb_sdmmc.c index 9a3ff22dd0fe..14b4a4e13fe6 100644 --- a/drivers/mmc/host/rtsx_usb_sdmmc.c +++ b/drivers/mmc/host/rtsx_usb_sdmmc.c @@ -1297,14 +1297,18 @@ static void rtsx_usb_update_led(struct work_struct *work) container_of(work, struct rtsx_usb_sdmmc, led_work); struct rtsx_ucr *ucr = host->ucr; - pm_runtime_get_sync(sdmmc_dev(host)); + pm_runtime_get_noresume(sdmmc_dev(host)); mutex_lock(&ucr->dev_mutex); + if (host->power_mode == MMC_POWER_OFF) + goto out; + if (host->led.brightness == LED_OFF) rtsx_usb_turn_off_led(ucr); else rtsx_usb_turn_on_led(ucr); +out: mutex_unlock(&ucr->dev_mutex); pm_runtime_put(sdmmc_dev(host)); }