From: Akari Tsuyukusa <akkun11.open@gmail.com>
To: mturquette@baylibre.com, sboyd@kernel.org,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Akari Tsuyukusa <akkun11.open@gmail.com>
Subject: [PATCH 1/3] clk: mediatek: clk-mtk: Add cpumux support to common probe/remove helpers
Date: Thu, 5 Mar 2026 03:10:22 +0900 [thread overview]
Message-ID: <20260304181024.738391-2-akkun11.open@gmail.com> (raw)
In-Reply-To: <20260304181024.738391-1-akkun11.open@gmail.com>
Extend __mtk_clk_simple_probe() and __mtk_clk_simple_remove() to support
cpumux clocks. This reduces boilerplate code in drivers for SoCs that
require cpumux registration, such as mt6795-infracfg.
Signed-off-by: Akari Tsuyukusa <akkun11.open@gmail.com>
---
drivers/clk/mediatek/clk-mtk.c | 18 +++++++++++++++++-
drivers/clk/mediatek/clk-mtk.h | 2 ++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c
index 3dfdd3a422f8..8148c21e6099 100644
--- a/drivers/clk/mediatek/clk-mtk.c
+++ b/drivers/clk/mediatek/clk-mtk.c
@@ -19,6 +19,7 @@
#include "clk-mtk.h"
#include "clk-gate.h"
#include "clk-mux.h"
+#include "clk-cpumux.h"
const struct mtk_gate_regs cg_regs_dummy = { 0, 0, 0 };
EXPORT_SYMBOL_GPL(cg_regs_dummy);
@@ -513,6 +514,7 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
num_clks = mcd->num_clks + mcd->num_composite_clks;
num_clks += mcd->num_fixed_clks + mcd->num_factor_clks;
num_clks += mcd->num_mux_clks + mcd->num_divider_clks;
+ num_clks += mcd->num_cpumuxes;
clk_data = mtk_alloc_clk_data(num_clks);
if (!clk_data) {
@@ -542,6 +544,13 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
goto unregister_factors;
}
+ if (mcd->cpumuxes) {
+ r = mtk_clk_register_cpumuxes(&pdev->dev, node, mcd->cpumuxes,
+ mcd->num_cpumuxes, clk_data);
+ if (r)
+ goto unregister_muxes;
+ }
+
if (mcd->composite_clks) {
/* We don't check composite_lock because it's optional */
r = mtk_clk_register_composites(&pdev->dev,
@@ -549,7 +558,7 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
mcd->num_composite_clks,
base, mcd->clk_lock, clk_data);
if (r)
- goto unregister_muxes;
+ goto unregister_cpumuxes;
}
if (mcd->divider_clks) {
@@ -605,6 +614,10 @@ static int __mtk_clk_simple_probe(struct platform_device *pdev,
if (mcd->composite_clks)
mtk_clk_unregister_composites(mcd->composite_clks,
mcd->num_composite_clks, clk_data);
+unregister_cpumuxes:
+ if (mcd->cpumuxes)
+ mtk_clk_unregister_cpumuxes(mcd->cpumuxes,
+ mcd->num_cpumuxes, clk_data);
unregister_muxes:
if (mcd->mux_clks)
mtk_clk_unregister_muxes(mcd->mux_clks,
@@ -643,6 +656,9 @@ static void __mtk_clk_simple_remove(struct platform_device *pdev,
if (mcd->composite_clks)
mtk_clk_unregister_composites(mcd->composite_clks,
mcd->num_composite_clks, clk_data);
+ if (mcd->cpumuxes)
+ mtk_clk_unregister_cpumuxes(mcd->cpumuxes,
+ mcd->num_cpumuxes, clk_data);
if (mcd->mux_clks)
mtk_clk_unregister_muxes(mcd->mux_clks,
mcd->num_mux_clks, clk_data);
diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
index 5417b9264e6d..02fab4b166f2 100644
--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -252,6 +252,8 @@ struct mtk_clk_desc {
size_t num_factor_clks;
const struct mtk_mux *mux_clks;
size_t num_mux_clks;
+ const struct mtk_composite *cpumuxes;
+ size_t num_cpumuxes;
const struct mtk_clk_rst_desc *rst_desc;
spinlock_t *clk_lock;
bool shared_io;
--
2.52.0
next prev parent reply other threads:[~2026-03-04 18:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 18:10 [PATCH 0/3] Refactor infracfg drivers to be able to use common helpers Akari Tsuyukusa
2026-03-04 18:10 ` Akari Tsuyukusa [this message]
2026-03-09 5:25 ` [PATCH 1/3] clk: mediatek: clk-mtk: Add cpumux support to common probe/remove helpers Chen-Yu Tsai
2026-03-04 18:10 ` [PATCH 2/3] clk: mediatek: mt6795-infracfg: Switch " Akari Tsuyukusa
2026-03-04 18:10 ` [PATCH 3/3] clk: mediatek: mt7622-infracfg: " Akari Tsuyukusa
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=20260304181024.738391-2-akkun11.open@gmail.com \
--to=akkun11.open@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.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