msm: acpuclock-krait: Add voltage boost mode
Add support to bump up or down the voltage via sysfs.
# echo 1 > /sys/module/acpuclock_krait/parameters/boost
enables the boost and
# echo 0 > /sys/module/acpuclock_krait/parameters/boost
disables the boost. Boost mode is enabled by default for fast and
nominal devices because those devices could be at the boundaries
of the characterization thresholds and exhibit CPU/L1 errors.
Change-Id: If0dd4ed949188debbb55f82f07004b57548164f6
Signed-off-by: Matt Wagantall <mattw@codeaurora.org>
diff --git a/arch/arm/mach-msm/acpuclock-krait.c b/arch/arm/mach-msm/acpuclock-krait.c
index 070ce71..78fe5ca 100644
--- a/arch/arm/mach-msm/acpuclock-krait.c
+++ b/arch/arm/mach-msm/acpuclock-krait.c
@@ -14,6 +14,7 @@
#define pr_fmt(fmt) "%s: " fmt, __func__
#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/delay.h>
@@ -59,6 +60,7 @@
struct hfpll_data *hfpll_data;
u32 bus_perf_client;
struct msm_bus_scale_pdata *bus_scale;
+ int boost_uv;
struct device *dev;
} drv;
@@ -421,9 +423,12 @@
max(l2_pll_vdd_dig, cpu_pll_vdd_dig));
}
+static bool enable_boost = true;
+module_param_named(boost, enable_boost, bool, S_IRUGO | S_IWUSR);
+
static int calculate_vdd_core(const struct acpu_level *tgt)
{
- return tgt->vdd_core;
+ return tgt->vdd_core + (enable_boost ? drv.boost_uv : 0);
}
/* Set the CPU's clock rate and adjust the L2 rate, voltage and BW requests. */
@@ -1007,6 +1012,7 @@
params->pvs_tables[tbl_idx].size,
GFP_KERNEL);
BUG_ON(!drv.acpu_freq_tbl);
+ drv.boost_uv = params->pvs_tables[tbl_idx].boost_uv;
}
static void __init hw_init(void)