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

Commit 59e8c0d0 authored by Nicholas Troast's avatar Nicholas Troast Committed by Harry Yang
Browse files

qcom-charger: qpnp-fg-gen3: add flag to bypass SRAM read/write wake lock



In the suspend path a wakelock should not be held. Add a flag to bypass
holding a wakelock during an SRAM read or write so that they can be used
in the suspend path.

Change-Id: I74ccae4e9b5aeccf261cc94e9bb89138d7d48345
Signed-off-by: default avatarNicholas Troast <ntroast@codeaurora.org>
parent fa0dc604
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -69,7 +69,8 @@ enum fg_debug_flag {
/* SRAM access */
enum sram_access_flags {
	FG_IMA_DEFAULT	= 0,
	FG_IMA_ATOMIC,
	FG_IMA_ATOMIC	= BIT(0),
	FG_IMA_NO_WLOCK	= BIT(1),
};

/* JEITA */
+8 −4
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ int fg_sram_write(struct fg_chip *chip, u16 address, u8 offset,
	if (!fg_sram_address_valid(address, len))
		return -EFAULT;

	if (!(flags & FG_IMA_NO_WLOCK))
		vote(chip->awake_votable, SRAM_WRITE, true, 0);
	mutex_lock(&chip->sram_rw_lock);

@@ -113,6 +114,7 @@ out:
		disable_irq_nosync(chip->irqs[SOC_UPDATE_IRQ].irq);

	mutex_unlock(&chip->sram_rw_lock);
	if (!(flags & FG_IMA_NO_WLOCK))
		vote(chip->awake_votable, SRAM_WRITE, false, 0);
	return rc;
}
@@ -128,6 +130,7 @@ int fg_sram_read(struct fg_chip *chip, u16 address, u8 offset,
	if (!fg_sram_address_valid(address, len))
		return -EFAULT;

	if (!(flags & FG_IMA_NO_WLOCK))
		vote(chip->awake_votable, SRAM_READ, true, 0);
	mutex_lock(&chip->sram_rw_lock);

@@ -137,6 +140,7 @@ int fg_sram_read(struct fg_chip *chip, u16 address, u8 offset,
			address, offset, rc);

	mutex_unlock(&chip->sram_rw_lock);
	if (!(flags & FG_IMA_NO_WLOCK))
		vote(chip->awake_votable, SRAM_READ, false, 0);
	return rc;
}