From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 04/12] clk: Add regmap core helpers for enable/disable/is_enabled
Date: Fri, 20 Dec 2013 22:15:49 -0800 [thread overview]
Message-ID: <20131221061549.GD31766@codeaurora.org> (raw)
In-Reply-To: <20131219045050.23538.94293@quantum>
On 12/18, Mike Turquette wrote:
> Quoting Stephen Boyd (2013-10-16 00:40:06)
> > struct clk_hw {
> > struct clk *clk;
> > const struct clk_init_data *init;
> > struct regmap *regmap;
> > + unsigned int enable_reg;
> > + unsigned int enable_mask;
> > + bool enable_is_inverted;
>
> Thanks for submitting this patch.
>
> Adding all of this stuff to struct clk_hw makes me a sad panda. You are
> essentially sharing a common set of ops for clocks that use regmap as
> their io operation back-end, and that is a good thing.
>
> However, why not just do this as drivers/clk/clk-regmap.c, or
> drivers/clk/clk-gate-regmap.c?
These new members aren't exclusively for use by the regmap code.
For example, we could extend the gate clock implementation to
store the enable bit in the 'enable_mask' member. They also
aren't used exclusively by simple gates. If you look at this
patch series you'll see that I call the helpers from hardware
specific ops when I want to do the gate operation in addition to
something else like polling a status bit.
What is the concern though? I can only guess that perhaps not
every clock type will have a bit to toggle and so putting the
information here would unnecessarily penalize those clocks? How
many clocks in a particular system don't have an on/off
capability? On MSM hardware I can only count 5 or so out of 200
that don't have on/off capabilities so it didn't seem worth the
effort to have a struct inside a struct inside a struct just to
save a 100 bytes of data.
If I understand you, I could make clk-regmap.c and struct
clk_regmap like so:
struct clk_regmap {
struct regmap *regmap;
unsigned int enable_reg;
unsigned int enable_mask;
bool enable_is_inverted;
struct clk_hw hw;
};
int clk_is_enabled_regmap(struct clk_hw *hw)
{
...
That certainly avoids adding members to struct clk_hw, but it
also means that if we want to use this structure and augment it
with something like a status bit poll we need to make a third
structure to wrap the clk_regmap struct. That makes me a sad
panda.
The reason is because we'll need to add a registration function
like clk_regmap_register(). I would like to just have an array of
clk_hw pointers that I iterate through and call clk_register()
on, without having to think/worry that this clock is a basic
clock that doesn't use a regmap so I should call clk_register()
and this other clock is wrapping a clk_regmap struct so I need to
call clk_regmap_register(). I guess I could have more arrays or
pair the clk_hw pointers with some registration function pointer,
but that doesn't make me feel much better.
> Putting the clk_ops callback functions in
> drivers/clk/clk.c is a little weird and putting those struct members
> into struct clk_hw is definitely strange.
In the regulator framework we have helpers.c. I could make a
similar file for these very similar helpers.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
next prev parent reply other threads:[~2013-12-21 6:15 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 7:40 [PATCH v3 00/12] Add support for MSM's mmio clock/reset controller Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 01/12] clk: Fix debugfs reparenting NULL pointer dereference Stephen Boyd
2013-12-15 3:24 ` Mike Turquette
2013-10-16 7:40 ` [PATCH v3 02/12] reset: Silence warning in reset-controller.h Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 03/12] clk: Allow drivers to pass in a regmap Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 04/12] clk: Add regmap core helpers for enable/disable/is_enabled Stephen Boyd
2013-12-19 4:50 ` Mike Turquette
2013-12-19 20:24 ` Gerhard Sittig
2013-12-24 13:45 ` Gerhard Sittig
2013-12-21 6:15 ` Stephen Boyd [this message]
2013-10-16 7:40 ` [PATCH v3 05/12] clk: Add set_rate_and_parent() op Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 06/12] clk: msm: Add support for phase locked loops (PLLs) Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 07/12] clk: msm: Add support for root clock generators (RCGs) Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 08/12] clk: msm: Add support for branches/gate clocks Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 09/12] clk: msm: Add reset controller support Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 10/12] clk: msm: Add support for MSM8960's global clock controller (GCC) Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 11/12] clk: msm: Add support for MSM8960's multimedia clock controller (MMCC) Stephen Boyd
2013-10-16 7:40 ` [PATCH v3 12/12] clk: msm: Add support for MSM8974's global clock controller (GCC) Stephen Boyd
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=20131221061549.GD31766@codeaurora.org \
--to=sboyd@codeaurora.org \
--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).