Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp4604906rwb; Tue, 8 Aug 2023 10:50:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFVS61OOQbIGW9a0fw0ZX5gzZZN3CffvcM++ie4fspSghXDOQR9uTUFwStXpT52q/fnND7g X-Received: by 2002:a17:90b:1647:b0:259:10a8:2389 with SMTP id il7-20020a17090b164700b0025910a82389mr223045pjb.35.1691517037564; Tue, 08 Aug 2023 10:50:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691517037; cv=none; d=google.com; s=arc-20160816; b=J2tf9hsbnR2oVs+o9rbcstluJ9upu4XZf7ivsOIJZLVpAV9IS0kS5AT32YEnPG3Epx S++O/3mjbEpBnob404wFskAi5at0oqtrMeJ9bG3pjdNNgrLNStYJb8Ex3o4Qw77zfIYn AVnq/V7XgYFUu1bYXn6IwMCRBXpqWgJ+umI1xW/M6Jdm560Z18cqewbuKcYc42BlRjft ph+9tOHc2LD64VnIlbcBRjYtrYP0LlfWrIbSvxC/nOGqI/Lr681EQaFAN1+oNmvdVRQh qPLDkXxO47pGiMhKarV7bQInqdwuQY64b9f/TEocSgOTwgw9Nrn9rlgY0pTxLQ/pVwtL UUmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=I6q8AWTQBFD8b34cUtgYL+witLNypid98p7CdPe4IBE=; fh=23+s72NXPUB0UvhkcaArTrLLtl5wIv+pmyZ2F8Ao704=; b=iBuUrkKs2vSAaw//yd3/29v9FeVfLqCVXTxZ9x+kPgBWpY8MzhZ3qfVsykq8+GwXGj xGzT8Sdl+9I47sb/u1g8HaVAiK43SL0UTTMdQiTCka3OrR5jq7o3MDzMXbYTWKqsr+OJ +pcmPOO/h9XMOEqJQlqABXkY2qlAgDt6Bg2UdW1XCugJScU3CX3kWXn1yWSrBlFHsAi1 881T9oCuqW657l7P7zvkgwO5pzPs8CNSS/3ZYqMjEDSyxGaMeEIV6bA+2EzejWdAvd58 JH9lwW+C+Ou6BmOGJcNRERL88Tbyyk6ol85jBb7wWAlhorcfQrtdpm1pTxlzhHsbARb/ 3IHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Gj/GBrie"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nh5-20020a17090b364500b00262f7dccaecsi7512340pjb.170.2023.08.08.10.50.25; Tue, 08 Aug 2023 10:50:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Gj/GBrie"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S233540AbjHHQtf (ORCPT + 99 others); Tue, 8 Aug 2023 12:49:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231924AbjHHQss (ORCPT ); Tue, 8 Aug 2023 12:48:48 -0400 Received: from mail-ot1-x32e.google.com (mail-ot1-x32e.google.com [IPv6:2607:f8b0:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DBC144477 for ; Tue, 8 Aug 2023 08:57:15 -0700 (PDT) Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6b9a2416b1cso4969426a34.2 for ; Tue, 08 Aug 2023 08:57:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1691510196; x=1692114996; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=I6q8AWTQBFD8b34cUtgYL+witLNypid98p7CdPe4IBE=; b=Gj/GBrieD7aSggPe6Y+oAG5Wc9wDwnV3g3daa9uYCvuJtyB1VQq/YRQx6S8mU3HYS5 bmk7aPoH6yutI1auQ4WiBuPgdRQBA/4+PMt2lRJRUS1pSGdkwUHEHBVSSDMYTOE+9VO5 mp/7qwGT4fClfPO2HT1ZKQtM5YCXN0BHhbdx22y7Dv7MQ1XbRs8LOioJqoyw8ws/A7iL OxhJGTH9+0xz/p2k66j466C56mUj01uEwdGfxM7ivSbdMdv7xH9e1XBKmQyimy1ZkNfj OAdokVf5X1bwuZSSJkk0ac/XgSnq9Uaz1rH3LO4YDi4D3qrm8P+0jSKeQHEm8ffcbsGa 33jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691510196; x=1692114996; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=I6q8AWTQBFD8b34cUtgYL+witLNypid98p7CdPe4IBE=; b=D29oAj/v+qipzFaFr9+JfeXWfBvgFNNIlm2bi8Nic6GYziCCjS4itXvEUY+bBRqmkW Ykhd0HITMZHpSeCG/5wF1SjqSwWCyj7Tg3OyoP5KbaDOxWMhBLXdVa8stP9SIP99Jz1A tw9NiRiWZcarhIHjTbSUVZHF8WZv6akBc7vc83izjvncSRC34/nQ5ZAO2WuYiKuKVbyV T3adBGUhhwiYaV+CNftfS0VAasiHBSKh1knpBNT+jNw7bGeCBaEkqqLwhPJ0gO6iwFCt FSZ6yuS5yn2bIy4pJVJxzngSkXWUtVueJb0y0AxLt4YvXScon7FKkwFplZeqouumre8p HGvg== X-Gm-Message-State: AOJu0Yyso2AsV+c7hxdjh/4Re1sqsJmfMANlEUDl12DTlH3BgQEhrJCS ewtuR24B4HLAWn+TfeqU5roVSutAM34d1H+8v1eModZWhDlOaQsq X-Received: by 2002:a25:374c:0:b0:d0d:2d17:3f11 with SMTP id e73-20020a25374c000000b00d0d2d173f11mr12364694yba.17.1691503040670; Tue, 08 Aug 2023 06:57:20 -0700 (PDT) MIME-Version: 1.0 References: <79137159a833c164ea8ea3f05d8d6d9537db2f42.1683747334.git.limings@nvidia.com> <20230804233015.173957-1-limings@nvidia.com> In-Reply-To: From: Ulf Hansson Date: Tue, 8 Aug 2023 15:56:44 +0200 Message-ID: Subject: Re: [PATCH v6] mmc: sdhci-of-dwcmshc: Add runtime PM operations To: Liming Sun Cc: Adrian Hunter , David Thompson , Shawn Lin , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Aug 2023 at 15:21, Liming Sun wrote: > > > > > -----Original Message----- > > From: Ulf Hansson > > Sent: Tuesday, August 8, 2023 5:40 AM > > To: Liming Sun > > Cc: Adrian Hunter ; David Thompson > > ; Shawn Lin ; linux- > > mmc@vger.kernel.org; linux-kernel@vger.kernel.org > > Subject: Re: [PATCH v6] mmc: sdhci-of-dwcmshc: Add runtime PM operation= s > > > > On Sat, 5 Aug 2023 at 01:30, Liming Sun wrote: > > > > > > This commit implements the runtime PM operations to disable eMMC > > > card clock when idle. > > > > > > Reviewed-by: David Thompson > > > Signed-off-by: Liming Sun > > > --- > > > v5->v6: > > > - Address Adrian's more comments and add coordination between > > > runtime PM and system PM; > > > v4->v5: > > > - Address Adrian's comment to move the pm_enable to the end to > > > avoid race; > > > v3->v4: > > > - Fix compiling reported by 'kernel test robot'; > > > v2->v3: > > > - Revise the commit message; > > > v1->v2: > > > Updates for comments from Ulf: > > > - Make the runtime PM logic generic for sdhci-of-dwcmshc; > > > v1: Initial version. > > > --- > > > drivers/mmc/host/sdhci-of-dwcmshc.c | 72 > > ++++++++++++++++++++++++++++- > > > 1 file changed, 70 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/s= dhci- > > of-dwcmshc.c > > > index e68cd87998c8..aaf66358f626 100644 > > > --- a/drivers/mmc/host/sdhci-of-dwcmshc.c > > > +++ b/drivers/mmc/host/sdhci-of-dwcmshc.c > > > @@ -15,6 +15,7 @@ > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > > > > @@ -548,9 +549,13 @@ static int dwcmshc_probe(struct platform_device > > *pdev) > > > > > > host->mmc->caps |=3D MMC_CAP_WAIT_WHILE_BUSY; > > > > > > + pm_runtime_get_noresume(dev); > > > + pm_runtime_set_active(dev); > > > + pm_runtime_enable(dev); > > > + > > > err =3D sdhci_setup_host(host); > > > if (err) > > > - goto err_clk; > > > + goto err_rpm; > > > > > > if (rk_priv) > > > dwcmshc_rk35xx_postinit(host, priv); > > > @@ -559,10 +564,15 @@ static int dwcmshc_probe(struct platform_device > > *pdev) > > > if (err) > > > goto err_setup_host; > > > > > > + pm_runtime_put_sync(dev); > > > + > > > > The async pm_runtime_put() is probably sufficient - and it would allow > > the probe to complete a bit "sooner". > > Sure, will test and update the line in v7. > > > > > > return 0; > > > > > > err_setup_host: > > > sdhci_cleanup_host(host); > > > +err_rpm: > > > + pm_runtime_disable(dev); > > > + pm_runtime_put_noidle(dev); > > > err_clk: > > > clk_disable_unprepare(pltfm_host->clk); > > > clk_disable_unprepare(priv->bus_clk); > > > @@ -606,6 +616,12 @@ static int dwcmshc_suspend(struct device *dev) > > > if (ret) > > > return ret; > > > > > > + ret =3D pm_runtime_force_suspend(dev); > > > > Can dwcmshc_suspend() be called for a device that may be attached to > > the ACPI PM domain? > > BlueField SoC is the only chip that uses ACPI in this driver for now and = it doesn't support System Sleep. Thus, the dwcmshc_suspend() won't be calle= d. But I guess it might be possible when other new chip support is added in= to this driver. Is it a concern? The ACPI PM domain doesn't support drivers using pm_runtime_force_suspend|resume(). Unless that has been changed without me knowing about it. Anyway, it looks like it shouldn't be a problem at this point. We can also add separate callbacks for other SoCs, if that comes into play going forward. [...] Kind regards Uffe