Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1074878rwi; Thu, 3 Nov 2022 00:10:39 -0700 (PDT) X-Google-Smtp-Source: AMsMyM52UgsWpZT9KmVT+UCDD/QSHQklI+jKuoKllUeytZc7Lllt5vQhMfcQvPGKkYwmbebb1LQg X-Received: by 2002:a62:d412:0:b0:56c:6f25:8b12 with SMTP id a18-20020a62d412000000b0056c6f258b12mr28779830pfh.60.1667459439005; Thu, 03 Nov 2022 00:10:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667459438; cv=none; d=google.com; s=arc-20160816; b=onLrZ2EMxaXskKgVDPJ8sM8uaYdGPTqlbQrgj0iNxd2SKDmiRR7Ox5tkSsePnA98Jw Waylmwm95u2+JnjGZ1YalweW3JMue/rdJi9JXi4ln7R8l3WT7w5fGI6xF7UHSDjUrUQ+ 1p7GaPjUzNW3/RzsuuDrj6LXIU1Mzqcn09TmSQjjO4ZIlnwtUb+tgXRHexnp3HLPpPjC 3xnnMBpFKtL71815Xz1c8E+sE+7k2kwTVvecQPpMM0nnN12bQPQgVUyXiRcMZHtOdlaw xp+gk95ZHoz6rc/+Uh24CQdpu+zbeIi/Dt5EUQ9MrZ6FTbU99a/Rs/p36D/CGqG2+5aA Qurg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=Qg1QNjyl1qoo9Xd/edYHGbicHl3EBfsOpxO6bOWNl30=; b=l9WNbt5LR9TuMWbcxvejoMgTL7NX+KCG/5gaZwNJeimaUAs48BCIIQLjSBMF6LkA5L qd8/al7tzUIGI7EhcJtlpqtTf24Bl536d0UNW5s8RW+v3AziyHPcFgg0iiKQ6FDnxU+g PuMKwGuYLJc8+fHjevvIp+WBV6Fpb3XdVho0S4Ldpr8rJ9rXckxhqM2O/bTLrUwxNGWp DMwY21iFw31xWZU3Vca1GTuWxMwUWu9SfSUagae/AkdkfAe6cQ2iDqdo0Upd7tnlMfId Q9EuSgh4MTTc467S+b0uVN+nNpkpmer6MgwD6ZaF/zhRzYrqq22fum0xVm9gla8+1Fbj Xm9w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a71-20020a63904a000000b0046ef67cb979si186184pge.82.2022.11.03.00.10.26; Thu, 03 Nov 2022 00:10:38 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230153AbiKCHFU (ORCPT + 98 others); Thu, 3 Nov 2022 03:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230182AbiKCHFQ (ORCPT ); Thu, 3 Nov 2022 03:05:16 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C32F12088 for ; Thu, 3 Nov 2022 00:05:11 -0700 (PDT) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1oqUHi-0004a5-Ur; Thu, 03 Nov 2022 08:05:07 +0100 Message-ID: Date: Thu, 3 Nov 2022 08:05:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 From: Ahmad Fatoum Subject: Re: [PATCH v1] PCI: imx6: Keep the GPIO regulator always on To: Richard Zhu , l.stach@pengutronix.de, bhelgaas@google.com, lorenzo.pieralisi@arm.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org References: <1667455698-14578-1-git-send-email-hongxing.zhu@nxp.com> Content-Language: en-US In-Reply-To: <1667455698-14578-1-git-send-email-hongxing.zhu@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS 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 Hello Richard, On 03.11.22 07:08, Richard Zhu wrote: > Since vpcie regulator is one GPIO regulator, used to control the > VPCIe_3V3 and power up remote PCIe EP device. Regulator need not be a GPIO regulator. I'd drop this from the title. > Some WIFI modules load their firmware once in probe, and can't be > powered off during suspend. Otherwise, these WIFI modules wouldn't be > functional anymore after resume back. The brcmfmac OTOH, reprobes when resuming from suspend. Before this patch, AFAIU, it should've been possible for the EP to go into D3cold during suspend. This may no longer be possible when we keep vpcie powered. > So, keep this regulator always on in the probe. > > Fixes: a4bb720eeb1e ("PCI: imx6: Turn off regulator when system is in suspend mode") Prior to a4bb720eeb1e, vpcie was briefly toggled during PCIe core reset sequence, so aforementioned WiFi modules that don't reprobe over resume should've been broken by that too? If so, I don't see how it fixes that commit as everything that is broken now was broken before that commit as well. After this patch however, modules that can accept vpcie being toggled can't benefit from some of the power saving. Why can't users with this issue use a regulator-always-on regulator instead? > Signed-off-by: Richard Zhu > --- > drivers/pci/controller/dwc/pci-imx6.c | 24 ++++++++---------------- > 1 file changed, 8 insertions(+), 16 deletions(-) > > diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c > index 2616585ca5f8..94a89bbf381d 100644 > --- a/drivers/pci/controller/dwc/pci-imx6.c > +++ b/drivers/pci/controller/dwc/pci-imx6.c > @@ -926,22 +926,13 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) > struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci); > int ret; > > - if (imx6_pcie->vpcie) { > - ret = regulator_enable(imx6_pcie->vpcie); > - if (ret) { > - dev_err(dev, "failed to enable vpcie regulator: %d\n", > - ret); > - return ret; > - } > - } > - > imx6_pcie_assert_core_reset(imx6_pcie); > imx6_pcie_init_phy(imx6_pcie); > > ret = imx6_pcie_clk_enable(imx6_pcie); > if (ret) { > dev_err(dev, "unable to enable pcie clocks: %d\n", ret); > - goto err_reg_disable; > + return ret; > } > > if (imx6_pcie->phy) { > @@ -974,9 +965,6 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp) > phy_exit(imx6_pcie->phy); > err_clk_disable: > imx6_pcie_clk_disable(imx6_pcie); > -err_reg_disable: > - if (imx6_pcie->vpcie) > - regulator_disable(imx6_pcie->vpcie); > return ret; > } > > @@ -991,9 +979,6 @@ static void imx6_pcie_host_exit(struct dw_pcie_rp *pp) > phy_exit(imx6_pcie->phy); > } > imx6_pcie_clk_disable(imx6_pcie); > - > - if (imx6_pcie->vpcie) > - regulator_disable(imx6_pcie->vpcie); > } > > static const struct dw_pcie_host_ops imx6_pcie_host_ops = { > @@ -1263,6 +1248,13 @@ static int imx6_pcie_probe(struct platform_device *pdev) > if (PTR_ERR(imx6_pcie->vpcie) != -ENODEV) > return PTR_ERR(imx6_pcie->vpcie); > imx6_pcie->vpcie = NULL; > + } else { > + ret = regulator_enable(imx6_pcie->vpcie); > + if (ret) { > + dev_err(dev, "failed to enable vpcie regulator: %d\n", > + ret); > + return ret; > + } Shouldn't the regulator enable be undone if the probe later fails? Cheers, Ahmad -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |