From: Tobias Schramm <t.schramm@manjaro.org>
To: Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Icenowy Zheng <icenowy@aosc.io>
Cc: Maxime Ripard <mripard@kernel.org>, Chen-Yu Tsai <wens@csie.org>,
Jernej Skrabec <jernej.skrabec@siol.net>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Tobias Schramm <t.schramm@manjaro.org>
Subject: [PATCH] clk: sunxi-ng: v3s: add support for variable rate audio pll output
Date: Fri, 12 Feb 2021 14:57:25 +0100 [thread overview]
Message-ID: <20210212135725.283877-1-t.schramm@manjaro.org> (raw)
Previously the variable rate audio pll output was fixed to a divider of
four. This is unfortunately incompatible with generating commonly used
I2S core clock rates like 24.576MHz from the 24MHz parent clock.
This commit adds support for arbitrary audio pll output dividers to fix
that.
Signed-off-by: Tobias Schramm <t.schramm@manjaro.org>
---
drivers/clk/sunxi-ng/ccu-sun8i-v3s.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
index 0e36ca3bf3d5..c6cf590b235a 100644
--- a/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
+++ b/drivers/clk/sunxi-ng/ccu-sun8i-v3s.c
@@ -36,12 +36,9 @@ static SUNXI_CCU_NKMP_WITH_GATE_LOCK(pll_cpu_clk, "pll-cpu",
0);
/*
- * The Audio PLL is supposed to have 4 outputs: 3 fixed factors from
- * the base (2x, 4x and 8x), and one variable divider (the one true
- * pll audio).
- *
- * We don't have any need for the variable divider for now, so we just
- * hardcode it to match with the clock names
+ * The Audio PLL has 4 outputs: 3 fixed factors from the base (2x, 4x and 8x),
+ * and one variable divider (the one true pll audio).
+ * The variable rate output is supported via a a separate divider below.
*/
#define SUN8I_V3S_PLL_AUDIO_REG 0x008
@@ -53,6 +50,11 @@ static SUNXI_CCU_NM_WITH_GATE_LOCK(pll_audio_base_clk, "pll-audio-base",
BIT(28), /* lock */
0);
+static SUNXI_CCU_M(pll_audio_clk, "pll-audio",
+ "pll-audio-base", 0x008,
+ 16, 4, /* P from audio pll */
+ CLK_SET_RATE_PARENT);
+
static SUNXI_CCU_NM_WITH_FRAC_GATE_LOCK(pll_video_clk, "pll-video",
"osc24M", 0x0010,
8, 7, /* N */
@@ -377,6 +379,7 @@ static SUNXI_CCU_M_WITH_MUX_GATE(mipi_csi_clk, "mipi-csi", mipi_csi_parents,
static struct ccu_common *sun8i_v3s_ccu_clks[] = {
&pll_cpu_clk.common,
&pll_audio_base_clk.common,
+ &pll_audio_clk.common,
&pll_video_clk.common,
&pll_ve_clk.common,
&pll_ddr0_clk.common,
@@ -453,6 +456,7 @@ static const struct clk_hw *clk_parent_pll_audio[] = {
static struct ccu_common *sun8i_v3_ccu_clks[] = {
&pll_cpu_clk.common,
&pll_audio_base_clk.common,
+ &pll_audio_clk.common,
&pll_video_clk.common,
&pll_ve_clk.common,
&pll_ddr0_clk.common,
@@ -524,10 +528,6 @@ static struct ccu_common *sun8i_v3_ccu_clks[] = {
&mipi_csi_clk.common,
};
-/* We hardcode the divider to 4 for now */
-static CLK_FIXED_FACTOR_HWS(pll_audio_clk, "pll-audio",
- clk_parent_pll_audio,
- 4, 1, CLK_SET_RATE_PARENT);
static CLK_FIXED_FACTOR_HWS(pll_audio_2x_clk, "pll-audio-2x",
clk_parent_pll_audio,
2, 1, CLK_SET_RATE_PARENT);
@@ -545,7 +545,7 @@ static struct clk_hw_onecell_data sun8i_v3s_hw_clks = {
.hws = {
[CLK_PLL_CPU] = &pll_cpu_clk.common.hw,
[CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw,
- [CLK_PLL_AUDIO] = &pll_audio_clk.hw,
+ [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw,
[CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw,
[CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw,
[CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw,
@@ -625,7 +625,7 @@ static struct clk_hw_onecell_data sun8i_v3_hw_clks = {
.hws = {
[CLK_PLL_CPU] = &pll_cpu_clk.common.hw,
[CLK_PLL_AUDIO_BASE] = &pll_audio_base_clk.common.hw,
- [CLK_PLL_AUDIO] = &pll_audio_clk.hw,
+ [CLK_PLL_AUDIO] = &pll_audio_clk.common.hw,
[CLK_PLL_AUDIO_2X] = &pll_audio_2x_clk.hw,
[CLK_PLL_AUDIO_4X] = &pll_audio_4x_clk.hw,
[CLK_PLL_AUDIO_8X] = &pll_audio_8x_clk.hw,
--
2.30.0
next reply other threads:[~2021-02-12 14:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-12 13:57 Tobias Schramm [this message]
2021-02-18 7:58 ` Maxime Ripard
2021-02-18 8:04 ` Icenowy Zheng
2021-02-18 8:08 ` Chen-Yu Tsai
2021-02-18 9:18 ` Tobias Schramm
2021-02-18 9:21 ` Icenowy Zheng
2021-02-18 9:44 ` Maxime Ripard
2021-02-18 8:51 ` Tobias Schramm
2021-02-18 8:53 ` Tobias Schramm
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=20210212135725.283877-1-t.schramm@manjaro.org \
--to=t.schramm@manjaro.org \
--cc=icenowy@aosc.io \
--cc=jernej.skrabec@siol.net \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mripard@kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.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
all inboxes | Powered by JetHome®