linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: k.kozlowski@samsung.com (Krzysztof Kozlowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/7] opp: add dev_pm_opp_get_turbo_mode_setting() helper
Date: Fri, 10 Jul 2015 11:17:54 +0900	[thread overview]
Message-ID: <559F2B52.4060903@samsung.com> (raw)
In-Reply-To: <1436456621-29839-2-git-send-email-b.zolnierkie@samsung.com>

On 10.07.2015 00:43, Bartlomiej Zolnierkiewicz wrote:
> Add dev_pm_opp_get_turbo_mode_setting() helper for getting turbo
> mode setting for a given opp.
> 
> Cc: Tomasz Figa <tomasz.figa@gmail.com>
> Cc: Michael Turquette <mturquette@baylibre.com>
> Cc: Javier Martinez Canillas <javier@dowhile0.org>
> Cc: Thomas Abraham <thomas.ab@samsung.com>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
> ---
>  drivers/base/power/opp.c | 31 +++++++++++++++++++++++++++++++
>  include/linux/pm_opp.h   |  7 +++++++
>  2 files changed, 38 insertions(+)
> 
> diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
> index e24502a2..6b34b2a 100644
> --- a/drivers/base/power/opp.c
> +++ b/drivers/base/power/opp.c
> @@ -287,6 +287,37 @@ unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
>  EXPORT_SYMBOL_GPL(dev_pm_opp_get_freq);
>  
>  /**
> + * dev_pm_opp_get_turbo_mode_setting() - Gets the turbo setting
> + * @opp:	opp for which turbo mode setting has to be returned for
> + *
> + * Return: turbo mode setting corresponding to the opp (true or false)
> + *
> + * Locking: This function must be called under rcu_read_lock(). opp is a rcu
> + * protected pointer. This means that opp which could have been fetched by
> + * opp_find_freq_{exact,ceil,floor} functions is valid as long as we are
> + * under RCU lock. The pointer returned by the opp_find_freq family must be
> + * used in the same section as the usage of this function with the pointer
> + * prior to unlocking with rcu_read_unlock() to maintain the integrity of the
> + * pointer.
> + */
> +bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp)

It is just true or false, so maybe dev_pm_opp_is_turbo_mode()?

Everything else looks good to me.

Best regards,
Krzysztof

> +{
> +	struct dev_pm_opp *tmp_opp;
> +	bool f = false;
> +
> +	opp_rcu_lockdep_assert();
> +
> +	tmp_opp = rcu_dereference(opp);
> +	if (unlikely(IS_ERR_OR_NULL(tmp_opp)) || !tmp_opp->available)
> +		pr_err("%s: Invalid parameters\n", __func__);
> +	else
> +		f = tmp_opp->turbo;
> +
> +	return f;
> +}
> +EXPORT_SYMBOL_GPL(dev_pm_opp_get_turbo_mode_setting);
> +
> +/**
>   * dev_pm_opp_get_max_clock_latency() - Get max clock latency in nanoseconds
>   * @dev:	device for which we do this operation
>   *
> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
> index bb52fae..7856baf 100644
> --- a/include/linux/pm_opp.h
> +++ b/include/linux/pm_opp.h
> @@ -30,6 +30,8 @@ unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
>  
>  unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
>  
> +bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp);
> +
>  int dev_pm_opp_get_opp_count(struct device *dev);
>  unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
>  
> @@ -63,6 +65,11 @@ static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
>  	return 0;
>  }
>  
> +static inline bool dev_pm_opp_get_turbo_mode_setting(struct dev_pm_opp *opp)
> +{
> +	return false;
> +}
> +
>  static inline int dev_pm_opp_get_opp_count(struct device *dev)
>  {
>  	return 0;
> 

  reply	other threads:[~2015-07-10  2:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-09 15:43 [PATCH v2 0/7] cpufreq: use generic cpufreq drivers for Exynos4x12 platform Bartlomiej Zolnierkiewicz
2015-07-09 15:43 ` [PATCH v2 1/7] opp: add dev_pm_opp_get_turbo_mode_setting() helper Bartlomiej Zolnierkiewicz
2015-07-10  2:17   ` Krzysztof Kozlowski [this message]
2015-07-27  8:33   ` Viresh Kumar
2015-07-09 15:43 ` [PATCH v2 2/7] cpufreq: opp: fix handling of turbo modes Bartlomiej Zolnierkiewicz
2015-07-10  2:20   ` Krzysztof Kozlowski
2015-07-27  8:35   ` Viresh Kumar
2015-07-27 10:24     ` Bartlomiej Zolnierkiewicz
2015-07-27 10:35       ` Viresh Kumar
2015-07-27 11:14         ` Bartlomiej Zolnierkiewicz
2015-07-27 11:36           ` Viresh Kumar
2015-07-27 11:47             ` Bartlomiej Zolnierkiewicz
2015-07-30 14:37               ` Kukjin Kim
2015-07-31 18:58                 ` Bartlomiej Zolnierkiewicz
2015-08-04  1:31                 ` Krzysztof Kozlowski
2015-07-09 15:43 ` [PATCH v2 3/7] cpufreq-dt: add turbo modes support Bartlomiej Zolnierkiewicz
2015-07-10  8:22   ` Krzysztof Kozlowski
2015-07-27  8:37   ` Viresh Kumar
2015-07-27 11:01     ` Bartlomiej Zolnierkiewicz
2015-07-27 11:33       ` Viresh Kumar
2015-07-27 11:58         ` Bartlomiej Zolnierkiewicz
2015-07-27 12:01           ` Viresh Kumar
2015-07-09 15:43 ` [PATCH v2 4/7] clk: samsung: exynos4x12: add cpu clock configuration data and instantiate cpu clock Bartlomiej Zolnierkiewicz
2015-07-10  8:30   ` Krzysztof Kozlowski
2015-07-10 16:12     ` Javier Martinez Canillas
2015-07-11  6:36       ` Krzysztof Kozlowski
2015-07-15  9:58   ` Sylwester nawrocki
2015-07-09 15:43 ` [PATCH v2 5/7] ARM: dts: Exynos4x12: add CPU OPP and regulator supply property Bartlomiej Zolnierkiewicz
2015-07-10  8:35   ` Krzysztof Kozlowski
2015-07-09 15:43 ` [PATCH v2 6/7] ARM: Exynos: switch to using generic cpufreq driver for Exynos4x12 Bartlomiej Zolnierkiewicz
2015-07-10  8:55   ` Krzysztof Kozlowski
2015-07-09 15:43 ` [PATCH v2 7/7] cpufreq: exynos: remove Exynos4x12 specific cpufreq driver support Bartlomiej Zolnierkiewicz
2015-07-10  8:57   ` Krzysztof Kozlowski

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=559F2B52.4060903@samsung.com \
    --to=k.kozlowski@samsung.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;
as well as URLs for NNTP newsgroup(s).