From 11642ca31e9ef7ee318bb3d4bb5e2bd435e879c0 Mon Sep 17 00:00:00 2001 From: Ashish Chavan Date: Sun, 20 Feb 2022 14:44:17 +0530 Subject: [PATCH] power: supply: smb5: Fix moisture detection exit condition When USB is connected and moisture detected we disable USB_ICL with LPD_VOTER. This voter is not removed until usb is removed. Fix this by removing LPD_VOTER vote from ICL when LPD bit is not set with usb connected. Change-Id: I188f5d94bc3ec3527ddccf116a6a68a4b9ddea6d Signed-off-by: Ashish Chavan --- drivers/power/supply/qcom/smb5-lib.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/qcom/smb5-lib.c b/drivers/power/supply/qcom/smb5-lib.c index ce4ba0aaffab..4bfead753772 100644 --- a/drivers/power/supply/qcom/smb5-lib.c +++ b/drivers/power/supply/qcom/smb5-lib.c @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* - * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2022 The Linux Foundation. All rights reserved. */ #include @@ -8047,6 +8047,9 @@ static void smblib_lpd_ra_open_work(struct work_struct *work) if (!(stat & TYPEC_WATER_DETECTION_STATUS_BIT) || (stat & TYPEC_TCCDEBOUNCE_DONE_STATUS_BIT)) { chg->lpd_stage = LPD_STAGE_NONE; + + /* Remove LPD_VOTER from ICL is moisture status is gone in attached state. */ + vote(chg->usb_icl_votable, LPD_VOTER, false, 0); goto out; }