Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 86974ccc authored by Tirupathi Reddy's avatar Tirupathi Reddy
Browse files

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: default avatarTirupathi Reddy <tirupath@codeaurora.org>
parent 6f55033e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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,
+5 −0
Original line number Diff line number Diff line
@@ -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;
+12 −1
Original line number Diff line number Diff line
@@ -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);

+8 −0
Original line number Diff line number Diff line
@@ -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;