bq2589x: ryu: enable IR compensation

Set the resistance compensation for the charger IC according to the EE
team measurements :
- Resistance compensation = 60 mOhm
- Voltage clamping = 160 mV
- Thermal regulation = 120C

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=smaug
BUG=chrome-os-partner:38603
TEST=dump the BQ25892 registers by using the "bq25" command and see that
REG08 contains 0x77.

Change-Id: I90e9ea4569d77fd90ed0290ec78e66810d744648
Reviewed-on: https://chromium-review.googlesource.com/281660
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Vincent Palatin
2015-06-24 10:29:15 -07:00
committed by ChromeOS Commit Bot
parent 68198a2446
commit 564256d2ee
4 changed files with 42 additions and 0 deletions

View File

@@ -68,6 +68,9 @@
#define CONFIG_CHARGER
#define CONFIG_CHARGER_V2
#define CONFIG_CHARGER_BQ25892
#define CONFIG_CHARGER_BQ2589X_IR_COMP (BQ2589X_IR_TREG_120C | \
BQ2589X_IR_VCLAMP_160MV | \
BQ2589X_IR_BAT_COMP_60MOHM)
#define CONFIG_CHARGER_BQ2589X_BOOST (BQ2589X_BOOSTV_MV(4998) | \
BQ2589X_BOOST_LIM_1650MA)
#define CONFIG_CHARGER_ILIM_PIN_DISABLED

View File

@@ -24,6 +24,11 @@
#define CONFIG_CHARGER_BQ2589X_BOOST BQ2589X_BOOST_DEFAULT
#endif
/* IR compensation settings */
#ifndef CONFIG_CHARGER_BQ2589X_IR_COMP
#define CONFIG_CHARGER_BQ2589X_IR_COMP BQ2589X_IR_COMP_DEFAULT
#endif
/* Charger information */
static const struct charger_info bq2589x_charger_info = {
.name = "bq2589x",
@@ -265,6 +270,9 @@ static void bq2589x_init(void)
if (bq2589x_watchdog_reset())
return;
if (bq2589x_write(BQ2589X_REG_IR_COMP, CONFIG_CHARGER_BQ2589X_IR_COMP))
return;
if (bq2589x_write(BQ2589X_REG_BOOST_MODE, CONFIG_CHARGER_BQ2589X_BOOST))
return;

View File

@@ -43,6 +43,31 @@
#define BQ2589X_CFG2_OTG_CONFIG (1<<5)
#define BQ2589X_CFG2_WD_RST (1<<6)
/* REG08 : IR compensation definitions */
#define BQ2589X_IR_BAT_COMP_140MOHM (7 << 5)
#define BQ2589X_IR_BAT_COMP_120MOHM (6 << 5)
#define BQ2589X_IR_BAT_COMP_100MOHM (5 << 5)
#define BQ2589X_IR_BAT_COMP_80MOHM (4 << 5)
#define BQ2589X_IR_BAT_COMP_60MOHM (3 << 5)
#define BQ2589X_IR_BAT_COMP_40MOHM (2 << 5)
#define BQ2589X_IR_BAT_COMP_20MOHM (1 << 5)
#define BQ2589X_IR_BAT_COMP_0MOHM (0 << 5)
#define BQ2589X_IR_VCLAMP_224MV (7 << 2)
#define BQ2589X_IR_VCLAMP_192MV (6 << 2)
#define BQ2589X_IR_VCLAMP_160MV (5 << 2)
#define BQ2589X_IR_VCLAMP_128MV (4 << 2)
#define BQ2589X_IR_VCLAMP_96MV (3 << 2)
#define BQ2589X_IR_VCLAMP_64MV (2 << 2)
#define BQ2589X_IR_VCLAMP_32MV (1 << 2)
#define BQ2589X_IR_VCLAMP_0MV (0 << 2)
#define BQ2589X_IR_TREG_120C (3 << 0)
#define BQ2589X_IR_TREG_100C (2 << 0)
#define BQ2589X_IR_TREG_80C (1 << 0)
#define BQ2589X_IR_TREG_60C (0 << 0)
#define BQ2589X_IR_COMP_DEFAULT (BQ2589X_IR_TREG_120C | BQ2589X_IR_VCLAMP_0MV |\
BQ2589X_IR_BAT_COMP_0MOHM)
/* 5V VBUS Boost settings */
#define BQ2589X_BOOSTV_MV(mv) (((((mv) - 4550)/64) & 0xF) << 4)
#define BQ2589X_BOOSTV_DEFAULT BQ2589X_BOOSTV_MV(4998)

View File

@@ -252,6 +252,12 @@
#undef CONFIG_CHARGER_BQ25895
#undef CONFIG_CHARGER_TPS65090 /* Note: does not use CONFIG_CHARGER */
/*
* BQ2589x IR Compensation settings.
* Should be the combination of BQ2589X_IR_TREG_xxxC, BQ2589X_IR_VCLAMP_yyyMV
* and BQ2589X_IR_BAT_COMP_zzzMOHM.
*/
#undef CONFIG_CHARGER_BQ2589X_IR_COMP
/*
* BQ2589x 5V boost current limit and voltage.
* Should be the combination of BQ2589X_BOOSTV_MV(voltage) and