Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1434426

Re: [RFC PATCH 1/3] soc/tegra: pmc: Initialise power partitions early

Path csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod
From Thierry Reding <thierry.reding@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 1/3] soc/tegra: pmc: Initialise power partitions early
Date Thu, 30 Jun 2016 12:20:01 +0200
Message-ID <rPHeF-8kN-5@gated-at.bofh.it> (permalink)
References <rOZnk-6lK-33@gated-at.bofh.it> <rOZnk-6lK-31@gated-at.bofh.it>
X-Original-To Jon Hunter <jonathanh@nvidia.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=XoyEpP2sX2DFG7qPLrulTdnP6JSb2hmpTyw5w70DN8g=; b=Xhx16YjrRBytcOzfEuNnGtFJONPUgDQAgBdfJQNX6rlxxzD09Pvx13OmwJ6yJuf5ei 7iYWTwjwnQHlj9qJbvvWt/aoUFAhbkGcKqQDdA6DaQ5eEdeA1RyIWPaVKvNyjFUP0FUN auh/62Mig+LPUg9+buldIA7bxyV21+4Z/FMoQnM8WjTugxfMj/cK0DY2JFRlRYbWtbgJ qUOlc1Yj48pHVKoaXFO0Q8+wQqmigsmil0wpmEvHnEEnzZAqayX+ZpAKILR0jLvGrFCB InSUTsio7M3YL6/lo8nvLhJKq5Sx0D2dWC1qUIWR9zRAE/xxtCj2vUpFM0bTCj/URzcG r6zg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=XoyEpP2sX2DFG7qPLrulTdnP6JSb2hmpTyw5w70DN8g=; b=m+h0c459nrnGcSwMpT72LHLSTCzu7FukR50CJzO6wBs8r+b6m7hmlVgJjpF57I7MhM j1tfNo53HB+WfHYS5jVWt8btW4J3EniEbk3OBRqDqT+KKapGC3VSo6Mzbp6w5BotNP+y 6SGeneMsKu5A9yj1mL2sPf5R0qbg1Ce/qmpqDixRP45FkCbdfqpbvOAbv3d+qXDbHPHy 0fm0JOFgr+QmD4RKNsG6vmDTibFBWv01w7fnSVelucI858Oh9Fsm05fVBATgh9VLLKOj Q+/HklKba1Q+Yhlge09p8qqMo5/Bqw8PNuDQP6YfPCUPt+926gk9L7n2+uHwDZSOB3tm c25Q==
X-Gm-Message-State ALyK8tIjHGiL1NdrREm+G/1dpOhQQTbu2fJ71F1WvTLlkIAkXzxNuzF8edPaaFZ+8Q6FmA==
X-Received by 10.98.149.149 with SMTP id c21mr20069133pfk.73.1467281856549; Thu, 30 Jun 2016 03:17:36 -0700 (PDT)
MIME-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="z9ECzHErBrwFF8sy"
Content-Disposition inline
User-Agent Mutt/1.6.1 (2016-04-27)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 103
Organization linux.* mail to news gateway
X-Original-Cc Stephen Warren <swarren@wwwdotorg.org>, Alexandre Courbot <gnurou@gmail.com>, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
X-Original-Date Thu, 30 Jun 2016 12:17:32 +0200
X-Original-Message-ID <20160630101732.GG1776@ulmo.ba.sec>
X-Original-References <1467112844-26927-1-git-send-email-jonathanh@nvidia.com> <1467112844-26927-2-git-send-email-jonathanh@nvidia.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1434426

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Tue, Jun 28, 2016 at 12:20:42PM +0100, Jon Hunter wrote:
> If CONFIG_PM_GENERIC_DOMAINS is not enabled, then power partitions
> associated with a device will not be enabled automatically by the PM
> core when the device is in use. To avoid situations where a device in
> a power partition is to be used but the partition is not enabled,
> initialise the power partitions for Tegra early in the boot process and
> if CONFIG_PM_GENERIC_DOMAINS is not enabled, then power on all
> partitions defined in the device-tree blob.
> 
> Note that if CONFIG_PM_GENERIC_DOMAINS is not enabled, after the
> partitions are turned on, the clocks and resets used as part of the
> sequence for turning on the partition are released again as they are no
> longer needed by the PMC driver. Another benefit of this is that this
> avoids any issues of sharing resets between the PMC driver and other
> device drivers that may wish to independently control a particular
> reset.
> 
> Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
> ---
>  drivers/soc/tegra/pmc.c | 33 ++++++++++++++++++++++-----------
>  1 file changed, 22 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> index 1f702538f8ec..64678ff2173e 100644
> --- a/drivers/soc/tegra/pmc.c
> +++ b/drivers/soc/tegra/pmc.c
> @@ -788,7 +788,7 @@ error:
>  static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
>  {
>  	struct tegra_powergate *pg;
> -	bool off;
> +	bool off, err = true;
>  	int id;
>  
>  	pg = kzalloc(sizeof(*pg), GFP_KERNEL);
> @@ -819,6 +819,9 @@ static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
>  	if (tegra_powergate_of_get_resets(pg, np, off))
>  		goto remove_clks;
>  
> +	if (!IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
> +		goto power_on_cleanup;
> +
>  	pm_genpd_init(&pg->genpd, NULL, off);
>  
>  	if (of_genpd_add_provider_simple(np, &pg->genpd))
> @@ -828,6 +831,11 @@ static void tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
>  
>  	return;
>  
> +power_on_cleanup:
> +	if (off)
> +		WARN_ON(tegra_powergate_power_up(pg, true));
> +	err = false;
> +
>  remove_resets:
>  	while (pg->num_resets--)
>  		reset_control_put(pg->resets[pg->num_resets]);
> @@ -845,14 +853,23 @@ free_mem:
>  	kfree(pg);
>  
>  error:
> -	dev_err(pmc->dev, "failed to create power domain for %s\n", np->name);
> +	if (err)
> +		dev_err(pmc->dev, "failed to configure partition %s\n",
> +			np->name);

This is beginning to look very spaghetti-like. Do we really need the
error message here? Could we instead add more explicit error messages
before the gotos above?

Thierry

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 1/3] soc/tegra: pmc: Initialise power partitions early Jon Hunter <jonathanh@nvidia.com> - 2016-06-28 13:30 +0200
  Re: [RFC PATCH 1/3] soc/tegra: pmc: Initialise power partitions early Thierry Reding <thierry.reding@gmail.com> - 2016-06-30 12:20 +0200
    Re: [RFC PATCH 1/3] soc/tegra: pmc: Initialise power partitions early Jon Hunter <jonathanh@nvidia.com> - 2016-06-30 12:30 +0200

csiph-web