From: Maxime Ripard <maxime.ripard@free-electrons.com>
To: Jean-Francois Moine <moinejf@free.fr>
Cc: Emilio Lopez <emilio@elopez.com.ar>, Chen-Yu Tsai <wens@csie.org>,
Stephen Boyd <sboyd@codeaurora.org>,
linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH 3/3] clk: sunxi: Add sun8i PLL audio support
Date: Sun, 10 Apr 2016 02:53:22 -0700 [thread overview]
Message-ID: <20160410095322.GZ4227@lukather> (raw)
In-Reply-To: <8ba2e0d78c70ea4c54fb25969956fc31674df612.1459358017.git.moinejf@free.fr>
[-- Attachment #1: Type: text/plain, Size: 3051 bytes --]
Hi,
On Wed, Mar 30, 2016 at 06:57:16PM +0200, Jean-Francois Moine wrote:
> Add the PLL type which is used by the sun8i family for audio.
>
> Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
> ---
> Documentation/devicetree/bindings/clock/sunxi.txt | 1 +
> drivers/clk/sunxi/clk-sunxi.c | 48 +++++++++++++++++++++++
> 2 files changed, 49 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/clock/sunxi.txt b/Documentation/devicetree/bindings/clock/sunxi.txt
> index ff93aee..917d4aa 100644
> --- a/Documentation/devicetree/bindings/clock/sunxi.txt
> +++ b/Documentation/devicetree/bindings/clock/sunxi.txt
> @@ -10,6 +10,7 @@ Required properties:
> "allwinner,sun4i-a10-pll1-clk" - for the main PLL clock and PLL4
> "allwinner,sun6i-a31-pll1-clk" - for the main PLL clock on A31
> "allwinner,sun8i-a23-pll1-clk" - for the main PLL clock on A23
> + "allwinner,sun8i-pll2-clk" - for the audio PLL clock
You should mention the name of the first SoC that introduced it.
> "allwinner,sun6i-a31-pll3-clk" - for the video PLL clock
> "allwinner,sun9i-a80-pll4-clk" - for the peripheral PLLs on A80
> "allwinner,sun4i-a10-pll5-clk" - for the PLL5 clock
> diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
> index 270f2a9..7386141 100644
> --- a/drivers/clk/sunxi/clk-sunxi.c
> +++ b/drivers/clk/sunxi/clk-sunxi.c
> @@ -1130,6 +1130,54 @@ CLK_OF_DECLARE(sun6i_pll6, "allwinner,sun6i-a31-pll6-clk",
> sun6i_pll6_clk_setup);
>
> /*
> + * sun8i pll2
> + *
> + * rate = parent_rate / (m + 1) * (n + 1) / (p + 1);
^ I'm guessing it's a "*" instead?
> + */
> +static void sun8i_pll2_factors(struct factors_request *req)
> +{
> + unsigned long n, m;
> +
> + /* set p = 4 so that pll2 = pll2x8 / 8 */
> + req->p = 4 - 1;
> + rational_best_approximation(req->rate,
> + req->parent_rate / 4,
> + 1 << 7, 1 << 5, &n, &m);
> + req->rate = req->parent_rate / m * n / 4;
> + req->m = m - 1;
> + req->n = n - 1;
> +}
> +
> +static void sun8i_pll2_recalc(struct factors_request *req)
> +{
> + req->rate = req->parent_rate / (req->m + 1) * (req->n + 1) /
> + (req->p + 1);
> +}
> +
> +static const struct clk_factors_config sun8i_pll2_config = {
> + .mshift = 0,
> + .mwidth = 5,
> + .nshift = 8,
> + .nwidth = 7,
> + .pshift = 16,
> + .pwidth = 4,
> +};
> +
> +static const struct factors_data sun8i_pll2_data __initconst = {
> + .enable = 31,
> + .table = &sun8i_pll2_config,
> + .getter = sun8i_pll2_factors,
> + .recalc = sun8i_pll2_recalc,
> +};
> +
> +static void __init sun8i_pll2_setup(struct device_node *node)
> +{
> + sunxi_factors_clk_setup(node, &sun8i_pll2_data);
> +}
> +CLK_OF_DECLARE(sun8i_pll2, "allwinner,sun8i-pll2-clk",
> + sun8i_pll2_setup);
How do you plan on supporting the multiple pll2 output?
Thanks,
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-10 9:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-30 17:13 [PATCH 0/3] clk: sunxi: Add the clocks used for audio/video on sun8i Jean-Francois Moine
[not found] ` <cover.1459358017.git.moinejf-GANU6spQydw@public.gmane.org>
2016-03-30 16:43 ` [PATCH 1/3] clk: sunxi: Add sun6i/8i display support Jean-Francois Moine
[not found] ` <2b347763e38cfeeb7a2d6af6357eaea6c4ec07ac.1459358017.git.moinejf-GANU6spQydw@public.gmane.org>
2016-04-01 17:05 ` Rob Herring
2016-04-10 9:40 ` Maxime Ripard
2016-03-30 16:50 ` [PATCH 2/3] clk: sunxi: Add sun6i/8i PLL video support Jean-Francois Moine
2016-04-01 17:07 ` Rob Herring
[not found] ` <e63499f789971b8c45a0ae5e90bd127371cbcf19.1459358017.git.moinejf-GANU6spQydw@public.gmane.org>
2016-04-10 9:50 ` Maxime Ripard
2016-04-10 17:11 ` Jean-Francois Moine
2016-03-30 16:57 ` [PATCH 3/3] clk: sunxi: Add sun8i PLL audio support Jean-Francois Moine
2016-04-01 17:08 ` Rob Herring
2016-04-10 9:53 ` Maxime Ripard [this message]
2016-04-10 16:55 ` Jean-Francois Moine
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=20160410095322.GZ4227@lukather \
--to=maxime.ripard@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=emilio@elopez.com.ar \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=moinejf@free.fr \
--cc=sboyd@codeaurora.org \
--cc=wens@csie.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).