mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 02:15:14 +00:00
bq2589x: Add CONFIG_CHARGER_TERM_CURRENT_LIMIT support.
Create a config to allow customization of a board's charger termination current and add support to bq2589x charger. Note, BQ2589X_TERM_CURRENT_LIMIT_DEFAULT, currently set to 64 to make CL benign to ryu board. Future CL will change to 256 as thats the POR value for that charger. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=smaug BUG=chrome-os-partner:42848 TEST=manual, read charger IC register and see its termination current set to 64mA Change-Id: I79348ed62a077a6432c8d8db6ac90e1e4e92dbc7 Reviewed-on: https://chromium-review.googlesource.com/293095 Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
This commit is contained in:
committed by
ChromeOS Commit Bot
parent
09b065c84c
commit
82bc3c7028
@@ -29,6 +29,11 @@
|
||||
#define CONFIG_CHARGER_BQ2589X_IR_COMP BQ2589X_IR_COMP_DEFAULT
|
||||
#endif
|
||||
|
||||
/* Termination current limit setting */
|
||||
#ifndef CONFIG_CHARGER_TERM_CURRENT_LIMIT
|
||||
#define CONFIG_CHARGER_TERM_CURRENT_LIMIT BQ2589X_TERM_CURRENT_LIMIT_DEFAULT
|
||||
#endif
|
||||
|
||||
/* Charger information */
|
||||
static const struct charger_info bq2589x_charger_info = {
|
||||
.name = "bq2589x",
|
||||
@@ -304,7 +309,7 @@ static void bq2589x_init(void)
|
||||
if (bq2589x_write(BQ2589X_REG_TIMER, val))
|
||||
return;
|
||||
|
||||
if (bq2589x_set_terminate_current(64))
|
||||
if (bq2589x_set_terminate_current(CONFIG_CHARGER_TERM_CURRENT_LIMIT))
|
||||
return;
|
||||
|
||||
if (bq2589x_watchdog_reset())
|
||||
|
||||
@@ -69,6 +69,8 @@
|
||||
#define BQ2589X_IR_COMP_DEFAULT (BQ2589X_IR_TREG_120C | BQ2589X_IR_VCLAMP_0MV |\
|
||||
BQ2589X_IR_BAT_COMP_0MOHM)
|
||||
|
||||
#define BQ2589X_TERM_CURRENT_LIMIT_DEFAULT 64
|
||||
|
||||
/* 5V VBUS Boost settings */
|
||||
#define BQ2589X_BOOSTV_MV(mv) (((((mv) - 4550)/64) & 0xF) << 4)
|
||||
#define BQ2589X_BOOSTV_DEFAULT BQ2589X_BOOSTV_MV(4998)
|
||||
|
||||
@@ -300,6 +300,16 @@
|
||||
*/
|
||||
#undef CONFIG_CHARGER_CURRENT_LIMIT
|
||||
|
||||
/*
|
||||
* Board specific charging current termination limit, in mA. If defined and
|
||||
* charger supports setting termination current it should be set during charger
|
||||
* init.
|
||||
*
|
||||
* TODO(tbroch): Only valid for bq2589x currently. Configure defaults for other
|
||||
* charger ICs that support termination currents.
|
||||
*/
|
||||
#undef CONFIG_CHARGER_TERM_CURRENT_LIMIT
|
||||
|
||||
/*
|
||||
* Board supports discharge mode. In this mode, the battery will discharge
|
||||
* even if AC is present. Used for testing.
|
||||
|
||||
Reference in New Issue
Block a user