summaryrefslogtreecommitdiff
path: root/driver/charger
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2022-10-27 17:07:05 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-10-28 07:46:14 +0000
commita13ffeba8e0b5d944aa79121514b6be2f60c7bc2 (patch)
tree397b9daa67d3e0326c3bcd27f6d5b531c2bd5bdf /driver/charger
parent45ad08b8dfd3d0c0bd65fae07abe426c3fdebb19 (diff)
downloadchrome-ec-a13ffeba8e0b5d944aa79121514b6be2f60c7bc2.tar.gz
rt9490: disable the force B-FET on experimental feature
See b:254186078. This is a workaround that applies to all devices, so it's implemented in the common driver code. BUG=b:254186078, b:253568743 TEST=`i2c read_byte I2C_PWR_CBI 0x53 0x6f` returns 0x5e (bit5=0) on tentacruel BRANCH=corsola Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I6c2864423a5bb04fefdc261f20209f44dce8053e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3985083 Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'driver/charger')
-rw-r--r--driver/charger/rt9490.c21
-rw-r--r--driver/charger/rt9490.h8
2 files changed, 29 insertions, 0 deletions
diff --git a/driver/charger/rt9490.c b/driver/charger/rt9490.c
index 0f198c6b76..8bf418a065 100644
--- a/driver/charger/rt9490.c
+++ b/driver/charger/rt9490.c
@@ -353,6 +353,27 @@ static int rt9490_init_setting(int chgnum)
RETURN_ERROR(rt9490_set_bit(chgnum, RT9490_REG_CHG_CTRL2,
RT9490_DIS_EOC_FCCM));
+ /* b/253568743#comment14 vsys workaround */
+ RETURN_ERROR(rt9490_enable_hidden_mode(chgnum, true));
+ rt9490_clr_bit(chgnum, RT9490_REG_HD_ADD_CTRL2,
+ RT9490_EN_FON_PP_BAT_TRACK);
+ RETURN_ERROR(rt9490_enable_hidden_mode(chgnum, false));
+
+ return EC_SUCCESS;
+}
+
+int rt9490_enable_hidden_mode(int chgnum, bool en)
+{
+ if (en) {
+ RETURN_ERROR(
+ rt9490_write8(chgnum, RT9490_REG_TM_PAS_CODE1, 0x69));
+ RETURN_ERROR(
+ rt9490_write8(chgnum, RT9490_REG_TM_PAS_CODE2, 0x96));
+ } else {
+ RETURN_ERROR(rt9490_write8(chgnum, RT9490_REG_TM_PAS_CODE1, 0));
+ RETURN_ERROR(rt9490_write8(chgnum, RT9490_REG_TM_PAS_CODE2, 0));
+ }
+
return EC_SUCCESS;
}
diff --git a/driver/charger/rt9490.h b/driver/charger/rt9490.h
index 18e1d393b3..ea1d6cfcfb 100644
--- a/driver/charger/rt9490.h
+++ b/driver/charger/rt9490.h
@@ -76,6 +76,9 @@
#define RT9490_REG_ADD_CTRL2 0x4C
#define RT9490_REG_ADD_IRQ_FLAG 0x4D
#define RT9490_REG_ADD_IRQ_MASK6 0x4E
+#define RT9490_REG_HD_ADD_CTRL2 0x6F
+#define RT9490_REG_TM_PAS_CODE1 0xF1
+#define RT9490_REG_TM_PAS_CODE2 0xF2
struct rt9490_init_setting {
int eoc_current;
@@ -245,6 +248,9 @@ struct rt9490_init_setting {
/* ADD CTRL1 */
#define RT9490_PWM_1MHZ_EN BIT(4)
+/* HD_ADD_CTRL 2 */
+#define RT9490_EN_FON_PP_BAT_TRACK BIT(5)
+
extern const struct charger_drv rt9490_drv;
extern const struct bc12_drv rt9490_bc12_drv;
@@ -254,6 +260,8 @@ int rt9490_enable_adc(int chgnum, bool en);
/* enable pwm frequency 1MHz mode */
int rt9490_enable_pwm_1mhz(int chgnum, bool en);
+int rt9490_enable_hidden_mode(int chgnum, bool en);
+
#endif /* __CROS_EC_RT9490_H */
/*