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

Commit bccf0798 authored by Ke Liu's avatar Ke Liu
Browse files

msm: cpr-regulator: add dummy read to bypass false register value



There is an issue in certain CPR HW, which requires ignoring the
first read of IRQ_STATUS register in ISR.

CRs-Fixed: 570495
Change-Id: Ib1a57a3da3c60ffb5af3669947a4eb09dbb8c255
Signed-off-by: default avatarKe Liu <keliu@codeaurora.org>
parent 7b6446cc
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -34,6 +34,10 @@

/* Register Offsets for RB-CPR and Bit Definitions */

/* RBCPR Version Register */
#define REG_RBCPR_VERSION		0
#define RBCPR_VER_2			0x02

/* RBCPR Gate Count and Target Registers */
#define REG_RBCPR_GCNT_TARGET(n)	(0x60 + 4 * n)

@@ -138,6 +142,7 @@

#define BYTES_PER_FUSE_ROW		8

#define FLAGS_IGNORE_1ST_IRQ_STATUS	BIT(0)
#define FLAGS_SET_MIN_VOLTAGE		BIT(1)

enum voltage_change_dir {
@@ -674,6 +679,9 @@ static irqreturn_t cpr_irq_handler(int irq, void *dev)
	mutex_lock(&cpr_vreg->cpr_mutex);

	reg_val = cpr_read(cpr_vreg, REG_RBIF_IRQ_STATUS);
	if (cpr_vreg->flags & FLAGS_IGNORE_1ST_IRQ_STATUS)
		reg_val = cpr_read(cpr_vreg, REG_RBIF_IRQ_STATUS);

	cpr_debug_irq("IRQ_STATUS = 0x%02X\n", reg_val);

	if (!cpr_is_allowed(cpr_vreg)) {
@@ -967,6 +975,10 @@ static int cpr_config(struct cpr_regulator *cpr_vreg)

	cpr_irq_set(cpr_vreg, CPR_INT_DEFAULT);

	val = cpr_read(cpr_vreg, REG_RBCPR_VERSION);
	if (val <= RBCPR_VER_2)
		cpr_vreg->flags |= FLAGS_IGNORE_1ST_IRQ_STATUS;

	cpr_corner_save(cpr_vreg, CPR_CORNER_SVS);
	cpr_corner_save(cpr_vreg, CPR_CORNER_NORMAL);
	cpr_corner_save(cpr_vreg, CPR_CORNER_TURBO);