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

Commit 3bbd7480 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "regulator: cpr3: Use scaled gate count for aging measurements"

parents 212f9fef 6906589e
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
@@ -210,6 +210,9 @@ static const int msmcobalt_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 MSMCOBALT_MMSS_AGING_INIT_QUOT_DIFF_SCALE	1
#define MSMCOBALT_MMSS_AGING_INIT_QUOT_DIFF_SIZE	8

@@ -853,6 +856,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 (vreg->thread->ctrl->soc_revision == MSMCOBALT_SOC_ID) {
		ctrl->aging_sensor->sensor_id = MSMCOBALT_MMSS_AGING_SENSOR_ID;
+12 −1
Original line number Diff line number Diff line
@@ -316,6 +316,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;
@@ -3364,7 +3370,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
@@ -663,6 +663,13 @@ struct cpr3_panic_regs_info {
 * @aging_sensor:	Array of CPR3 aging sensors which are used to perform
 *			aging measurements at a runtime.
 * @aging_sensor_count:	Number of elements in the aging_sensor array
 * @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
@@ -775,6 +782,7 @@ struct cpr3_controller {
	bool			aging_failed;
	struct cpr3_aging_sensor_info *aging_sensor;
	int			aging_sensor_count;
	u32			aging_gcnt_scaling_factor;

	u32			step_quot_fixed;
	u32			initial_temp_band;