summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2022-04-22 07:58:12 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-04-27 01:04:16 +0000
commit4a5f4708c39c8ce1f57181acd81e86e74bea17b5 (patch)
tree85852dd8ab8e467ada8290960fb9a3db189b108d /driver
parentdc030dc95c3cedf282d232fd49fe5e687a14d8d6 (diff)
downloadchrome-ec-4a5f4708c39c8ce1f57181acd81e86e74bea17b5.tar.gz
ISL923x: Disable input regulation with function
Use same function to disable input regulation BUG=b:224616537 BRANCH=none TEST=make -j runtests Signed-off-by: Sam Hurst <shurst@google.com> Change-Id: Ieb844d931b7fdd93dc6fb8ca2b4f48ae2932344a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3602216 Reviewed-by: Wai-Hong Tam <waihong@google.com>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/isl923x.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c
index c1e4f203fd..011a83de27 100644
--- a/driver/charger/isl923x.c
+++ b/driver/charger/isl923x.c
@@ -490,6 +490,23 @@ static enum ec_error_list isl923x_post_init(int chgnum)
return EC_SUCCESS;
}
+static enum ec_error_list isl923x_set_hw_ramp(int chgnum, int enable)
+{
+ int rv, reg;
+
+ rv = raw_read16(chgnum, ISL923X_REG_CONTROL0, &reg);
+ if (rv)
+ return rv;
+
+ /* HW ramp is controlled by input voltage regulation reference bits */
+ if (enable)
+ reg &= ~ISL923X_C0_DISABLE_VREG;
+ else
+ reg |= ISL923X_C0_DISABLE_VREG;
+
+ return raw_write16(chgnum, ISL923X_REG_CONTROL0, reg);
+}
+
int isl923x_set_ac_prochot(int chgnum, uint16_t ma)
{
int rv;
@@ -650,13 +667,8 @@ static void isl923x_init(int chgnum)
goto init_fail;
}
} else {
- if (raw_read16(chgnum, ISL923X_REG_CONTROL0, &reg))
- goto init_fail;
-
/* Disable voltage regulation loop to disable charge ramp */
- reg |= ISL923X_C0_DISABLE_VREG;
-
- if (raw_write16(chgnum, ISL923X_REG_CONTROL0, reg))
+ if (isl923x_set_hw_ramp(chgnum, 0))
goto init_fail;
}
@@ -979,23 +991,6 @@ enum ec_error_list isl9238c_resume(int chgnum)
/* Hardware current ramping */
#ifdef CONFIG_CHARGE_RAMP_HW
-static enum ec_error_list isl923x_set_hw_ramp(int chgnum, int enable)
-{
- int rv, reg;
-
- rv = raw_read16(chgnum, ISL923X_REG_CONTROL0, &reg);
- if (rv)
- return rv;
-
- /* HW ramp is controlled by input voltage regulation reference bits */
- if (enable)
- reg &= ~ISL923X_C0_DISABLE_VREG;
- else
- reg |= ISL923X_C0_DISABLE_VREG;
-
- return raw_write16(chgnum, ISL923X_REG_CONTROL0, reg);
-}
-
static int isl923x_ramp_is_stable(int chgnum)
{
/*