From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F780C04A6A for ; Thu, 13 Jul 2023 15:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235018AbjGMPeX (ORCPT ); Thu, 13 Jul 2023 11:34:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232154AbjGMPeF (ORCPT ); Thu, 13 Jul 2023 11:34:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DB21FC4; Thu, 13 Jul 2023 08:34:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EAF8061A04; Thu, 13 Jul 2023 15:34:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FDA0C433C8; Thu, 13 Jul 2023 15:34:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689262443; bh=TXXooUFVHTPaYTGh9FoTYszC1QZuaCRw5/+96j0pc6s=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Xe5OKuEmVyzCWQGWWTpbwZp9QmpxM25RMyrl/t2vF6laqsfNK2a4HPaaULj6dNWIU W9xqH5wYzIwc9vZ10gvdkYx0LQZPft+7z2N4c+N+fa/Ic/45egxS7oOBnY0l1366pY jBm8C0dqSAO3aWJnjMhTjC5fK9OOeFF3X/NXJ8l46HhJ2Q5UhdIDzOwluYGrTFbEr/ mNZfsq65W7FzjZq58xWCgqSRzd1IsRQh64B6jQ8IGkmgcfL0s5miNNiCLdgzEYVGW2 pNK2YbO7FElM+52Ur3d/D2CXaGJ5LKGIZq6tAI0WHXiKVloB3alxKJvlKmsHuKmvr6 PgQN5jIvPVjEA== Date: Thu, 13 Jul 2023 10:34:01 -0500 From: Bjorn Helgaas To: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Marek Vasut , Yoshihiro Shimoda , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 RESEND 2/2] PCI: rcar-host: add support for optional regulators Message-ID: <20230713153401.GA317502@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230712103916.1631-3-wsa+renesas@sang-engineering.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 12, 2023 at 12:39:16PM +0200, Wolfram Sang wrote: > The KingFisher board has regulators. They just need to be en-/disabled, > so we can leave the handling to devm. Order variables in reverse-xmas > while we are here. > > Signed-off-by: Wolfram Sang > Reviewed-by: Geert Uytterhoeven Krzysztof or Lorenzo may fix this up for you, but: s/add support/Add support/ in subject to match history and recast commit log to say what the patch *does* ("enable optional regulators using devm, so devm will automatically disable them when the driver releases the device"), not *what needs to be done*. > --- > drivers/pci/controller/pcie-rcar-host.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c > index 88975e40ee2f..7aecc114af4f 100644 > --- a/drivers/pci/controller/pcie-rcar-host.c > +++ b/drivers/pci/controller/pcie-rcar-host.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > > #include "pcie-rcar.h" > > @@ -953,14 +954,20 @@ static const struct of_device_id rcar_pcie_of_match[] = { > {}, > }; > > +/* Design note 346 from Linear Technology says order is not important */ > +static const char * const rcar_pcie_supplies[] = { > + "vpcie12v", "vpcie3v3", "vpcie1v5" > +}; > + > static int rcar_pcie_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > + struct pci_host_bridge *bridge; > struct rcar_pcie_host *host; > struct rcar_pcie *pcie; > + unsigned int i; > u32 data; > int err; > - struct pci_host_bridge *bridge; > > bridge = devm_pci_alloc_host_bridge(dev, sizeof(*host)); > if (!bridge) > @@ -971,6 +978,13 @@ static int rcar_pcie_probe(struct platform_device *pdev) > pcie->dev = dev; > platform_set_drvdata(pdev, host); > > + for (i = 0; i < ARRAY_SIZE(rcar_pcie_supplies); i++) { > + err = devm_regulator_get_enable_optional(dev, rcar_pcie_supplies[i]); > + if (err < 0 && err != -ENODEV) > + return dev_err_probe(dev, err, "can't enable regulator %s\n", > + rcar_pcie_supplies[i]); > + } > + > pm_runtime_enable(pcie->dev); > err = pm_runtime_get_sync(pcie->dev); > if (err < 0) { > -- > 2.30.2 >