From 7b32e9aedf33ee3b1fb65ff7bfde98482e955235 Mon Sep 17 00:00:00 2001 From: Ashish Chavan Date: Fri, 17 Jul 2020 14:11:37 +0530 Subject: [PATCH] power: smb1398: Update win-uv threshold to 10mV MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When VIN/2 – VOUT < the threshold with debounce time, WIN_UV protection kicks in. Update this threshold to 10mV. Change-Id: I015528b9fb1e4db86c4e1af186aa0f6a912967f2 Signed-off-by: Ashish Chavan --- drivers/power/supply/qcom/smb1398-charger.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/power/supply/qcom/smb1398-charger.c b/drivers/power/supply/qcom/smb1398-charger.c index c53942003ad8..df70e87209e2 100644 --- a/drivers/power/supply/qcom/smb1398-charger.c +++ b/drivers/power/supply/qcom/smb1398-charger.c @@ -1945,6 +1945,14 @@ static int smb1398_div2_cp_hw_init(struct smb1398_chip *chip) return rc; } + /* Configure window (Vin/2 - Vout) UV level to 10mV */ + rc = smb1398_masked_write(chip, NOLOCK_SPARE_REG, + DIV2_WIN_UV_SEL_BIT, 0); + if (rc < 0) { + dev_err(chip->dev, "Couldn't set WIN_UV_10_MV rc=%d\n", rc); + return rc; + } + /* Configure master TEMP pin to output Vtemp signal by default */ rc = smb1398_masked_write(chip, SSUPLY_TEMP_CTRL_REG, SEL_OUT_TEMP_MAX_MASK, SEL_OUT_VTEMP); @@ -2270,6 +2278,14 @@ static int smb1398_div2_cp_slave_probe(struct smb1398_chip *chip) return rc; } + /* Configure window (Vin/2 - Vout) UV level to 10mV */ + rc = smb1398_masked_write(chip, NOLOCK_SPARE_REG, + DIV2_WIN_UV_SEL_BIT, 0); + if (rc < 0) { + dev_err(chip->dev, "Couldn't set WIN_UV_10_MV rc=%d\n", rc); + return rc; + } + /* * Disable slave WIN_UV detection, otherwise slave might not be * enabled due to WIN_UV until master drawing very high current.