public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Turquette <mturquette@linaro.org>
To: Krzysztof Kozlowski <k.kozlowski@samsung.com>,
	"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
	"Tomasz Figa" <tomasz.figa@gmail.com>,
	"Kukjin Kim" <kgene@kernel.org>,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Javier Martinez Canillas" <javier.martinez@collabora.co.uk>,
	"Vivek Gautam" <gautam.vivek@samsung.com>,
	"Kevin Hilman" <khilman@kernel.org>
Cc: "Krzysztof Kozlowski" <k.kozlowski@samsung.com>
Subject: Re: [RFC 1/2] clk: Allow overriding generic ops for clocks
Date: Mon, 24 Nov 2014 17:34:50 -0800	[thread overview]
Message-ID: <20141125013450.12298.96117@quantum> (raw)
In-Reply-To: <1416842312-4405-2-git-send-email-k.kozlowski@samsung.com>

Quoting Krzysztof Kozlowski (2014-11-24 07:18:31)
> For clocks depending on some other clock domain one may want to perform
> specific ops before actual enable/disable of gate clock. Allow such case
> by accepting supplied ops in new exported function:
> clk_register_gate_ops().

If you are not going to use the gate_ops, why use the gate clock at all?
You can create a platform-specific clock type which uses the ops you
specify.

Regards,
Mike

> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> ---
>  drivers/clk/clk-gate.c       | 16 +++++++++++++---
>  include/linux/clk-provider.h |  5 +++++
>  2 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c
> index 51fd87fb7ba6..51802af2d9e7 100644
> --- a/drivers/clk/clk-gate.c
> +++ b/drivers/clk/clk-gate.c
> @@ -117,11 +117,12 @@ EXPORT_SYMBOL_GPL(clk_gate_ops);
>   * @bit_idx: which bit in the register controls gating of this clock
>   * @clk_gate_flags: gate-specific flags for this clock
>   * @lock: shared register lock for this clock
> + * @ops: clk_ops to use for this clock
>   */
> -struct clk *clk_register_gate(struct device *dev, const char *name,
> +struct clk *clk_register_gate_ops(struct device *dev, const char *name,
>                 const char *parent_name, unsigned long flags,
>                 void __iomem *reg, u8 bit_idx,
> -               u8 clk_gate_flags, spinlock_t *lock)
> +               u8 clk_gate_flags, spinlock_t *lock, const struct clk_ops *ops)
>  {
>         struct clk_gate *gate;
>         struct clk *clk;
> @@ -142,7 +143,7 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
>         }
>  
>         init.name = name;
> -       init.ops = &clk_gate_ops;
> +       init.ops = ops;
>         init.flags = flags | CLK_IS_BASIC;
>         init.parent_names = (parent_name ? &parent_name: NULL);
>         init.num_parents = (parent_name ? 1 : 0);
> @@ -161,4 +162,13 @@ struct clk *clk_register_gate(struct device *dev, const char *name,
>  
>         return clk;
>  }
> +EXPORT_SYMBOL_GPL(clk_register_gate_ops);
> +
> +struct clk *clk_register_gate(struct device *dev, const char *name,
> +               const char *parent_name, unsigned long flags,
> +               void __iomem *reg, u8 bit_idx,
> +               u8 clk_gate_flags, spinlock_t *lock)
> +{
> +       return clk_register_gate_ops(dev, name, parent_name, flags, reg, bit_idx, clk_gate_flags, lock, &clk_gate_ops);
> +}
>  EXPORT_SYMBOL_GPL(clk_register_gate);
> diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
> index be21af149f11..6cfc77a9f339 100644
> --- a/include/linux/clk-provider.h
> +++ b/include/linux/clk-provider.h
> @@ -290,11 +290,16 @@ struct clk_gate {
>  #define CLK_GATE_HIWORD_MASK           BIT(1)
>  
>  extern const struct clk_ops clk_gate_ops;
> +struct clk *clk_register_gate_ops(struct device *dev, const char *name,
> +               const char *parent_name, unsigned long flags,
> +               void __iomem *reg, u8 bit_idx,
> +               u8 clk_gate_flags, spinlock_t *lock, const struct clk_ops *ops);
>  struct clk *clk_register_gate(struct device *dev, const char *name,
>                 const char *parent_name, unsigned long flags,
>                 void __iomem *reg, u8 bit_idx,
>                 u8 clk_gate_flags, spinlock_t *lock);
>  
> +
>  struct clk_div_table {
>         unsigned int    val;
>         unsigned int    div;
> -- 
> 1.9.1
> 

  reply	other threads:[~2014-11-25  1:34 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-24 15:18 [RFC 0/2] Fix Arndale Octa/Peach Pi boot on Audio subsystem clocks Krzysztof Kozlowski
2014-11-24 15:18 ` [RFC 1/2] clk: Allow overriding generic ops for clocks Krzysztof Kozlowski
2014-11-25  1:34   ` Mike Turquette [this message]
2014-11-25  8:10     ` Krzysztof Kozlowski
2014-11-24 15:18 ` [RFC 2/2] clk: samsung: Fix clock disable failure because domain being gated Krzysztof Kozlowski
2014-11-25 11:35   ` Tomasz Figa
2014-11-25 12:19     ` Krzysztof Kozlowski
2014-11-24 17:28 ` [RFC 0/2] Fix Arndale Octa/Peach Pi boot on Audio subsystem clocks Javier Martinez Canillas
2014-11-25  9:22   ` Krzysztof Kozlowski
2014-11-25 13:36     ` Javier Martinez Canillas
2014-11-25 14:22       ` Krzysztof Kozlowski
2014-11-25 14:52         ` Javier Martinez Canillas
2014-11-25 14:54           ` Krzysztof Kozlowski
2014-11-25 15:13             ` Javier Martinez Canillas

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=20141125013450.12298.96117@quantum \
    --to=mturquette@linaro.org \
    --cc=gautam.vivek@samsung.com \
    --cc=javier.martinez@collabora.co.uk \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=tomasz.figa@gmail.com \
    /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