public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 01/14] PM / Domains: Allow domain power states to be read from DT
Date: Thu, 23 Jun 2016 18:38:22 +0100	[thread overview]
Message-ID: <20160623173822.GB22204@leverpostej> (raw)
In-Reply-To: <1466624209-27432-2-git-send-email-lina.iyer@linaro.org>

On Wed, Jun 22, 2016 at 01:36:36PM -0600, Lina Iyer wrote:
> From: Axel Haslam <ahaslam+renesas@baylibre.com>
> 
> This patch allows domains to define idle states in the DT. SoC's can
> define domain idle states in DT using the "power-states" property of the
> domain provider. Calling of_pm_genpd_init() will  read the idle states
> and initialize the genpd for the domain.
> 
> In addition to the entry and exit latency for idle state, also add
> residency and state-param properties. A domain idling in a state is only
> power effecient if it stays idle for a certain period in that state. The
> residency provides this minimum time for the idle state to provide power
> benefits. The state-param is a state specific u32 value that the
> platform may use for that idle state.
> 
> Signed-off-by: Marc Titinger <mtitinger+renesas@baylibre.com>
> Signed-off-by: Lina Iyer <lina.iyer@linaro.org>
> [Lina: Added state properties, removed state names, wakeup-latency,
> added of_pm_genpd_init() API, pruned commit text]
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> [Ulf: Moved around code to make it compile properly, rebased on top of multiple
> state support,changed to use pm_genpd_init()]
> ---
>  drivers/base/power/domain.c | 84 ++++++++++++++++++++++++++++++++++++++++++++-
>  include/linux/pm_domain.h   |  3 ++
>  2 files changed, 86 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index a1f2aff..62ffabd 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1253,6 +1253,82 @@ out:
>  }
>  EXPORT_SYMBOL_GPL(pm_genpd_remove_subdomain);
>  
> +static int genpd_of_get_power_state(struct genpd_power_state *genpd_state,
> +				    struct device_node *state_node)
> +{
> +	int err = 0;
> +	u32 latency;
> +	u32 residency;
> +	u32 param;
> +	u32 entry_latency, exit_latency;
> +
> +	err = of_property_read_u32(state_node, "entry-latency-us",
> +				   &entry_latency);
> +	if (err) {
> +		pr_debug(" * %s missing entry-latency-us property\n",
> +			 state_node->full_name);
> +		return -EINVAL;
> +	}
> +
> +	err = of_property_read_u32(state_node, "exit-latency-us",
> +				   &exit_latency);
> +	if (err) {
> +		pr_debug(" * %s missing exit-latency-us property\n",
> +			 state_node->full_name);
> +		return -EINVAL;
> +	}
> +
> +	err = of_property_read_u32(state_node, "residency-us", &residency);
> +	if (!err)
> +		genpd_state->residency_ns = 1000 * residency;
> +
> +	err = of_property_read_u32(state_node, "state-param", &param);
> +	if (!err)
> +		genpd_state->param = param;
> +
> +	latency = entry_latency + exit_latency;
> +	genpd_state->power_on_latency_ns = 1000 * latency;
> +	genpd_state->power_off_latency_ns = 1000 * entry_latency;
> +
> +	return 0;
> +}

As with the binding, I would very much prefer that this were unfiied
with the existing idle state parsing. I'm not keen on having two
arbitrarily different idle state binidngs and parsers.

Thanks,
Mark.

  reply	other threads:[~2016-06-23 17:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-22 19:36 [PATCH 00/14] PM: SoC idle support using PM domains Lina Iyer
2016-06-22 19:36 ` [PATCH 01/14] PM / Domains: Allow domain power states to be read from DT Lina Iyer
2016-06-23 17:38   ` Mark Rutland [this message]
2016-06-22 19:36 ` [PATCH 02/14] dt/bindings: update binding for PM domain idle states Lina Iyer
2016-06-23 17:35   ` Mark Rutland
2016-06-23 18:04     ` Lina Iyer
2016-06-23 18:19       ` Mark Rutland
2016-06-23 18:39         ` Lina Iyer
2016-06-22 19:36 ` [PATCH 03/14] PM / Domains: Abstract genpd locking Lina Iyer
2016-06-22 19:36 ` [PATCH 04/14] PM / Domains: Support IRQ safe PM domains Lina Iyer
2016-06-22 19:36 ` [PATCH 05/14] PM / doc: update device documentation for devices in " Lina Iyer
2016-07-25 22:50   ` Kevin Hilman
2016-07-25 23:21     ` Lina Iyer
2016-06-22 19:36 ` [PATCH 06/14] PM / cpu_domains: Setup PM domains for CPUs/clusters Lina Iyer
2016-06-22 19:36 ` [PATCH 07/14] ARM: cpuidle: Add runtime PM support for CPUs Lina Iyer
2016-06-22 19:36 ` [PATCH 08/14] timer: Export next wake up of a CPU Lina Iyer
2016-07-26 18:26   ` Kevin Hilman
2016-07-27  9:14   ` Thomas Gleixner
2016-07-27 15:04     ` Lina Iyer
2016-06-22 19:36 ` [PATCH 09/14] PM / cpu_domains: Add PM Domain governor for CPUs Lina Iyer
2016-06-22 19:36 ` [PATCH 10/14] doc / cpu_domains: Describe CPU PM domains setup and governor Lina Iyer
2016-06-22 19:36 ` [PATCH 11/14] drivers: firmware: psci: Allow OS Initiated suspend mode Lina Iyer
2016-06-24  4:25   ` Vikas Sajjan
2016-06-24 16:53     ` Lina Iyer
2016-06-27 10:12     ` Mark Rutland
2016-06-28  6:07       ` Vikas Sajjan
2016-06-22 19:36 ` [PATCH 12/14] drivers: firmware: psci: Support cluster idle states for OS-Initiated Lina Iyer
2016-06-22 19:36 ` [PATCH 13/14] ARM64: dts: Add PSCI cpuidle support for MSM8916 Lina Iyer
2016-06-22 19:36 ` [PATCH 14/14] ARM64: dts: Define CPU power domain " Lina Iyer
2016-07-26 22:08 ` [PATCH 00/14] PM: SoC idle support using PM domains Kevin Hilman
2016-07-27 15:06   ` Lina Iyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160623173822.GB22204@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox