Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp632891pxj; Thu, 10 Jun 2021 09:02:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymBrbl8UYF4bqTRTGFZ/d3eP2zrc+nWgbRJLrKJpWkfvKZM6BWZ7s1bLsitKS/F5ejrcZP X-Received: by 2002:a05:6402:145a:: with SMTP id d26mr136166edx.151.1623340924573; Thu, 10 Jun 2021 09:02:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623340924; cv=none; d=google.com; s=arc-20160816; b=UilroevbROQxBXKbk37mjl7IvtzaNBUX1RoFOTFhf24uXRXPVOkywmx9CvPg/rN5L/ YmP3JLfRlIPxsepC1LBWNItrv+ab2PXeF+FvRXVYOHEwuL+OlgAl5dWZAgBiR00ZDocL +gy45lPOCKlpSZTjwHocKoDNaEaU4kKDIUDpLvQmaoKv/w7PUhXN5u8NsMKwCSkqU2od GYH3sL+ItWXfF+OXBHtdCa9fsD0bi0JelvGoUIIag/OedugyLAsjhbLdgntqGjjNzWQS NgfJLAfioY2T4okVpGPZ7dZT9CtuIT7CjCg2jOpyt2uQxd47OIKLWNWGWAW6itQ9hHK1 Mf4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=gEOhLn04ufSH/EYWeHJiDResBxu7Zjy3LEUOA404M9M=; b=G2AVYgLrvCQpjN11DVvnfNxfrRf8lhtta/Pj2pd6AjqyqPXV/E/MrvHsRtTB8/8h4+ UyAbDF7Nx2K/FJ23iTwyCxcceNhotDZgNZ/jouzSwCYbLd8/u8z/d8uuoOSDNXk4Sw3T j6C0I0AXuWm7j7EgxTCj+da0qBw2u2GxAB/7S0Y+alXuh6x/XL39f3j2JvvhAuGfLgWV ybRBlaHLAfpm31OpZ8L64/qslHQLZqNCAvKkW+7suMLolPbfAt5pl7P7LYyUK0HflFNF 9/iDPWs3dRVGlN/Lo/Qwb5Gp4dp7WVNNBpecK80kbyKjhOPM2Q7QWvfaIGZ7EUKwJn+M lQ3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MvNErbbu; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si3058574ejj.750.2021.06.10.09.01.40; Thu, 10 Jun 2021 09:02:04 -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=@gmail.com header.s=20161025 header.b=MvNErbbu; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230381AbhFJQB1 (ORCPT + 99 others); Thu, 10 Jun 2021 12:01:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230247AbhFJQB1 (ORCPT ); Thu, 10 Jun 2021 12:01:27 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4096DC061574; Thu, 10 Jun 2021 08:59:18 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id l184so119957pgd.8; Thu, 10 Jun 2021 08:59:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=gEOhLn04ufSH/EYWeHJiDResBxu7Zjy3LEUOA404M9M=; b=MvNErbbuJgsYARWhegkk6WNOEMgQbvVcbR6iy+mrAf8t7qZEQVAxp85okAny4keJwX ktOiDfhx4YSPeOjaSjn/FAnDn1o1k0B1UQP3Pmrgpo6e9oiLdScB6ih72n/LORqPLHTx 2VUoOZ01+qKFp/xpD7TNsWYLe9AQEWeB7x1mZurgDS0W90mzURpQcKdKnd5lc7XTjStO Y1TRsa3iOSUUbArQiTztEZzJ2UUUuih/Q2gM5x0OVoL9iH8CKLa2xlxm8qr0AgsOuW9B K0DFR3SSjqIVPPZ7TDp8Ok8JzMstH0xwBLoUeElcE+B7PNX1GB4APwxDOjjLyKrdtljF 44xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gEOhLn04ufSH/EYWeHJiDResBxu7Zjy3LEUOA404M9M=; b=TNTkHt1N4yGdcNzVp26dIw6GlZs1UqX0iCA9APBeSK/P30n9o8z1+ZRRjDoU2lgkhf 6SIOViogWuiVTuk/Qj+o+fDl/Qp7X7ldPJ19HVDos8GyfrGVhCQgW1VDrVpVRoors1u+ 6B/gnNXXaVlh97pSAYBorIqFFRXHXP8L/CWWqMWe0/8dx5m8JdusnWeLsarYmIJFgd8W QubgUKegnCk2vsYvkx1HaAnX4p5T5KZLa8CBzQeg7bSU30h3j1Fj7/iFT5JGQLfTKBbm INZjcDQ2ygtLVWg5CE/xgG3nC4f+As/Wx1xHWes2p3APkN11k+MOG4K0IDHUZzHSniyN tgoA== X-Gm-Message-State: AOAM531DO0/FRlmzcoDacCGPZKaIDHpnbrBTlPeGFygqtMkXWxCBMyMB LjziUGkX386yMTADVX8C6xQ= X-Received: by 2002:a63:ff1f:: with SMTP id k31mr5482804pgi.315.1623340757631; Thu, 10 Jun 2021 08:59:17 -0700 (PDT) Received: from [10.230.29.202] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id p20sm2708534pff.204.2021.06.10.08.59.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 10 Jun 2021 08:59:17 -0700 (PDT) Subject: Re: [PATCH 2/2] mmc: sdhci-iproc: Add support for the legacy sdhci controller on the BCM7211 To: Ulf Hansson , "Rafael J. Wysocki" , Linux PM Cc: Al Cooper , Linux Kernel Mailing List , Adrian Hunter , BCM Kernel Feedback , DTML , Linux ARM , linux-mmc , Nicolas Saenz Julienne , Ray Jui , Rob Herring , Scott Branden References: <20210602192758.38735-1-alcooperx@gmail.com> <20210602192758.38735-2-alcooperx@gmail.com> <6acd480a-8928-89bb-0f40-d278294973a1@gmail.com> From: Florian Fainelli Message-ID: Date: Thu, 10 Jun 2021 08:59:07 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/10/2021 1:49 AM, Ulf Hansson wrote: > On Thu, 10 Jun 2021 at 01:59, Florian Fainelli wrote: >> >> >> >> On 6/9/2021 2:22 AM, Ulf Hansson wrote: >>> On Wed, 9 Jun 2021 at 05:07, Florian Fainelli wrote: >>>> >>>> >>>> >>>> On 6/8/2021 5:40 AM, Ulf Hansson wrote: >>>>> On Wed, 2 Jun 2021 at 21:28, Al Cooper wrote: >>>>>> >>>>>> Add support for the legacy Arasan sdhci controller on the BCM7211 and >>>>>> related SoC's. This includes adding a .shutdown callback to increase >>>>>> the power savings during S5. >>>>> >>>>> Please split this into two separate changes. >>>>> >>>>> May I also ask about the ->shutdown() callback and in relation to S5. >>>>> What makes the ->shutdown callback only being invoked for S5? >>>> >>>> It is not only called for S5 (entered via poweroff on a prompt) but also >>>> during kexec or reboot. The poweroff path is via: >>>> >>>> kernel_power_off() -> kernel_shutdown_prepare() -> device_shutdown() -> >>>> .shutdown() >>>> >>>> For kexec or reboot we do not really care about power savings since we >>>> are about to load a new image anyway, however for S5/poweroff we do care >>>> about quiescing the eMMC controller in a way that its clocks and the >>>> eMMC device can be put into low power mode since we will stay in that >>>> mode for seconds/hours/days until someone presses a button on their >>>> remote (or other wake-up sources). >>> >>> Hmm, I am not sure I understand correctly. At shutdown we don't care >>> about wake-up sources from the kernel point of view, instead we treat >>> everything as if it will be powered off. >> >> The same .shutdown() path is used whether you kexec, reboot or poweroff, >> but for poweroff we do care about allowing specific wake-up sources >> configured as such to wake-up the system at a later time, like GPIOs, >> RTC, etc. > > That's true, but using the ->shutdown() callbacks in this way would > certainly be a new use case. > > Most subsystems/drivers don't care about power management in those > callbacks, but rather just about managing a graceful shutdown. > > It sounds to me like you should have a look at the hibernation > path/callbacks instead - or perhaps even the system suspend > path/callback. Normally, that's where we care about power management. The platforms we use do not support hibernation, keep in mind that these are embedded SoCs that support the S2 (standby), S3 (mem) and poweroff suspend states, hibernation is not something that we can support. > > I have looped in Rafael, to allow him to share his opinion on this. > >> >>> >>> We put devices into low power state at system suspend and potentially >>> also during some of the hibernation phases. >>> >>> Graceful shutdown of the eMMC is also managed by the mmc core. >> >> AFAICT that calls mmc_blk_shutdown() but that is pretty much it, the >> SDHCI platform_driver still needs to do something in order to conserve >> power including disabling host->clk, otherwise we would not have done >> that for sdhci-brcmstb.c. > > That's not entirely correct. When mmc_bus_shutdown() is called for the > struct device* that belongs to an eMMC card, two actions are taken. > > *) We call mmc_blk_shutdown(), to suspend the block device queue from > receiving new I/O requests. > **) We call host->bus_ops->shutdown(), which is an eMMC specific > callback set to mmc_shutdown(). In this step, we do a graceful > shutdown/power-off of the eMMC card. > > When it comes to controller specific resources, like clocks and PM > domains, for example, those may very well stay turned on. Do deal with > these, then yes, you would need to implement the ->shutdown() > callback. But as I said above, I am not sure it's the right thing to > do. As explained before, we can enter S5 for an indefinite amount of time until a wake-up source wakes us up so we must conserve power, even if we happen to wake up the next second, we don't know that ahead of time. The point of calling sdhci_pltfm_suspend() here is to ensure that host->clk is turned off which cuts the eMMC controller digital clock, I forgot how much power we save by doing so, but every 10s of mW counts for us. -- Florian