dev: pqnp_wled: change max precharge time to 500us
There is an issue that lab precharge failure when fast precharge is
disable and battery voltage is very low. Change max precharge time
to 500us to avoid this case.
CRs-Fixed: 1028320
Change-Id: I88196e131e36961fd2a8328e999bb0155da618d0
diff --git a/dev/qpnp_wled/include/qpnp_wled.h b/dev/qpnp_wled/include/qpnp_wled.h
index 64e85e0..32a58dc 100644
--- a/dev/qpnp_wled/include/qpnp_wled.h
+++ b/dev/qpnp_wled/include/qpnp_wled.h
@@ -164,6 +164,11 @@
#define QPNP_WLED_LAB_FAST_PC_MASK 0xFB
#define QPNP_WLED_LAB_START_DLY_US 8
#define QPNP_WLED_LAB_FAST_PC_SHIFT 2
+#define QPNP_WLED_PRECHARGE_MASK 0xFC
+#define QPNP_WLED_PRECHARGE_US200 0x00
+#define QPNP_WLED_PRECHARGE_US300 0x01
+#define QPNP_WLED_PRECHARGE_US400 0x02
+#define QPNP_WLED_PRECHARGE_US500 0x03
#define QPNP_WLED_SEC_ACCESS_REG(b) (b + 0xD0)
#define QPNP_WLED_SEC_UNLOCK 0xA5
@@ -266,6 +271,7 @@
bool disp_type_amoled;
bool ibb_bias_active;
bool lab_fast_precharge;
+ uint8_t lab_max_precharge_time;
uint32_t lab_min_volt;
uint32_t lab_max_volt;
uint32_t ibb_min_volt;
diff --git a/dev/qpnp_wled/qpnp_wled.c b/dev/qpnp_wled/qpnp_wled.c
index 3aa41f8..3575b5c 100644
--- a/dev/qpnp_wled/qpnp_wled.c
+++ b/dev/qpnp_wled/qpnp_wled.c
@@ -425,6 +425,9 @@
QPNP_WLED_LAB_FAST_PC_REG(wled->lab_base));
reg &= QPNP_WLED_LAB_FAST_PC_MASK;
reg |= (wled->lab_fast_precharge << QPNP_WLED_LAB_FAST_PC_SHIFT);
+ /* LAB max precharge time */
+ reg &= QPNP_WLED_PRECHARGE_MASK;
+ reg |= (wled->lab_max_precharge_time);
pm8x41_wled_reg_write(QPNP_WLED_LAB_FAST_PC_REG(wled->lab_base), reg);
/* Configure lab display type */
@@ -523,6 +526,7 @@
wled->ibb_bias_active = false;
wled->lab_fast_precharge = false;
+ wled->lab_max_precharge_time = QPNP_WLED_PRECHARGE_US500;
wled->ibb_pwrup_dly_ms = config->pwr_up_delay;
wled->ibb_pwrdn_dly_ms = config->pwr_down_delay;
wled->ibb_discharge_en = config->ibb_discharge_en;