summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorRong Chang <rongchang@chromium.org>2012-07-03 19:39:27 +0800
committerGerrit <chrome-bot@google.com>2012-07-03 23:51:19 -0700
commit717e556759304490548ee23973895d995ee88a05 (patch)
tree54d1ff404a50bfca53116be3fb2dd30ea9eb84bf /common
parentb4789cf1f731d120f074831dc4b9552f6bcb8163 (diff)
downloadchrome-ec-717e556759304490548ee23973895d995ee88a05.tar.gz
Initialize PMU default settings using board configuration
Signed-off-by: Rong Chang <rongchang@chromium.org> BUG=chrome-os-partner:11749 TEST=on snow with fully discharged dead battery plug ac power and check if it can charge to full Change-Id: Ie90255614bff879780edbd2bf1fc77bf8e2c04c8 Reviewed-on: https://gerrit.chromium.org/gerrit/26674 Reviewed-by: David Hendricks <dhendrix@chromium.org> Commit-Ready: Rong Chang <rongchang@chromium.org> Tested-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/pmu_tps65090.c36
-rw-r--r--common/pmu_tps65090_charger.c6
2 files changed, 25 insertions, 17 deletions
diff --git a/common/pmu_tps65090.c b/common/pmu_tps65090.c
index 93d9886699..e674da9ff4 100644
--- a/common/pmu_tps65090.c
+++ b/common/pmu_tps65090.c
@@ -9,6 +9,7 @@
#include "console.h"
#include "common.h"
#include "i2c.h"
+#include "pmu_tpschrome.h"
#include "util.h"
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
@@ -39,17 +40,6 @@
/* Charger alarm */
#define CHARGER_ALARM 3
-/* Read/write tps65090 register */
-static inline int pmu_read(int reg, int *value)
-{
- return i2c_read8(I2C_PORT_CHARGER, TPS65090_I2C_ADDR, reg, value);
-}
-
-static inline int pmu_write(int reg, int value)
-{
- return i2c_write8(I2C_PORT_CHARGER, TPS65090_I2C_ADDR, reg, value);
-}
-
/* Clear tps65090 irq */
static inline int pmu_clear_irq(void)
{
@@ -82,6 +72,17 @@ static int pmu_get_event(int *event)
return EC_SUCCESS;
}
+/* Read/write tps65090 register */
+int pmu_read(int reg, int *value)
+{
+ return i2c_read8(I2C_PORT_CHARGER, TPS65090_I2C_ADDR, reg, value);
+}
+
+int pmu_write(int reg, int value)
+{
+ return i2c_write8(I2C_PORT_CHARGER, TPS65090_I2C_ADDR, reg, value);
+}
+
int pmu_is_charger_alarm(void)
{
int status;
@@ -129,6 +130,9 @@ int pmu_enable_charger(int enable)
void pmu_init(void)
{
+#ifdef CONFIG_PMU_BOARD_INIT
+ board_pmu_init();
+#else
/* Init configuration
* Fast charge timer : 2 hours
* Charger : disable
@@ -137,13 +141,13 @@ void pmu_init(void)
* TODO: move settings to battery pack specific init
*/
pmu_write(CG_CTRL0, 2);
-
- /* Enable interrupt mask */
- pmu_write(IRQ1MASK, 0xff);
- pmu_write(IRQ2MASK, 0xff);
-
/* Limit full charge current to 50%
* TODO: remove this temporary hack.
*/
pmu_write(CG_CTRL3, 0xbb);
+#endif
+ /* Enable interrupt mask */
+ pmu_write(IRQ1MASK, 0xff);
+ pmu_write(IRQ2MASK, 0xff);
+
}
diff --git a/common/pmu_tps65090_charger.c b/common/pmu_tps65090_charger.c
index bb473b5c2a..28bcfafe0b 100644
--- a/common/pmu_tps65090_charger.c
+++ b/common/pmu_tps65090_charger.c
@@ -56,7 +56,11 @@ static void enable_charging(int enable)
if (gpio_get_level(GPIO_CHARGER_EN) != enable)
gpio_set_level(GPIO_CHARGER_EN, enable);
- pmu_enable_charger(enable);
+ /* With NOITERM bit set, charger can be controlled by gpio.
+ * Hence following charger enable command can be removed.
+ *
+ * pmu_enable_charger(enable);
+ */
}