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

Commit 50a7aa11 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "power: qpnp-fg-gen4: retry ESR fast calibration based on delta ESR count"

parents 6196231c 55246969
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@
#define FG_MEM_IF_PM8150B		0x0D
#define FG_ADC_RR_PM8150B		0x13

#define FG_SRAM_LEN			960
#define FG_SRAM_LEN			972
#define PROFILE_LEN			416
#define PROFILE_COMP_LEN		24
#define KI_COEFF_SOC_LEVELS		3
@@ -2767,13 +2767,14 @@ static irqreturn_t fg_delta_msoc_irq_handler(int irq, void *data)
		pr_err("Error in adjusting ki_coeff_dischg, rc=%d\n", rc);

	/*
	 * If ESR fast calibration is done without a delta ESR interrupt, then
	 * it is possibly a failed attempt. In such cases, retry ESR fast
	 * calibration once again. This will get restored to normal config once
	 * a delta ESR interrupt fires or the timer expires.
	 * If ESR fast calibration is done even before 3 delta ESR interrupts
	 * had fired, then it is possibly a failed attempt. In such cases,
	 * retry ESR fast calibration once again. This will get restored to
	 * normal config once the timer expires or delta ESR interrupt count
	 * reaches the threshold.
	 */
	if (chip->esr_fast_calib && chip->esr_fast_calib_done &&
		!chip->delta_esr_count && !chip->esr_fast_calib_retry) {
		(chip->delta_esr_count < 3) && !chip->esr_fast_calib_retry) {
		rc = fg_gen4_esr_fast_calib_config(chip, true);
		if (rc < 0)
			pr_err("Error in configuring esr_fast_calib, rc=%d\n",
+4 −33
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@
#define QNOVO_OVERALL_VOTER	"QNOVO_OVERALL_VOTER"
#define QNI_PT_VOTER		"QNI_PT_VOTER"

#define HW_OK_TO_QNOVO_VOTER	"HW_OK_TO_QNOVO_VOTER"
#define CHG_READY_VOTER		"CHG_READY_VOTER"
#define USB_READY_VOTER		"USB_READY_VOTER"

@@ -456,7 +455,7 @@ static struct param_info params[] = {
		.name			= "PCURR1",
		.start_addr		= QNOVO_PCURR1_LSB,
		.num_regs		= 2,
		.reg_to_unit_multiplier	= 305185, /* converts to nA */
		.reg_to_unit_multiplier	= 488281, /* converts to nA */
		.reg_to_unit_divider	= 1,
		.units_str		= "uA",
	},
@@ -464,7 +463,7 @@ static struct param_info params[] = {
		.name			= "PCURR1_SUM",
		.start_addr		= QNOVO_PCURR1_SUM_LSB,
		.num_regs		= 2,
		.reg_to_unit_multiplier	= 305185, /* converts to nA */
		.reg_to_unit_multiplier	= 488281, /* converts to nA */
		.reg_to_unit_divider	= 1,
		.units_str		= "uA",
	},
@@ -472,7 +471,7 @@ static struct param_info params[] = {
		.name			= "PCURR1_TERMINAL",
		.start_addr		= QNOVO_PCURR1_TERMINAL_LSB,
		.num_regs		= 2,
		.reg_to_unit_multiplier	= 305185, /* converts to nA */
		.reg_to_unit_multiplier	= 488281, /* converts to nA */
		.reg_to_unit_divider	= 1,
		.min_val		= -10000000,
		.max_val		= 10000000,
@@ -546,7 +545,7 @@ static struct param_info params[] = {
		.name			= "PCURR2",
		.start_addr		= QNOVO_PCURR2_LSB,
		.num_regs		= 2,
		.reg_to_unit_multiplier	= 305185, /* converts to nA */
		.reg_to_unit_multiplier	= 488281, /* converts to nA */
		.reg_to_unit_divider	= 1,
		.units_str		= "uA",
	},
@@ -1084,30 +1083,6 @@ static struct attribute *qnovo_class_attrs[] = {
};
ATTRIBUTE_GROUPS(qnovo_class);

static int qnovo5_update_status(struct qnovo *chip)
{
	u8 val = 0;
	int rc;
	bool hw_ok_to_qnovo;

	rc = qnovo5_read(chip, QNOVO_ERROR_STS, &val, 1);
	if (rc < 0) {
		pr_err("Couldn't read error sts rc = %d\n", rc);
		hw_ok_to_qnovo = false;
	} else {
		/*
		 * For CV mode keep qnovo enabled, userspace is expected to
		 * disable it after few runs
		 */
		hw_ok_to_qnovo = (val == ERR_CV_MODE || val == 0) ?
			true : false;
	}

	vote(chip->not_ok_to_qnovo_votable, HW_OK_TO_QNOVO_VOTER,
					!hw_ok_to_qnovo, 0);
	return 0;
}

static void usb_debounce_work(struct work_struct *work)
{
	struct qnovo *chip = container_of(work,
@@ -1145,8 +1120,6 @@ static void status_change_work(struct work_struct *work)
		schedule_delayed_work(&chip->usb_debounce_work,
				msecs_to_jiffies(DEBOUNCE_MS));
	}

	qnovo5_update_status(chip);
}

static int qnovo_notifier_call(struct notifier_block *nb,
@@ -1170,8 +1143,6 @@ static irqreturn_t handle_ptrain_done(int irq, void *data)
{
	struct qnovo *chip = data;

	qnovo5_update_status(chip);

	/*
	 * hw resets pt_en bit once ptrain_done triggers.
	 * vote on behalf of QNI to disable it such that