From: "Benoît Monin" <benoit.monin@bootlin.com>
To: "Vladimir Kondratiev" <vladimir.kondratiev@mobileye.com>,
"Gregory CLEMENT" <gregory.clement@bootlin.com>,
"Théo Lebrun" <theo.lebrun@bootlin.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Michael Turquette" <mturquette@baylibre.com>,
"Stephen Boyd" <sboyd@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Paul Walmsley" <pjw@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Alexandre Ghiti" <alex@ghiti.fr>
Cc: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
"Tawfik Bayouk" <tawfik.bayouk@mobileye.com>,
linux-riscv@lists.infradead.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
linux-mips@vger.kernel.org,
"Benoît Monin" <benoit.monin@bootlin.com>,
"Brian Masney" <bmasney@redhat.com>
Subject: [PATCH v5 04/10] clk: fixed-factor: Export __clk_hw_register_fixed_factor()
Date: Tue, 17 Mar 2026 14:33:06 +0100 [thread overview]
Message-ID: <20260317-clk-eyeq7-v5-4-6f6daa2c2367@bootlin.com> (raw)
In-Reply-To: <20260317-clk-eyeq7-v5-0-6f6daa2c2367@bootlin.com>
Make the base registration function for fixed-factor clocks public and
re-implement the various registration functions that are a direct call
to __clk_hw_register_fixed_factor() as macros.
This is similar to how the registration functions of divider, mux and
other clocks are implemented.
Add a new macro clk_hw_register_fixed_factor_pdata() to register
a fixed-factor clock with its parent clock passed as a struct
clk_parent_data.
Reviewed-by: Brian Masney <bmasney@redhat.com>
Signed-off-by: Benoît Monin <benoit.monin@bootlin.com>
---
drivers/clk/clk-fixed-factor.c | 52 ++-------------------------------------
include/linux/clk-provider.h | 56 +++++++++++++++++++++++++++++++++---------
2 files changed, 46 insertions(+), 62 deletions(-)
diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c
index 359e91441c74..6116f878fc8f 100644
--- a/drivers/clk/clk-fixed-factor.c
+++ b/drivers/clk/clk-fixed-factor.c
@@ -90,7 +90,7 @@ static void devm_clk_hw_register_fixed_factor_release(struct device *dev, void *
clk_hw_unregister(&fix->hw);
}
-static struct clk_hw *
+struct clk_hw *
__clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
const char *name, const char *parent_name,
const struct clk_hw *parent_hw, const struct clk_parent_data *pdata,
@@ -148,6 +148,7 @@ __clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
return hw;
}
+EXPORT_SYMBOL_GPL(__clk_hw_register_fixed_factor);
/**
* devm_clk_hw_register_fixed_factor_index - Register a fixed factor clock with
@@ -173,46 +174,6 @@ struct clk_hw *devm_clk_hw_register_fixed_factor_index(struct device *dev,
}
EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor_index);
-/**
- * devm_clk_hw_register_fixed_factor_parent_hw - Register a fixed factor clock with
- * pointer to parent clock
- * @dev: device that is registering this clock
- * @name: name of this clock
- * @parent_hw: pointer to parent clk
- * @flags: fixed factor flags
- * @mult: multiplier
- * @div: divider
- *
- * Return: Pointer to fixed factor clk_hw structure that was registered or
- * an error pointer.
- */
-struct clk_hw *devm_clk_hw_register_fixed_factor_parent_hw(struct device *dev,
- const char *name, const struct clk_hw *parent_hw,
- unsigned long flags, unsigned int mult, unsigned int div)
-{
- return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw,
- NULL, flags, mult, div, 0, 0, true);
-}
-EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor_parent_hw);
-
-struct clk_hw *clk_hw_register_fixed_factor_parent_hw(struct device *dev,
- const char *name, const struct clk_hw *parent_hw,
- unsigned long flags, unsigned int mult, unsigned int div)
-{
- return __clk_hw_register_fixed_factor(dev, NULL, name, NULL, parent_hw,
- NULL, flags, mult, div, 0, 0, false);
-}
-EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor_parent_hw);
-
-struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
- const char *name, const char *parent_name, unsigned long flags,
- unsigned int mult, unsigned int div)
-{
- return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL,
- NULL, flags, mult, div, 0, 0, false);
-}
-EXPORT_SYMBOL_GPL(clk_hw_register_fixed_factor);
-
struct clk_hw *clk_hw_register_fixed_factor_fwname(struct device *dev,
struct device_node *np, const char *name, const char *fw_name,
unsigned long flags, unsigned int mult, unsigned int div)
@@ -286,15 +247,6 @@ void clk_hw_unregister_fixed_factor(struct clk_hw *hw)
}
EXPORT_SYMBOL_GPL(clk_hw_unregister_fixed_factor);
-struct clk_hw *devm_clk_hw_register_fixed_factor(struct device *dev,
- const char *name, const char *parent_name, unsigned long flags,
- unsigned int mult, unsigned int div)
-{
- return __clk_hw_register_fixed_factor(dev, NULL, name, parent_name, NULL,
- NULL, flags, mult, div, 0, 0, true);
-}
-EXPORT_SYMBOL_GPL(devm_clk_hw_register_fixed_factor);
-
struct clk_hw *devm_clk_hw_register_fixed_factor_fwname(struct device *dev,
struct device_node *np, const char *name, const char *fw_name,
unsigned long flags, unsigned int mult, unsigned int div)
diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h
index 630705a47129..7a3de1009270 100644
--- a/include/linux/clk-provider.h
+++ b/include/linux/clk-provider.h
@@ -1146,13 +1146,16 @@ struct clk_fixed_factor {
#define to_clk_fixed_factor(_hw) container_of(_hw, struct clk_fixed_factor, hw)
extern const struct clk_ops clk_fixed_factor_ops;
+struct clk_hw *
+__clk_hw_register_fixed_factor(struct device *dev, struct device_node *np,
+ const char *name, const char *parent_name,
+ const struct clk_hw *parent_hw, const struct clk_parent_data *pdata,
+ unsigned long flags, unsigned int mult, unsigned int div,
+ unsigned long acc, unsigned int fixflags, bool devm);
struct clk *clk_register_fixed_factor(struct device *dev, const char *name,
const char *parent_name, unsigned long flags,
unsigned int mult, unsigned int div);
void clk_unregister_fixed_factor(struct clk *clk);
-struct clk_hw *clk_hw_register_fixed_factor(struct device *dev,
- const char *name, const char *parent_name, unsigned long flags,
- unsigned int mult, unsigned int div);
struct clk_hw *clk_hw_register_fixed_factor_fwname(struct device *dev,
struct device_node *np, const char *name, const char *fw_name,
unsigned long flags, unsigned int mult, unsigned int div);
@@ -1164,9 +1167,6 @@ struct clk_hw *clk_hw_register_fixed_factor_index(struct device *dev,
const char *name, unsigned int index, unsigned long flags,
unsigned int mult, unsigned int div);
void clk_hw_unregister_fixed_factor(struct clk_hw *hw);
-struct clk_hw *devm_clk_hw_register_fixed_factor(struct device *dev,
- const char *name, const char *parent_name, unsigned long flags,
- unsigned int mult, unsigned int div);
struct clk_hw *devm_clk_hw_register_fixed_factor_fwname(struct device *dev,
struct device_node *np, const char *name, const char *fw_name,
unsigned long flags, unsigned int mult, unsigned int div);
@@ -1178,13 +1178,45 @@ struct clk_hw *devm_clk_hw_register_fixed_factor_index(struct device *dev,
const char *name, unsigned int index, unsigned long flags,
unsigned int mult, unsigned int div);
-struct clk_hw *devm_clk_hw_register_fixed_factor_parent_hw(struct device *dev,
- const char *name, const struct clk_hw *parent_hw,
- unsigned long flags, unsigned int mult, unsigned int div);
+#define clk_hw_register_fixed_factor(dev, name, parent_name, \
+ flags, mult, div) \
+ __clk_hw_register_fixed_factor((dev), NULL, (name), (parent_name), \
+ NULL, NULL, (flags), (mult), (div), \
+ 0, 0, false)
+#define clk_hw_register_fixed_factor_pdata(dev, np, name, pdata, \
+ flags, mult, div, acc, fixflags) \
+ __clk_hw_register_fixed_factor((dev), (np), (name), NULL, NULL, \
+ (pdata), (flags), (mult), (div), \
+ (acc), (fixflags), false)
+#define devm_clk_hw_register_fixed_factor(dev, name, parent_name, flags, \
+ mult, div) \
+ __clk_hw_register_fixed_factor((dev), NULL, (name), (parent_name), \
+ NULL, NULL, (flags), (mult), (div), 0, \
+ 0, true)
+/**
+ * devm_clk_hw_register_fixed_factor_parent_hw - Register a fixed factor clock with
+ * pointer to parent clock
+ * @dev: device that is registering this clock
+ * @name: name of this clock
+ * @parent_hw: pointer to parent clk
+ * @flags: fixed factor flags
+ * @mult: multiplier
+ * @div: divider
+ *
+ * Return: Pointer to fixed factor clk_hw structure that was registered or
+ * an error pointer.
+ */
+#define devm_clk_hw_register_fixed_factor_parent_hw(dev, name, parent_hw, \
+ flags, mult, div) \
+ __clk_hw_register_fixed_factor((dev), NULL, (name), NULL, \
+ (parent_hw), NULL, (flags), (mult), \
+ (div), 0, 0, true)
-struct clk_hw *clk_hw_register_fixed_factor_parent_hw(struct device *dev,
- const char *name, const struct clk_hw *parent_hw,
- unsigned long flags, unsigned int mult, unsigned int div);
+#define clk_hw_register_fixed_factor_parent_hw(dev, name, parent_hw, flags, \
+ mult, div) \
+ __clk_hw_register_fixed_factor((dev), NULL, (name), NULL, \
+ (parent_hw), NULL, (flags), (mult), \
+ (div), 0, 0, false)
/**
* struct clk_fractional_divider - adjustable fractional divider clock
*
--
2.53.0
next prev parent reply other threads:[~2026-03-17 13:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 13:33 [PATCH v5 00/10] Add clock and reset support for Mobileye EyeQ7H Benoît Monin
2026-03-17 13:33 ` [PATCH v5 01/10] dt-bindings: soc: mobileye: Add EyeQ7H OLB Benoît Monin
2026-03-17 13:33 ` [PATCH v5 02/10] reset: eyeq: Add EyeQ7H compatibles Benoît Monin
2026-03-17 13:33 ` [PATCH v5 03/10] clk: fixed-factor: Rework initialization with parent clocks Benoît Monin
2026-03-17 13:33 ` Benoît Monin [this message]
2026-03-17 13:33 ` [PATCH v5 05/10] clk: eyeq: Prefix the PLL registers with the PLL type Benoît Monin
2026-03-17 13:33 ` [PATCH v5 06/10] clk: eyeq: Introduce a generic clock type Benoît Monin
2026-03-17 13:33 ` [PATCH v5 07/10] clk: eyeq: Convert clocks declaration to eqc_clock Benoît Monin
2026-03-17 13:33 ` [PATCH v5 08/10] clk: eyeq: Drop PLL, dividers, and fixed factors structs Benoît Monin
2026-03-17 13:33 ` [PATCH v5 09/10] clk: eyeq: Add EyeQ7H compatibles Benoît Monin
2026-03-17 13:33 ` [PATCH v5 10/10] MAINTAINERS: Add entry for Mobileye RISC-V SoCs Benoît Monin
2026-03-24 0:38 ` [PATCH v5 00/10] Add clock and reset support for Mobileye EyeQ7H Stephen Boyd
2026-03-25 12:48 ` Benoît Monin
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=20260317-clk-eyeq7-v5-4-6f6daa2c2367@bootlin.com \
--to=benoit.monin@bootlin.com \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=bmasney@redhat.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregory.clement@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=palmer@dabbelt.com \
--cc=pjw@kernel.org \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=tawfik.bayouk@mobileye.com \
--cc=theo.lebrun@bootlin.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=vladimir.kondratiev@mobileye.com \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).