linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: bilhuang@nvidia.com (Bill Huang)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC v2 1/1] clk: Add notifier support in clk_prepare/clk_unprepare
Date: Thu, 14 Mar 2013 02:51:27 -0700	[thread overview]
Message-ID: <1363254687.3311.35.camel@bilhuang-vm1> (raw)
In-Reply-To: <1363253464-3200-1-git-send-email-bilhuang@nvidia.com>

On Thu, 2013-03-14 at 17:31 +0800, Bill Huang wrote:
> Add the below two notifier events so drivers which are interested in
> knowing the clock status can act accordingly. This is extremely useful
> in some of the DVFS (Dynamic Voltage Frequency Scaling) design.
> 
> CLK_PREPARED
> CLK_UNPREPARED
> 
> Signed-off-by: Bill Huang <bilhuang@nvidia.com>
> ---
>  drivers/clk/clk.c   |    3 +++
>  include/linux/clk.h |    2 ++
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index ed87b24..3292cec 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -550,6 +550,7 @@ void clk_unprepare(struct clk *clk)
>  {
>  	mutex_lock(&prepare_lock);
>  	__clk_unprepare(clk);
> +	__clk_notify(clk, CLK_UNPREPARED, clk->rate, clk->rate);
>  	mutex_unlock(&prepare_lock);
>  }
>  EXPORT_SYMBOL_GPL(clk_unprepare);
> @@ -598,6 +599,8 @@ int clk_prepare(struct clk *clk)
>  
>  	mutex_lock(&prepare_lock);
>  	ret = __clk_prepare(clk);
> +	if (!ret)
> +		__clk_notify(clk, CLK_PREPARED, clk->rate, clk->rate);
>  	mutex_unlock(&prepare_lock);
>  
>  	return ret;
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index b3ac22d..16c1d92 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -43,6 +43,8 @@ struct clk;
>  #define PRE_RATE_CHANGE			BIT(0)
>  #define POST_RATE_CHANGE		BIT(1)
>  #define ABORT_RATE_CHANGE		BIT(2)
> +#define CLK_PREPARED			BIT(3)
> +#define CLK_UNPREPARED			BIT(4)
>  
>  /**
>   * struct clk_notifier - associate a clk with a notifier
Sorry, I'll send v3 since this bread build.

  reply	other threads:[~2013-03-14  9:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-14  9:31 [RFC v2 1/1] clk: Add notifier support in clk_prepare/clk_unprepare Bill Huang
2013-03-14  9:51 ` Bill Huang [this message]
2013-03-15 17:45 ` Russell King - ARM Linux
2013-03-15 19:51   ` Stephen Warren
2013-03-16  1:58     ` Bill Huang

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=1363254687.3311.35.camel@bilhuang-vm1 \
    --to=bilhuang@nvidia.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).