From 3402e90ecb7d00e7591772ac07b85996fa6eff34 Mon Sep 17 00:00:00 2001 From: Ashish Chavan Date: Tue, 18 Aug 2020 12:40:00 +0530 Subject: [PATCH] power: smb1398: Update min-ilim setting to 1A At higher SOC Vbatt is close to Vbus which can cause (Vin/2 - Vout) to cross the 10mV threshold and thus result in win-uv IRQ to fire. To prevent this CPs should not be enabled below a certain FCC. Do this by not allowing "min-ilim" value lower than 1A. Eg: Master/Slave CP gets disable at following FCC if main_fcc is 200mA: slave disables = total_fcc < (3000mA + 200mA) master disables = total_fcc < (2000mA + 200mA). Change-Id: Ie67e9ae60b5e3526413a1a4bb256181b0226a1b1 Signed-off-by: Ashish Chavan --- drivers/power/supply/qcom/smb1398-charger.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/qcom/smb1398-charger.c b/drivers/power/supply/qcom/smb1398-charger.c index 196b99402de3..b2500485e270 100644 --- a/drivers/power/supply/qcom/smb1398-charger.c +++ b/drivers/power/supply/qcom/smb1398-charger.c @@ -2014,6 +2014,7 @@ static int smb1398_div2_cp_hw_init(struct smb1398_chip *chip) return rc; } +#define DIV2_CP_MIN_ILIM_UA 1000000 static int smb1398_div2_cp_parse_dt(struct smb1398_chip *chip) { int rc = 0; @@ -2036,9 +2037,14 @@ static int smb1398_div2_cp_parse_dt(struct smb1398_chip *chip) return rc; } - chip->div2_cp_min_ilim_ua = 750000; of_property_read_u32(chip->dev->of_node, "qcom,div2-cp-min-ilim-ua", &chip->div2_cp_min_ilim_ua); + /* + * Set minimum allowed ilim configuration to 1A for DIV2_CP + * operation. + */ + if (chip->div2_cp_min_ilim_ua < DIV2_CP_MIN_ILIM_UA) + chip->div2_cp_min_ilim_ua = DIV2_CP_MIN_ILIM_UA; chip->max_cutoff_soc = 85; of_property_read_u32(chip->dev->of_node, "qcom,max-cutoff-soc",