Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp3429062ybz; Mon, 20 Apr 2020 02:33:35 -0700 (PDT) X-Google-Smtp-Source: APiQypLJp7Nfbjla4R1KDnrbycPOUUPxBjsZ8HhxZ+fE/HEk2qSlx6z18wMNbBHLeH0F61+3xfhy X-Received: by 2002:a17:906:af6f:: with SMTP id os15mr15401005ejb.78.1587375214911; Mon, 20 Apr 2020 02:33:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587375214; cv=none; d=google.com; s=arc-20160816; b=SMarYkfD78PTNTbKOXW14lcibk16XdEX9YoI0EMPZglY1xjnxUpzpds6Qa07e4d03C zErwjQeBCvHpi8JkOh1MCp35r9Hh/TvRpiiHhhV/I4EMjAh6/xUGFL0+qE3a0qzQLUdr 8E7PMFCuw1BiXIZW6TF1N/G5xJq1lV32KJP41QUjRLPxHPkb4ekRPez6WQnzIoCnKaiF uyM4mEtOveWHQgZ94+MySmws0RwLWI1H+ri5RGMffA4hP7yOsNpEdIxLNrn89r6L56Ms g1kJpSDYBtiKU+uBcQGSHXpxxYhaijnVTHuWA/XWPPxBHGQecNmc+sTbOXU6s0cOwUgZ 7pnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+bXbV2G5yAsWPdoik74HL3zT7EvaYkbi6HLAip4kCPE=; b=wLI4GQ5r+GbOIxg1rsRFjYJElG0kvZZvR2ACSD40IPyzIehIPpihFcJpkYPY7dpvYo F40SyfD9vI3Rr32iF+BFRPE8F4uCvk7lRVT4kwMZyFg6yGqxU7YKzfLXtFZtookvQrBI m6u2XXzUQs8I9b5pomWr6MvxidJHZvQtPSOOrRcp3a8RqSaTZxnRRH72dO9MjM+QCrJY dyL1hNvljyDZfvJ70LE3miIIgMfk4QwWE7nizf2U2OARFQ3LEtCZKDO35NOANFvkABU7 qEgkzF0fYFYng1B7sWAEKm7WUmtdr1g50rEqn5620df988sLE91s+1iDu56P7DO5qqJ5 yexQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s4jIYNmD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq3si220218edb.367.2020.04.20.02.33.11; Mon, 20 Apr 2020 02:33:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s4jIYNmD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725959AbgDTJ3n (ORCPT + 99 others); Mon, 20 Apr 2020 05:29:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725775AbgDTJ3n (ORCPT ); Mon, 20 Apr 2020 05:29:43 -0400 Received: from mail-ua1-x943.google.com (mail-ua1-x943.google.com [IPv6:2607:f8b0:4864:20::943]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9F31C061A0C for ; Mon, 20 Apr 2020 02:29:42 -0700 (PDT) Received: by mail-ua1-x943.google.com with SMTP id c24so3331622uap.13 for ; Mon, 20 Apr 2020 02:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+bXbV2G5yAsWPdoik74HL3zT7EvaYkbi6HLAip4kCPE=; b=s4jIYNmDSCSre8L1fOBe4BKz3cwsdftChktN5JBQLZjCofDyAxUTDTCrR29bQ8dwx0 /UULMi3OKQNpg/O5WT4mJDqSI5Hk78M1a6nm2+fLJQyRjBbAfQNz/ioFJ7RxAG8dsQe2 HOv+Mde3TMlgY4x2WmVmPYgzvk8jN8pKNA7iRczjLE5el78RwB7Xddsct5dPQcj/nz85 zFiR2pBDqDB1AMP8msDaTcEmMj1fANeYRsk7sP3SyWpg9pD9/cptg1Hx8UJuzgV7ye2f j04qjnuf2cPvH1WJr+/Uox3iREXQ9C4W9RHpflU+HXxQUURDtFXPr6Ee3zxVrTGNjEWd Z32A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+bXbV2G5yAsWPdoik74HL3zT7EvaYkbi6HLAip4kCPE=; b=gJu25TD3zF0S6AVHEFc61IgtVFtQQCrIvuFcEWvWm8Eh5azOW0IETc0V+n/0syvwBp QYyBY1UPrn30ivodOKX2G0iJj9p0uxfuPjvFoiUueaIq2L8fVnJSuYV3qJIZ+5lKAkGc n8zF8930RfdfmCLJjI4Miv7W+wqaoBVh+BHllzkbbZky69uBj3mCiOPIs39QZCWj955J 5ggWSsU5425Ty14c0ntKq86qdOhW9t5k6RtKYaY2umJMwud1BWmdV/gT5J/K1ZCrO9Ds SNiwcIfn7wFW7lPk5F2uJiMjFpVdjHvqgPBouObJ+XjaHkWvEaweQcEW+/tzE87rCIuG F+8Q== X-Gm-Message-State: AGi0PuaiHcR+M4pSdwfdaGt9IGgLAFVHBDLqwUNKG4XUW7OMb18iS8d5 FaPs4xQnRws6iHDjRP/P8HCrfj/KMvKL9CUh6UfOW8fiNr0= X-Received: by 2002:ab0:3343:: with SMTP id h3mr517711uap.19.1587374982046; Mon, 20 Apr 2020 02:29:42 -0700 (PDT) MIME-Version: 1.0 References: <1582181100-29914-1-git-send-email-sbhanu@codeaurora.org> <158334039680.7173.16159724456027777605@swboyd.mtv.corp.google.com> <158463974696.152100.8345578995373250448@swboyd.mtv.corp.google.com> <158690616084.105027.4255268086188981149@swboyd.mtv.corp.google.com> In-Reply-To: <158690616084.105027.4255268086188981149@swboyd.mtv.corp.google.com> From: Ulf Hansson Date: Mon, 20 Apr 2020 11:29:06 +0200 Message-ID: Subject: Re: [PATCH V4] mmc: sdhci-msm: Update system suspend/resume callbacks of sdhci-msm platform driver To: Stephen Boyd Cc: Shaik Sajida Bhanu , Adrian Hunter , Rob Herring , Matthias Kaehlcke , Asutosh Das , Sahitya Tummala , Sayali Lokhande , cang@codeaurora.org, Veerabhadrarao Badiganti , Ram Prakash Gupta , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , linux-arm-msm , DTML , Andy Gross , Bjorn Andersson Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 15 Apr 2020 at 01:16, Stephen Boyd wrote: > > Quoting Ulf Hansson (2020-03-20 03:22:01) > > On Thu, 19 Mar 2020 at 18:42, Stephen Boyd wrote: > > > > > > Quoting Ulf Hansson (2020-03-06 02:07:41) > > > > On Wed, 4 Mar 2020 at 17:46, Stephen Boyd wrote: > > > > > > > > > > Quoting Ulf Hansson (2020-03-04 07:34:29) > > > > > > On Thu, 20 Feb 2020 at 07:45, Shaik Sajida Bhanu wrote: > > > > > > > > > > > > > > The existing suspend/resume callbacks of sdhci-msm driver are just > > > > > > > gating/un-gating the clocks. During suspend cycle more can be done > > > > > > > like disabling controller, disabling card detection, enabling wake-up events. > > > > > > > > > > > > > > So updating the system pm callbacks for performing these extra > > > > > > > actions besides controlling the clocks. > > > > > > > > > > > > > > Signed-off-by: Shaik Sajida Bhanu > > > > > > > Reviewed-by: Stephen Boyd > > > > > > > --- > > > [...] > > > > > > > > > > > > > > > > > > > > > > + > > > > > > > + ret = pm_runtime_force_suspend(dev); > > > > > > > > > > > > It looks to me that perhaps you could make use of solely > > > > > > pm_runtime_force_suspend(), then just skip calling > > > > > > sdhci_suspend|resume_host() altogether. Do you think that could work? > > > > > > > > > > Does that do all the things the commit text mentions is desired for > > > > > system suspend? > > > > > > > > No. :-) > > > > > > > > But why is system wakeup needed for an eMMC card? > > > > > > > > > > I don't know if system wakeup is needed for an eMMC card. Probably only > > > if you plug in a card and some daemon wants to wake up and probe the > > > card for auto-play or something like that? Seems possible so might as > > > well expose the CD gpio as a wakeup in that case and let userspace > > > decide if it wants to do that. > > > > Right, card detect IRQs could be useful for system wakeups. > > > > I assume you are using a GPIO IRQ for that, which is easily managed, > > as the runtime PM status of the mmc controller is irrelevant when > > configuring the GPIO IRQ as wakeup. > > > > We even have a helper for doing this, mmc_gpio_set_cd_wake(). > > Right. Maybe mmc_gpio_set_cd_wake() needs to be called from somewhere in > the sdhci core? Yes, that seems reasonable. > > > > > > > > > Is runtime suspended state the same as system suspended state here > > > though? The commit text seems to imply that only clks are disabled when > > > it's desirable to disable the entire controller. I'm still fuzzy on how > > > runtime PM and system PM interact because it seems to have changed since > > > I looked last a few years ago. If the driver can stay in a runtime > > > suspended state across system suspend then I'm all for it. That would > > > save time for system PM transitions. > > > > In most cases this should be possible. And so far, for this case, I > > haven't found a good reason to why it shouldn't work. > > > > Although, perhaps we need to improve some of the sdhci's library > > functions for PM, to better support this. > > > > So does that mean it's all just working then? Nothing to do here except > make wakeup irqs for CD work? Well, if it "works " or not, I am not really sure. My point is, I think most of the things that need to be managed at system suspend/resume are the same things that need to be managed during runtime suspend/resume (except wakeups). So, rather than implementing a whole bunch of system suspend/resume specific things, why not make use of the runtime suspend/resume callbacks instead. Kind regards Uffe