summaryrefslogtreecommitdiff
path: root/driver
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-06-30 14:54:01 -0600
committerCommit Bot <commit-bot@chromium.org>2020-07-11 06:05:20 +0000
commita0efb9c8039ca50962976d506e738e2071bb431f (patch)
treefb7fbf14f5cf1b6220aeed0b2a0fc4cde3a827ff /driver
parent7e50f69303fc74562dfede6c7a3f61713814a82c (diff)
downloadchrome-ec-a0efb9c8039ca50962976d506e738e2071bb431f.tar.gz
OCPC: Use enum chg_id values
Remove redundancy between the OCPC header and "enum chg_id" BRANCH=None BUG=None TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I4058e2395ec1cbd50ce197775eb07d3bcfad95f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2277834 Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver')
-rw-r--r--driver/charger/isl923x.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/driver/charger/isl923x.c b/driver/charger/isl923x.c
index 3faa6cdb7a..2828ffca2c 100644
--- a/driver/charger/isl923x.c
+++ b/driver/charger/isl923x.c
@@ -623,10 +623,9 @@ void raa489000_hibernate(int chgnum)
if (rv)
CPRINTS("%s(%d):Failed to set Control4!", __func__, chgnum);
- if (IS_ENABLED(CONFIG_OCPC) && (chgnum == PRIMARY_CHARGER)) {
- /* The LDO is needed in the Z-state */
- CPRINTS("%s(%d): Skip disable MCU LDO", __func__, chgnum);
- } else {
+#ifdef CONFIG_OCPC
+ /* The LDO is needed in the Z-state on the primary charger */
+ if (chgnum != CHARGER_PRIMARY) {
rv = raw_read16(chgnum, RAA489000_REG_CONTROL8, &regval);
if (!rv) {
/* Disable MCU LDO in battery state */
@@ -639,6 +638,7 @@ void raa489000_hibernate(int chgnum)
CPRINTS("%s(%d):Failed to set Control8!", __func__,
chgnum);
}
+#endif
cflush();
}
@@ -959,7 +959,7 @@ static enum ec_error_list isl923x_get_vbus_voltage(int chgnum, int port,
return EC_SUCCESS;
}
-#ifdef CONFIG_CHARGER_RAA489000
+#if defined(CONFIG_CHARGER_RAA489000) && defined(CONFIG_OCPC)
static enum ec_error_list raa489000_set_vsys_compensation(int chgnum,
struct ocpc_data *o,
int current_ma,
@@ -972,7 +972,7 @@ static enum ec_error_list raa489000_set_vsys_compensation(int chgnum,
int regval;
/* This should never be called against the primary charger. */
- ASSERT(chgnum != PRIMARY_CHARGER);
+ ASSERT(chgnum != CHARGER_PRIMARY);
/* Only B0+ silicon supports VSYS compensation. */
rv = isl923x_device_id(chgnum, &device_id);
@@ -1056,9 +1056,9 @@ static enum ec_error_list raa489000_set_vsys_compensation(int chgnum,
}
/* Lastly, enable DVC fast charge mode for the primary charger IC. */
- rv = raw_read16(PRIMARY_CHARGER, RAA489000_REG_CONTROL10, &regval);
+ rv = raw_read16(CHARGER_PRIMARY, RAA489000_REG_CONTROL10, &regval);
regval |= RAA489000_C10_ENABLE_DVC_CHARGE_MODE;
- rv |= raw_write16(PRIMARY_CHARGER, RAA489000_REG_CONTROL10, regval);
+ rv |= raw_write16(CHARGER_PRIMARY, RAA489000_REG_CONTROL10, regval);
if (rv) {
CPRINTS("%s Failed to enable DVC on primary charger!",
__func__);
@@ -1071,7 +1071,7 @@ static enum ec_error_list raa489000_set_vsys_compensation(int chgnum,
*/
return EC_ERROR_UNIMPLEMENTED;
}
-#endif /* CONFIG_CHARGER_RAA489000 */
+#endif /* CONFIG_CHARGER_RAA489000 && CONFIG_OCPC */
const struct charger_drv isl923x_drv = {
.init = &isl923x_init,
@@ -1101,7 +1101,7 @@ const struct charger_drv isl923x_drv = {
.ramp_is_detected = &isl923x_ramp_is_detected,
.ramp_get_current_limit = &isl923x_ramp_get_current_limit,
#endif
-#ifdef CONFIG_CHARGER_RAA489000
+#if defined(CONFIG_CHARGER_RAA489000) && defined(CONFIG_OCPC)
.set_vsys_compensation = &raa489000_set_vsys_compensation,
#endif
};