linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mturquette@ti.com (Mike Turquette)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/5] clk: samsung: add common clock framework support for Samsung platforms
Date: Tue, 30 Oct 2012 09:30:12 -0700	[thread overview]
Message-ID: <20121030163012.18780.19304@nucleus> (raw)
In-Reply-To: <1349629855-4962-2-git-send-email-thomas.abraham@linaro.org>

Hi Thomas,

Quoting Thomas Abraham (2012-10-07 10:10:51)
> +/* determine the output clock speed of the pll */
> +static unsigned long samsung_pll_clock_recalc_rate(struct clk_hw *hw,
> +                               unsigned long parent_rate)
> +{
> +       struct samsung_pll_clock *clk_pll = to_clk_pll(hw);
> +
> +       if (clk_pll->get_rate)
> +               return to_clk_pll(hw)->get_rate(parent_rate);

Why the extra indirection?  Does your samsung_pll_clock abstract several
different PLL implementations (with separate clock ops)?  If so, why not
make a unique struct for each PLL type?

> +
> +       return 0;
> +}
> +
> +/* round operation not supported */
> +static long samsung_pll_clock_round_rate(struct clk_hw *hw, unsigned long drate,
> +                               unsigned long *prate)
> +{
> +       return samsung_pll_clock_recalc_rate(hw, *prate);

Why is round_rate not supported?  How is returning the recalculated rate
the right thing here?

> +/*
> + * Allow platform specific implementations to attach set_rate and get_rate
> + * callbacks for the pll type clock. Typical calling sequence..
> + *
> + * struct clk *clk = clk_get(NULL, "pll-clk-name");
> + * samsung_pll_clk_set_cb(clk, pll_set_rate, pll_get_rate);
> + */
> +void __init samsung_pll_clk_set_cb(struct clk *clk,
> +                       int (*set_rate)(unsigned long rate),
> +                       unsigned long (*get_rate)(unsigned long rate))
> +{
> +       struct samsung_pll_clock *clk_pll;
> +       struct clk_hw *hw = __clk_get_hw(clk);
> +
> +       clk_pll = to_clk_pll(hw);
> +       clk_pll->set_rate = set_rate;
> +       clk_pll->get_rate = get_rate;
> +}

This answers my questions above having different PLL types.  Why not
just make seprate clk_hw structs for each PLL type instead of the extra
layer of abstraction + runtime assignment of clk ops?

Regards,
Mike

  parent reply	other threads:[~2012-10-30 16:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-07 17:10 [PATCH v2 0/5] clk: exynos4: migrate to common clock framework Thomas Abraham
2012-10-07 17:10 ` [PATCH v2 1/5] clk: samsung: add common clock framework support for Samsung platforms Thomas Abraham
2012-10-22 15:55   ` Sylwester Nawrocki
2012-10-29 10:09     ` Thomas Abraham
2012-10-30 23:10       ` Sylwester Nawrocki
2012-10-30 23:32         ` Tomasz Figa
2012-11-05  7:41           ` Thomas Abraham
2012-11-05  7:36         ` Thomas Abraham
2012-10-30 16:30   ` Mike Turquette [this message]
2012-11-05  7:22     ` Thomas Abraham
2012-10-07 17:10 ` [PATCH v2 2/5] clk: exynos4: register clocks using common clock framework Thomas Abraham
2012-10-08  7:54   ` Tomasz Figa
2012-11-14  5:14   ` Kukjin Kim
2012-10-07 17:10 ` [PATCH v2 3/5] ARM: dts: Add Exynos4210 clock nodes Thomas Abraham
2012-10-07 17:10 ` [PATCH v2 4/5] ARM: dts: list the clock providers for serial ports Thomas Abraham
2012-10-07 17:10 ` [PATCH v2 5/5] ARM: Exynos4: Migrate clock support to common clock framework Thomas Abraham
2012-11-14  5:25   ` Kukjin Kim
2012-11-14  5:26   ` Kukjin Kim

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=20121030163012.18780.19304@nucleus \
    --to=mturquette@ti.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).