/**
* struct acpm_match_data - of_device_id data.
* @initdata_base: offset in SRAM where the channels configuration resides.
+ * @acpm_clk_dev_name: base name for the ACPM clocks device that we're registering.
*/
struct acpm_match_data {
loff_t initdata_base;
+ const char *acpm_clk_dev_name;
};
#define client_to_acpm_chan(c) container_of(c, struct acpm_chan, cl)
pmic_ops->update_reg = acpm_pmic_update_reg;
}
+static void acpm_clk_pdev_unregister(void *data)
+{
+ platform_device_unregister(data);
+}
+
static int acpm_probe(struct platform_device *pdev)
{
const struct acpm_match_data *match_data;
+ struct platform_device *acpm_clk_pdev;
struct device *dev = &pdev->dev;
struct device_node *shmem;
struct acpm_info *acpm;
platform_set_drvdata(pdev, acpm);
+ acpm_clk_pdev = platform_device_register_data(dev,
+ match_data->acpm_clk_dev_name,
+ PLATFORM_DEVID_NONE, NULL, 0);
+ if (IS_ERR(acpm_clk_pdev))
+ return dev_err_probe(dev, PTR_ERR(acpm_clk_pdev),
+ "Failed to register ACPM clocks device.\n");
+
+ ret = devm_add_action_or_reset(dev, acpm_clk_pdev_unregister,
+ acpm_clk_pdev);
+ if (ret)
+ return dev_err_probe(dev, ret, "Failed to add devm action.\n");
+
return devm_of_platform_populate(dev);
}
static const struct acpm_match_data acpm_gs101 = {
.initdata_base = ACPM_GS101_INITDATA_BASE,
+ .acpm_clk_dev_name = "gs101-acpm-clk",
};
static const struct of_device_id acpm_match[] = {