msm: cpr: Add boot parameter option to disable CPR
CPR should have an option to be disabled at boot if required.
Usage: Append "msm-cpr.enable=0" to the kernel commandline to
disable CPR. Append "msm-cpr.enable=1" to enable CPR.
Change-Id: Idaac721063184abcfb37ae1ea33870f2464d70f0
Signed-off-by: Kaushal Kumar <kaushalk@codeaurora.org>
(cherry picked from commit 5d83a9e81a449fd8eab5071226fcbdfdfe6b9857)
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
diff --git a/arch/arm/mach-msm/msm_cpr.c b/arch/arm/mach-msm/msm_cpr.c
index f4272f3..3ef39c7 100644
--- a/arch/arm/mach-msm/msm_cpr.c
+++ b/arch/arm/mach-msm/msm_cpr.c
@@ -15,6 +15,7 @@
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/io.h>
#include <linux/irq.h>
@@ -39,6 +40,10 @@
/* Need platform device handle for suspend and resume APIs */
static struct platform_device *cpr_pdev;
+static bool enable = 1;
+module_param(enable, bool, 0644);
+MODULE_PARM_DESC(enable, "CPR Enable");
+
struct msm_cpr {
int curr_osc;
int cpr_mode;
@@ -701,6 +706,9 @@
void __iomem *base;
struct resource *mem;
+ if (!enable)
+ return -EPERM;
+
if (!pdata) {
pr_err("CPR: Platform data is not available\n");
return -EIO;