summaryrefslogtreecommitdiff
path: root/board/st/u8500/u8500.c
diff options
context:
space:
mode:
Diffstat (limited to 'board/st/u8500/u8500.c')
-rw-r--r--board/st/u8500/u8500.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c
index 621a168d6..8b4609bf5 100644
--- a/board/st/u8500/u8500.c
+++ b/board/st/u8500/u8500.c
@@ -297,17 +297,42 @@ static void probe_href(void)
}
+#define BATT_OK_SEL1_TH_F_MASK 0xF0
+#define BATT_OK_SEL1_TH_F_2V71 0x70
+
/*
* board_early_access - for functionality that needs to run before
* board_late_init but after board_init and emmc init.
*/
int board_early_access(block_dev_desc_t *block_dev)
{
+ int ret;
+ int battok_regval;
/* set board_id according to HREF version */
probe_href();
/*
+ * In AB8500 rev2.0, the cut-off voltage threshold is set too low
+ * and the AB will power-off when we start with a drained battery
+ * and a charger connected when the backlight is turned on.
+ * Here we will lower the cut-off voltage threshold before
+ * power consumption goes up
+ */
+ ret = ab8500_read(AB8500_SYS_CTRL2_BLOCK, AB8500_BATT_OK_REG);
+ if (ret < 0)
+ return -EINVAL;
+
+ battok_regval = ret;
+
+ /* Mask and set BattOkSel1ThF */
+ ret = ab8500_write(AB8500_SYS_CTRL2_BLOCK, AB8500_BATT_OK_REG,
+ (battok_regval & ~BATT_OK_SEL1_TH_F_MASK) |
+ BATT_OK_SEL1_TH_F_2V71);
+ if (ret < 0)
+ return -EINVAL;
+
+ /*
* Don't load itp, modem and splash if restarted (eg crashdump).
*/
if (!(data_init_flag > 0)) {