diff options
Diffstat (limited to 'driver')
-rw-r--r-- | driver/battery/smart.c | 23 | ||||
-rw-r--r-- | driver/ppc/ktu1125.c | 10 | ||||
-rw-r--r-- | driver/ppc/rt1739.c | 2 | ||||
-rw-r--r-- | driver/ppc/rt1739.h | 2 |
4 files changed, 27 insertions, 10 deletions
diff --git a/driver/battery/smart.c b/driver/battery/smart.c index b3d1787338..4d64c29efa 100644 --- a/driver/battery/smart.c +++ b/driver/battery/smart.c @@ -590,14 +590,25 @@ int battery_wait_for_stable(void) BATTERY_NO_RESPONSE_TIMEOUT); while (get_time().val < wait_timeout) { /* Starting pinging battery */ - if (battery_status(&status) == EC_SUCCESS) { - /* Battery is stable */ - CPRINTS("battery responded with status %x", status); - return EC_SUCCESS; + if (battery_status(&status) != EC_SUCCESS) { + msleep(25); /* clock stretching could hold 25ms */ + continue; + } + +#ifdef CONFIG_BATTERY_STBL_STAT + if (((status & CONFIG_BATT_ALARM_MASK1) == + CONFIG_BATT_ALARM_MASK1) || + ((status & CONFIG_BATT_ALARM_MASK2) == + CONFIG_BATT_ALARM_MASK2)) { + msleep(25); + continue; } - msleep(25); /* clock stretching could hold 25ms */ +#endif + /* Battery is stable */ + CPRINTS("battery responded with status %x", status); + return EC_SUCCESS; } - CPRINTS("battery not responding"); + CPRINTS("battery not responding with status %x", status); return EC_ERROR_NOT_POWERED; } diff --git a/driver/ppc/ktu1125.c b/driver/ppc/ktu1125.c index 647512d801..24b03e8538 100644 --- a/driver/ppc/ktu1125.c +++ b/driver/ppc/ktu1125.c @@ -348,11 +348,15 @@ static int ktu1125_set_vconn(int port, int enable) polarity = polarity_rm_dts(pd_get_polarity(port)); if (enable) { - flags |= polarity ? KTU1125_CC2S_VCONN : KTU1125_CC1S_VCONN; - status = set_flags(port, KTU1125_SET_SW_CFG, flags); + /* + * If polarity is CC1, then apply VCONN on CC2. + * else if polarity is CC2, then apply VCONN on CC1 + */ + flags |= polarity ? KTU1125_CC1S_VCONN : KTU1125_CC2S_VCONN; + status = set_flags(port, KTU1125_CTRL_SW_CFG, flags); } else { flags |= KTU1125_CC1S_VCONN | KTU1125_CC2S_VCONN; - status = clr_flags(port, KTU1125_SET_SW_CFG, flags); + status = clr_flags(port, KTU1125_CTRL_SW_CFG, flags); } return status; diff --git a/driver/ppc/rt1739.c b/driver/ppc/rt1739.c index ffd7760986..4679290b67 100644 --- a/driver/ppc/rt1739.c +++ b/driver/ppc/rt1739.c @@ -273,7 +273,7 @@ static int rt1739_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp) return write_reg(port, RT1739_REG_VBUS_OC_SETTING, reg); } -static int rt1739_init(int port) +int rt1739_init(int port) { int device_id, oc_setting, sys_ctrl, vbus_switch_ctrl; bool batt_connected = false; diff --git a/driver/ppc/rt1739.h b/driver/ppc/rt1739.h index f4c5e44354..48256da202 100644 --- a/driver/ppc/rt1739.h +++ b/driver/ppc/rt1739.h @@ -134,4 +134,6 @@ extern const struct bc12_drv rt1739_bc12_drv; void rt1739_interrupt(int port); +int rt1739_init(int port); + #endif /* defined(__CROS_EC_PPC_RT1739_H) */ |