From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Alexey Klimov <alexey.klimov@linaro.org>,
Sam Protsenko <semen.protsenko@linaro.org>,
Krzysztof Kozlowski <krzk@kernel.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Alim Akhtar <alim.akhtar@samsung.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Brian Masney <bmasney@redhat.com>
Cc: linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] clk: samsung: acpm: introduce driver data for SoC-specific clocks
Date: Mon, 18 May 2026 13:57:11 +0300 [thread overview]
Message-ID: <1c41ecc9-d951-45df-b933-1934e1381663@linaro.org> (raw)
In-Reply-To: <20260512-exynos850-acpm-clk-v1-1-837532ddbf38@linaro.org>
On 5/12/26 11:40 PM, Alexey Klimov wrote:
> Currently, the ACPM clock driver hardcodes the GS101 clock variant
> arrays and counts directly in probe() routine. To support additional
> other SoCs (for instance Exynos850 SoC) that use the same ACPM protocol
> but have different clock trees, the driver needs to be more flexible.
>
> Introduce driver data attached to the platform_device_id table.
> Update the probe function to dynamically extract the clock lists,
> number of clocks, its names and mailbox channel id based on the matching
> device ID.
>
> Signed-off-by: Alexey Klimov <alexey.klimov@linaro.org>
> ---
> drivers/clk/samsung/clk-acpm.c | 17 ++++++++++++-----
> 1 file changed, 12 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clk/samsung/clk-acpm.c b/drivers/clk/samsung/clk-acpm.c
> index d8944160793a..604604b5b814 100644
> --- a/drivers/clk/samsung/clk-acpm.c
> +++ b/drivers/clk/samsung/clk-acpm.c
> @@ -113,6 +113,8 @@ static int acpm_clk_register(struct device *dev, struct acpm_clk *aclk,
>
> static int acpm_clk_probe(struct platform_device *pdev)
> {
> + const struct acpm_clk_driver_data *drv_data;
> + const struct platform_device_id *id;
> struct acpm_handle *acpm_handle;
> struct clk_hw_onecell_data *clk_data;
> struct clk_hw **hws;
> @@ -126,8 +128,14 @@ static int acpm_clk_probe(struct platform_device *pdev)
> return dev_err_probe(dev, PTR_ERR(acpm_handle),
> "Failed to get acpm handle\n");
>
> - count = acpm_clk_gs101.nr_clks;
> - mbox_chan_id = acpm_clk_gs101.mbox_chan_id;
> + id = platform_get_device_id(pdev);
> + if (!id || !id->driver_data)
> + return -ENODEV;
> +
> + drv_data = (const struct acpm_clk_driver_data *)id->driver_data;
> +
> + count = drv_data->nr_clks;
> + mbox_chan_id = drv_data->mbox_chan_id;
>
> clk_data = devm_kzalloc(dev, struct_size(clk_data, hws, count),
> GFP_KERNEL);
> @@ -154,8 +162,7 @@ static int acpm_clk_probe(struct platform_device *pdev)
>
> hws[i] = &aclk->hw;
>
> - err = acpm_clk_register(dev, aclk,
> - acpm_clk_gs101.clks[i].name);
> + err = acpm_clk_register(dev, aclk, drv_data->clks[i].name);
> if (err)
> return dev_err_probe(dev, err,
> "Failed to register clock\n");
> @@ -166,7 +173,7 @@ static int acpm_clk_probe(struct platform_device *pdev)
> }
>
> static const struct platform_device_id acpm_clk_id[] = {
> - { "gs101-acpm-clk" },
> + { "gs101-acpm-clk", (kernel_ulong_t)&acpm_clk_gs101 },
you need to include linux/mod_devicetable.h for kernel_ulong_t.
With that:
Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org>
> {}
> };
> MODULE_DEVICE_TABLE(platform, acpm_clk_id);
>
next prev parent reply other threads:[~2026-05-18 10:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-12 20:40 [PATCH 0/2] Initial support for Exynos850 SoC in ACPM clk driver Alexey Klimov
2026-05-12 20:40 ` [PATCH 1/2] clk: samsung: acpm: introduce driver data for SoC-specific clocks Alexey Klimov
2026-05-18 10:57 ` Tudor Ambarus [this message]
2026-05-12 20:40 ` [PATCH 2/2] clk: samsung: acpm: add initial Exynos850 support Alexey Klimov
2026-05-18 11:03 ` Tudor Ambarus
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=1c41ecc9-d951-45df-b933-1934e1381663@linaro.org \
--to=tudor.ambarus@linaro.org \
--cc=alexey.klimov@linaro.org \
--cc=alim.akhtar@samsung.com \
--cc=bmasney@redhat.com \
--cc=cw00.choi@samsung.com \
--cc=krzk@kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
--cc=semen.protsenko@linaro.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 read-only IMAP folder(s) and NNTP newsgroup(s).