mod the sc89890h register config

as the sc89890 datasheet,
the REG04 Icc - Fast Charge Current offset is 0ma, LSB is 60ma
the REG05 Itc - Tirckle Current offect is 60ma, LSB is 60ma
the REG05 Iterm - Termination Current offect is 30ma, LSB is 60ma

Change-Id: I6cd85cd48878492682c1c9802e5ce972e2db0664
Signed-off-by: liyiying <liyiying@wingtech.com>
Reviewed-on: https://gerrit.mot.com/2151683
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
liyiying 2021-12-22 14:28:51 +08:00
commit ef103ab40d
2 changed files with 21 additions and 3 deletions

View file

@ -468,7 +468,11 @@ int bq2589x_set_chargecurrent(struct bq2589x *bq, int curr)
{
u8 ichg;
ichg = (curr - BQ2589X_ICHG_BASE)/BQ2589X_ICHG_LSB;
if (bq->part_no == SC89890H) {
ichg = (curr - SC89890H_ICHG_BASE)/SC89890H_ICHG_LSB;
} else {
ichg = (curr - BQ2589X_ICHG_BASE)/BQ2589X_ICHG_LSB;
}
return bq2589x_update_bits(bq, BQ2589X_REG_04, BQ2589X_ICHG_MASK, ichg << BQ2589X_ICHG_SHIFT);
}
@ -477,7 +481,11 @@ int bq2589x_set_term_current(struct bq2589x *bq, int curr)
{
u8 iterm;
iterm = (curr - BQ2589X_ITERM_BASE) / BQ2589X_ITERM_LSB;
if (bq->part_no == SC89890H) {
iterm = (curr - SC89890H_ITERM_BASE) / SC89890H_ITERM_LSB;
} else {
iterm = (curr - BQ2589X_ITERM_BASE) / BQ2589X_ITERM_LSB;
}
return bq2589x_update_bits(bq, BQ2589X_REG_05, BQ2589X_ITERM_MASK, iterm << BQ2589X_ITERM_SHIFT);
}
@ -487,7 +495,11 @@ int bq2589x_set_prechg_current(struct bq2589x *bq, int curr)
{
u8 iprechg;
iprechg = (curr - BQ2589X_IPRECHG_BASE) / BQ2589X_IPRECHG_LSB;
if (bq->part_no == SC89890H) {
iprechg = (curr - SC89890H_IPRECHG_BASE) / SC89890H_IPRECHG_LSB;
} else {
iprechg = (curr - BQ2589X_IPRECHG_BASE) / BQ2589X_IPRECHG_LSB;
}
return bq2589x_update_bits(bq, BQ2589X_REG_05, BQ2589X_IPRECHG_MASK, iprechg << BQ2589X_IPRECHG_SHIFT);
}

View file

@ -100,6 +100,8 @@
#define BQ2589X_ICHG_SHIFT 0
#define BQ2589X_ICHG_BASE 0
#define BQ2589X_ICHG_LSB 64
#define SC89890H_ICHG_BASE 0
#define SC89890H_ICHG_LSB 60
/* Register 0x05*/
#define BQ2589X_REG_05 0x05
@ -111,6 +113,10 @@
#define BQ2589X_IPRECHG_LSB 64
#define BQ2589X_ITERM_BASE 64
#define BQ2589X_ITERM_LSB 64
#define SC89890H_IPRECHG_BASE 60
#define SC89890H_IPRECHG_LSB 60
#define SC89890H_ITERM_BASE 30
#define SC89890H_ITERM_LSB 60
/* Register 0x06*/
#define BQ2589X_REG_06 0x06