dev: pmic: Add new API for PM8996 reset configuration
PMI8996 needs to be configured as shutdown during device hard reset
power off type, so add new API for PM8996 reset configuration.
CRs-Fixed: 2194997
Change-Id: I3cc19b1bea0846689118b86177551ffd3ca3ceab
Signed-off-by: Vamshi Krishna B V <vbv@codeaurora.org>
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index e289623..65011ec 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -223,6 +223,7 @@
uint32_t pm8x41_resin_status();
void pm8x41_reset_configure(uint8_t);
void pm8994_reset_configure(uint8_t);
+void pm8996_reset_configure(uint8_t, uint8_t);
void pmi632_reset_configure(uint8_t);
void pm8x41_v2_reset_configure(uint8_t);
uint8_t pmi8950_get_pmi_subtype();
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index ba723b4..4e0b85a 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -450,6 +450,25 @@
pm8xxx_reg_write(slave_id[i], PON_PS_HOLD_RESET_CTL2, BIT(S2_RESET_EN_BIT));
}
+void pm8996_reset_configure(uint8_t slave_id, uint8_t reset_type)
+{
+ /* Reset sequence
+ 1. Disable the ps hold
+ 2. set reset type
+ 3. Enable ps hold to trigger the reset
+ */
+ /* disable PS_HOLD_RESET */
+ pm8xxx_reg_write(slave_id, PON_PS_HOLD_RESET_CTL2, 0x0);
+
+ /* Delay needed for disable to kick in. */
+ udelay(300);
+
+ /* configure reset type */
+ pm8xxx_reg_write(slave_id, PON_PS_HOLD_RESET_CTL, reset_type);
+ /* enable PS_HOLD_RESET */
+ pm8xxx_reg_write(slave_id, PON_PS_HOLD_RESET_CTL2, BIT(S2_RESET_EN_BIT));
+}
+
void pm8x41_v2_reset_configure(uint8_t reset_type)
{
uint8_t val;