summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/devfreq/devfreq_simple_dev.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/drivers/devfreq/devfreq_simple_dev.c b/drivers/devfreq/devfreq_simple_dev.c
index a571867335ca..b354bcb2aba2 100644
--- a/drivers/devfreq/devfreq_simple_dev.c
+++ b/drivers/devfreq/devfreq_simple_dev.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -146,12 +146,23 @@ static int devfreq_clock_probe(struct platform_device *pdev)
if (of_property_read_string(dev->of_node, "governor", &gov_name))
gov_name = "performance";
+ if (of_property_read_bool(dev->of_node, "qcom,prepare-clk")) {
+ ret = clk_prepare(d->clk);
+ if (ret)
+ return ret;
+ }
d->df = devfreq_add_device(dev, p, gov_name, NULL);
- if (IS_ERR(d->df))
- return PTR_ERR(d->df);
+ if (IS_ERR(d->df)) {
+ ret = PTR_ERR(d->df);
+ goto add_err;
+ }
return 0;
+add_err:
+ if (of_property_read_bool(dev->of_node, "qcom,prepare-clk"))
+ clk_unprepare(d->clk);
+ return ret;
}
static int devfreq_clock_remove(struct platform_device *pdev)