power: qpnp-smb5: Configure ICL based on flash active state
The charger driver configures the ICL to 100mA or 0mA on input
removal and to 100mA on charger insertion (before USB enumeration).
When there is a TORCH concurrency with USB insertion, there can be
a scenario where the TORCH could delay in ramping up. Fix this
this by forcing the ICL to at least 500mA when TORCH is active.
While at it, reject the current reported from USB if input is absent.
Change-Id: Ie4084c236957538d396cfb504f50d7b325a5743e
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
diff --git a/drivers/power/supply/qcom/smb5-lib.h b/drivers/power/supply/qcom/smb5-lib.h
index 35e5dd3..a0e835f 100644
--- a/drivers/power/supply/qcom/smb5-lib.h
+++ b/drivers/power/supply/qcom/smb5-lib.h
@@ -73,6 +73,15 @@
#define VBAT_TO_VRAW_ADC(v) div_u64((u64)v * 1000000UL, 194637UL)
+#define SDP_100_MA 100000
+#define SDP_CURRENT_UA 500000
+#define CDP_CURRENT_UA 1500000
+#define DCP_CURRENT_UA 1500000
+#define HVDCP_CURRENT_UA 3000000
+#define TYPEC_DEFAULT_CURRENT_UA 900000
+#define TYPEC_MEDIUM_CURRENT_UA 1500000
+#define TYPEC_HIGH_CURRENT_UA 3000000
+
enum smb_mode {
PARALLEL_MASTER = 0,
PARALLEL_SLAVE,