summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-04-04 23:13:05 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2017-04-04 23:13:05 -0700
commit62413888f1b970b82e50a784904818754e11a400 (patch)
tree45b3a4804ce8b942fc1000967c56d44a2ee85fae
parent4183c077969fc2b1e2ee32e387cba9add186e883 (diff)
parent84b339bd0aee50417668d7fbdb264482aa846a8d (diff)
Merge "regulator: cpr3: Use scaled gate count for aging measurements" into dev/msm-4.4-8996au
-rw-r--r--drivers/regulator/cpr3-hmss-regulator.c5
-rw-r--r--drivers/regulator/cpr3-mmss-regulator.c5
-rw-r--r--drivers/regulator/cpr3-regulator.c13
-rw-r--r--drivers/regulator/cpr3-regulator.h8
4 files changed, 30 insertions, 1 deletions
diff --git a/drivers/regulator/cpr3-hmss-regulator.c b/drivers/regulator/cpr3-hmss-regulator.c
index 77e8bf4b9895..2cbe3914cb68 100644
--- a/drivers/regulator/cpr3-hmss-regulator.c
+++ b/drivers/regulator/cpr3-hmss-regulator.c
@@ -420,6 +420,9 @@ static const int msm8996_vdd_mx_fuse_ret_volt[] = {
#define MSM8996_HMSS_AGING_SENSOR_ID 11
#define MSM8996_HMSS_AGING_BYPASS_MASK0 (GENMASK(7, 0) & ~BIT(3))
+/* Use scaled gate count (GCNT) for aging measurements */
+#define MSM8996_HMSS_AGING_GCNT_SCALING_FACTOR 1500
+
/**
* cpr3_msm8996_hmss_use_voltage_offset_fuse() - return if this part utilizes
* voltage offset fuses or not
@@ -1541,6 +1544,8 @@ static int cpr3_hmss_init_aging(struct cpr3_controller *ctrl)
ctrl->aging_sensor->sensor_id = MSM8996_HMSS_AGING_SENSOR_ID;
ctrl->aging_sensor->bypass_mask[0] = MSM8996_HMSS_AGING_BYPASS_MASK0;
ctrl->aging_sensor->ro_scale = aging_ro_scale;
+ ctrl->aging_gcnt_scaling_factor
+ = MSM8996_HMSS_AGING_GCNT_SCALING_FACTOR;
ctrl->aging_sensor->init_quot_diff
= cpr3_convert_open_loop_voltage_fuse(0,
diff --git a/drivers/regulator/cpr3-mmss-regulator.c b/drivers/regulator/cpr3-mmss-regulator.c
index 41032dd3c15a..80780bf9f527 100644
--- a/drivers/regulator/cpr3-mmss-regulator.c
+++ b/drivers/regulator/cpr3-mmss-regulator.c
@@ -245,6 +245,9 @@ msm8998_v2_rev0_mmss_fuse_ref_volt[MSM8996_MMSS_FUSE_CORNERS] = {
#define MSM8996_MMSS_AGING_SENSOR_ID 29
#define MSM8996_MMSS_AGING_BYPASS_MASK0 (GENMASK(23, 0))
+/* Use scaled gate count (GCNT) for aging measurements */
+#define MSM8996_MMSS_AGING_GCNT_SCALING_FACTOR 1500
+
#define MSM8998_MMSS_AGING_INIT_QUOT_DIFF_SCALE 1
#define MSM8998_MMSS_AGING_INIT_QUOT_DIFF_SIZE 8
@@ -808,6 +811,8 @@ static int cpr3_mmss_init_aging(struct cpr3_controller *ctrl)
return -ENOMEM;
ctrl->aging_sensor->ro_scale = aging_ro_scale;
+ ctrl->aging_gcnt_scaling_factor
+ = MSM8996_MMSS_AGING_GCNT_SCALING_FACTOR;
if (cpr3_ctrl_is_msm8998(ctrl)) {
ctrl->aging_sensor->sensor_id = MSM8998_MMSS_AGING_SENSOR_ID;
diff --git a/drivers/regulator/cpr3-regulator.c b/drivers/regulator/cpr3-regulator.c
index 3ffe094fe53c..8884c6033af9 100644
--- a/drivers/regulator/cpr3-regulator.c
+++ b/drivers/regulator/cpr3-regulator.c
@@ -317,6 +317,12 @@
*/
#define CPRH_DELTA_QUOT_STEP_FACTOR 4
+/*
+ * The multiplier applied to scaling factor value used to derive GCNT
+ * for aging measurements.
+ */
+#define CPR3_AGING_GCNT_SCALING_UNITY 1000
+
static DEFINE_MUTEX(cpr3_controller_list_mutex);
static LIST_HEAD(cpr3_controller_list);
static struct dentry *cpr3_debugfs_base;
@@ -3563,7 +3569,12 @@ static int cpr3_regulator_measure_aging(struct cpr3_controller *ctrl,
gcnt0_restore = cpr3_read(ctrl, CPR3_REG_GCNT(0));
gcnt1_restore = cpr3_read(ctrl, CPR3_REG_GCNT(1));
gcnt_ref = cpr3_regulator_get_gcnt(ctrl);
- gcnt = gcnt_ref * 3 / 2;
+
+ gcnt = gcnt_ref;
+ if (ctrl->aging_gcnt_scaling_factor)
+ gcnt = gcnt_ref * ctrl->aging_gcnt_scaling_factor
+ / CPR3_AGING_GCNT_SCALING_UNITY;
+
cpr3_write(ctrl, CPR3_REG_GCNT(0), gcnt);
cpr3_write(ctrl, CPR3_REG_GCNT(1), gcnt);
diff --git a/drivers/regulator/cpr3-regulator.h b/drivers/regulator/cpr3-regulator.h
index 1ac0f7b816b3..99c86e7b70c9 100644
--- a/drivers/regulator/cpr3-regulator.h
+++ b/drivers/regulator/cpr3-regulator.h
@@ -702,6 +702,13 @@ struct cpr3_panic_regs_info {
* @aging_possible_val: Optional value that the masked aging_possible_reg
* register must have in order for a CPR aging measurement
* to be possible.
+ * @aging_gcnt_scaling_factor: The scaling factor used to derive the gate count
+ * used for aging measurements. This value is divided by
+ * 1000 when used as shown in the below equation:
+ * Aging_GCNT = GCNT_REF * scaling_factor / 1000.
+ * For example, a value of 1500 specifies that the gate
+ * count (GCNT) used for aging measurement should be 1.5
+ * times of reference gate count (GCNT_REF).
* @step_quot_fixed: Fixed step quotient value used for target quotient
* adjustment if use_dynamic_step_quot is not set.
* This parameter is only relevant for CPR4 controllers
@@ -827,6 +834,7 @@ struct cpr3_controller {
int aging_sensor_count;
u32 aging_possible_mask;
u32 aging_possible_val;
+ u32 aging_gcnt_scaling_factor;
u32 step_quot_fixed;
u32 initial_temp_band;