Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de8bce8d authored by Vikram Mulukutla's avatar Vikram Mulukutla Committed by Junjie Wu
Browse files

msm: clock-dummy: Add a dummy clock provider



Add a dummy clock provider that registers a simple callback that
in turn always returns the dummy clock for any clk_get call.

Change-Id: Id38808c53dca9efc9ff9db7a3066088f03cccf65
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent c64d45f1
Loading
Loading
Loading
Loading
+41 −0
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@
 */

#include <linux/clk/msm-clk-provider.h>
#include <linux/platform_device.h>
#include <linux/of.h>

static int dummy_clk_reset(struct clk *clk, enum clk_reset_action action)
{
@@ -57,3 +59,42 @@ struct clk dummy_clk = {
	.ops = &clk_ops_dummy,
	CLK_INIT(dummy_clk),
};

static struct clk *of_dummy_get(struct of_phandle_args *clkspec,
				  void *data)
{
	return &dummy_clk;
}

static struct of_device_id msm_clock_dummy_match_table[] = {
	{ .compatible = "qcom,dummycc" },
	{}
};

static int msm_clock_dummy_probe(struct platform_device *pdev)
{
	int ret;

	ret = of_clk_add_provider(pdev->dev.of_node, of_dummy_get, NULL);
	if (ret)
		return -ENOMEM;

	dev_info(&pdev->dev, "Registered DUMMY provider.\n");
	return ret;
}

static struct platform_driver msm_clock_dummy_driver = {
	.probe = msm_clock_dummy_probe,
	.driver = {
		.name = "clock-dummy",
		.of_match_table = msm_clock_dummy_match_table,
		.owner = THIS_MODULE,
	},
};

int __init msm_dummy_clk_init(void)
{
	return platform_driver_register(&msm_clock_dummy_driver);
}
arch_initcall(msm_dummy_clk_init);