diff options
| author | Tirupathi Reddy <tirupath@codeaurora.org> | 2016-05-26 16:36:28 +0530 |
|---|---|---|
| committer | Tirupathi Reddy <tirupath@codeaurora.org> | 2017-03-17 14:47:40 +0530 |
| commit | 86974ccc17f5879bbec02697b4523d76b47f5f37 (patch) | |
| tree | 5e0341a51feffa0ee1c5c4d7c7f78218d093aeff | |
| parent | 6f55033ecf068f77136caac2e7c4a7869b3ec2bd (diff) | |
regulator: cpr3: Use scaled gate count for aging measurements
Use scaled gate count (GCNT) for aging measurements to reduce
the noise effect on aging data. The amount of scaling depends
on the noise effect observed in characterization results. Use
a selected scaling factor value to derive the gate count (GCNT)
used for aging measurements.
CRs-Fixed: 1025832
Change-Id: I0eb3fb08d51ddca5cd4c08e26bc83eb9f66fd3ed
Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
| -rw-r--r-- | drivers/regulator/cpr3-hmss-regulator.c | 5 | ||||
| -rw-r--r-- | drivers/regulator/cpr3-mmss-regulator.c | 5 | ||||
| -rw-r--r-- | drivers/regulator/cpr3-regulator.c | 13 | ||||
| -rw-r--r-- | drivers/regulator/cpr3-regulator.h | 8 |
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; |
