From: "Yu-Chun Lin [林祐君]" <eleanor.lin@realtek.com>
To: Brian Masney <bmasney@redhat.com>
Cc: "mturquette@baylibre.com" <mturquette@baylibre.com>,
"sboyd@kernel.org" <sboyd@kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"Edgar Lee [李承諭]" <cylee12@realtek.com>,
"afaerber@suse.com" <afaerber@suse.com>,
"Jyan Chou [周芷安]" <jyanchou@realtek.com>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-realtek-soc@lists.infradead.org"
<linux-realtek-soc@lists.infradead.org>,
"James Tai [戴志峰]" <james.tai@realtek.com>,
"CY_Huang[黃鉦晏]" <cy.huang@realtek.com>,
"Stanley Chang[昌育德]" <stanley_chang@realtek.com>
Subject: RE: [PATCH v13 04/11] clk: realtek: Introduce common probe() and remove()
Date: Fri, 28 Aug 2026 06:39:05 +0000 [thread overview]
Message-ID: <9642b853a9c24ba6b11c81e95341bfbd@realtek.com> (raw)
In-Reply-To: <aoxv9PJd6r_8DaNA@redhat.com>
Hi Brian,
> Hi Yu-Chun,
>
...
> > +int rtk_clk_probe(struct platform_device *pdev, const struct
> > +rtk_clk_desc *desc) {
> > + struct device *dev = &pdev->dev;
> > + struct regmap *regmap;
> > + struct clk_hw *hw;
> > + int i, ret;
> > +
> > + regmap = device_node_to_regmap(dev->of_node);
>
> Looking at the Sashiko comments for this series. device_node_to_regmap() has
> this note in drivers/mfd/syscon.c:
>
> /**
> * device_node_to_regmap() - Get or create a regmap for specified device
> node
> * @np: Device tree node
> *
> * Get a regmap for the specified device node. If there's not an existing
> * regmap, then one is instantiated. This function should not be used if the
> * device node has a custom regmap driver or has resources (clocks, resets) to
> * be managed. Use syscon_node_to_regmap() instead for those cases.
> *
> * Return: regmap ptr on success, negative error code on failure.
> */
>
> Should this be moved to syscon_node_to_regmap()?
>
You are right that using device_node_to_regmap() is inappropriate here.
However, these clock domains have their own dedicated registers and are not
shared with any other drivers.
I will drop device_node_to_regmap() and initialize the regmap via
devm_regmap_init_mmio() instead. Since they all share the exact same register
format, I will define a shared regmap_config in clk-rtk-common.c.
> > + if (IS_ERR(regmap))
> > + return dev_err_probe(dev, PTR_ERR(regmap), "failed to
> > + get regmap\n");
> > +
> > + for (i = 0; i < desc->num_clks; i++)
> > + desc->clks[i]->regmap = regmap;
> > +
> > + for (i = 0; i < desc->clk_data->num; i++) {
> > + hw = desc->clk_data->hws[i];
> > + if (!hw)
> > + continue;
> > +
> > + ret = devm_clk_hw_register(dev, hw);
> > + if (ret)
> > + return dev_err_probe(dev, ret, "failed to register
> hw of clk%d\n", i);
> > + }
> > +
> > + ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get,
> > + desc->clk_data);
> > + if (ret)
> > + return dev_err_probe(dev, ret, "failed to add clock
> > + provider\n");
> > +
> > + platform_set_drvdata(pdev, (void *)desc);
> > +
> > + return rtk_reset_controller_register(dev, desc->aux_name,
> > +regmap); } EXPORT_SYMBOL_NS_GPL(rtk_clk_probe, "CLK_REALTEK");
> > +
> > +void rtk_clk_remove(struct platform_device *pdev) {
> > + const struct rtk_clk_desc *desc = platform_get_drvdata(pdev);
> > +
> > + if (!desc)
> > + return;
> > +
> > + for (int i = 0; i < desc->num_clks; i++)
> > + desc->clks[i]->regmap = NULL;
>
> Looking at the Sashiko comments, is this remove callback really needed?
>
Will drop.
Best Regards,
Yu-Chun
> Brian
next prev parent reply other threads:[~2026-08-28 6:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-12 1:59 [PATCH v13 00/11] clk / reset: realtek: Add RTD1625 clock and reset support Yu-Chun Lin
2026-08-12 1:59 ` [PATCH v13 01/11] dt-bindings: clock: Add Realtek RTD1625 Clock & Reset Controller Yu-Chun Lin
2026-08-12 8:48 ` Krzysztof Kozlowski
2026-08-12 9:41 ` Yu-Chun Lin [林祐君]
2026-08-12 9:49 ` Krzysztof Kozlowski
2026-08-12 10:22 ` Yu-Chun Lin [林祐君]
2026-08-12 12:49 ` Krzysztof Kozlowski
2026-08-13 12:27 ` Yu-Chun Lin [林祐君]
2026-08-13 13:49 ` Krzysztof Kozlowski
2026-08-12 2:00 ` [PATCH v13 02/11] reset: Add Realtek basic reset support Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 03/11] reset: realtek: Add RTD1625 reset controller driver Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 04/11] clk: realtek: Introduce common probe() and remove() Yu-Chun Lin
2026-08-24 16:23 ` Brian Masney
2026-08-28 6:39 ` Yu-Chun Lin [林祐君] [this message]
2026-08-12 2:00 ` [PATCH v13 05/11] clk: realtek: Add support for phase locked loops (PLLs) Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 06/11] clk: realtek: Add support for gate clock Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 07/11] clk: realtek: Add support for mux clock Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 08/11] clk: realtek: Add support for MMC-tuned PLL clocks Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 09/11] clk: realtek: Add RTD1625-CRT clock controller driver Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 10/11] clk: realtek: Add RTD1625-ISO " Yu-Chun Lin
2026-08-12 2:00 ` [PATCH v13 11/11] arm64: dts: realtek: Add clock support for RTD1625 Yu-Chun Lin
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=9642b853a9c24ba6b11c81e95341bfbd@realtek.com \
--to=eleanor.lin@realtek.com \
--cc=afaerber@suse.com \
--cc=bmasney@redhat.com \
--cc=conor+dt@kernel.org \
--cc=cy.huang@realtek.com \
--cc=cylee12@realtek.com \
--cc=devicetree@vger.kernel.org \
--cc=james.tai@realtek.com \
--cc=jyanchou@realtek.com \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-realtek-soc@lists.infradead.org \
--cc=mturquette@baylibre.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=stanley_chang@realtek.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