Re: [PATCH 1/2] clk: samsung: acpm: introduce driver data for SoC-specific clocks

From: Tudor Ambarus

Date: Mon May 18 2026 - 07:14:03 EST




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@xxxxxxxxxx>
> ---
> 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@xxxxxxxxxx>

> {}
> };
> MODULE_DEVICE_TABLE(platform, acpm_clk_id);
>