From: Scott Wood <scottwood@freescale.com>
To: Michael Turquette <mturquette@baylibre.com>
Cc: Stephen Boyd <sboyd@codeaurora.org>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Viresh Kumar <viresh.kumar@linaro.org>,
Russell King <linux@arm.linux.org.uk>,
linux-clk@vger.kernel.org, linux-pm@vger.kernel.org,
linuxppc-dev@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org,
Tang Yuantian <Yuantian.Tang@freescale.com>
Subject: Re: [PATCH v3 4/5] clk: Add consumer APIs for discovering possible parent clocks
Date: Thu, 15 Oct 2015 15:03:32 -0500 [thread overview]
Message-ID: <1444939412.5185.267.camel@freescale.com> (raw)
In-Reply-To: <1442723397-26329-5-git-send-email-scottwood@freescale.com>
On Sat, 2015-09-19 at 23:29 -0500, Scott Wood wrote:
> Commit fc4a05d4b0eb ("clk: Remove unused provider APIs") removed
> __clk_get_num_parents() and clk_hw_get_parent_by_index(), leaving only
> true provider API versions that operate on struct clk_hw.
>
> qoriq-cpufreq needs these functions in order to determine the options
> it has for calling clk_set_parent() and thus populate the cpufreq
> table, so revive them as legitimate consumer APIs.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
> v3: new patch
>
> drivers/clk/clk.c | 19 +++++++++++++++++++
> include/linux/clk.h | 31 +++++++++++++++++++++++++++++++
> 2 files changed, 50 insertions(+)
Russell, could you ACK this if there are no objections?
Thanks,
Scott
>
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 43e2c3a..9436356 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -290,6 +290,12 @@ struct clk_hw *__clk_get_hw(struct clk *clk)
> }
> EXPORT_SYMBOL_GPL(__clk_get_hw);
>
> +unsigned int clk_get_num_parents(struct clk *clk)
> +{
> + return !clk ? 0 : clk->core->num_parents;
> +}
> +EXPORT_SYMBOL_GPL(clk_get_num_parents);
> +
> unsigned int clk_hw_get_num_parents(const struct clk_hw *hw)
> {
> return hw->core->num_parents;
> @@ -359,6 +365,19 @@ static struct clk_core
> *clk_core_get_parent_by_index(struct clk_core *core,
> return core->parents[index];
> }
>
> +struct clk *clk_get_parent_by_index(struct clk *clk, unsigned int index)
> +{
> + struct clk_core *parent;
> +
> + if (!clk)
> + return NULL;
> +
> + parent = clk_core_get_parent_by_index(clk->core, index);
> +
> + return !parent ? NULL : parent->hw->clk;
> +}
> +EXPORT_SYMBOL_GPL(clk_get_parent_by_index);
> +
> struct clk_hw *
> clk_hw_get_parent_by_index(const struct clk_hw *hw, unsigned int index)
> {
> diff --git a/include/linux/clk.h b/include/linux/clk.h
> index 0df4a51..937de0e 100644
> --- a/include/linux/clk.h
> +++ b/include/linux/clk.h
> @@ -392,6 +392,26 @@ int clk_set_parent(struct clk *clk, struct clk
> *parent);
> struct clk *clk_get_parent(struct clk *clk);
>
> /**
> + * clk_get_parent_by_index - get a possible parent clock by index
> + * @clk: clock source
> + * @index: index into the array of possible parents of this clock
> + *
> + * Returns struct clk corresponding to the requested possible
> + * parent clock source, or NULL.
> + */
> +struct clk *clk_get_parent_by_index(struct clk *clk,
> + unsigned int index);
> +
> +/**
> + * clk_get_num_parents - get number of possible parents
> + * @clk: clock source
> + *
> + * Returns the number of possible parents of this clock,
> + * which can then be enumerated using clk_get_parent_by_index().
> + */
> +unsigned int clk_get_num_parents(struct clk *clk);
> +
> +/**
> * clk_get_sys - get a clock based upon the device name
> * @dev_id: device name
> * @con_id: connection ID
> @@ -461,6 +481,17 @@ static inline struct clk *clk_get_parent(struct clk
> *clk)
> return NULL;
> }
>
> +struct clk *clk_get_parent_by_index(struct clk *clk,
> + unsigned int index)
> +{
> + return NULL;
> +}
> +
> +unsigned int clk_get_num_parents(struct clk *clk)
> +{
> + return 0;
> +}
> +
> #endif
>
> /* clk_prepare_enable helps cases using clk_enable in non-atomic context.
> */
next prev parent reply other threads:[~2015-10-15 20:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-20 4:29 [PATCH v3 0/5] clk: qoriq: Move chip-specific knowledge into driver Scott Wood
2015-09-20 4:29 ` [PATCH v3 1/5] powerpc/fsl: Move fsl_guts.h out of arch/powerpc Scott Wood
2015-09-20 4:29 ` [PATCH v3 2/5] clk: qoriq: Move chip-specific knowledge into driver Scott Wood
2015-10-15 19:53 ` Stephen Boyd
2015-09-20 4:29 ` [PATCH v3 3/5] clk: qoriq: Add ls2080a support Scott Wood
2015-10-15 19:53 ` Stephen Boyd
2015-09-20 4:29 ` [PATCH v3 4/5] clk: Add consumer APIs for discovering possible parent clocks Scott Wood
2015-10-15 20:03 ` Scott Wood [this message]
2015-12-07 20:44 ` Scott Wood
2015-09-20 4:29 ` [PATCH v3 5/5] cpufreq: qoriq: Don't look at clock implementation details Scott Wood
2015-09-22 19:46 ` Viresh Kumar
2015-09-25 21:42 ` Rafael J. Wysocki
2015-09-25 21:17 ` Scott Wood
2015-09-25 21:50 ` Rafael J. Wysocki
2016-02-26 18:14 ` Li Yang
2016-02-26 18:16 ` Scott Wood
2016-02-26 21:01 ` Li Yang
2016-02-26 21:46 ` Scott Wood
2015-10-23 22:39 ` [PATCH v3 0/5] clk: qoriq: Move chip-specific knowledge into driver Scott Wood
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=1444939412.5185.267.camel@freescale.com \
--to=scottwood@freescale.com \
--cc=Yuantian.Tang@freescale.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mturquette@baylibre.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@codeaurora.org \
--cc=viresh.kumar@linaro.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).