Skip to content

Commit bad0d12

Browse files
ambaruskrzk
authored andcommitted
firmware: exynos-acpm: register ACPM clocks pdev
Register by hand a platform device for the ACPM clocks. The ACPM clocks are not modeled as a DT child of ACPM because: 1/ they don't have their own resources. 2/ they are not a block that can be reused. The clock identifying data is reduced (clock ID, clock name and mailbox channel ID) and may differ from a SoC to another. Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org> Reviewed-by: Peter Griffin <peter.griffin@linaro.org> Tested-by: Peter Griffin <peter.griffin@linaro.org> # on gs101-oriole Link: https://patch.msgid.link/20251010-acpm-clk-v6-3-321ee8826fd4@linaro.org Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
1 parent 84a222d commit bad0d12

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

drivers/firmware/samsung/exynos-acpm.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,11 @@ struct acpm_info {
177177
/**
178178
* struct acpm_match_data - of_device_id data.
179179
* @initdata_base: offset in SRAM where the channels configuration resides.
180+
* @acpm_clk_dev_name: base name for the ACPM clocks device that we're registering.
180181
*/
181182
struct acpm_match_data {
182183
loff_t initdata_base;
184+
const char *acpm_clk_dev_name;
183185
};
184186

185187
#define client_to_acpm_chan(c) container_of(c, struct acpm_chan, cl)
@@ -604,9 +606,15 @@ static void acpm_setup_ops(struct acpm_info *acpm)
604606
pmic_ops->update_reg = acpm_pmic_update_reg;
605607
}
606608

609+
static void acpm_clk_pdev_unregister(void *data)
610+
{
611+
platform_device_unregister(data);
612+
}
613+
607614
static int acpm_probe(struct platform_device *pdev)
608615
{
609616
const struct acpm_match_data *match_data;
617+
struct platform_device *acpm_clk_pdev;
610618
struct device *dev = &pdev->dev;
611619
struct device_node *shmem;
612620
struct acpm_info *acpm;
@@ -647,6 +655,18 @@ static int acpm_probe(struct platform_device *pdev)
647655

648656
platform_set_drvdata(pdev, acpm);
649657

658+
acpm_clk_pdev = platform_device_register_data(dev,
659+
match_data->acpm_clk_dev_name,
660+
PLATFORM_DEVID_NONE, NULL, 0);
661+
if (IS_ERR(acpm_clk_pdev))
662+
return dev_err_probe(dev, PTR_ERR(acpm_clk_pdev),
663+
"Failed to register ACPM clocks device.\n");
664+
665+
ret = devm_add_action_or_reset(dev, acpm_clk_pdev_unregister,
666+
acpm_clk_pdev);
667+
if (ret)
668+
return dev_err_probe(dev, ret, "Failed to add devm action.\n");
669+
650670
return devm_of_platform_populate(dev);
651671
}
652672

@@ -746,6 +766,7 @@ EXPORT_SYMBOL_GPL(devm_acpm_get_by_node);
746766

747767
static const struct acpm_match_data acpm_gs101 = {
748768
.initdata_base = ACPM_GS101_INITDATA_BASE,
769+
.acpm_clk_dev_name = "gs101-acpm-clk",
749770
};
750771

751772
static const struct of_device_id acpm_match[] = {

0 commit comments

Comments
 (0)